From 9d1e2871f4b8e9bb40efaf5ee16473f514393538 Mon Sep 17 00:00:00 2001 From: Jasso Date: Fri, 31 Mar 2023 22:07:13 -0300 Subject: [PATCH 01/13] iter 1 feeder --- packages/denylist_bot/.env.example | 0 packages/denylist_bot/.gitignore | 5 + packages/denylist_bot/build.js | 24 ++++ packages/denylist_bot/jest.config.js | 25 +++++ packages/denylist_bot/package.json | 42 +++++++ packages/denylist_bot/scripts/.gitignore | 1 + packages/denylist_bot/scripts/package.json | 5 + .../denylist_bot/scripts/src/populateEnvs.ts | 78 +++++++++++++ packages/denylist_bot/scripts/src/secrets.ts | 81 ++++++++++++++ packages/denylist_bot/scripts/tsconfig.json | 103 ++++++++++++++++++ packages/denylist_bot/src/env.ts | 19 ++++ packages/denylist_bot/src/graphql.ts | 58 ++++++++++ packages/denylist_bot/src/index.ts | 19 ++++ packages/denylist_bot/tsconfig.json | 25 +++++ packages/denylist_bot/wrangler.toml | 19 ++++ 15 files changed, 504 insertions(+) create mode 100644 packages/denylist_bot/.env.example create mode 100644 packages/denylist_bot/.gitignore create mode 100644 packages/denylist_bot/build.js create mode 100644 packages/denylist_bot/jest.config.js create mode 100644 packages/denylist_bot/package.json create mode 100644 packages/denylist_bot/scripts/.gitignore create mode 100644 packages/denylist_bot/scripts/package.json create mode 100644 packages/denylist_bot/scripts/src/populateEnvs.ts create mode 100644 packages/denylist_bot/scripts/src/secrets.ts create mode 100644 packages/denylist_bot/scripts/tsconfig.json create mode 100644 packages/denylist_bot/src/env.ts create mode 100644 packages/denylist_bot/src/graphql.ts create mode 100644 packages/denylist_bot/src/index.ts create mode 100644 packages/denylist_bot/tsconfig.json create mode 100644 packages/denylist_bot/wrangler.toml diff --git a/packages/denylist_bot/.env.example b/packages/denylist_bot/.env.example new file mode 100644 index 000000000..e69de29bb diff --git a/packages/denylist_bot/.gitignore b/packages/denylist_bot/.gitignore new file mode 100644 index 000000000..771f07a0c --- /dev/null +++ b/packages/denylist_bot/.gitignore @@ -0,0 +1,5 @@ +node_modules +dist +.mf +.env +testnet_setup.json diff --git a/packages/denylist_bot/build.js b/packages/denylist_bot/build.js new file mode 100644 index 000000000..e1fec7eca --- /dev/null +++ b/packages/denylist_bot/build.js @@ -0,0 +1,24 @@ +import path from "path"; +import { build } from "esbuild"; +import { fileURLToPath } from "url"; +import { NodeModulesPolyfillPlugin } from "@esbuild-plugins/node-modules-polyfill"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + +try { + await build({ + bundle: true, + format: "esm", + external: ["__STATIC_CONTENT_MANIFEST"], + conditions: ["worker"], + entryPoints: [path.join(__dirname, "src", "index.ts")], + outdir: path.join(__dirname, "dist"), + outExtension: { ".js": ".mjs" }, + plugins: [NodeModulesPolyfillPlugin()], + }); +} catch (e) { + console.warn(e); + + process.exitCode = 1; +} diff --git a/packages/denylist_bot/jest.config.js b/packages/denylist_bot/jest.config.js new file mode 100644 index 000000000..3a9152e21 --- /dev/null +++ b/packages/denylist_bot/jest.config.js @@ -0,0 +1,25 @@ +export default { + preset: "ts-jest/presets/default-esm", + globals: { + "ts-jest": { + tsconfig: "test/tsconfig.json", + useESM: true, + }, + }, + moduleNameMapper: { + "^@/(.*)$": "/src/$1", + "^(\\.{1,2}/.*)\\.js$": "$1", + }, + testEnvironment: "miniflare", + forceExit: true, + verbose: true, + detectOpenHandles: true, + clearMocks: true, + testEnvironmentOptions: { + // Miniflare doesn't yet support the `main` field in `wrangler.toml` so we + // need to explicitly tell it where our built worker is. We also need to + // explicitly mark it as an ES module. + scriptPath: "dist/index.mjs", + modules: true, + }, +}; diff --git a/packages/denylist_bot/package.json b/packages/denylist_bot/package.json new file mode 100644 index 000000000..0b92c6950 --- /dev/null +++ b/packages/denylist_bot/package.json @@ -0,0 +1,42 @@ +{ + "name": "denylist-bot", + "version": "1.0.0", + "description": "Production level relayer with cloudflare workers", + "type": "module", + "module": "./dist/index.mjs", + "scripts": { + "build": "node build.js", + "dev": "miniflare --live-reload --debug --modules dist/index.mjs --env .env", + "dev:remote": "wrangler dev", + "test:only": "yarn build && node --experimental-vm-modules --no-warnings node_modules/.bin/jest --forceExit --detectOpenHandles", + "test": "(cd ../contracts && yarn tests:ts) && (cd ../sdk && yarn test:only) && yarn test:only --forceExit --detectOpenHandles", + "types:check": "tsc && tsc -p test/tsconfig.json", + "deploy": "yarn build && wrangler publish --keep-vars", + "populate:envs": "cd scripts && tsc && node build/populateEnvs.js" + }, + "keywords": [], + "author": "", + "license": "MIT", + "devDependencies": { + "@cloudflare/workers-types": "^4.20230321.0", + "@esbuild-plugins/node-modules-polyfill": "^0.2.2", + "@jest/globals": "^29.5.0", + "@types/big.js": "^6.1.6", + "@types/jest": "^27.5.1", + "esbuild": "^0.14.41", + "jest": "^28.1.0", + "jest-environment-miniflare": "^2.5.0", + "miniflare": "^2.5.0", + "prettier": "^2.6.2", + "ts-jest": "^28.0.3", + "typescript": "^4.7.2", + "wrangler": "^2.0.7" + }, + "dependencies": { + "@tsndr/cloudflare-worker-jwt": "^2.2.1", + "@tsndr/cloudflare-worker-router": "^2.3.2", + "big.js": "^6.2.1", + "buffer": "^6.0.3", + "near-api-js": "^1.1.0" + } +} diff --git a/packages/denylist_bot/scripts/.gitignore b/packages/denylist_bot/scripts/.gitignore new file mode 100644 index 000000000..c795b054e --- /dev/null +++ b/packages/denylist_bot/scripts/.gitignore @@ -0,0 +1 @@ +build \ No newline at end of file diff --git a/packages/denylist_bot/scripts/package.json b/packages/denylist_bot/scripts/package.json new file mode 100644 index 000000000..86abb38cc --- /dev/null +++ b/packages/denylist_bot/scripts/package.json @@ -0,0 +1,5 @@ +{ + "name": "relayer-scripts", + "version": "1.0.0", + "description": "Production level relayer with cloudflare workers" +} diff --git a/packages/denylist_bot/scripts/src/populateEnvs.ts b/packages/denylist_bot/scripts/src/populateEnvs.ts new file mode 100644 index 000000000..0ad4678f9 --- /dev/null +++ b/packages/denylist_bot/scripts/src/populateEnvs.ts @@ -0,0 +1,78 @@ +import { deploySecrets } from "./secrets"; + +const { + NEAR_NETWORK, + RPC_URL, + PRIVATE_KEY, + ACCOUNT_ID, + RELAYER_FEE, + RELAYER_URL, + HYC_CONTRACT, + BASE_STORAGE_FEE, + CF_API_TOKEN, + CF_IDENTIFIER, + RELAYER_NAME +} = process.env; + +if ( + !NEAR_NETWORK || + !RPC_URL || + !PRIVATE_KEY || + !ACCOUNT_ID || + !RELAYER_FEE || + !RELAYER_URL || + !HYC_CONTRACT || + !BASE_STORAGE_FEE || + !CF_API_TOKEN || + !CF_IDENTIFIER || + !RELAYER_NAME +) { + throw new Error("There are missing Envs that need to be set"); +} + +console.log(`Deploy secrets for script: ${RELAYER_NAME}`); + +deploySecrets(CF_API_TOKEN, RELAYER_NAME, CF_IDENTIFIER, [ + { + name: "NEAR_NETWORK", + text: NEAR_NETWORK, + type: 'secret_text', + }, + { + name: "RPC_URL", + text: RPC_URL, + type: 'secret_text', + }, + { + name: "PRIVATE_KEY", + text: PRIVATE_KEY, + type: 'secret_text', + }, + { + name: "ACCOUNT_ID", + text: ACCOUNT_ID, + type: 'secret_text', + }, + { + name: "RELAYER_FEE", + text: RELAYER_FEE, + type: 'secret_text', + }, + { + name: "RELAYER_URL", + text: RELAYER_URL, + type: 'secret_text', + }, + { + name: "HYC_CONTRACT", + text: HYC_CONTRACT, + type: 'secret_text', + }, + { + name: "BASE_STORAGE_FEE", + text: BASE_STORAGE_FEE, + type: 'secret_text', + }, +]).then(res => { + console.log('Deploy secrets res: ', res); +}); diff --git a/packages/denylist_bot/scripts/src/secrets.ts b/packages/denylist_bot/scripts/src/secrets.ts new file mode 100644 index 000000000..05faadf4d --- /dev/null +++ b/packages/denylist_bot/scripts/src/secrets.ts @@ -0,0 +1,81 @@ +export interface FetchError { + code: number; + message: string; + error_chain?: FetchError[]; +} + +export interface FetchResult { + success: boolean; + result: ResponseType; + errors: FetchError[]; + messages: string[]; + result_info?: unknown; +} + +export interface SecretInterface { + name: string, + text: string, + type: string, +} + +export const deploySecrets = async ( + apiToken = '', + scriptName = 'prod-relayer', + accountIdentifier = '', + secrets: SecretInterface[], +) => { + const url = `/accounts/${accountIdentifier}/workers/services/${scriptName}/environments/production/secrets`; + + return await Promise.all(secrets.map(async (secret) => { + const response = await performApiFetch( + apiToken, + url, + { + method: "PUT", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify(secret), + }, + ); + + return await response.text(); + })); +} + +export async function performApiFetch( + apiToken: string, + resource: string, + init: RequestInit = {}, +) { + const method = init.method ?? "GET"; + + const headers = cloneHeaders(init.headers); + addAuthorizationHeaderIfUnspecified(headers, apiToken); + addUserAgent(headers); + + return await fetch(`https://api.cloudflare.com/client/v4${resource}`, { + method, + headers, + body: init.body, + }); +} + +function addAuthorizationHeaderIfUnspecified( + headers: Record, + auth: string +): void { + headers["Authorization"] = `Bearer ${auth}`; +} + +function addUserAgent(headers: Record): void { + headers["User-Agent"] = `wrangler/2.0.7`; +} + +function cloneHeaders( + headers: HeadersInit | undefined +): Record { + return headers instanceof Headers + ? Object.fromEntries(headers.entries()) + : Array.isArray(headers) + ? Object.fromEntries(headers) + : { ...headers }; +} diff --git a/packages/denylist_bot/scripts/tsconfig.json b/packages/denylist_bot/scripts/tsconfig.json new file mode 100644 index 000000000..472fb587d --- /dev/null +++ b/packages/denylist_bot/scripts/tsconfig.json @@ -0,0 +1,103 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig to read more about this file */ + + /* Projects */ + // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ + // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ + // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ + // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ + // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ + + /* Language and Environment */ + "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + "lib": ["es6"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "jsx": "preserve", /* Specify what JSX code is generated. */ + // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ + // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ + // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ + // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ + // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + + /* Modules */ + "module": "commonjs", /* Specify what module code is generated. */ + "rootDir": "src", /* Specify the root folder within your source files. */ + // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ + // "types": [], /* Specify type package names to be included without being referenced in a source file. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ + "resolveJsonModule": true, /* Enable importing .json files. */ + // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ + + /* JavaScript Support */ + "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ + + /* Emit */ + // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + // "declarationMap": true, /* Create sourcemaps for d.ts files. */ + // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ + // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ + "outDir": "build", /* Specify an output folder for all emitted files. */ + // "removeComments": true, /* Disable emitting comments. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ + // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ + // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ + // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ + // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Set the newline character for emitting files. */ + // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ + // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ + // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ + // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ + // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ + // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ + + /* Interop Constraints */ + // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ + // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ + // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ + // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ + // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ + // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ + // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ + // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ + // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ + // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ + // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ + // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ + // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ + // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ + // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ + // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ + + /* Completeness */ + // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ + "skipLibCheck": true /* Skip type checking all .d.ts files. */ + } +} diff --git a/packages/denylist_bot/src/env.ts b/packages/denylist_bot/src/env.ts new file mode 100644 index 000000000..9e8b04da7 --- /dev/null +++ b/packages/denylist_bot/src/env.ts @@ -0,0 +1,19 @@ +import type { Queue } from "@cloudflare/workers-types/experimental" + +export interface Env { + // Near network data + // mainnet or testnet + NEAR_NETWORK: "mainnet" | "testnet"; + RPC_URL: string; + // Data for relayer account + PRIVATE_KEY: string; + ACCOUNT_ID: string; + // Addresses for relevant contracts + HYC_CONTRACT: string; + HAPI_CONTRACT: string; + // Graphql URL + GRAPHQL_URL: string; + // Bindings + QUEUE: Queue; + DURABLE: DurableObjectNamespace; +} diff --git a/packages/denylist_bot/src/graphql.ts b/packages/denylist_bot/src/graphql.ts new file mode 100644 index 000000000..9b26884aa --- /dev/null +++ b/packages/denylist_bot/src/graphql.ts @@ -0,0 +1,58 @@ +import Big from "big.js"; +import { Env } from "./env"; + +const paginationSize = 100; + +type FeederState = string | null; + +export class Pagination { + state: FeederState; + env: Env; + constructor(state: FeederState, env: Env) { + this.state = state; + this.env = env; + } + + async fetch(request: Request) { + const state = this.state || "0"; + const env = this.env; + + const query = ` + query GetHapioneEntries($lastViewed: BigInt!) { + hapioneEntries(where: {counter_gte: $lastViewed}, first: ${paginationSize}, orderBy: counter) { + id + counter + account + category + risk + } + } + `; + + const variables = { + lastViewed: state + } + + const response = await fetch(env.GRAPHQL_URL, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ query, variables }), + }); + + const { data, errors } = (await response.json()) as { data: any[], errors: any }; + + // if error is thrown, exit execution + if (errors) throw new Error(JSON.stringify(errors)); + + // sends all items collected in batch to queue + await env.QUEUE.sendBatch(data); + + // updates state to new last read item + this.state = (new Big(state).plus(data.length)).toFixed(0); + + // returns success response + return new Response("Success!"); + } +} \ No newline at end of file diff --git a/packages/denylist_bot/src/index.ts b/packages/denylist_bot/src/index.ts new file mode 100644 index 000000000..58ba65cfd --- /dev/null +++ b/packages/denylist_bot/src/index.ts @@ -0,0 +1,19 @@ +import { Env } from "./env"; + +const durableObjecId = "HYC"; + +export default { + scheduled: async (event: Event, env: Env, ctx: ExecutionContext) => { + const id = env.DURABLE.idFromName(durableObjecId); + const stub = env.DURABLE.get(id); + const request = new Request("dummyurl"); + try { + await stub.fetch(request); + } catch (err) { + console.log( + "execution failed during durable object request, error: ", + err + ) + } + }, +}; diff --git a/packages/denylist_bot/tsconfig.json b/packages/denylist_bot/tsconfig.json new file mode 100644 index 000000000..378bea6cd --- /dev/null +++ b/packages/denylist_bot/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "target": "ESNext", + "useDefineForClassFields": true, + "module": "ESNext", + "lib": ["ESNext", "DOM"], + "moduleResolution": "Node", + "strict": true, + "sourceMap": true, + "resolveJsonModule": true, + "isolatedModules": true, + "esModuleInterop": true, + "noEmit": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "skipLibCheck": true, + "baseUrl": ".", + "types": ["@cloudflare/workers-types"], + "paths": { + "@/*": ["src/*"], + } + }, + "include": ["src/**/*", "scripts/src/populateEnvs.ts", "bindings.d.ts"] +} diff --git a/packages/denylist_bot/wrangler.toml b/packages/denylist_bot/wrangler.toml new file mode 100644 index 000000000..962ab9073 --- /dev/null +++ b/packages/denylist_bot/wrangler.toml @@ -0,0 +1,19 @@ +name = "prod-denybot" +main = "dist/index.mjs" +compatibility_date = "experimental" +node_compat = true + +[[queues.producers]] +queue = "my-queue" +binding = "QUEUE" + +[durable_objects] +bindings = [{ name = "pagination", class_name = "Pagination" }] + +[build] +command = "node build.js" + +[miniflare] +kv_persist = true +cache_persist = true +durable_objects_persist = true From 88acda5b1bb917136d08098be3640d03d9c93b38 Mon Sep 17 00:00:00 2001 From: Jasso Date: Mon, 3 Apr 2023 11:05:16 -0300 Subject: [PATCH 02/13] progress --- packages/denylist_bot/src/consumer.ts | 24 +++++++++++ packages/denylist_bot/src/env.ts | 5 ++- packages/denylist_bot/src/graphql.ts | 15 +++++-- packages/denylist_bot/src/index.ts | 9 +++++ packages/denylist_bot/src/utils.ts | 58 +++++++++++++++++++++++++++ packages/denylist_bot/wrangler.toml | 7 +++- 6 files changed, 111 insertions(+), 7 deletions(-) create mode 100644 packages/denylist_bot/src/consumer.ts create mode 100644 packages/denylist_bot/src/utils.ts diff --git a/packages/denylist_bot/src/consumer.ts b/packages/denylist_bot/src/consumer.ts new file mode 100644 index 000000000..1ebd068ab --- /dev/null +++ b/packages/denylist_bot/src/consumer.ts @@ -0,0 +1,24 @@ +import type { QueuedData } from "./utils"; +import type { Env } from "./env"; + +import { setupNear, viewFunction } from "./utils"; + +export const consumer = async (message: QueuedData, env: Env) => { + console.log("dummy"); +} + +// this function must perform a view call to contract to fetch +// accepted risk parameters +// there is currently no such view call in the contract. Mock +// values for now +const fetchRiskParams = async (): Promise => { + console.log("dummy") +} + +// this function must sign and send a denylist transaction +// to the contract +const sendBanTransaction = async (env: Env): Promise => { + const connection = await setupNear(env); + const account = await connection.account(env.ACCOUNT_ID); + // await account.functionCall(); +} \ No newline at end of file diff --git a/packages/denylist_bot/src/env.ts b/packages/denylist_bot/src/env.ts index 9e8b04da7..45fb28afd 100644 --- a/packages/denylist_bot/src/env.ts +++ b/packages/denylist_bot/src/env.ts @@ -1,4 +1,5 @@ import type { Queue } from "@cloudflare/workers-types/experimental" +import type { QueuedData } from "./utils"; export interface Env { // Near network data @@ -14,6 +15,6 @@ export interface Env { // Graphql URL GRAPHQL_URL: string; // Bindings - QUEUE: Queue; + QUEUE: Queue; DURABLE: DurableObjectNamespace; -} +} \ No newline at end of file diff --git a/packages/denylist_bot/src/graphql.ts b/packages/denylist_bot/src/graphql.ts index 9b26884aa..b1ab3ad3b 100644 --- a/packages/denylist_bot/src/graphql.ts +++ b/packages/denylist_bot/src/graphql.ts @@ -1,10 +1,15 @@ import Big from "big.js"; import { Env } from "./env"; +import type { QueuedData } from "./utils"; const paginationSize = 100; type FeederState = string | null; +type GraphqlResponse = { + hapioneEntries: QueuedData[] +} + export class Pagination { state: FeederState; env: Env; @@ -20,7 +25,6 @@ export class Pagination { const query = ` query GetHapioneEntries($lastViewed: BigInt!) { hapioneEntries(where: {counter_gte: $lastViewed}, first: ${paginationSize}, orderBy: counter) { - id counter account category @@ -41,16 +45,19 @@ export class Pagination { body: JSON.stringify({ query, variables }), }); - const { data, errors } = (await response.json()) as { data: any[], errors: any }; + const { data, errors } = (await response.json()) as { data: GraphqlResponse, errors: any }; // if error is thrown, exit execution if (errors) throw new Error(JSON.stringify(errors)); + // fetches items from response object + const parsedData = data.hapioneEntries; + // sends all items collected in batch to queue - await env.QUEUE.sendBatch(data); + await env.QUEUE.sendBatch(parsedData as any[]); // updates state to new last read item - this.state = (new Big(state).plus(data.length)).toFixed(0); + this.state = (new Big(state).plus(parsedData.length)).toFixed(0); // returns success response return new Response("Success!"); diff --git a/packages/denylist_bot/src/index.ts b/packages/denylist_bot/src/index.ts index 58ba65cfd..b0bd0b203 100644 --- a/packages/denylist_bot/src/index.ts +++ b/packages/denylist_bot/src/index.ts @@ -1,4 +1,8 @@ import { Env } from "./env"; +import { consumer } from "./consumer"; +import { QueuedData } from "./utils"; + +export { Pagination } from "./graphql"; const durableObjecId = "HYC"; @@ -16,4 +20,9 @@ export default { ) } }, + queue: async (batch: MessageBatch, env: Env): Promise => { + for (const message of batch.messages) { + consumer(message.body, env); + } + } }; diff --git a/packages/denylist_bot/src/utils.ts b/packages/denylist_bot/src/utils.ts new file mode 100644 index 000000000..32a6ebf3f --- /dev/null +++ b/packages/denylist_bot/src/utils.ts @@ -0,0 +1,58 @@ +import { connect, keyStores, KeyPair, providers } from "near-api-js"; +import { Buffer } from "buffer"; +import Process from "process"; + +import type { Env } from "./env"; + +/* tslint:disable */ +globalThis.Buffer = Buffer; +globalThis.process = Process; +/* tslint:enable */ + +export type QueuedData = { + counter: string; + account: string; + category: string; + risk: string; +}; + +export const setupNear = async ({ + RPC_URL, + ACCOUNT_ID, + PRIVATE_KEY, + NEAR_NETWORK, +}: Env) => { + const myKeyStore = new keyStores.InMemoryKeyStore(); + + const keyPair = KeyPair.fromString(PRIVATE_KEY); + + await myKeyStore.setKey(NEAR_NETWORK, ACCOUNT_ID, keyPair); + + const connectionConfig = { + nodeUrl: RPC_URL, + networkId: NEAR_NETWORK, + }; + + return connect({ ...connectionConfig, keyStore: myKeyStore }); +}; + +export const viewFunction = async ( + nodeUrl: string, + contractId: string, + methodName: string, + args: any = {} +) => { + const provider = new providers.JsonRpcProvider({ url: nodeUrl }); + + const serializedArgs = Buffer.from(JSON.stringify(args)).toString("base64"); + + const res = (await provider.query({ + request_type: "call_function", + account_id: contractId, + method_name: methodName, + args_base64: serializedArgs, + finality: "optimistic", + })) as any; + + return JSON.parse(Buffer.from(res.result).toString()); +}; \ No newline at end of file diff --git a/packages/denylist_bot/wrangler.toml b/packages/denylist_bot/wrangler.toml index 962ab9073..fb701b88b 100644 --- a/packages/denylist_bot/wrangler.toml +++ b/packages/denylist_bot/wrangler.toml @@ -7,8 +7,13 @@ node_compat = true queue = "my-queue" binding = "QUEUE" +[[queues.consumers]] +queue = "my-queue" +max_batch_size = 3 +max_batch_timeout = 60 + [durable_objects] -bindings = [{ name = "pagination", class_name = "Pagination" }] +bindings = [{ name = "DURABLE", class_name = "Pagination" }] [build] command = "node build.js" From b4e7731f8fe2dd108ef3e1d689dbe17f7bb420da Mon Sep 17 00:00:00 2001 From: Mateus Santana <42101423+1Mateus@users.noreply.github.com> Date: Mon, 10 Apr 2023 08:51:54 -0300 Subject: [PATCH 03/13] feat(denylist): new bot --- packages/contracts/tests-ts/src/index.ts | 1 + .../.env.example | 0 .../{denylist_bot => denylist-bot}/.gitignore | 0 .../{denylist_bot => denylist-bot}/build.js | 0 .../jest.config copy.js} | 0 packages/denylist-bot/jest.config.js | 25 + .../package.json | 1 + .../scripts/.gitignore | 0 .../scripts/package.json | 0 .../scripts/src/populateEnvs.ts | 0 .../scripts/src/secrets.ts | 0 .../scripts/tsconfig.json | 0 packages/denylist-bot/src/constants.ts | 1 + packages/denylist-bot/src/dos/pagination.ts | 73 + .../src/index.ts | 17 +- packages/denylist-bot/src/query.ts | 12 + .../denylist-bot/src/services/consumer.ts | 92 + packages/denylist-bot/src/services/request.ts | 21 + .../src => denylist-bot/src/types}/env.ts | 5 +- packages/denylist-bot/src/types/pagination.ts | 14 + packages/denylist-bot/src/utils/near.ts | 50 + packages/denylist-bot/test/queue.test.ts | 79 + packages/denylist-bot/test/tsconfig.json | 7 + .../tsconfig.json | 0 .../wrangler.toml | 5 +- .../denylist_bot/node_modules/.bin/esbuild | 1 - packages/denylist_bot/node_modules/.bin/jest | 1 - .../denylist_bot/node_modules/.bin/miniflare | 1 - .../denylist_bot/node_modules/.bin/prettier | 1 - .../denylist_bot/node_modules/.bin/ts-jest | 1 - packages/denylist_bot/node_modules/.bin/tsc | 1 - .../denylist_bot/node_modules/.bin/tsserver | 1 - .../denylist_bot/node_modules/.bin/wrangler | 1 - .../denylist_bot/node_modules/.bin/wrangler2 | 1 - .../workers-types/2021-11-03/index.d.ts | 2990 ---------------- .../workers-types/2021-11-03/index.ts | 2992 ----------------- .../workers-types/2022-01-31/index.d.ts | 2976 ---------------- .../workers-types/2022-01-31/index.ts | 2978 ---------------- .../workers-types/2022-03-21/index.d.ts | 2982 ---------------- .../workers-types/2022-03-21/index.ts | 2984 ---------------- .../workers-types/2022-08-04/index.d.ts | 2983 ---------------- .../workers-types/2022-08-04/index.ts | 2985 ---------------- .../workers-types/2022-10-31/index.d.ts | 2980 ---------------- .../workers-types/2022-10-31/index.ts | 2982 ---------------- .../workers-types/2022-11-30/index.d.ts | 2983 ---------------- .../workers-types/2022-11-30/index.ts | 2985 ---------------- .../@cloudflare/workers-types/README.md | 123 - .../@cloudflare/workers-types/entrypoints.svg | 53 - .../workers-types/experimental/index.d.ts | 2984 ---------------- .../workers-types/experimental/index.ts | 2986 ---------------- .../@cloudflare/workers-types/index.d.ts | 2990 ---------------- .../@cloudflare/workers-types/index.ts | 2992 ----------------- .../workers-types/oldest/index.d.ts | 2990 ---------------- .../@cloudflare/workers-types/oldest/index.ts | 2992 ----------------- .../@cloudflare/workers-types/package.json | 11 - .../node_modules/buffer/AUTHORS.md | 73 - .../denylist_bot/node_modules/buffer/LICENSE | 21 - .../node_modules/buffer/README.md | 410 --- .../node_modules/buffer/index.d.ts | 194 -- .../denylist_bot/node_modules/buffer/index.js | 2106 ------------ .../node_modules/buffer/package.json | 93 - .../node_modules/esbuild/LICENSE.md | 21 - .../node_modules/esbuild/README.md | 3 - .../node_modules/esbuild/bin/esbuild | 178 - .../node_modules/esbuild/install.js | 244 -- .../node_modules/esbuild/lib/main.d.ts | 602 ---- .../node_modules/esbuild/lib/main.js | 2332 ------------- .../node_modules/esbuild/package.json | 41 - packages/denylist_bot/src/consumer.ts | 24 - packages/denylist_bot/src/graphql.ts | 65 - packages/denylist_bot/src/utils.ts | 58 - packages/front/src/hooks/useEnv.tsx | 2 +- yarn.lock | 5 + 73 files changed, 397 insertions(+), 60408 deletions(-) rename packages/{denylist_bot => denylist-bot}/.env.example (100%) rename packages/{denylist_bot => denylist-bot}/.gitignore (100%) rename packages/{denylist_bot => denylist-bot}/build.js (100%) rename packages/{denylist_bot/jest.config.js => denylist-bot/jest.config copy.js} (100%) create mode 100644 packages/denylist-bot/jest.config.js rename packages/{denylist_bot => denylist-bot}/package.json (97%) rename packages/{denylist_bot => denylist-bot}/scripts/.gitignore (100%) rename packages/{denylist_bot => denylist-bot}/scripts/package.json (100%) rename packages/{denylist_bot => denylist-bot}/scripts/src/populateEnvs.ts (100%) rename packages/{denylist_bot => denylist-bot}/scripts/src/secrets.ts (100%) rename packages/{denylist_bot => denylist-bot}/scripts/tsconfig.json (100%) create mode 100644 packages/denylist-bot/src/constants.ts create mode 100644 packages/denylist-bot/src/dos/pagination.ts rename packages/{denylist_bot => denylist-bot}/src/index.ts (58%) create mode 100644 packages/denylist-bot/src/query.ts create mode 100644 packages/denylist-bot/src/services/consumer.ts create mode 100644 packages/denylist-bot/src/services/request.ts rename packages/{denylist_bot/src => denylist-bot/src/types}/env.ts (86%) create mode 100644 packages/denylist-bot/src/types/pagination.ts create mode 100644 packages/denylist-bot/src/utils/near.ts create mode 100644 packages/denylist-bot/test/queue.test.ts create mode 100644 packages/denylist-bot/test/tsconfig.json rename packages/{denylist_bot => denylist-bot}/tsconfig.json (100%) rename packages/{denylist_bot => denylist-bot}/wrangler.toml (92%) delete mode 120000 packages/denylist_bot/node_modules/.bin/esbuild delete mode 120000 packages/denylist_bot/node_modules/.bin/jest delete mode 120000 packages/denylist_bot/node_modules/.bin/miniflare delete mode 120000 packages/denylist_bot/node_modules/.bin/prettier delete mode 120000 packages/denylist_bot/node_modules/.bin/ts-jest delete mode 120000 packages/denylist_bot/node_modules/.bin/tsc delete mode 120000 packages/denylist_bot/node_modules/.bin/tsserver delete mode 120000 packages/denylist_bot/node_modules/.bin/wrangler delete mode 120000 packages/denylist_bot/node_modules/.bin/wrangler2 delete mode 100755 packages/denylist_bot/node_modules/@cloudflare/workers-types/2021-11-03/index.d.ts delete mode 100755 packages/denylist_bot/node_modules/@cloudflare/workers-types/2021-11-03/index.ts delete mode 100755 packages/denylist_bot/node_modules/@cloudflare/workers-types/2022-01-31/index.d.ts delete mode 100755 packages/denylist_bot/node_modules/@cloudflare/workers-types/2022-01-31/index.ts delete mode 100755 packages/denylist_bot/node_modules/@cloudflare/workers-types/2022-03-21/index.d.ts delete mode 100755 packages/denylist_bot/node_modules/@cloudflare/workers-types/2022-03-21/index.ts delete mode 100755 packages/denylist_bot/node_modules/@cloudflare/workers-types/2022-08-04/index.d.ts delete mode 100755 packages/denylist_bot/node_modules/@cloudflare/workers-types/2022-08-04/index.ts delete mode 100755 packages/denylist_bot/node_modules/@cloudflare/workers-types/2022-10-31/index.d.ts delete mode 100755 packages/denylist_bot/node_modules/@cloudflare/workers-types/2022-10-31/index.ts delete mode 100755 packages/denylist_bot/node_modules/@cloudflare/workers-types/2022-11-30/index.d.ts delete mode 100755 packages/denylist_bot/node_modules/@cloudflare/workers-types/2022-11-30/index.ts delete mode 100644 packages/denylist_bot/node_modules/@cloudflare/workers-types/README.md delete mode 100644 packages/denylist_bot/node_modules/@cloudflare/workers-types/entrypoints.svg delete mode 100755 packages/denylist_bot/node_modules/@cloudflare/workers-types/experimental/index.d.ts delete mode 100755 packages/denylist_bot/node_modules/@cloudflare/workers-types/experimental/index.ts delete mode 100755 packages/denylist_bot/node_modules/@cloudflare/workers-types/index.d.ts delete mode 100755 packages/denylist_bot/node_modules/@cloudflare/workers-types/index.ts delete mode 100755 packages/denylist_bot/node_modules/@cloudflare/workers-types/oldest/index.d.ts delete mode 100755 packages/denylist_bot/node_modules/@cloudflare/workers-types/oldest/index.ts delete mode 100644 packages/denylist_bot/node_modules/@cloudflare/workers-types/package.json delete mode 100644 packages/denylist_bot/node_modules/buffer/AUTHORS.md delete mode 100644 packages/denylist_bot/node_modules/buffer/LICENSE delete mode 100644 packages/denylist_bot/node_modules/buffer/README.md delete mode 100644 packages/denylist_bot/node_modules/buffer/index.d.ts delete mode 100644 packages/denylist_bot/node_modules/buffer/index.js delete mode 100644 packages/denylist_bot/node_modules/buffer/package.json delete mode 100644 packages/denylist_bot/node_modules/esbuild/LICENSE.md delete mode 100644 packages/denylist_bot/node_modules/esbuild/README.md delete mode 100755 packages/denylist_bot/node_modules/esbuild/bin/esbuild delete mode 100644 packages/denylist_bot/node_modules/esbuild/install.js delete mode 100644 packages/denylist_bot/node_modules/esbuild/lib/main.d.ts delete mode 100644 packages/denylist_bot/node_modules/esbuild/lib/main.js delete mode 100644 packages/denylist_bot/node_modules/esbuild/package.json delete mode 100644 packages/denylist_bot/src/consumer.ts delete mode 100644 packages/denylist_bot/src/graphql.ts delete mode 100644 packages/denylist_bot/src/utils.ts diff --git a/packages/contracts/tests-ts/src/index.ts b/packages/contracts/tests-ts/src/index.ts index d3269a243..47b25d5b7 100644 --- a/packages/contracts/tests-ts/src/index.ts +++ b/packages/contracts/tests-ts/src/index.ts @@ -212,6 +212,7 @@ export async function setup(): Promise { fs.writeFileSync("../../sdk/test/test_setup.json", testSetup); fs.writeFileSync("../../relayer/test/test_setup.json", testSetup); + fs.writeFileSync("../../denylist-bot/test/test_setup.json", testSetup); if (isCI) { console.log("The code is running on a CI server"); diff --git a/packages/denylist_bot/.env.example b/packages/denylist-bot/.env.example similarity index 100% rename from packages/denylist_bot/.env.example rename to packages/denylist-bot/.env.example diff --git a/packages/denylist_bot/.gitignore b/packages/denylist-bot/.gitignore similarity index 100% rename from packages/denylist_bot/.gitignore rename to packages/denylist-bot/.gitignore diff --git a/packages/denylist_bot/build.js b/packages/denylist-bot/build.js similarity index 100% rename from packages/denylist_bot/build.js rename to packages/denylist-bot/build.js diff --git a/packages/denylist_bot/jest.config.js b/packages/denylist-bot/jest.config copy.js similarity index 100% rename from packages/denylist_bot/jest.config.js rename to packages/denylist-bot/jest.config copy.js diff --git a/packages/denylist-bot/jest.config.js b/packages/denylist-bot/jest.config.js new file mode 100644 index 000000000..3a9152e21 --- /dev/null +++ b/packages/denylist-bot/jest.config.js @@ -0,0 +1,25 @@ +export default { + preset: "ts-jest/presets/default-esm", + globals: { + "ts-jest": { + tsconfig: "test/tsconfig.json", + useESM: true, + }, + }, + moduleNameMapper: { + "^@/(.*)$": "/src/$1", + "^(\\.{1,2}/.*)\\.js$": "$1", + }, + testEnvironment: "miniflare", + forceExit: true, + verbose: true, + detectOpenHandles: true, + clearMocks: true, + testEnvironmentOptions: { + // Miniflare doesn't yet support the `main` field in `wrangler.toml` so we + // need to explicitly tell it where our built worker is. We also need to + // explicitly mark it as an ES module. + scriptPath: "dist/index.mjs", + modules: true, + }, +}; diff --git a/packages/denylist_bot/package.json b/packages/denylist-bot/package.json similarity index 97% rename from packages/denylist_bot/package.json rename to packages/denylist-bot/package.json index 0b92c6950..6516ccf7d 100644 --- a/packages/denylist_bot/package.json +++ b/packages/denylist-bot/package.json @@ -37,6 +37,7 @@ "@tsndr/cloudflare-worker-router": "^2.3.2", "big.js": "^6.2.1", "buffer": "^6.0.3", + "graphql-request": "^5.2.0", "near-api-js": "^1.1.0" } } diff --git a/packages/denylist_bot/scripts/.gitignore b/packages/denylist-bot/scripts/.gitignore similarity index 100% rename from packages/denylist_bot/scripts/.gitignore rename to packages/denylist-bot/scripts/.gitignore diff --git a/packages/denylist_bot/scripts/package.json b/packages/denylist-bot/scripts/package.json similarity index 100% rename from packages/denylist_bot/scripts/package.json rename to packages/denylist-bot/scripts/package.json diff --git a/packages/denylist_bot/scripts/src/populateEnvs.ts b/packages/denylist-bot/scripts/src/populateEnvs.ts similarity index 100% rename from packages/denylist_bot/scripts/src/populateEnvs.ts rename to packages/denylist-bot/scripts/src/populateEnvs.ts diff --git a/packages/denylist_bot/scripts/src/secrets.ts b/packages/denylist-bot/scripts/src/secrets.ts similarity index 100% rename from packages/denylist_bot/scripts/src/secrets.ts rename to packages/denylist-bot/scripts/src/secrets.ts diff --git a/packages/denylist_bot/scripts/tsconfig.json b/packages/denylist-bot/scripts/tsconfig.json similarity index 100% rename from packages/denylist_bot/scripts/tsconfig.json rename to packages/denylist-bot/scripts/tsconfig.json diff --git a/packages/denylist-bot/src/constants.ts b/packages/denylist-bot/src/constants.ts new file mode 100644 index 000000000..d3f690272 --- /dev/null +++ b/packages/denylist-bot/src/constants.ts @@ -0,0 +1 @@ +export const AttachedGas = "300000000000000"; diff --git a/packages/denylist-bot/src/dos/pagination.ts b/packages/denylist-bot/src/dos/pagination.ts new file mode 100644 index 000000000..aeda07be5 --- /dev/null +++ b/packages/denylist-bot/src/dos/pagination.ts @@ -0,0 +1,73 @@ +import { Env } from "../types/env"; +import { FeederState } from "../types/pagination"; +import { sendRequest } from "..//services/request"; + +/** + * The Durable Object + */ +export class Pagination { + env: Env; + durable: DurableObjectState; + + /** constructor + * The constructor of durable object + * @param state The durable feeder state + * @param env The env object + * @returns void + */ + constructor(durable: DurableObjectState, env: Env) { + this.env = env; + this.durable = durable; + } + + /** getCurrentCounter + * This function returns the feeder state. + * @returns The current feeder state + */ + async getCurrentCounter (): Promise { + return await this.durable.storage.get('counter') || '0'; + } + + /** updateCurrentCounter + * This function update the feeder state. + * @param counter The new feeder state value + * @returns void + */ + async updateCurrentCounter (counter: FeederState): Promise { + return await this.durable.storage.put('counter', counter); + } + + /** fetch + * This function gets the last 100 entries from Hapi-One since the last counter and send to be processed for queue. + * @param request The request object + * @returns The response with an success value + */ + async fetch() { + const currentState = await this.getCurrentCounter(); + + console.info(`Fetching new Happi-one entries of counter: ${currentState}`); + + const { + data: { + hapioneEntries, + }, + errors, + } = await sendRequest(currentState, this.env); + + if (hapioneEntries.length <= 0) { + console.info(`The fetch for counter: ${currentState} returns a empty value`); + + return new Response("Success!"); + } + + if (errors) { + throw new Error(JSON.stringify(errors)) + } + + await this.env.QUEUE.sendBatch(hapioneEntries.map(value => ({ body: value})) as any); + + await this.updateCurrentCounter(hapioneEntries.at(-1)?.counter); + + return new Response("Success!"); + } +} diff --git a/packages/denylist_bot/src/index.ts b/packages/denylist-bot/src/index.ts similarity index 58% rename from packages/denylist_bot/src/index.ts rename to packages/denylist-bot/src/index.ts index b0bd0b203..6930cdd13 100644 --- a/packages/denylist_bot/src/index.ts +++ b/packages/denylist-bot/src/index.ts @@ -1,20 +1,21 @@ -import { Env } from "./env"; -import { consumer } from "./consumer"; -import { QueuedData } from "./utils"; +import { Env } from "./types/env"; +import { consumer } from "./services/consumer"; +import { QueuedData } from "./types/pagination"; -export { Pagination } from "./graphql"; +export { Pagination } from "./dos/pagination"; const durableObjecId = "HYC"; export default { - scheduled: async (event: Event, env: Env, ctx: ExecutionContext) => { + scheduled: async (_: any, env: Env) => { const id = env.DURABLE.idFromName(durableObjecId); + const stub = env.DURABLE.get(id); - const request = new Request("dummyurl"); + try { - await stub.fetch(request); + await stub.fetch(env.GRAPHQL_URL); } catch (err) { - console.log( + console.warn( "execution failed during durable object request, error: ", err ) diff --git a/packages/denylist-bot/src/query.ts b/packages/denylist-bot/src/query.ts new file mode 100644 index 000000000..a1814c65a --- /dev/null +++ b/packages/denylist-bot/src/query.ts @@ -0,0 +1,12 @@ +export const paginationSize = 100; + +export const getHapioneEntriesQuery = ` + query GetHapioneEntries($lastViewed: BigInt!) { + hapioneEntries(where: {counter_gt: $lastViewed}, first: ${paginationSize}, orderBy: counter) { + counter + account + category + risk + } + } +`; diff --git a/packages/denylist-bot/src/services/consumer.ts b/packages/denylist-bot/src/services/consumer.ts new file mode 100644 index 000000000..54ab81d5a --- /dev/null +++ b/packages/denylist-bot/src/services/consumer.ts @@ -0,0 +1,92 @@ +import type { Env } from "../types/env"; +import { AttachedGas } from "../constants"; +import { setupNear, viewFunction } from "../utils/near"; +import type { QueuedData } from "../types/pagination"; + +const riskMap: any = { + "Scam": 5, + "Theft": 5, + "Sanctions": 5, + "ChildAbuse": 5, + "Ransomware": 5, + "Counterfeit": 5, + "DarknetService": 5, + "TerroristFinancing": 5, + "IllicitOrganization": 5, +}; + +/** fetchRiskParams + * This function must perform a view call to contract to fetch + * there is currently no such view call in the contract. Mock + * @param category The risk category + * @returns Returns the max risk accepted by the contract + */ +const fetchRiskParams = async (category: string): Promise => { + return riskMap[category]; +} + +/** sendBanTransaction + * This function must sign and send a denylist transaction to the contract + * @param payload The queue payload + * @param env The env object + * @returns void + */ +const sendBanTransaction = async (payload: QueuedData, env: Env): Promise => { + const connection = await setupNear(env); + + const account = await connection.account(env.ACCOUNT_ID); + + await account.functionCall({ + contractId: env.HYC_CONTRACT, + methodName: "denylist", + args: { + account_id: payload.account, + }, + gas: AttachedGas as any, + attachedDeposit: "320000000000000000000" as any, + }); +} + +/** consumer + * This role is responsible for analyzing the risk and, if necessary, submitting the account to the DenyList + * @param payload The queue payload + * @param env The env object + * @returns void + */ +export const consumer = async (payload: QueuedData, env: Env) => { + console.info(`Start evaluate the payload:`, payload); + + const inAllowlist = await viewFunction( + env.RPC_URL, + env.HYC_CONTRACT, + 'view_is_in_allowlist', + { + account_id: payload.account, + } + ); + + if (!inAllowlist) { + console.info(`The account ${payload.account} is not in Allowlist`); + + return + } + + const maxRiskScore = await fetchRiskParams(payload.category); + + if (Number(payload.risk) < maxRiskScore) { + console.info(`The ${payload.account} account not is over the max risk`); + + return + } + + console.info(`Send the account: ${payload.account} to denylist`); + + try { + await sendBanTransaction(payload, env); + + console.info(`The ${payload.account} account has been banned`); + } catch (e) { + console.error(`Error to send the account: ${payload.account} to denylist`); + console.error(e); + } +} diff --git a/packages/denylist-bot/src/services/request.ts b/packages/denylist-bot/src/services/request.ts new file mode 100644 index 000000000..04f67eea1 --- /dev/null +++ b/packages/denylist-bot/src/services/request.ts @@ -0,0 +1,21 @@ + +import { Env } from "@/types/env"; +import { getHapioneEntriesQuery } from "@/query"; +import { FeederState, FetchResponseInterface } from "@/types/pagination"; + +export const sendRequest = async (counter: FeederState, env: Env): Promise => { + const response = await fetch(env.GRAPHQL_URL, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + query: getHapioneEntriesQuery, + variables: { + lastViewed: counter, + }, + }), + }); + + return await response.json(); +}; diff --git a/packages/denylist_bot/src/env.ts b/packages/denylist-bot/src/types/env.ts similarity index 86% rename from packages/denylist_bot/src/env.ts rename to packages/denylist-bot/src/types/env.ts index 45fb28afd..a1407b27f 100644 --- a/packages/denylist_bot/src/env.ts +++ b/packages/denylist-bot/src/types/env.ts @@ -1,5 +1,5 @@ import type { Queue } from "@cloudflare/workers-types/experimental" -import type { QueuedData } from "./utils"; +import type { QueuedData } from "./pagination"; export interface Env { // Near network data @@ -11,10 +11,9 @@ export interface Env { ACCOUNT_ID: string; // Addresses for relevant contracts HYC_CONTRACT: string; - HAPI_CONTRACT: string; // Graphql URL GRAPHQL_URL: string; // Bindings QUEUE: Queue; DURABLE: DurableObjectNamespace; -} \ No newline at end of file +} diff --git a/packages/denylist-bot/src/types/pagination.ts b/packages/denylist-bot/src/types/pagination.ts new file mode 100644 index 000000000..db74104ab --- /dev/null +++ b/packages/denylist-bot/src/types/pagination.ts @@ -0,0 +1,14 @@ +export type FeederState = string | undefined; + +export type QueuedData = { + counter: string; + account: string; + category: string; + risk: string; +} + +export type GraphqlResponse = { + hapioneEntries: QueuedData[]; +} + +export interface FetchResponseInterface { data: GraphqlResponse, errors: any } diff --git a/packages/denylist-bot/src/utils/near.ts b/packages/denylist-bot/src/utils/near.ts new file mode 100644 index 000000000..a71bd15f3 --- /dev/null +++ b/packages/denylist-bot/src/utils/near.ts @@ -0,0 +1,50 @@ +import Process from "process"; +import { Buffer } from "buffer"; +import type { Env } from "../types/env"; +import { connect, keyStores, KeyPair, providers } from "near-api-js"; + +/* tslint:disable */ +globalThis.Buffer = Buffer; +globalThis.process = Process; +/* tslint:enable */ + +export const setupNear = async ({ + RPC_URL, + ACCOUNT_ID, + PRIVATE_KEY, + NEAR_NETWORK, +}: Env) => { + const myKeyStore = new keyStores.InMemoryKeyStore(); + + const keyPair = KeyPair.fromString(PRIVATE_KEY); + + await myKeyStore.setKey(NEAR_NETWORK, ACCOUNT_ID, keyPair); + + const connectionConfig = { + nodeUrl: RPC_URL, + networkId: NEAR_NETWORK, + }; + + return connect({ ...connectionConfig, keyStore: myKeyStore }); +}; + +export const viewFunction = async ( + nodeUrl: string, + contractId: string, + methodName: string, + args: any = {} +) => { + const provider = new providers.JsonRpcProvider({ url: nodeUrl }); + + const serializedArgs = Buffer.from(JSON.stringify(args)).toString("base64"); + + const res = (await provider.query({ + request_type: "call_function", + account_id: contractId, + method_name: methodName, + args_base64: serializedArgs, + finality: "optimistic", + })) as any; + + return JSON.parse(Buffer.from(res.result).toString()); +}; diff --git a/packages/denylist-bot/test/queue.test.ts b/packages/denylist-bot/test/queue.test.ts new file mode 100644 index 000000000..3cd0ce1a8 --- /dev/null +++ b/packages/denylist-bot/test/queue.test.ts @@ -0,0 +1,79 @@ +import testnetSetup from "./test_setup.json"; +import { consumer } from "../src/services/consumer"; +import { describe, expect, jest, it, beforeAll } from '@jest/globals'; +import { setupNear, viewFunction } from "../src//utils/near"; + +const payload = { + counter: '34', + account: '3ae95aeeb5a4600264ecneko.testnet', + category: 'Theft', + risk: '7', +}; + +const baseEnv = { + NEAR_NETWORK: "testnet", + HYC_CONTRACT: testnetSetup.hyc_contract, + RPC_URL: "https://rpc.testnet.near.org", + ACCOUNT_ID: testnetSetup.account.account_id, + PRIVATE_KEY: testnetSetup.account.private_key, +}; + +describe("Test all service actions", () => { + jest.setTimeout(1000000000); + + let account: any = null; + let connection: any = null; + + beforeAll(async () => { + connection = await setupNear({ + RPC_URL: "https://archival-rpc.testnet.near.org", + ACCOUNT_ID: baseEnv.ACCOUNT_ID, + PRIVATE_KEY: baseEnv.PRIVATE_KEY, + NEAR_NETWORK: "testnet", + } as any); + + account = await connection.account(baseEnv.ACCOUNT_ID); + }); + + it("should return success - The account has been banned", async () => { + const inAllowlist = await viewFunction( + baseEnv.RPC_URL, + baseEnv.HYC_CONTRACT, + 'view_is_in_allowlist', + { + account_id: payload.account, + }, + ); + + expect(inAllowlist).toEqual(false); + + account.functionCall({ + contractId: baseEnv.HYC_CONTRACT, + methodName: "allowlist", + args: { + account_id: payload.account, + }, + gas: "300000000000000" as any, + attachedDeposit: "480000000000000000000" as any, + }); + + expect(inAllowlist).toEqual(true); + + try { + await consumer(payload, baseEnv as any); + } catch (e) { + console.warn(e); + } + + const inDenylist = await viewFunction( + baseEnv.RPC_URL, + baseEnv.HYC_CONTRACT, + 'view_is_in_allowlist', + { + account_id: payload.account, + }, + ); + + expect(inDenylist).toEqual(true); + }); +}); diff --git a/packages/denylist-bot/test/tsconfig.json b/packages/denylist-bot/test/tsconfig.json new file mode 100644 index 000000000..f6923df30 --- /dev/null +++ b/packages/denylist-bot/test/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "types": ["@cloudflare/workers-types", "jest", "../bindings"] + }, + "include": ["../src/**/*", "**/*"] +} diff --git a/packages/denylist_bot/tsconfig.json b/packages/denylist-bot/tsconfig.json similarity index 100% rename from packages/denylist_bot/tsconfig.json rename to packages/denylist-bot/tsconfig.json diff --git a/packages/denylist_bot/wrangler.toml b/packages/denylist-bot/wrangler.toml similarity index 92% rename from packages/denylist_bot/wrangler.toml rename to packages/denylist-bot/wrangler.toml index fb701b88b..b620437fd 100644 --- a/packages/denylist_bot/wrangler.toml +++ b/packages/denylist-bot/wrangler.toml @@ -1,7 +1,10 @@ +node_compat = true name = "prod-denybot" main = "dist/index.mjs" compatibility_date = "experimental" -node_compat = true + +[triggers] +crons = ["* * * * *"] [[queues.producers]] queue = "my-queue" diff --git a/packages/denylist_bot/node_modules/.bin/esbuild b/packages/denylist_bot/node_modules/.bin/esbuild deleted file mode 120000 index c83ac0707..000000000 --- a/packages/denylist_bot/node_modules/.bin/esbuild +++ /dev/null @@ -1 +0,0 @@ -../esbuild/bin/esbuild \ No newline at end of file diff --git a/packages/denylist_bot/node_modules/.bin/jest b/packages/denylist_bot/node_modules/.bin/jest deleted file mode 120000 index bbcd42467..000000000 --- a/packages/denylist_bot/node_modules/.bin/jest +++ /dev/null @@ -1 +0,0 @@ -../../../../node_modules/jest/bin/jest.js \ No newline at end of file diff --git a/packages/denylist_bot/node_modules/.bin/miniflare b/packages/denylist_bot/node_modules/.bin/miniflare deleted file mode 120000 index fd044705e..000000000 --- a/packages/denylist_bot/node_modules/.bin/miniflare +++ /dev/null @@ -1 +0,0 @@ -../../../../node_modules/miniflare/bootstrap.js \ No newline at end of file diff --git a/packages/denylist_bot/node_modules/.bin/prettier b/packages/denylist_bot/node_modules/.bin/prettier deleted file mode 120000 index e5e6cd505..000000000 --- a/packages/denylist_bot/node_modules/.bin/prettier +++ /dev/null @@ -1 +0,0 @@ -../../../../node_modules/prettier/bin-prettier.js \ No newline at end of file diff --git a/packages/denylist_bot/node_modules/.bin/ts-jest b/packages/denylist_bot/node_modules/.bin/ts-jest deleted file mode 120000 index 89c3b247e..000000000 --- a/packages/denylist_bot/node_modules/.bin/ts-jest +++ /dev/null @@ -1 +0,0 @@ -../../../../node_modules/ts-jest/cli.js \ No newline at end of file diff --git a/packages/denylist_bot/node_modules/.bin/tsc b/packages/denylist_bot/node_modules/.bin/tsc deleted file mode 120000 index d21531ad1..000000000 --- a/packages/denylist_bot/node_modules/.bin/tsc +++ /dev/null @@ -1 +0,0 @@ -../../../../node_modules/typescript/bin/tsc \ No newline at end of file diff --git a/packages/denylist_bot/node_modules/.bin/tsserver b/packages/denylist_bot/node_modules/.bin/tsserver deleted file mode 120000 index b951c5a42..000000000 --- a/packages/denylist_bot/node_modules/.bin/tsserver +++ /dev/null @@ -1 +0,0 @@ -../../../../node_modules/typescript/bin/tsserver \ No newline at end of file diff --git a/packages/denylist_bot/node_modules/.bin/wrangler b/packages/denylist_bot/node_modules/.bin/wrangler deleted file mode 120000 index 213f34e60..000000000 --- a/packages/denylist_bot/node_modules/.bin/wrangler +++ /dev/null @@ -1 +0,0 @@ -../../../../node_modules/wrangler/bin/wrangler.js \ No newline at end of file diff --git a/packages/denylist_bot/node_modules/.bin/wrangler2 b/packages/denylist_bot/node_modules/.bin/wrangler2 deleted file mode 120000 index 213f34e60..000000000 --- a/packages/denylist_bot/node_modules/.bin/wrangler2 +++ /dev/null @@ -1 +0,0 @@ -../../../../node_modules/wrangler/bin/wrangler.js \ No newline at end of file diff --git a/packages/denylist_bot/node_modules/@cloudflare/workers-types/2021-11-03/index.d.ts b/packages/denylist_bot/node_modules/@cloudflare/workers-types/2021-11-03/index.d.ts deleted file mode 100755 index 4ccf4237b..000000000 --- a/packages/denylist_bot/node_modules/@cloudflare/workers-types/2021-11-03/index.d.ts +++ /dev/null @@ -1,2990 +0,0 @@ -/*! ***************************************************************************** -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 class DOMException extends Error { - constructor(message?: string, name?: string); - readonly message: string; - readonly name: string; - readonly code: number; - readonly stack: any; - 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; -} -declare type WorkerGlobalScopeEventMap = { - fetch: FetchEvent; - scheduled: ScheduledEvent; - unhandledrejection: PromiseRejectionEvent; - rejectionhandled: PromiseRejectionEvent; -}; -declare abstract class WorkerGlobalScope extends EventTarget { - EventTarget: typeof EventTarget; -} -declare interface Console { - "assert"(condition?: boolean, ...data: any[]): void; - clear(): void; - count(label?: string): void; - countReset(label?: string): void; - debug(...data: any[]): void; - dir(item?: any, options?: any): void; - dirxml(...data: any[]): void; - error(...data: any[]): void; - group(...data: any[]): void; - groupCollapsed(...data: any[]): void; - groupEnd(): void; - info(...data: any[]): void; - log(...data: any[]): void; - table(tabularData?: any, properties?: string[]): void; - time(label?: string): void; - timeEnd(label?: string): void; - timeLog(label?: string, ...data: any[]): void; - timeStamp(label?: string): void; - trace(...data: any[]): void; - warn(...data: any[]): void; -} -declare const console: Console; -declare type BufferSource = ArrayBufferView | ArrayBuffer; -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; - type Imports = Record; - type ExportValue = Function | Global | Memory | Table; - type Exports = Record; - 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; - function validate(bytes: BufferSource): boolean; -} -/** This ServiceWorker API interface represents the global execution context of a service worker. */ -declare 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( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args - ): number; - clearTimeout(timeoutId: number | null): void; - setInterval(callback: (...args: any[]) => void, msDelay?: number): number; - setInterval( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args - ): number; - clearInterval(timeoutId: number | null): void; - queueMicrotask(task: Function): void; - structuredClone(value: T, options?: StructuredSerializeOptions): T; - fetch( - input: RequestInfo, - init?: RequestInit - ): Promise; - self: ServiceWorkerGlobalScope; - crypto: Crypto; - caches: CacheStorage; - scheduler: Scheduler; - Event: typeof Event; - ExtendableEvent: typeof ExtendableEvent; - PromiseRejectionEvent: typeof PromiseRejectionEvent; - FetchEvent: typeof FetchEvent; - TraceEvent: typeof TraceEvent; - 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; - 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; - AbortController: typeof AbortController; - AbortSignal: typeof AbortSignal; - TextDecoder: typeof TextDecoder; - TextEncoder: typeof TextEncoder; - 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: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetAddEventListenerOptions | boolean -): void; -declare function removeEventListener< - Type extends keyof WorkerGlobalScopeEventMap ->( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetEventListenerOptions | boolean -): void; -/** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */ -declare function dispatchEvent( - event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap] -): boolean; -declare function btoa(data: string): string; -declare function atob(data: string): string; -declare function setTimeout( - callback: (...args: any[]) => void, - msDelay?: number -): number; -declare function setTimeout( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args -): number; -declare function clearTimeout(timeoutId: number | null): void; -declare function setInterval( - callback: (...args: any[]) => void, - msDelay?: number -): number; -declare function setInterval( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args -): number; -declare function clearInterval(timeoutId: number | null): void; -declare function queueMicrotask(task: Function): void; -declare function structuredClone( - value: T, - options?: StructuredSerializeOptions -): T; -declare function fetch( - input: RequestInfo, - init?: RequestInit -): Promise; -declare const self: ServiceWorkerGlobalScope; -declare const crypto: Crypto; -declare const caches: CacheStorage; -declare const scheduler: Scheduler; -declare interface TestController {} -declare interface ExecutionContext { - waitUntil(promise: Promise): void; - passThroughOnException(): void; -} -declare type ExportedHandlerFetchHandler< - Env = unknown, - CfHostMetadata = unknown -> = ( - request: Request>, - env: Env, - ctx: ExecutionContext -) => Response | Promise; -declare type ExportedHandlerTraceHandler = ( - traces: TraceItem[], - env: Env, - ctx: ExecutionContext -) => void | Promise; -declare type ExportedHandlerScheduledHandler = ( - controller: ScheduledController, - env: Env, - ctx: ExecutionContext -) => void | Promise; -declare type ExportedHandlerQueueHandler = ( - batch: MessageBatch, - env: Env, - ctx: ExecutionContext -) => void | Promise; -declare type ExportedHandlerTestHandler = ( - controller: TestController, - env: Env, - ctx: ExecutionContext -) => void | Promise; -declare interface ExportedHandler< - Env = unknown, - QueueMessage = unknown, - CfHostMetadata = unknown -> { - fetch?: ExportedHandlerFetchHandler; - trace?: ExportedHandlerTraceHandler; - scheduled?: ExportedHandlerScheduledHandler; - test?: ExportedHandlerTestHandler; - queue?: ExportedHandlerQueueHandler; -} -declare interface StructuredSerializeOptions { - transfer?: any[]; -} -declare abstract class PromiseRejectionEvent extends Event { - readonly promise: Promise; - readonly reason: any; -} -declare interface DurableObject { - fetch(request: Request): Response | Promise; - alarm?(): void | Promise; -} -declare interface DurableObjectStub extends Fetcher { - readonly id: DurableObjectId; - readonly name?: string; -} -declare interface DurableObjectId { - toString(): string; - equals(other: DurableObjectId): boolean; - readonly name?: string; -} -declare interface DurableObjectNamespace { - newUniqueId( - options?: DurableObjectNamespaceNewUniqueIdOptions - ): DurableObjectId; - idFromName(name: string): DurableObjectId; - idFromString(id: string): DurableObjectId; - get( - id: DurableObjectId, - options?: DurableObjectNamespaceGetDurableObjectOptions - ): DurableObjectStub; - jurisdiction(jurisdiction: string): DurableObjectNamespace; -} -declare interface DurableObjectNamespaceNewUniqueIdOptions { - jurisdiction?: string; -} -declare interface DurableObjectNamespaceGetDurableObjectOptions { - locationHint?: string; -} -declare interface DurableObjectState { - waitUntil(promise: Promise): void; - readonly id: DurableObjectId; - readonly storage: DurableObjectStorage; - blockConcurrencyWhile(callback: () => Promise): Promise; -} -declare interface DurableObjectTransaction { - get( - key: string, - options?: DurableObjectGetOptions - ): Promise; - get( - keys: string[], - options?: DurableObjectGetOptions - ): Promise>; - list( - options?: DurableObjectListOptions - ): Promise>; - put( - key: string, - value: T, - options?: DurableObjectPutOptions - ): Promise; - put( - entries: Record, - options?: DurableObjectPutOptions - ): Promise; - delete(key: string, options?: DurableObjectPutOptions): Promise; - delete(keys: string[], options?: DurableObjectPutOptions): Promise; - rollback(): void; - getAlarm(options?: DurableObjectGetAlarmOptions): Promise; - setAlarm( - scheduledTime: number | Date, - options?: DurableObjectSetAlarmOptions - ): Promise; - deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise; -} -declare interface DurableObjectStorage { - get( - key: string, - options?: DurableObjectGetOptions - ): Promise; - get( - keys: string[], - options?: DurableObjectGetOptions - ): Promise>; - list( - options?: DurableObjectListOptions - ): Promise>; - put( - key: string, - value: T, - options?: DurableObjectPutOptions - ): Promise; - put( - entries: Record, - options?: DurableObjectPutOptions - ): Promise; - delete(key: string, options?: DurableObjectPutOptions): Promise; - delete(keys: string[], options?: DurableObjectPutOptions): Promise; - deleteAll(options?: DurableObjectPutOptions): Promise; - transaction( - closure: (txn: DurableObjectTransaction) => Promise - ): Promise; - getAlarm(options?: DurableObjectGetAlarmOptions): Promise; - setAlarm( - scheduledTime: number | Date, - options?: DurableObjectSetAlarmOptions - ): Promise; - deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise; - sync(): Promise; -} -declare interface DurableObjectListOptions { - start?: string; - startAfter?: string; - end?: string; - prefix?: string; - reverse?: boolean; - limit?: number; - allowConcurrency?: boolean; - noCache?: boolean; -} -declare interface DurableObjectGetOptions { - allowConcurrency?: boolean; - noCache?: boolean; -} -declare interface DurableObjectGetAlarmOptions { - allowConcurrency?: boolean; -} -declare interface DurableObjectPutOptions { - allowConcurrency?: boolean; - allowUnconfirmed?: boolean; - noCache?: boolean; -} -declare interface DurableObjectSetAlarmOptions { - allowConcurrency?: boolean; - allowUnconfirmed?: boolean; -} -declare interface AnalyticsEngineDataset { - writeDataPoint(event?: AnalyticsEngineDataPoint): void; -} -declare interface AnalyticsEngineDataPoint { - indexes?: ((ArrayBuffer | string) | null)[]; - doubles?: number[]; - blobs?: ((ArrayBuffer | string) | null)[]; -} -declare class Event { - constructor(type: string, init?: EventInit); - /** Returns the type of event, e.g. "click", "hashchange", or "submit". */ - readonly type: string; - /** Returns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE. */ - readonly eventPhase: number; - /** Returns true or false depending on how event was initialized. True if event invokes listeners past a ShadowRoot node that is the root of its target, and false otherwise. */ - readonly composed: boolean; - /** Returns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise. */ - readonly bubbles: boolean; - /** Returns true or false depending on how event was initialized. Its return value does not always carry meaning, but true can indicate that part of the operation during which event was dispatched, can be canceled by invoking the preventDefault() method. */ - readonly cancelable: boolean; - /** Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise. */ - readonly defaultPrevented: boolean; - /** @deprecated */ - readonly returnValue: boolean; - /** Returns the object whose event listener's callback is currently being invoked. */ - readonly currentTarget?: EventTarget; - /** @deprecated */ - readonly srcElement?: EventTarget; - /** Returns the event's timestamp as the number of milliseconds measured relative to the time origin. */ - readonly timeStamp: number; - /** Returns true if event was dispatched by the user agent, and false otherwise. */ - readonly isTrusted: boolean; - cancelBubble: boolean; - stopImmediatePropagation(): void; - preventDefault(): void; - stopPropagation(): void; - composedPath(): EventTarget[]; - static readonly NONE: number; - static readonly CAPTURING_PHASE: number; - static readonly AT_TARGET: number; - static readonly BUBBLING_PHASE: number; -} -declare interface EventInit { - bubbles?: boolean; - cancelable?: boolean; - composed?: boolean; -} -declare type EventListener = ( - event: EventType -) => void; -declare interface EventListenerObject { - handleEvent(event: EventType): void; -} -declare type EventListenerOrEventListenerObject< - EventType extends Event = Event -> = EventListener | EventListenerObject; -declare class EventTarget< - EventMap extends Record = Record -> { - constructor(); - addEventListener( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetAddEventListenerOptions | boolean - ): void; - removeEventListener( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetEventListenerOptions | boolean - ): void; - dispatchEvent(event: EventMap[keyof EventMap]): boolean; -} -declare interface EventTargetEventListenerOptions { - capture?: boolean; -} -declare interface EventTargetAddEventListenerOptions { - capture?: boolean; - passive?: boolean; - once?: boolean; - signal?: AbortSignal; -} -declare interface EventTargetHandlerObject { - handleEvent: (event: Event) => any | undefined; -} -declare class AbortController { - constructor(); - /** Returns the AbortSignal object associated with this object. */ - readonly signal: AbortSignal; - abort(reason?: any): void; -} -declare abstract class AbortSignal extends EventTarget { - static abort(reason?: any): AbortSignal; - static timeout(delay: number): AbortSignal; - /** Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. */ - readonly aborted: boolean; - readonly reason: any; - throwIfAborted(): void; -} -declare interface Scheduler { - wait(delay: number, maybeOptions?: SchedulerWaitOptions): Promise; -} -declare interface SchedulerWaitOptions { - signal?: AbortSignal; -} -declare abstract class ExtendableEvent extends Event { - waitUntil(promise: Promise): void; -} -declare class Blob { - constructor( - bits?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[], - options?: BlobOptions - ); - readonly size: number; - readonly type: string; - slice(start?: number, end?: number, type?: string): Blob; - arrayBuffer(): Promise; - text(): Promise; - stream(): ReadableStream; -} -declare interface BlobOptions { - type?: string; -} -declare class File extends Blob { - constructor( - bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined, - name: string, - options?: FileOptions - ); - readonly name: string; - readonly lastModified: number; -} -declare interface FileOptions { - type?: string; - lastModified?: number; -} -declare abstract class CacheStorage { - open(cacheName: string): Promise; - readonly default: Cache; -} -declare abstract class Cache { - delete(request: RequestInfo, options?: CacheQueryOptions): Promise; - match( - request: RequestInfo, - options?: CacheQueryOptions - ): Promise; - put(request: RequestInfo, response: Response): Promise; -} -declare interface CacheQueryOptions { - ignoreMethod?: boolean; -} -declare abstract class Crypto { - /** Available only in secure contexts. */ - readonly subtle: SubtleCrypto; - getRandomValues< - T extends - | Int8Array - | Uint8Array - | Int16Array - | Uint16Array - | Int32Array - | Uint32Array - | BigInt64Array - | BigUint64Array - >(buffer: T): T; - randomUUID(): string; - DigestStream: typeof DigestStream; -} -declare abstract class SubtleCrypto { - encrypt( - algorithm: string | SubtleCryptoEncryptAlgorithm, - key: CryptoKey, - plainText: ArrayBuffer | ArrayBufferView - ): Promise; - decrypt( - algorithm: string | SubtleCryptoEncryptAlgorithm, - key: CryptoKey, - cipherText: ArrayBuffer | ArrayBufferView - ): Promise; - sign( - algorithm: string | SubtleCryptoSignAlgorithm, - key: CryptoKey, - data: ArrayBuffer | ArrayBufferView - ): Promise; - verify( - algorithm: string | SubtleCryptoSignAlgorithm, - key: CryptoKey, - signature: ArrayBuffer | ArrayBufferView, - data: ArrayBuffer | ArrayBufferView - ): Promise; - digest( - algorithm: string | SubtleCryptoHashAlgorithm, - data: ArrayBuffer | ArrayBufferView - ): Promise; - generateKey( - algorithm: string | SubtleCryptoGenerateKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - deriveKey( - algorithm: string | SubtleCryptoDeriveKeyAlgorithm, - baseKey: CryptoKey, - derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - deriveBits( - algorithm: string | SubtleCryptoDeriveKeyAlgorithm, - baseKey: CryptoKey, - length: number | null - ): Promise; - importKey( - format: string, - keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey, - algorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - exportKey(format: string, key: CryptoKey): Promise; - wrapKey( - format: string, - key: CryptoKey, - wrappingKey: CryptoKey, - wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm - ): Promise; - unwrapKey( - format: string, - wrappedKey: ArrayBuffer | ArrayBufferView, - unwrappingKey: CryptoKey, - unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm, - unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - timingSafeEqual( - a: ArrayBuffer | ArrayBufferView, - b: ArrayBuffer | ArrayBufferView - ): boolean; -} -declare abstract class CryptoKey { - readonly type: string; - readonly extractable: boolean; - readonly algorithm: - | CryptoKeyKeyAlgorithm - | CryptoKeyAesKeyAlgorithm - | CryptoKeyHmacKeyAlgorithm - | CryptoKeyRsaKeyAlgorithm - | CryptoKeyEllipticKeyAlgorithm - | CryptoKeyArbitraryKeyAlgorithm; - readonly usages: string[]; -} -declare interface CryptoKeyPair { - publicKey: CryptoKey; - privateKey: CryptoKey; -} -declare 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; -} -declare interface RsaOtherPrimesInfo { - r?: string; - d?: string; - t?: string; -} -declare interface SubtleCryptoDeriveKeyAlgorithm { - name: string; - salt?: ArrayBuffer; - iterations?: number; - hash?: string | SubtleCryptoHashAlgorithm; - $public?: CryptoKey; - info?: ArrayBuffer; -} -declare interface SubtleCryptoEncryptAlgorithm { - name: string; - iv?: ArrayBuffer; - additionalData?: ArrayBuffer; - tagLength?: number; - counter?: ArrayBuffer; - length?: number; - label?: ArrayBuffer; -} -declare interface SubtleCryptoGenerateKeyAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - modulusLength?: number; - publicExponent?: ArrayBuffer; - length?: number; - namedCurve?: string; -} -declare interface SubtleCryptoHashAlgorithm { - name: string; -} -declare interface SubtleCryptoImportKeyAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - length?: number; - namedCurve?: string; - compressed?: boolean; -} -declare interface SubtleCryptoSignAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - dataLength?: number; - saltLength?: number; -} -declare interface CryptoKeyKeyAlgorithm { - name: string; -} -declare interface CryptoKeyAesKeyAlgorithm { - name: string; - length: number; -} -declare interface CryptoKeyHmacKeyAlgorithm { - name: string; - hash: CryptoKeyKeyAlgorithm; - length: number; -} -declare interface CryptoKeyRsaKeyAlgorithm { - name: string; - modulusLength: number; - publicExponent: ArrayBuffer; - hash?: CryptoKeyKeyAlgorithm; -} -declare interface CryptoKeyEllipticKeyAlgorithm { - name: string; - namedCurve: string; -} -declare interface CryptoKeyArbitraryKeyAlgorithm { - name: string; - hash?: CryptoKeyKeyAlgorithm; - namedCurve?: string; - length?: number; -} -declare class DigestStream extends WritableStream< - ArrayBuffer | ArrayBufferView -> { - constructor(algorithm: string | SubtleCryptoHashAlgorithm); - readonly digest: Promise; -} -declare class TextDecoder { - constructor(decoder?: string, options?: TextDecoderConstructorOptions); - decode( - input?: ArrayBuffer | ArrayBufferView, - options?: TextDecoderDecodeOptions - ): string; - readonly encoding: string; - readonly fatal: boolean; - readonly ignoreBOM: boolean; -} -declare class TextEncoder { - constructor(); - encode(input?: string): Uint8Array; - encodeInto(input: string, buffer: Uint8Array): TextEncoderEncodeIntoResult; - readonly encoding: string; -} -declare interface TextDecoderConstructorOptions { - fatal: boolean; - ignoreBOM: boolean; -} -declare interface TextDecoderDecodeOptions { - stream: boolean; -} -declare interface TextEncoderEncodeIntoResult { - read: number; - written: number; -} -declare class FormData { - constructor(); - append(name: string, value: string): void; - append(name: string, value: Blob, filename?: string): void; - delete(name: string): void; - get(name: string): (File | string) | null; - getAll(name: string): (File | string)[]; - has(name: string): boolean; - set(name: string, value: string): void; - set(name: string, value: Blob, filename?: string): void; - entries(): IterableIterator<[key: string, value: File | string]>; - keys(): IterableIterator; - values(): IterableIterator; - forEach( - callback: ( - this: This, - value: File | string, - key: string, - parent: FormData - ) => void, - thisArg?: This - ): void; - [Symbol.iterator](): IterableIterator<[key: string, value: File | string]>; -} -declare interface ContentOptions { - html?: boolean; -} -declare class HTMLRewriter { - constructor(); - on( - selector: string, - handlers: HTMLRewriterElementContentHandlers - ): HTMLRewriter; - onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter; - transform(response: Response): Response; -} -declare interface HTMLRewriterElementContentHandlers { - element?(element: Element): void | Promise; - comments?(comment: Comment): void | Promise; - text?(element: Text): void | Promise; -} -declare interface HTMLRewriterDocumentContentHandlers { - doctype?(doctype: Doctype): void | Promise; - comments?(comment: Comment): void | Promise; - text?(text: Text): void | Promise; - end?(end: DocumentEnd): void | Promise; -} -declare interface Doctype { - readonly name: string | null; - readonly publicId: string | null; - readonly systemId: string | null; -} -declare interface Element { - tagName: string; - readonly attributes: IterableIterator; - 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, options?: ContentOptions): Element; - after(content: string, options?: ContentOptions): Element; - prepend(content: string, options?: ContentOptions): Element; - append(content: string, options?: ContentOptions): Element; - replace(content: string, options?: ContentOptions): Element; - remove(): Element; - removeAndKeepContent(): Element; - setInnerContent(content: string, options?: ContentOptions): Element; - onEndTag(handler: (tag: EndTag) => void | Promise): void; -} -declare interface EndTag { - name: string; - before(content: string, options?: ContentOptions): EndTag; - after(content: string, options?: ContentOptions): EndTag; - remove(): EndTag; -} -declare 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; -} -declare interface Text { - readonly text: string; - readonly lastInTextNode: boolean; - readonly removed: boolean; - before(content: string, options?: ContentOptions): Text; - after(content: string, options?: ContentOptions): Text; - replace(content: string, options?: ContentOptions): Text; - remove(): Text; -} -declare interface DocumentEnd { - append(content: string, options?: ContentOptions): DocumentEnd; -} -declare abstract class FetchEvent extends ExtendableEvent { - readonly request: Request; - respondWith(promise: Response | Promise): void; - passThroughOnException(): void; -} -declare type HeadersInit = - | Headers - | Iterable> - | Record; -declare class Headers { - constructor(init?: HeadersInit); - get(name: string): string | null; - getAll(name: string): string[]; - has(name: string): boolean; - set(name: string, value: string): void; - append(name: string, value: string): void; - delete(name: string): void; - forEach( - callback: (this: This, value: string, key: string, parent: Headers) => void, - thisArg?: This - ): void; - entries(): IterableIterator<[key: string, value: string]>; - keys(): IterableIterator; - values(): IterableIterator; - [Symbol.iterator](): IterableIterator<[key: string, value: string]>; -} -declare type BodyInit = - | ReadableStream - | string - | ArrayBuffer - | ArrayBufferView - | Blob - | URLSearchParams - | FormData; -declare abstract class Body { - readonly body: ReadableStream | null; - readonly bodyUsed: boolean; - arrayBuffer(): Promise; - text(): Promise; - json(): Promise; - formData(): Promise; - blob(): Promise; -} -declare class Response extends Body { - constructor(body?: BodyInit | null, init?: ResponseInit); - static redirect(url: string, status?: number): Response; - static json(any: any, maybeInit?: ResponseInit | Response): Response; - clone(): Response; - readonly status: number; - readonly statusText: string; - readonly headers: Headers; - readonly ok: boolean; - readonly redirected: boolean; - readonly url: string; - readonly webSocket: WebSocket | null; - readonly cf?: any; -} -declare interface ResponseInit { - status?: number; - statusText?: string; - headers?: HeadersInit; - cf?: any; - webSocket?: WebSocket | null; - encodeBody?: "automatic" | "manual"; -} -declare type RequestInfo< - CfHostMetadata = unknown, - Cf = CfProperties -> = Request | string | URL; -declare class Request< - CfHostMetadata = unknown, - Cf = CfProperties -> extends Body { - constructor(input: RequestInfo, init?: RequestInit); - clone(): Request; - /** Returns request's HTTP method, which is "GET" by default. */ - readonly method: string; - /** Returns the URL of request as a string. */ - readonly url: string; - /** Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the "Host" header. */ - readonly headers: Headers; - /** Returns the redirect mode associated with request, which is a string indicating how redirects for the request will be handled during fetching. A request will follow redirects by default. */ - readonly redirect: string; - readonly fetcher: Fetcher | null; - /** Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler. */ - readonly signal: AbortSignal; - readonly cf?: Cf; - /** Returns request's subresource integrity metadata, which is a cryptographic hash of the resource being fetched. Its value consists of multiple hashes separated by whitespace. [SRI] */ - readonly integrity: string; - /** Returns a boolean indicating whether or not request can outlive the global in which it was created. */ - readonly keepalive: boolean; -} -declare interface RequestInit { - /** 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 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; -} -declare abstract class Fetcher { - fetch(input: RequestInfo, init?: RequestInit): Promise; -} -declare interface FetcherPutOptions { - expiration?: number; - expirationTtl?: number; -} -declare interface KVNamespaceListKey { - name: Key; - expiration?: number; - metadata?: Metadata; -} -declare type KVNamespaceListResult = - | { - list_complete: false; - keys: KVNamespaceListKey[]; - cursor: string; - } - | { - list_complete: true; - keys: KVNamespaceListKey[]; - }; -declare interface KVNamespace { - get( - key: Key, - options?: Partial> - ): Promise; - get(key: Key, type: "text"): Promise; - get( - key: Key, - type: "json" - ): Promise; - get(key: Key, type: "arrayBuffer"): Promise; - get(key: Key, type: "stream"): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"text"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"json"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"arrayBuffer"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"stream"> - ): Promise; - list( - options?: KVNamespaceListOptions - ): Promise>; - put( - key: Key, - value: string | ArrayBuffer | ArrayBufferView | ReadableStream, - options?: KVNamespacePutOptions - ): Promise; - getWithMetadata( - key: Key, - options?: Partial> - ): Promise>; - getWithMetadata( - key: Key, - type: "text" - ): Promise>; - getWithMetadata( - key: Key, - type: "json" - ): Promise>; - getWithMetadata( - key: Key, - type: "arrayBuffer" - ): Promise>; - getWithMetadata( - key: Key, - type: "stream" - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"text"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"json"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"arrayBuffer"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"stream"> - ): Promise>; - delete(key: Key): Promise; -} -declare interface KVNamespaceListOptions { - limit?: number; - prefix?: string | null; - cursor?: string | null; -} -declare interface KVNamespaceGetOptions { - type: Type; - cacheTtl?: number; -} -declare interface KVNamespacePutOptions { - expiration?: number; - expirationTtl?: number; - metadata?: any | null; -} -declare interface KVNamespaceGetWithMetadataResult { - value: Value | null; - metadata: Metadata | null; -} -declare interface R2Error extends Error { - readonly name: string; - readonly code: number; - readonly message: string; - readonly action: string; - readonly stack: any; -} -declare interface R2ListOptions { - limit?: number; - prefix?: string; - cursor?: string; - delimiter?: string; - startAfter?: string; -} -declare abstract class R2Bucket { - head(key: string): Promise; - get( - key: string, - options: R2GetOptions & { - onlyIf: R2Conditional | Headers; - } - ): Promise; - get(key: string, options?: R2GetOptions): Promise; - put( - key: string, - value: - | ReadableStream - | ArrayBuffer - | ArrayBufferView - | string - | null - | Blob, - options?: R2PutOptions - ): Promise; - put( - key: string, - value: - | ReadableStream - | ArrayBuffer - | ArrayBufferView - | string - | null - | Blob, - options?: R2PutOptions & { - onlyIf: R2Conditional | Headers; - } - ): Promise; - createMultipartUpload( - key: string, - options?: R2MultipartOptions - ): Promise; - resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload; - delete(keys: string | string[]): Promise; - list(options?: R2ListOptions): Promise; -} -declare interface R2MultipartUpload { - readonly key: string; - readonly uploadId: string; - uploadPart( - partNumber: number, - value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob - ): Promise; - abort(): Promise; - complete(uploadedParts: R2UploadedPart[]): Promise; -} -declare 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; - readonly range?: R2Range; - writeHttpMetadata(headers: Headers): void; -} -declare interface R2ObjectBody extends R2Object { - get body(): ReadableStream; - get bodyUsed(): boolean; - arrayBuffer(): Promise; - text(): Promise; - json(): Promise; - blob(): Promise; -} -declare type R2Range = - | { - offset: number; - length?: number; - } - | { - offset?: number; - length: number; - } - | { - suffix: number; - }; -declare interface R2Conditional { - etagMatches?: string; - etagDoesNotMatch?: string; - uploadedBefore?: Date; - uploadedAfter?: Date; - secondsGranularity?: boolean; -} -declare interface R2GetOptions { - onlyIf?: R2Conditional | Headers; - range?: R2Range | Headers; -} -declare interface R2PutOptions { - onlyIf?: R2Conditional | Headers; - httpMetadata?: R2HTTPMetadata | Headers; - customMetadata?: Record; - md5?: ArrayBuffer | string; - sha1?: ArrayBuffer | string; - sha256?: ArrayBuffer | string; - sha384?: ArrayBuffer | string; - sha512?: ArrayBuffer | string; -} -declare interface R2MultipartOptions { - httpMetadata?: R2HTTPMetadata | Headers; - customMetadata?: Record; -} -declare interface R2Checksums { - readonly md5?: ArrayBuffer; - readonly sha1?: ArrayBuffer; - readonly sha256?: ArrayBuffer; - readonly sha384?: ArrayBuffer; - readonly sha512?: ArrayBuffer; - toJSON(): R2StringChecksums; -} -declare interface R2StringChecksums { - md5?: string; - sha1?: string; - sha256?: string; - sha384?: string; - sha512?: string; -} -declare interface R2HTTPMetadata { - contentType?: string; - contentLanguage?: string; - contentDisposition?: string; - contentEncoding?: string; - cacheControl?: string; - cacheExpiry?: Date; -} -declare interface R2Objects { - objects: R2Object[]; - truncated: boolean; - cursor?: string; - delimitedPrefixes: string[]; -} -declare abstract class ScheduledEvent extends ExtendableEvent { - readonly scheduledTime: number; - readonly cron: string; - noRetry(): void; -} -declare interface ScheduledController { - readonly scheduledTime: number; - readonly cron: string; - noRetry(): void; -} -declare interface QueuingStrategy { - highWaterMark?: number | bigint; - size?: (chunk: T) => number | bigint; -} -declare interface UnderlyingSink { - type?: string; - start?: (controller: WritableStreamDefaultController) => void | Promise; - write?: ( - chunk: W, - controller: WritableStreamDefaultController - ) => void | Promise; - abort?: (reason: any) => void | Promise; - close?: () => void | Promise; -} -declare interface UnderlyingByteSource { - type: "bytes"; - autoAllocateChunkSize?: number; - start?: (controller: ReadableByteStreamController) => void | Promise; - pull?: (controller: ReadableByteStreamController) => void | Promise; - cancel?: (reason: any) => void | Promise; -} -declare interface UnderlyingSource { - type?: "" | undefined; - start?: ( - controller: ReadableStreamDefaultController - ) => void | Promise; - pull?: ( - controller: ReadableStreamDefaultController - ) => void | Promise; - cancel?: (reason: any) => void | Promise; -} -declare interface Transformer { - readableType?: string; - writableType?: string; - start?: ( - controller: TransformStreamDefaultController - ) => void | Promise; - transform?: ( - chunk: I, - controller: TransformStreamDefaultController - ) => void | Promise; - flush?: ( - controller: TransformStreamDefaultController - ) => void | Promise; -} -declare interface StreamPipeOptions { - /** - * 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; - preventAbort?: boolean; - preventCancel?: boolean; - signal?: AbortSignal; -} -declare type ReadableStreamReadResult = - | { - done: false; - value: R; - } - | { - done: true; - value?: undefined; - }; -/** This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object. */ -declare interface ReadableStream { - readonly locked: boolean; - cancel(reason?: any): Promise; - getReader(): ReadableStreamDefaultReader; - getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader; - pipeThrough( - transform: ReadableWritablePair, - options?: StreamPipeOptions - ): ReadableStream; - pipeTo( - destination: WritableStream, - options?: StreamPipeOptions - ): Promise; - tee(): [ReadableStream, ReadableStream]; - values(options?: ReadableStreamValuesOptions): AsyncIterableIterator; - [Symbol.asyncIterator]( - options?: ReadableStreamValuesOptions - ): AsyncIterableIterator; -} -declare const ReadableStream: { - prototype: ReadableStream; - new ( - underlyingSource: UnderlyingByteSource, - strategy?: QueuingStrategy - ): ReadableStream; - new ( - underlyingSource?: UnderlyingSource, - strategy?: QueuingStrategy - ): ReadableStream; -}; -declare class ReadableStreamDefaultReader { - constructor(stream: ReadableStream); - readonly closed: Promise; - cancel(reason?: any): Promise; - read(): Promise>; - releaseLock(): void; -} -declare class ReadableStreamBYOBReader { - constructor(stream: ReadableStream); - readonly closed: Promise; - cancel(reason?: any): Promise; - read( - view: T - ): Promise>; - releaseLock(): void; - readAtLeast( - minElements: number, - view: T - ): Promise>; -} -declare interface ReadableStreamGetReaderOptions { - mode: "byob"; -} -declare interface ReadableStreamBYOBRequest { - readonly view: Uint8Array | null; - respond(bytesWritten: number): void; - respondWithNewView(view: ArrayBuffer | ArrayBufferView): void; - readonly atLeast: number | null; -} -declare interface ReadableStreamDefaultController { - readonly desiredSize: number | null; - close(): void; - enqueue(chunk?: R): void; - error(reason: any): void; -} -declare interface ReadableByteStreamController { - readonly byobRequest: ReadableStreamBYOBRequest | null; - readonly desiredSize: number | null; - close(): void; - enqueue(chunk: ArrayBuffer | ArrayBufferView): void; - error(reason: any): void; -} -/** This Streams API interface represents a controller allowing control of a WritableStream's state. When constructing a WritableStream, the underlying sink is given a corresponding WritableStreamDefaultController instance to manipulate. */ -declare interface WritableStreamDefaultController { - readonly signal: AbortSignal; - error(reason?: any): void; -} -declare interface TransformStreamDefaultController { - get desiredSize(): number | null; - enqueue(chunk?: O): void; - error(reason: any): void; - terminate(): void; -} -declare interface ReadableWritablePair { - /** - * 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; - readable: ReadableStream; -} -declare class WritableStream { - constructor( - underlyingSink?: UnderlyingSink, - queuingStrategy?: QueuingStrategy - ); - readonly locked: boolean; - abort(reason?: any): Promise; - close(): Promise; - getWriter(): WritableStreamDefaultWriter; -} -declare class WritableStreamDefaultWriter { - constructor(stream: WritableStream); - readonly closed: Promise; - readonly ready: Promise; - readonly desiredSize: number | null; - abort(reason?: any): Promise; - close(): Promise; - write(chunk?: W): Promise; - releaseLock(): void; -} -declare class TransformStream { - constructor( - transformer?: Transformer, - writableStrategy?: QueuingStrategy, - readableStrategy?: QueuingStrategy - ); - readonly readable: ReadableStream; - readonly writable: WritableStream; -} -declare class FixedLengthStream extends IdentityTransformStream { - constructor(expectedLength: number | bigint); -} -declare class IdentityTransformStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(); -} -declare interface ReadableStreamValuesOptions { - preventCancel?: boolean; -} -declare class CompressionStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(format: "gzip" | "deflate" | "deflate-raw"); -} -declare class DecompressionStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(format: "gzip" | "deflate" | "deflate-raw"); -} -declare class TextEncoderStream extends TransformStream { - constructor(); -} -declare class TextDecoderStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - string -> { - constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit); -} -declare interface TextDecoderStreamTextDecoderStreamInit { - fatal?: boolean; -} -declare class ByteLengthQueuingStrategy - implements QueuingStrategy -{ - constructor(init: QueuingStrategyInit); - get highWaterMark(): number; - get size(): (chunk?: any) => number; -} -declare class CountQueuingStrategy implements QueuingStrategy { - constructor(init: QueuingStrategyInit); - get highWaterMark(): number; - get size(): (chunk?: any) => number; -} -declare 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; -} -declare abstract class TraceEvent extends ExtendableEvent { - readonly traces: TraceItem[]; -} -declare interface TraceItem { - readonly event: - | ( - | TraceItemFetchEventInfo - | TraceItemScheduledEventInfo - | TraceItemAlarmEventInfo - | TraceItemQueueEventInfo - | TraceItemEmailEventInfo - | TraceItemCustomEventInfo - ) - | null; - readonly eventTimestamp: number | null; - readonly logs: TraceLog[]; - readonly exceptions: TraceException[]; - readonly scriptName: string | null; - readonly dispatchNamespace?: string; - readonly scriptTags?: string[]; - readonly outcome: string; -} -declare interface TraceItemAlarmEventInfo { - readonly scheduledTime: Date; -} -declare interface TraceItemCustomEventInfo {} -declare interface TraceItemScheduledEventInfo { - readonly scheduledTime: number; - readonly cron: string; -} -declare interface TraceItemQueueEventInfo { - readonly queue: string; - readonly batchSize: number; -} -declare interface TraceItemEmailEventInfo { - readonly mailFrom: string; - readonly rcptTo: string; - readonly rawSize: number; -} -declare interface TraceItemFetchEventInfo { - readonly response?: TraceItemFetchEventInfoResponse; - readonly request: TraceItemFetchEventInfoRequest; -} -declare interface TraceItemFetchEventInfoRequest { - readonly cf?: any; - readonly headers: Record; - readonly method: string; - readonly url: string; - getUnredacted(): TraceItemFetchEventInfoRequest; -} -declare interface TraceItemFetchEventInfoResponse { - readonly status: number; -} -declare interface TraceLog { - readonly timestamp: number; - readonly level: string; - readonly message: any; -} -declare interface TraceException { - readonly timestamp: number; - readonly message: string; - readonly name: string; -} -declare interface TraceMetrics { - readonly cpuTime: number; - readonly wallTime: number; -} -declare interface UnsafeTraceMetrics { - fromTrace(item: TraceItem): TraceMetrics; -} -declare class URL { - constructor(url: string | URL, base?: string | URL); - href: string; - readonly origin: string; - protocol: string; - username: string; - password: string; - host: string; - hostname: string; - port: string; - pathname: string; - search: string; - readonly searchParams: URLSearchParams; - hash: string; - toString(): string; - toJSON(): string; -} -declare class URLSearchParams { - constructor( - init?: - | URLSearchParams - | string - | Record - | [key: string, value: string][] - ); - get size(): number; - append(name: string, value: string): void; - delete(name: string): void; - get(name: string): string | null; - getAll(name: string): string[]; - has(name: string): boolean; - set(name: string, value: string): void; - sort(): void; - entries(): IterableIterator<[key: string, value: string]>; - keys(): IterableIterator; - values(): IterableIterator; - forEach( - callback: ( - this: This, - value: string, - key: string, - parent: URLSearchParams - ) => void, - thisArg?: This - ): void; - toString(): string; - [Symbol.iterator](): IterableIterator<[key: string, value: string]>; -} -declare class URLPattern { - constructor(input?: string | URLPatternURLPatternInit, baseURL?: string); - get protocol(): string; - get username(): string; - get password(): string; - get hostname(): string; - get port(): string; - get pathname(): string; - get search(): string; - get hash(): string; - test(input?: string | URLPatternURLPatternInit, baseURL?: string): boolean; - exec( - input?: string | URLPatternURLPatternInit, - baseURL?: string - ): URLPatternURLPatternResult | null; -} -declare interface URLPatternURLPatternInit { - protocol?: string; - username?: string; - password?: string; - hostname?: string; - port?: string; - pathname?: string; - search?: string; - hash?: string; - baseURL?: string; -} -declare interface URLPatternURLPatternComponentResult { - input: string; - groups: Record; -} -declare interface URLPatternURLPatternResult { - inputs: (string | URLPatternURLPatternInit)[]; - protocol: URLPatternURLPatternComponentResult; - username: URLPatternURLPatternComponentResult; - password: URLPatternURLPatternComponentResult; - hostname: URLPatternURLPatternComponentResult; - port: URLPatternURLPatternComponentResult; - pathname: URLPatternURLPatternComponentResult; - search: URLPatternURLPatternComponentResult; - hash: URLPatternURLPatternComponentResult; -} -declare class CloseEvent extends Event { - constructor(type: string, initializer: CloseEventInit); - /** Returns the WebSocket connection close code provided by the server. */ - readonly code: number; - /** Returns the WebSocket connection close reason provided by the server. */ - readonly reason: string; - /** Returns true if the connection closed cleanly; false otherwise. */ - readonly wasClean: boolean; -} -declare interface CloseEventInit { - code?: number; - reason?: string; - wasClean?: boolean; -} -declare class MessageEvent extends Event { - constructor(type: string, initializer: MessageEventInit); - readonly data: ArrayBuffer | string; -} -declare interface MessageEventInit { - data: ArrayBuffer | string; -} -/** Events providing information related to errors in scripts or in files. */ -declare interface ErrorEvent extends Event { - readonly filename: string; - readonly message: string; - readonly lineno: number; - readonly colno: number; - readonly error: any; -} -declare type WebSocketEventMap = { - close: CloseEvent; - message: MessageEvent; - open: Event; - error: ErrorEvent; -}; -declare class WebSocket extends EventTarget { - constructor(url: string, protocols?: string[] | string); - accept(): void; - send(message: (ArrayBuffer | ArrayBufferView) | string): void; - close(code?: number, reason?: string): void; - static readonly READY_STATE_CONNECTING: number; - static readonly READY_STATE_OPEN: number; - static readonly READY_STATE_CLOSING: number; - static readonly READY_STATE_CLOSED: number; - /** Returns the state of the WebSocket object's connection. It can have the values described below. */ - readonly readyState: number; - /** Returns the URL that was used to establish the WebSocket connection. */ - readonly url: string | null; - /** Returns the subprotocol selected by the server, if any. It can be used in conjunction with the array form of the constructor's second argument to perform subprotocol negotiation. */ - readonly protocol: string | null; - /** Returns the extensions selected by the server, if any. */ - readonly extensions: string | null; -} -declare const WebSocketPair: { - new (): { - 0: WebSocket; - 1: WebSocket; - }; -}; -declare interface BasicImageTransformations { - /** - * Maximum width in image pixels. The value must be an integer. - */ - width?: number; - /** - * Maximum height in image pixels. The value must be an integer. - */ - height?: number; - /** - * Resizing mode as a string. It affects interpretation of width and height - * options: - * - scale-down: Similar to contain, but the image is never enlarged. If - * the image is larger than given width or height, it will be resized. - * Otherwise its original size will be kept. - * - contain: Resizes to maximum size that fits within the given width and - * height. If only a single dimension is given (e.g. only width), the - * image will be shrunk or enlarged to exactly match that dimension. - * Aspect ratio is always preserved. - * - cover: Resizes (shrinks or enlarges) to fill the entire area of width - * and height. If the image has an aspect ratio different from the ratio - * of width and height, it will be cropped to fit. - * - crop: The image will be shrunk and cropped to fit within the area - * specified by width and height. The image will not be enlarged. For images - * smaller than the given dimensions it's the same as scale-down. For - * images larger than the given dimensions, it's the same as cover. - * See also trim. - * - pad: Resizes to the maximum size that fits within the given width and - * height, and then fills the remaining area with a background color - * (white by default). Use of this mode is not recommended, as the same - * effect can be more efficiently achieved with the contain mode and the - * CSS object-fit: contain property. - */ - fit?: "scale-down" | "contain" | "cover" | "crop" | "pad"; - /** - * When cropping with fit: "cover", this defines the side or point that should - * be left uncropped. The value is either a string - * "left", "right", "top", "bottom", "auto", or "center" (the default), - * or an object {x, y} containing focal point coordinates in the original - * image expressed as fractions ranging from 0.0 (top or left) to 1.0 - * (bottom or right), 0.5 being the center. {fit: "cover", gravity: "top"} will - * crop bottom or left and right sides as necessary, but won’t crop anything - * from the top. {fit: "cover", gravity: {x:0.5, y:0.2}} will crop each side to - * preserve as much as possible around a point at 20% of the height of the - * source image. - */ - gravity?: - | "left" - | "right" - | "top" - | "bottom" - | "center" - | "auto" - | BasicImageTransformationsGravityCoordinates; - /** - * Background color to add underneath the image. Applies only to images with - * transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…), - * hsl(…), etc.) - */ - background?: string; - /** - * Number of degrees (90, 180, 270) to rotate the image by. width and height - * options refer to axes after rotation. - */ - rotate?: 0 | 90 | 180 | 270 | 360; -} -declare interface BasicImageTransformationsGravityCoordinates { - x: number; - y: number; -} -/** - * In addition to the properties you can set in the RequestInit dict - * that you pass as an argument to the Request constructor, you can - * set certain properties of a `cf` object to control how Cloudflare - * features are applied to that new Request. - * - * Note: Currently, these properties cannot be tested in the - * playground. - */ -declare interface RequestInitCfProperties extends Record { - cacheEverything?: boolean; - /** - * A request's cache key is what determines if two requests are - * "the same" for caching purposes. If a request has the same cache key - * as some previous request, then we can serve the same cached response for - * both. (e.g. 'some-key') - * - * Only available for Enterprise customers. - */ - cacheKey?: string; - /** - * This allows you to append additional Cache-Tag response headers - * to the origin response without modifications to the origin server. - * This will allow for greater control over the Purge by Cache Tag feature - * utilizing changes only in the Workers process. - * - * Only available for Enterprise customers. - */ - cacheTags?: string[]; - /** - * Force response to be cached for a given number of seconds. (e.g. 300) - */ - cacheTtl?: number; - /** - * Force response to be cached for a given number of seconds based on the Origin status code. - * (e.g. { '200-299': 86400, '404': 1, '500-599': 0 }) - */ - cacheTtlByStatus?: Record; - scrapeShield?: boolean; - apps?: boolean; - image?: RequestInitCfPropertiesImage; - minify?: RequestInitCfPropertiesImageMinify; - mirage?: boolean; - polish?: "lossy" | "lossless" | "off"; - /** - * Redirects the request to an alternate origin server. You can use this, - * for example, to implement load balancing across several origins. - * (e.g.us-east.example.com) - * - * Note - For security reasons, the hostname set in resolveOverride must - * be proxied on the same Cloudflare zone of the incoming request. - * Otherwise, the setting is ignored. CNAME hosts are allowed, so to - * resolve to a host under a different domain or a DNS only domain first - * declare a CNAME record within your own zone’s DNS mapping to the - * external hostname, set proxy on Cloudflare, then set resolveOverride - * to point to that CNAME record. - */ - resolveOverride?: string; -} -declare interface RequestInitCfPropertiesImageDraw - extends BasicImageTransformations { - /** - * Absolute URL of the image file to use for the drawing. It can be any of - * the supported file formats. For drawing of watermarks or non-rectangular - * overlays we recommend using PNG or WebP images. - */ - url: string; - /** - * Floating-point number between 0 (transparent) and 1 (opaque). - * For example, opacity: 0.5 makes overlay semitransparent. - */ - opacity?: number; - /** - * - If set to true, the overlay image will be tiled to cover the entire - * area. This is useful for stock-photo-like watermarks. - * - If set to "x", the overlay image will be tiled horizontally only - * (form a line). - * - If set to "y", the overlay image will be tiled vertically only - * (form a line). - */ - repeat?: true | "x" | "y"; - /** - * Position of the overlay image relative to a given edge. Each property is - * an offset in pixels. 0 aligns exactly to the edge. For example, left: 10 - * positions left side of the overlay 10 pixels from the left edge of the - * image it's drawn over. bottom: 0 aligns bottom of the overlay with bottom - * of the background image. - * - * Setting both left & right, or both top & bottom is an error. - * - * If no position is specified, the image will be centered. - */ - top?: number; - left?: number; - bottom?: number; - right?: number; -} -declare interface RequestInitCfPropertiesImage - extends BasicImageTransformations { - /** - * Device Pixel Ratio. Default 1. Multiplier for width/height that makes it - * easier to specify higher-DPI sizes in . - */ - dpr?: number; - /** - * An object with four properties {left, top, right, bottom} that specify - * a number of pixels to cut off on each side. Allows removal of borders - * or cutting out a specific fragment of an image. Trimming is performed - * before resizing or rotation. Takes dpr into account. - */ - trim?: { - left?: number; - top?: number; - right?: number; - bottom?: number; - }; - /** - * Quality setting from 1-100 (useful values are in 60-90 range). Lower values - * make images look worse, but load faster. The default is 85. It applies only - * to JPEG and WebP images. It doesn’t have any effect on PNG. - */ - quality?: number; - /** - * Output format to generate. It can be: - * - avif: generate images in AVIF format. - * - webp: generate images in Google WebP format. Set quality to 100 to get - * the WebP-lossless format. - * - json: instead of generating an image, outputs information about the - * image, in JSON format. The JSON object will contain image size - * (before and after resizing), source image’s MIME type, file size, etc. - * - jpeg: generate images in JPEG format. - * - png: generate images in PNG format. - */ - format?: "avif" | "webp" | "json" | "jpeg" | "png"; - /** - * Whether to preserve animation frames from input files. Default is true. - * Setting it to false reduces animations to still images. This setting is - * recommended when enlarging images or processing arbitrary user content, - * because large GIF animations can weigh tens or even hundreds of megabytes. - * It is also useful to set anim:false when using format:"json" to get the - * response quicker without the number of frames. - */ - anim?: boolean; - /** - * What EXIF data should be preserved in the output image. Note that EXIF - * rotation and embedded color profiles are always applied ("baked in" into - * the image), and aren't affected by this option. Note that if the Polish - * feature is enabled, all metadata may have been removed already and this - * option may have no effect. - * - keep: Preserve most of EXIF metadata, including GPS location if there's - * any. - * - copyright: Only keep the copyright tag, and discard everything else. - * This is the default behavior for JPEG files. - * - none: Discard all invisible EXIF metadata. Currently WebP and PNG - * output formats always discard metadata. - */ - metadata?: "keep" | "copyright" | "none"; - /** - * Strength of sharpening filter to apply to the image. Floating-point - * number between 0 (no sharpening, default) and 10 (maximum). 1.0 is a - * recommended value for downscaled images. - */ - sharpen?: number; - /** - * Radius of a blur filter (approximate gaussian). Maximum supported radius - * is 250. - */ - blur?: number; - /** - * Overlays are drawn in the order they appear in the array (last array - * entry is the topmost layer). - */ - draw?: RequestInitCfPropertiesImageDraw[]; - /** - * Fetching image from authenticated origin. Setting this property will - * pass authentication headers (Authorization, Cookie, etc.) through to - * the origin. - */ - "origin-auth"?: "share-publicly"; - /** - * Adds a border around the image. The border is added after resizing. Border - * width takes dpr into account, and can be specified either using a single - * width property, or individually for each side. - */ - border?: - | { - color: string; - width: number; - } - | { - color: string; - top: number; - right: number; - bottom: number; - left: number; - }; - /** - * Increase brightness by a factor. A value of 1.0 equals no change, a value - * of 0.5 equals half brightness, and a value of 2.0 equals twice as bright. - * 0 is ignored. - */ - brightness?: number; - /** - * Increase contrast by a factor. A value of 1.0 equals no change, a value of - * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is - * ignored. - */ - contrast?: number; - /** - * Increase exposure by a factor. A value of 1.0 equals no change, a value of - * 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored. - */ - gamma?: number; - /** - * Slightly reduces latency on a cache miss by selecting a - * quickest-to-compress file format, at a cost of increased file size and - * lower image quality. It will usually override the format option and choose - * JPEG over WebP or AVIF. We do not recommend using this option, except in - * unusual circumstances like resizing uncacheable dynamically-generated - * images. - */ - compression?: "fast"; -} -declare interface RequestInitCfPropertiesImageMinify { - javascript?: boolean; - css?: boolean; - html?: boolean; -} -/** - * Request metadata provided by Cloudflare's edge. - */ -declare type IncomingRequestCfProperties = - IncomingRequestCfPropertiesBase & - IncomingRequestCfPropertiesBotManagementEnterprise & - IncomingRequestCfPropertiesCloudflareForSaaSEnterprise & - IncomingRequestCfPropertiesGeographicInformation & - IncomingRequestCfPropertiesCloudflareAccessOrApiShield; -declare interface IncomingRequestCfPropertiesBase - extends Record { - /** - * [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request. - * - * @example 395747 - */ - asn: number; - /** - * The organization which owns the ASN of the incoming request. - * - * @example "Google Cloud" - */ - asOrganization: string; - /** - * The original value of the `Accept-Encoding` header if Cloudflare modified it. - * - * @example "gzip, deflate, br" - */ - clientAcceptEncoding?: string; - /** - * The number of milliseconds it took for the request to reach your worker. - * - * @example 22 - */ - clientTcpRtt?: number; - /** - * The three-letter [IATA](https://en.wikipedia.org/wiki/IATA_airport_code) - * airport code of the data center that the request hit. - * - * @example "DFW" - */ - colo: string; - /** - * Represents the upstream's response to a - * [TCP `keepalive` message](https://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html) - * from cloudflare. - * - * For workers with no upstream, this will always be `1`. - * - * @example 3 - */ - edgeRequestKeepAliveStatus: IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus; - /** - * The HTTP Protocol the request used. - * - * @example "HTTP/2" - */ - httpProtocol: string; - /** - * The browser-requested prioritization information in the request object. - * - * If no information was set, defaults to the empty string `""` - * - * @example "weight=192;exclusive=0;group=3;group-weight=127" - * @default "" - */ - requestPriority: string; - /** - * The TLS version of the connection to Cloudflare. - * In requests served over plaintext (without TLS), this property is the empty string `""`. - * - * @example "TLSv1.3" - */ - tlsVersion: string; - /** - * The cipher for the connection to Cloudflare. - * In requests served over plaintext (without TLS), this property is the empty string `""`. - * - * @example "AEAD-AES128-GCM-SHA256" - */ - tlsCipher: string; - /** - * Metadata containing the [`HELLO`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2) and [`FINISHED`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9) messages from this request's TLS handshake. - * - * If the incoming request was served over plaintext (without TLS) this field is undefined. - */ - tlsExportedAuthenticator?: IncomingRequestCfPropertiesExportedAuthenticatorMetadata; -} -declare interface IncomingRequestCfPropertiesBotManagementBase { - /** - * Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot, - * represented as an integer percentage between `1` (almost certainly human) - * and `99` (almost certainly a bot). - * - * @example 54 - */ - score: number; - /** - * A boolean value that is true if the request comes from a good bot, like Google or Bing. - * Most customers choose to allow this traffic. For more details, see [Traffic from known bots](https://developers.cloudflare.com/firewall/known-issues-and-faq/#how-does-firewall-rules-handle-traffic-from-known-bots). - */ - verifiedBot: boolean; - /** - * A boolean value that is true if the request originates from a - * Cloudflare-verified proxy service. - */ - corporateProxy: boolean; - /** - * A boolean value that's true if the request matches [file extensions](https://developers.cloudflare.com/bots/reference/static-resources/) for many types of static resources. - */ - staticResource: boolean; - /** - * List of IDs that correlate to the Bot Management heuristic detections made on a request (you can have multiple heuristic detections on the same request). - */ - detectionIds: number[]; -} -declare interface IncomingRequestCfPropertiesBotManagement { - /** - * Results of Cloudflare's Bot Management analysis - */ - botManagement: IncomingRequestCfPropertiesBotManagementBase; - /** - * Duplicate of `botManagement.score`. - * - * @deprecated - */ - clientTrustScore: number; -} -declare interface IncomingRequestCfPropertiesBotManagementEnterprise - extends IncomingRequestCfPropertiesBotManagement { - /** - * Results of Cloudflare's Bot Management analysis - */ - botManagement: IncomingRequestCfPropertiesBotManagementBase & { - /** - * A [JA3 Fingerprint](https://developers.cloudflare.com/bots/concepts/ja3-fingerprint/) to help profile specific SSL/TLS clients - * across different destination IPs, Ports, and X509 certificates. - */ - ja3Hash: string; - }; -} -declare interface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise< - HostMetadata -> { - /** - * Custom metadata set per-host in [Cloudflare for SaaS](https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/). - * - * This field is only present if you have Cloudflare for SaaS enabled on your account - * and you have followed the [required steps to enable it]((https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/domain-support/custom-metadata/)). - */ - hostMetadata: HostMetadata; -} -declare interface IncomingRequestCfPropertiesCloudflareAccessOrApiShield { - /** - * Information about the client certificate presented to Cloudflare. - * - * This is populated when the incoming request is served over TLS using - * either Cloudflare Access or API Shield (mTLS) - * and the presented SSL certificate has a valid - * [Certificate Serial Number](https://ldapwiki.com/wiki/Certificate%20Serial%20Number) - * (i.e., not `null` or `""`). - * - * Otherwise, a set of placeholder values are used. - * - * The property `certPresented` will be set to `"1"` when - * the object is populated (i.e. the above conditions were met). - */ - tlsClientAuth: - | IncomingRequestCfPropertiesTLSClientAuth - | IncomingRequestCfPropertiesTLSClientAuthPlaceholder; -} -/** - * Metadata about the request's TLS handshake - */ -declare interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata { - /** - * The client's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal - * - * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d" - */ - clientHandshake: string; - /** - * The server's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal - * - * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d" - */ - serverHandshake: string; - /** - * The client's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal - * - * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b" - */ - clientFinished: string; - /** - * The server's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal - * - * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b" - */ - serverFinished: string; -} -/** - * Geographic data about the request's origin. - */ -declare interface IncomingRequestCfPropertiesGeographicInformation { - /** - * The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from. - * - * If your worker is [configured to accept TOR connections](https://support.cloudflare.com/hc/en-us/articles/203306930-Understanding-Cloudflare-Tor-support-and-Onion-Routing), this may also be `"T1"`, indicating a request that originated over TOR. - * - * If Cloudflare is unable to determine where the request originated this property is omitted. - * - * The country code `"T1"` is used for requests originating on TOR. - * - * @example "GB" - */ - country?: Iso3166Alpha2Code | "T1"; - /** - * If present, this property indicates that the request originated in the EU - * - * @example "1" - */ - isEUCountry?: "1"; - /** - * A two-letter code indicating the continent the request originated from. - * - * @example "AN" - */ - continent?: ContinentCode; - /** - * The city the request originated from - * - * @example "Austin" - */ - city?: string; - /** - * Postal code of the incoming request - * - * @example "78701" - */ - postalCode?: string; - /** - * Latitude of the incoming request - * - * @example "30.27130" - */ - latitude?: string; - /** - * Longitude of the incoming request - * - * @example "-97.74260" - */ - longitude?: string; - /** - * Timezone of the incoming request - * - * @example "America/Chicago" - */ - timezone?: string; - /** - * If known, the ISO 3166-2 name for the first level region associated with - * the IP address of the incoming request - * - * @example "Texas" - */ - region?: string; - /** - * If known, the ISO 3166-2 code for the first-level region associated with - * the IP address of the incoming request - * - * @example "TX" - */ - regionCode?: string; - /** - * Metro code (DMA) of the incoming request - * - * @example "635" - */ - metroCode?: string; -} -/** Data about the incoming request's TLS certificate */ -declare interface IncomingRequestCfPropertiesTLSClientAuth { - /** Always `"1"`, indicating that the certificate was presented */ - certPresented: "1"; - /** - * Result of certificate verification. - * - * @example "FAILED:self signed certificate" - */ - certVerified: Exclude; - /** The presented certificate's revokation status. - * - * - A value of `"1"` indicates the certificate has been revoked - * - A value of `"0"` indicates the certificate has not been revoked - */ - certRevoked: "1" | "0"; - /** - * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) - * - * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certIssuerDN: string; - /** - * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) - * - * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certSubjectDN: string; - /** - * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted) - * - * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certIssuerDNRFC2253: string; - /** - * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted) - * - * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certSubjectDNRFC2253: string; - /** The certificate issuer's distinguished name (legacy policies) */ - certIssuerDNLegacy: string; - /** The certificate subject's distinguished name (legacy policies) */ - certSubjectDNLegacy: string; - /** - * The certificate's serial number - * - * @example "00936EACBE07F201DF" - */ - certSerial: string; - /** - * The certificate issuer's serial number - * - * @example "2489002934BDFEA34" - */ - certIssuerSerial: string; - /** - * The certificate's Subject Key Identifier - * - * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4" - */ - certSKI: string; - /** - * The certificate issuer's Subject Key Identifier - * - * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4" - */ - certIssuerSKI: string; - /** - * The certificate's SHA-1 fingerprint - * - * @example "6b9109f323999e52259cda7373ff0b4d26bd232e" - */ - certFingerprintSHA1: string; - /** - * The certificate's SHA-256 fingerprint - * - * @example "acf77cf37b4156a2708e34c4eb755f9b5dbbe5ebb55adfec8f11493438d19e6ad3f157f81fa3b98278453d5652b0c1fd1d71e5695ae4d709803a4d3f39de9dea" - */ - certFingerprintSHA256: string; - /** - * The effective starting date of the certificate - * - * @example "Dec 22 19:39:00 2018 GMT" - */ - certNotBefore: string; - /** - * The effective expiration date of the certificate - * - * @example "Dec 22 19:39:00 2018 GMT" - */ - certNotAfter: string; -} -/** Placeholder values for TLS Client Authorization */ -declare interface IncomingRequestCfPropertiesTLSClientAuthPlaceholder { - certPresented: "0"; - certVerified: "NONE"; - certRevoked: "0"; - certIssuerDN: ""; - certSubjectDN: ""; - certIssuerDNRFC2253: ""; - certSubjectDNRFC2253: ""; - certIssuerDNLegacy: ""; - certSubjectDNLegacy: ""; - certSerial: ""; - certIssuerSerial: ""; - certSKI: ""; - certIssuerSKI: ""; - certFingerprintSHA1: ""; - certFingerprintSHA256: ""; - certNotBefore: ""; - certNotAfter: ""; -} -/** Possible outcomes of TLS verification */ -declare type CertVerificationStatus = - /** Authentication succeeded */ - | "SUCCESS" - /** No certificate was presented */ - | "NONE" - /** Failed because the certificate was self-signed */ - | "FAILED:self signed certificate" - /** Failed because the certificate failed a trust chain check */ - | "FAILED:unable to verify the first certificate" - /** Failed because the certificate not yet valid */ - | "FAILED:certificate is not yet valid" - /** Failed because the certificate is expired */ - | "FAILED:certificate has expired" - /** Failed for another unspecified reason */ - | "FAILED"; -/** - * An upstream endpoint's response to a TCP `keepalive` message from Cloudflare. - */ -declare type IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus = - | 0 /** Unknown */ - | 1 /** no keepalives (not found) */ - | 2 /** no connection re-use, opening keepalive connection failed */ - | 3 /** no connection re-use, keepalive accepted and saved */ - | 4 /** connection re-use, refused by the origin server (`TCP FIN`) */ - | 5; /** connection re-use, accepted by the origin server */ -/** ISO 3166-1 Alpha-2 codes */ -declare type Iso3166Alpha2Code = - | "AD" - | "AE" - | "AF" - | "AG" - | "AI" - | "AL" - | "AM" - | "AO" - | "AQ" - | "AR" - | "AS" - | "AT" - | "AU" - | "AW" - | "AX" - | "AZ" - | "BA" - | "BB" - | "BD" - | "BE" - | "BF" - | "BG" - | "BH" - | "BI" - | "BJ" - | "BL" - | "BM" - | "BN" - | "BO" - | "BQ" - | "BR" - | "BS" - | "BT" - | "BV" - | "BW" - | "BY" - | "BZ" - | "CA" - | "CC" - | "CD" - | "CF" - | "CG" - | "CH" - | "CI" - | "CK" - | "CL" - | "CM" - | "CN" - | "CO" - | "CR" - | "CU" - | "CV" - | "CW" - | "CX" - | "CY" - | "CZ" - | "DE" - | "DJ" - | "DK" - | "DM" - | "DO" - | "DZ" - | "EC" - | "EE" - | "EG" - | "EH" - | "ER" - | "ES" - | "ET" - | "FI" - | "FJ" - | "FK" - | "FM" - | "FO" - | "FR" - | "GA" - | "GB" - | "GD" - | "GE" - | "GF" - | "GG" - | "GH" - | "GI" - | "GL" - | "GM" - | "GN" - | "GP" - | "GQ" - | "GR" - | "GS" - | "GT" - | "GU" - | "GW" - | "GY" - | "HK" - | "HM" - | "HN" - | "HR" - | "HT" - | "HU" - | "ID" - | "IE" - | "IL" - | "IM" - | "IN" - | "IO" - | "IQ" - | "IR" - | "IS" - | "IT" - | "JE" - | "JM" - | "JO" - | "JP" - | "KE" - | "KG" - | "KH" - | "KI" - | "KM" - | "KN" - | "KP" - | "KR" - | "KW" - | "KY" - | "KZ" - | "LA" - | "LB" - | "LC" - | "LI" - | "LK" - | "LR" - | "LS" - | "LT" - | "LU" - | "LV" - | "LY" - | "MA" - | "MC" - | "MD" - | "ME" - | "MF" - | "MG" - | "MH" - | "MK" - | "ML" - | "MM" - | "MN" - | "MO" - | "MP" - | "MQ" - | "MR" - | "MS" - | "MT" - | "MU" - | "MV" - | "MW" - | "MX" - | "MY" - | "MZ" - | "NA" - | "NC" - | "NE" - | "NF" - | "NG" - | "NI" - | "NL" - | "NO" - | "NP" - | "NR" - | "NU" - | "NZ" - | "OM" - | "PA" - | "PE" - | "PF" - | "PG" - | "PH" - | "PK" - | "PL" - | "PM" - | "PN" - | "PR" - | "PS" - | "PT" - | "PW" - | "PY" - | "QA" - | "RE" - | "RO" - | "RS" - | "RU" - | "RW" - | "SA" - | "SB" - | "SC" - | "SD" - | "SE" - | "SG" - | "SH" - | "SI" - | "SJ" - | "SK" - | "SL" - | "SM" - | "SN" - | "SO" - | "SR" - | "SS" - | "ST" - | "SV" - | "SX" - | "SY" - | "SZ" - | "TC" - | "TD" - | "TF" - | "TG" - | "TH" - | "TJ" - | "TK" - | "TL" - | "TM" - | "TN" - | "TO" - | "TR" - | "TT" - | "TV" - | "TW" - | "TZ" - | "UA" - | "UG" - | "UM" - | "US" - | "UY" - | "UZ" - | "VA" - | "VC" - | "VE" - | "VG" - | "VI" - | "VN" - | "VU" - | "WF" - | "WS" - | "YE" - | "YT" - | "ZA" - | "ZM" - | "ZW"; -/** The 2-letter continent codes Cloudflare uses */ -declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA"; -declare type CfProperties = - | IncomingRequestCfProperties - | RequestInitCfProperties; -declare interface D1Result { - results?: T[]; - success: boolean; - error?: string; - meta: any; -} -declare abstract class D1Database { - prepare(query: string): D1PreparedStatement; - dump(): Promise; - batch(statements: D1PreparedStatement[]): Promise[]>; - exec(query: string): Promise>; -} -declare abstract class D1PreparedStatement { - bind(...values: any[]): D1PreparedStatement; - first(colName?: string): Promise; - run(): Promise>; - all(): Promise>; - raw(): Promise; -} -/** - * A email message that is sent to a consumer Worker. - */ -declare interface EmailMessage { - /** - * Envelope From attribute of the email message. - */ - readonly from: string; - /** - * Envelope To attribute of the email message. - */ - readonly to: string; - /** - * A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers). - */ - readonly headers: Headers; - /** - * Stream of the email message content. - */ - readonly raw: ReadableStream; - /** - * Size of the email message content. - */ - readonly rawSize: number; - /** - * Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason. - * @param reason The reject reason. - * @returns void - */ - setReject(reason: string): void; - /** - * Forward this email message to a verified destination address of the account. - * @param rcptTo Verified destination address. - * @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers). - * @returns A promise that resolves when the email message is forwarded. - */ - forward(rcptTo: string, headers?: Headers): Promise; -} -declare abstract class EmailEvent extends ExtendableEvent { - readonly message: EmailMessage; -} -declare type EmailExportedHandler = ( - message: EmailMessage, - env: Env, - ctx: ExecutionContext -) => void | Promise; -declare type Params

= Record; -declare type EventContext = { - request: Request; - functionPath: string; - waitUntil: (promise: Promise) => void; - passThroughOnException: () => void; - next: (input?: Request | string, init?: RequestInit) => Promise; - env: Env & { - ASSETS: { - fetch: typeof fetch; - }; - }; - params: Params

; - data: Data; -}; -declare type PagesFunction< - Env = unknown, - Params extends string = any, - Data extends Record = Record -> = (context: EventContext) => Response | Promise; -declare type EventPluginContext = { - request: Request; - functionPath: string; - waitUntil: (promise: Promise) => void; - passThroughOnException: () => void; - next: (input?: Request | string, init?: RequestInit) => Promise; - env: Env & { - ASSETS: { - fetch: typeof fetch; - }; - }; - params: Params

; - data: Data; - pluginArgs: PluginArgs; -}; -declare type PagesPluginFunction< - Env = unknown, - Params extends string = any, - Data extends Record = Record, - PluginArgs = unknown -> = ( - context: EventPluginContext -) => Response | Promise; -declare module "assets:*" { - export const onRequest: PagesFunction; -} -// https://developers.cloudflare.com/pub-sub/ -// PubSubMessage represents an incoming PubSub message. -// The message includes metadata about the broker, the client, and the payload -// itself. -declare interface PubSubMessage { - // Message ID - readonly mid: number; - // MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT - readonly broker: string; - // The MQTT topic the message was sent on. - readonly topic: string; - // The client ID of the client that published this message. - readonly clientId: string; - // The unique identifier (JWT ID) used by the client to authenticate, if token - // auth was used. - readonly jti?: string; - // A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker - // received the message from the client. - readonly receivedAt: number; - // An (optional) string with the MIME type of the payload, if set by the - // client. - readonly contentType: string; - // Set to 1 when the payload is a UTF-8 string - // https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063 - readonly payloadFormatIndicator: number; - // Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays. - // You can use payloadFormatIndicator to inspect this before decoding. - payload: string | Uint8Array; -} -// JsonWebKey extended by kid parameter -declare interface JsonWebKeyWithKid extends JsonWebKey { - // Key Identifier of the JWK - readonly kid: string; -} -/** - * A message that is sent to a consumer Worker. - */ -declare interface Message { - /** - * A unique, system-generated ID for the message. - */ - readonly id: string; - /** - * A timestamp when the message was sent. - */ - readonly timestamp: Date; - /** - * The body of the message. - */ - readonly body: Body; - /** - * Marks message to be retried. - */ - retry(): void; - /** - * Marks message acknowledged. - */ - ack(): void; -} -/** - * A batch of messages that are sent to a consumer Worker. - */ -declare interface MessageBatch { - /** - * The name of the Queue that belongs to this batch. - */ - readonly queue: string; - /** - * An array of messages in the batch. Ordering of messages is not guaranteed. - */ - readonly messages: readonly Message[]; - /** - * Marks every message to be retried in the next batch. - */ - retryAll(): void; - /** - * Marks every message acknowledged in the batch. - */ - ackAll(): void; -} -/** - * A wrapper class used to structure message batches. - */ -declare type MessageSendRequest = { - /** - * The body of the message. - */ - body: Body; -}; -/** - * A binding that allows a producer to send messages to a Queue. - */ -declare interface Queue { - /** - * Sends a message to the Queue. - * @param message The message can be any type supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types), as long as its size is less than 128 KB. - * @returns A promise that resolves when the message is confirmed to be written to disk. - */ - send(message: Body): Promise; - /** - * Sends a batch of messages to the Queue. - * @param messages Each item in the input must be supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types). A batch can contain up to 100 messages, though items are limited to 128 KB each, and the total size of the array cannot exceed 256 KB. - * @returns A promise that resolves when the messages are confirmed to be written to disk. - */ - sendBatch(messages: Iterable>): Promise; -} diff --git a/packages/denylist_bot/node_modules/@cloudflare/workers-types/2021-11-03/index.ts b/packages/denylist_bot/node_modules/@cloudflare/workers-types/2021-11-03/index.ts deleted file mode 100755 index 944648295..000000000 --- a/packages/denylist_bot/node_modules/@cloudflare/workers-types/2021-11-03/index.ts +++ /dev/null @@ -1,2992 +0,0 @@ -/*! ***************************************************************************** -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 -export declare class DOMException extends Error { - constructor(message?: string, name?: string); - readonly message: string; - readonly name: string; - readonly code: number; - readonly stack: any; - 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; -} -export type WorkerGlobalScopeEventMap = { - fetch: FetchEvent; - scheduled: ScheduledEvent; - unhandledrejection: PromiseRejectionEvent; - rejectionhandled: PromiseRejectionEvent; -}; -export declare abstract class WorkerGlobalScope extends EventTarget { - EventTarget: typeof EventTarget; -} -export interface Console { - "assert"(condition?: boolean, ...data: any[]): void; - clear(): void; - count(label?: string): void; - countReset(label?: string): void; - debug(...data: any[]): void; - dir(item?: any, options?: any): void; - dirxml(...data: any[]): void; - error(...data: any[]): void; - group(...data: any[]): void; - groupCollapsed(...data: any[]): void; - groupEnd(): void; - info(...data: any[]): void; - log(...data: any[]): void; - table(tabularData?: any, properties?: string[]): void; - time(label?: string): void; - timeEnd(label?: string): void; - timeLog(label?: string, ...data: any[]): void; - timeStamp(label?: string): void; - trace(...data: any[]): void; - warn(...data: any[]): void; -} -export declare const console: Console; -export type BufferSource = ArrayBufferView | ArrayBuffer; -export 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; - type Imports = Record; - type ExportValue = Function | Global | Memory | Table; - type Exports = Record; - 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; - function validate(bytes: BufferSource): boolean; -} -/** This ServiceWorker API interface represents the global execution context of a service worker. */ -export 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( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args - ): number; - clearTimeout(timeoutId: number | null): void; - setInterval(callback: (...args: any[]) => void, msDelay?: number): number; - setInterval( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args - ): number; - clearInterval(timeoutId: number | null): void; - queueMicrotask(task: Function): void; - structuredClone(value: T, options?: StructuredSerializeOptions): T; - fetch( - input: RequestInfo, - init?: RequestInit - ): Promise; - self: ServiceWorkerGlobalScope; - crypto: Crypto; - caches: CacheStorage; - scheduler: Scheduler; - Event: typeof Event; - ExtendableEvent: typeof ExtendableEvent; - PromiseRejectionEvent: typeof PromiseRejectionEvent; - FetchEvent: typeof FetchEvent; - TraceEvent: typeof TraceEvent; - 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; - 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; - AbortController: typeof AbortController; - AbortSignal: typeof AbortSignal; - TextDecoder: typeof TextDecoder; - TextEncoder: typeof TextEncoder; - 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; -} -export declare function addEventListener< - Type extends keyof WorkerGlobalScopeEventMap ->( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetAddEventListenerOptions | boolean -): void; -export declare function removeEventListener< - Type extends keyof WorkerGlobalScopeEventMap ->( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetEventListenerOptions | boolean -): void; -/** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */ -export declare function dispatchEvent( - event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap] -): boolean; -export declare function btoa(data: string): string; -export declare function atob(data: string): string; -export declare function setTimeout( - callback: (...args: any[]) => void, - msDelay?: number -): number; -export declare function setTimeout( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args -): number; -export declare function clearTimeout(timeoutId: number | null): void; -export declare function setInterval( - callback: (...args: any[]) => void, - msDelay?: number -): number; -export declare function setInterval( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args -): number; -export declare function clearInterval(timeoutId: number | null): void; -export declare function queueMicrotask(task: Function): void; -export declare function structuredClone( - value: T, - options?: StructuredSerializeOptions -): T; -export declare function fetch( - input: RequestInfo, - init?: RequestInit -): Promise; -export declare const self: ServiceWorkerGlobalScope; -export declare const crypto: Crypto; -export declare const caches: CacheStorage; -export declare const scheduler: Scheduler; -export interface TestController {} -export interface ExecutionContext { - waitUntil(promise: Promise): void; - passThroughOnException(): void; -} -export type ExportedHandlerFetchHandler< - Env = unknown, - CfHostMetadata = unknown -> = ( - request: Request>, - env: Env, - ctx: ExecutionContext -) => Response | Promise; -export type ExportedHandlerTraceHandler = ( - traces: TraceItem[], - env: Env, - ctx: ExecutionContext -) => void | Promise; -export type ExportedHandlerScheduledHandler = ( - controller: ScheduledController, - env: Env, - ctx: ExecutionContext -) => void | Promise; -export type ExportedHandlerQueueHandler = ( - batch: MessageBatch, - env: Env, - ctx: ExecutionContext -) => void | Promise; -export type ExportedHandlerTestHandler = ( - controller: TestController, - env: Env, - ctx: ExecutionContext -) => void | Promise; -export interface ExportedHandler< - Env = unknown, - QueueMessage = unknown, - CfHostMetadata = unknown -> { - fetch?: ExportedHandlerFetchHandler; - trace?: ExportedHandlerTraceHandler; - scheduled?: ExportedHandlerScheduledHandler; - test?: ExportedHandlerTestHandler; - queue?: ExportedHandlerQueueHandler; -} -export interface StructuredSerializeOptions { - transfer?: any[]; -} -export declare abstract class PromiseRejectionEvent extends Event { - readonly promise: Promise; - readonly reason: any; -} -export interface DurableObject { - fetch(request: Request): Response | Promise; - alarm?(): void | Promise; -} -export interface DurableObjectStub extends Fetcher { - readonly id: DurableObjectId; - readonly name?: string; -} -export interface DurableObjectId { - toString(): string; - equals(other: DurableObjectId): boolean; - readonly name?: string; -} -export interface DurableObjectNamespace { - newUniqueId( - options?: DurableObjectNamespaceNewUniqueIdOptions - ): DurableObjectId; - idFromName(name: string): DurableObjectId; - idFromString(id: string): DurableObjectId; - get( - id: DurableObjectId, - options?: DurableObjectNamespaceGetDurableObjectOptions - ): DurableObjectStub; - jurisdiction(jurisdiction: string): DurableObjectNamespace; -} -export interface DurableObjectNamespaceNewUniqueIdOptions { - jurisdiction?: string; -} -export interface DurableObjectNamespaceGetDurableObjectOptions { - locationHint?: string; -} -export interface DurableObjectState { - waitUntil(promise: Promise): void; - readonly id: DurableObjectId; - readonly storage: DurableObjectStorage; - blockConcurrencyWhile(callback: () => Promise): Promise; -} -export interface DurableObjectTransaction { - get( - key: string, - options?: DurableObjectGetOptions - ): Promise; - get( - keys: string[], - options?: DurableObjectGetOptions - ): Promise>; - list( - options?: DurableObjectListOptions - ): Promise>; - put( - key: string, - value: T, - options?: DurableObjectPutOptions - ): Promise; - put( - entries: Record, - options?: DurableObjectPutOptions - ): Promise; - delete(key: string, options?: DurableObjectPutOptions): Promise; - delete(keys: string[], options?: DurableObjectPutOptions): Promise; - rollback(): void; - getAlarm(options?: DurableObjectGetAlarmOptions): Promise; - setAlarm( - scheduledTime: number | Date, - options?: DurableObjectSetAlarmOptions - ): Promise; - deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise; -} -export interface DurableObjectStorage { - get( - key: string, - options?: DurableObjectGetOptions - ): Promise; - get( - keys: string[], - options?: DurableObjectGetOptions - ): Promise>; - list( - options?: DurableObjectListOptions - ): Promise>; - put( - key: string, - value: T, - options?: DurableObjectPutOptions - ): Promise; - put( - entries: Record, - options?: DurableObjectPutOptions - ): Promise; - delete(key: string, options?: DurableObjectPutOptions): Promise; - delete(keys: string[], options?: DurableObjectPutOptions): Promise; - deleteAll(options?: DurableObjectPutOptions): Promise; - transaction( - closure: (txn: DurableObjectTransaction) => Promise - ): Promise; - getAlarm(options?: DurableObjectGetAlarmOptions): Promise; - setAlarm( - scheduledTime: number | Date, - options?: DurableObjectSetAlarmOptions - ): Promise; - deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise; - sync(): Promise; -} -export interface DurableObjectListOptions { - start?: string; - startAfter?: string; - end?: string; - prefix?: string; - reverse?: boolean; - limit?: number; - allowConcurrency?: boolean; - noCache?: boolean; -} -export interface DurableObjectGetOptions { - allowConcurrency?: boolean; - noCache?: boolean; -} -export interface DurableObjectGetAlarmOptions { - allowConcurrency?: boolean; -} -export interface DurableObjectPutOptions { - allowConcurrency?: boolean; - allowUnconfirmed?: boolean; - noCache?: boolean; -} -export interface DurableObjectSetAlarmOptions { - allowConcurrency?: boolean; - allowUnconfirmed?: boolean; -} -export interface AnalyticsEngineDataset { - writeDataPoint(event?: AnalyticsEngineDataPoint): void; -} -export interface AnalyticsEngineDataPoint { - indexes?: ((ArrayBuffer | string) | null)[]; - doubles?: number[]; - blobs?: ((ArrayBuffer | string) | null)[]; -} -export declare class Event { - constructor(type: string, init?: EventInit); - /** Returns the type of event, e.g. "click", "hashchange", or "submit". */ - readonly type: string; - /** Returns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE. */ - readonly eventPhase: number; - /** Returns true or false depending on how event was initialized. True if event invokes listeners past a ShadowRoot node that is the root of its target, and false otherwise. */ - readonly composed: boolean; - /** Returns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise. */ - readonly bubbles: boolean; - /** Returns true or false depending on how event was initialized. Its return value does not always carry meaning, but true can indicate that part of the operation during which event was dispatched, can be canceled by invoking the preventDefault() method. */ - readonly cancelable: boolean; - /** Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise. */ - readonly defaultPrevented: boolean; - /** @deprecated */ - readonly returnValue: boolean; - /** Returns the object whose event listener's callback is currently being invoked. */ - readonly currentTarget?: EventTarget; - /** @deprecated */ - readonly srcElement?: EventTarget; - /** Returns the event's timestamp as the number of milliseconds measured relative to the time origin. */ - readonly timeStamp: number; - /** Returns true if event was dispatched by the user agent, and false otherwise. */ - readonly isTrusted: boolean; - cancelBubble: boolean; - stopImmediatePropagation(): void; - preventDefault(): void; - stopPropagation(): void; - composedPath(): EventTarget[]; - static readonly NONE: number; - static readonly CAPTURING_PHASE: number; - static readonly AT_TARGET: number; - static readonly BUBBLING_PHASE: number; -} -export interface EventInit { - bubbles?: boolean; - cancelable?: boolean; - composed?: boolean; -} -export type EventListener = ( - event: EventType -) => void; -export interface EventListenerObject { - handleEvent(event: EventType): void; -} -export type EventListenerOrEventListenerObject< - EventType extends Event = Event -> = EventListener | EventListenerObject; -export declare class EventTarget< - EventMap extends Record = Record -> { - constructor(); - addEventListener( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetAddEventListenerOptions | boolean - ): void; - removeEventListener( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetEventListenerOptions | boolean - ): void; - dispatchEvent(event: EventMap[keyof EventMap]): boolean; -} -export interface EventTargetEventListenerOptions { - capture?: boolean; -} -export interface EventTargetAddEventListenerOptions { - capture?: boolean; - passive?: boolean; - once?: boolean; - signal?: AbortSignal; -} -export interface EventTargetHandlerObject { - handleEvent: (event: Event) => any | undefined; -} -export declare class AbortController { - constructor(); - /** Returns the AbortSignal object associated with this object. */ - readonly signal: AbortSignal; - abort(reason?: any): void; -} -export declare abstract class AbortSignal extends EventTarget { - static abort(reason?: any): AbortSignal; - static timeout(delay: number): AbortSignal; - /** Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. */ - readonly aborted: boolean; - readonly reason: any; - throwIfAborted(): void; -} -export interface Scheduler { - wait(delay: number, maybeOptions?: SchedulerWaitOptions): Promise; -} -export interface SchedulerWaitOptions { - signal?: AbortSignal; -} -export declare abstract class ExtendableEvent extends Event { - waitUntil(promise: Promise): void; -} -export declare class Blob { - constructor( - bits?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[], - options?: BlobOptions - ); - readonly size: number; - readonly type: string; - slice(start?: number, end?: number, type?: string): Blob; - arrayBuffer(): Promise; - text(): Promise; - stream(): ReadableStream; -} -export interface BlobOptions { - type?: string; -} -export declare class File extends Blob { - constructor( - bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined, - name: string, - options?: FileOptions - ); - readonly name: string; - readonly lastModified: number; -} -export interface FileOptions { - type?: string; - lastModified?: number; -} -export declare abstract class CacheStorage { - open(cacheName: string): Promise; - readonly default: Cache; -} -export declare abstract class Cache { - delete(request: RequestInfo, options?: CacheQueryOptions): Promise; - match( - request: RequestInfo, - options?: CacheQueryOptions - ): Promise; - put(request: RequestInfo, response: Response): Promise; -} -export interface CacheQueryOptions { - ignoreMethod?: boolean; -} -export declare abstract class Crypto { - /** Available only in secure contexts. */ - readonly subtle: SubtleCrypto; - getRandomValues< - T extends - | Int8Array - | Uint8Array - | Int16Array - | Uint16Array - | Int32Array - | Uint32Array - | BigInt64Array - | BigUint64Array - >(buffer: T): T; - randomUUID(): string; - DigestStream: typeof DigestStream; -} -export declare abstract class SubtleCrypto { - encrypt( - algorithm: string | SubtleCryptoEncryptAlgorithm, - key: CryptoKey, - plainText: ArrayBuffer | ArrayBufferView - ): Promise; - decrypt( - algorithm: string | SubtleCryptoEncryptAlgorithm, - key: CryptoKey, - cipherText: ArrayBuffer | ArrayBufferView - ): Promise; - sign( - algorithm: string | SubtleCryptoSignAlgorithm, - key: CryptoKey, - data: ArrayBuffer | ArrayBufferView - ): Promise; - verify( - algorithm: string | SubtleCryptoSignAlgorithm, - key: CryptoKey, - signature: ArrayBuffer | ArrayBufferView, - data: ArrayBuffer | ArrayBufferView - ): Promise; - digest( - algorithm: string | SubtleCryptoHashAlgorithm, - data: ArrayBuffer | ArrayBufferView - ): Promise; - generateKey( - algorithm: string | SubtleCryptoGenerateKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - deriveKey( - algorithm: string | SubtleCryptoDeriveKeyAlgorithm, - baseKey: CryptoKey, - derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - deriveBits( - algorithm: string | SubtleCryptoDeriveKeyAlgorithm, - baseKey: CryptoKey, - length: number | null - ): Promise; - importKey( - format: string, - keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey, - algorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - exportKey(format: string, key: CryptoKey): Promise; - wrapKey( - format: string, - key: CryptoKey, - wrappingKey: CryptoKey, - wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm - ): Promise; - unwrapKey( - format: string, - wrappedKey: ArrayBuffer | ArrayBufferView, - unwrappingKey: CryptoKey, - unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm, - unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - timingSafeEqual( - a: ArrayBuffer | ArrayBufferView, - b: ArrayBuffer | ArrayBufferView - ): boolean; -} -export declare abstract class CryptoKey { - readonly type: string; - readonly extractable: boolean; - readonly algorithm: - | CryptoKeyKeyAlgorithm - | CryptoKeyAesKeyAlgorithm - | CryptoKeyHmacKeyAlgorithm - | CryptoKeyRsaKeyAlgorithm - | CryptoKeyEllipticKeyAlgorithm - | CryptoKeyArbitraryKeyAlgorithm; - readonly usages: string[]; -} -export interface CryptoKeyPair { - publicKey: CryptoKey; - privateKey: CryptoKey; -} -export 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; -} -export interface RsaOtherPrimesInfo { - r?: string; - d?: string; - t?: string; -} -export interface SubtleCryptoDeriveKeyAlgorithm { - name: string; - salt?: ArrayBuffer; - iterations?: number; - hash?: string | SubtleCryptoHashAlgorithm; - $public?: CryptoKey; - info?: ArrayBuffer; -} -export interface SubtleCryptoEncryptAlgorithm { - name: string; - iv?: ArrayBuffer; - additionalData?: ArrayBuffer; - tagLength?: number; - counter?: ArrayBuffer; - length?: number; - label?: ArrayBuffer; -} -export interface SubtleCryptoGenerateKeyAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - modulusLength?: number; - publicExponent?: ArrayBuffer; - length?: number; - namedCurve?: string; -} -export interface SubtleCryptoHashAlgorithm { - name: string; -} -export interface SubtleCryptoImportKeyAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - length?: number; - namedCurve?: string; - compressed?: boolean; -} -export interface SubtleCryptoSignAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - dataLength?: number; - saltLength?: number; -} -export interface CryptoKeyKeyAlgorithm { - name: string; -} -export interface CryptoKeyAesKeyAlgorithm { - name: string; - length: number; -} -export interface CryptoKeyHmacKeyAlgorithm { - name: string; - hash: CryptoKeyKeyAlgorithm; - length: number; -} -export interface CryptoKeyRsaKeyAlgorithm { - name: string; - modulusLength: number; - publicExponent: ArrayBuffer; - hash?: CryptoKeyKeyAlgorithm; -} -export interface CryptoKeyEllipticKeyAlgorithm { - name: string; - namedCurve: string; -} -export interface CryptoKeyArbitraryKeyAlgorithm { - name: string; - hash?: CryptoKeyKeyAlgorithm; - namedCurve?: string; - length?: number; -} -export declare class DigestStream extends WritableStream< - ArrayBuffer | ArrayBufferView -> { - constructor(algorithm: string | SubtleCryptoHashAlgorithm); - readonly digest: Promise; -} -export declare class TextDecoder { - constructor(decoder?: string, options?: TextDecoderConstructorOptions); - decode( - input?: ArrayBuffer | ArrayBufferView, - options?: TextDecoderDecodeOptions - ): string; - readonly encoding: string; - readonly fatal: boolean; - readonly ignoreBOM: boolean; -} -export declare class TextEncoder { - constructor(); - encode(input?: string): Uint8Array; - encodeInto(input: string, buffer: Uint8Array): TextEncoderEncodeIntoResult; - readonly encoding: string; -} -export interface TextDecoderConstructorOptions { - fatal: boolean; - ignoreBOM: boolean; -} -export interface TextDecoderDecodeOptions { - stream: boolean; -} -export interface TextEncoderEncodeIntoResult { - read: number; - written: number; -} -export declare class FormData { - constructor(); - append(name: string, value: string): void; - append(name: string, value: Blob, filename?: string): void; - delete(name: string): void; - get(name: string): (File | string) | null; - getAll(name: string): (File | string)[]; - has(name: string): boolean; - set(name: string, value: string): void; - set(name: string, value: Blob, filename?: string): void; - entries(): IterableIterator<[key: string, value: File | string]>; - keys(): IterableIterator; - values(): IterableIterator; - forEach( - callback: ( - this: This, - value: File | string, - key: string, - parent: FormData - ) => void, - thisArg?: This - ): void; - [Symbol.iterator](): IterableIterator<[key: string, value: File | string]>; -} -export interface ContentOptions { - html?: boolean; -} -export declare class HTMLRewriter { - constructor(); - on( - selector: string, - handlers: HTMLRewriterElementContentHandlers - ): HTMLRewriter; - onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter; - transform(response: Response): Response; -} -export interface HTMLRewriterElementContentHandlers { - element?(element: Element): void | Promise; - comments?(comment: Comment): void | Promise; - text?(element: Text): void | Promise; -} -export interface HTMLRewriterDocumentContentHandlers { - doctype?(doctype: Doctype): void | Promise; - comments?(comment: Comment): void | Promise; - text?(text: Text): void | Promise; - end?(end: DocumentEnd): void | Promise; -} -export interface Doctype { - readonly name: string | null; - readonly publicId: string | null; - readonly systemId: string | null; -} -export interface Element { - tagName: string; - readonly attributes: IterableIterator; - 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, options?: ContentOptions): Element; - after(content: string, options?: ContentOptions): Element; - prepend(content: string, options?: ContentOptions): Element; - append(content: string, options?: ContentOptions): Element; - replace(content: string, options?: ContentOptions): Element; - remove(): Element; - removeAndKeepContent(): Element; - setInnerContent(content: string, options?: ContentOptions): Element; - onEndTag(handler: (tag: EndTag) => void | Promise): void; -} -export interface EndTag { - name: string; - before(content: string, options?: ContentOptions): EndTag; - after(content: string, options?: ContentOptions): EndTag; - remove(): EndTag; -} -export 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; -} -export interface Text { - readonly text: string; - readonly lastInTextNode: boolean; - readonly removed: boolean; - before(content: string, options?: ContentOptions): Text; - after(content: string, options?: ContentOptions): Text; - replace(content: string, options?: ContentOptions): Text; - remove(): Text; -} -export interface DocumentEnd { - append(content: string, options?: ContentOptions): DocumentEnd; -} -export declare abstract class FetchEvent extends ExtendableEvent { - readonly request: Request; - respondWith(promise: Response | Promise): void; - passThroughOnException(): void; -} -export type HeadersInit = - | Headers - | Iterable> - | Record; -export declare class Headers { - constructor(init?: HeadersInit); - get(name: string): string | null; - getAll(name: string): string[]; - has(name: string): boolean; - set(name: string, value: string): void; - append(name: string, value: string): void; - delete(name: string): void; - forEach( - callback: (this: This, value: string, key: string, parent: Headers) => void, - thisArg?: This - ): void; - entries(): IterableIterator<[key: string, value: string]>; - keys(): IterableIterator; - values(): IterableIterator; - [Symbol.iterator](): IterableIterator<[key: string, value: string]>; -} -export type BodyInit = - | ReadableStream - | string - | ArrayBuffer - | ArrayBufferView - | Blob - | URLSearchParams - | FormData; -export declare abstract class Body { - readonly body: ReadableStream | null; - readonly bodyUsed: boolean; - arrayBuffer(): Promise; - text(): Promise; - json(): Promise; - formData(): Promise; - blob(): Promise; -} -export declare class Response extends Body { - constructor(body?: BodyInit | null, init?: ResponseInit); - static redirect(url: string, status?: number): Response; - static json(any: any, maybeInit?: ResponseInit | Response): Response; - clone(): Response; - readonly status: number; - readonly statusText: string; - readonly headers: Headers; - readonly ok: boolean; - readonly redirected: boolean; - readonly url: string; - readonly webSocket: WebSocket | null; - readonly cf?: any; -} -export interface ResponseInit { - status?: number; - statusText?: string; - headers?: HeadersInit; - cf?: any; - webSocket?: WebSocket | null; - encodeBody?: "automatic" | "manual"; -} -export type RequestInfo< - CfHostMetadata = unknown, - Cf = CfProperties -> = Request | string | URL; -export declare class Request< - CfHostMetadata = unknown, - Cf = CfProperties -> extends Body { - constructor(input: RequestInfo, init?: RequestInit); - clone(): Request; - /** Returns request's HTTP method, which is "GET" by default. */ - readonly method: string; - /** Returns the URL of request as a string. */ - readonly url: string; - /** Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the "Host" header. */ - readonly headers: Headers; - /** Returns the redirect mode associated with request, which is a string indicating how redirects for the request will be handled during fetching. A request will follow redirects by default. */ - readonly redirect: string; - readonly fetcher: Fetcher | null; - /** Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler. */ - readonly signal: AbortSignal; - readonly cf?: Cf; - /** Returns request's subresource integrity metadata, which is a cryptographic hash of the resource being fetched. Its value consists of multiple hashes separated by whitespace. [SRI] */ - readonly integrity: string; - /** Returns a boolean indicating whether or not request can outlive the global in which it was created. */ - readonly keepalive: boolean; -} -export interface RequestInit { - /** 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 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; -} -export declare abstract class Fetcher { - fetch(input: RequestInfo, init?: RequestInit): Promise; -} -export interface FetcherPutOptions { - expiration?: number; - expirationTtl?: number; -} -export interface KVNamespaceListKey { - name: Key; - expiration?: number; - metadata?: Metadata; -} -export type KVNamespaceListResult = - | { - list_complete: false; - keys: KVNamespaceListKey[]; - cursor: string; - } - | { - list_complete: true; - keys: KVNamespaceListKey[]; - }; -export interface KVNamespace { - get( - key: Key, - options?: Partial> - ): Promise; - get(key: Key, type: "text"): Promise; - get( - key: Key, - type: "json" - ): Promise; - get(key: Key, type: "arrayBuffer"): Promise; - get(key: Key, type: "stream"): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"text"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"json"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"arrayBuffer"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"stream"> - ): Promise; - list( - options?: KVNamespaceListOptions - ): Promise>; - put( - key: Key, - value: string | ArrayBuffer | ArrayBufferView | ReadableStream, - options?: KVNamespacePutOptions - ): Promise; - getWithMetadata( - key: Key, - options?: Partial> - ): Promise>; - getWithMetadata( - key: Key, - type: "text" - ): Promise>; - getWithMetadata( - key: Key, - type: "json" - ): Promise>; - getWithMetadata( - key: Key, - type: "arrayBuffer" - ): Promise>; - getWithMetadata( - key: Key, - type: "stream" - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"text"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"json"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"arrayBuffer"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"stream"> - ): Promise>; - delete(key: Key): Promise; -} -export interface KVNamespaceListOptions { - limit?: number; - prefix?: string | null; - cursor?: string | null; -} -export interface KVNamespaceGetOptions { - type: Type; - cacheTtl?: number; -} -export interface KVNamespacePutOptions { - expiration?: number; - expirationTtl?: number; - metadata?: any | null; -} -export interface KVNamespaceGetWithMetadataResult { - value: Value | null; - metadata: Metadata | null; -} -export interface R2Error extends Error { - readonly name: string; - readonly code: number; - readonly message: string; - readonly action: string; - readonly stack: any; -} -export interface R2ListOptions { - limit?: number; - prefix?: string; - cursor?: string; - delimiter?: string; - startAfter?: string; -} -export declare abstract class R2Bucket { - head(key: string): Promise; - get( - key: string, - options: R2GetOptions & { - onlyIf: R2Conditional | Headers; - } - ): Promise; - get(key: string, options?: R2GetOptions): Promise; - put( - key: string, - value: - | ReadableStream - | ArrayBuffer - | ArrayBufferView - | string - | null - | Blob, - options?: R2PutOptions - ): Promise; - put( - key: string, - value: - | ReadableStream - | ArrayBuffer - | ArrayBufferView - | string - | null - | Blob, - options?: R2PutOptions & { - onlyIf: R2Conditional | Headers; - } - ): Promise; - createMultipartUpload( - key: string, - options?: R2MultipartOptions - ): Promise; - resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload; - delete(keys: string | string[]): Promise; - list(options?: R2ListOptions): Promise; -} -export interface R2MultipartUpload { - readonly key: string; - readonly uploadId: string; - uploadPart( - partNumber: number, - value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob - ): Promise; - abort(): Promise; - complete(uploadedParts: R2UploadedPart[]): Promise; -} -export interface R2UploadedPart { - partNumber: number; - etag: string; -} -export 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; - readonly range?: R2Range; - writeHttpMetadata(headers: Headers): void; -} -export interface R2ObjectBody extends R2Object { - get body(): ReadableStream; - get bodyUsed(): boolean; - arrayBuffer(): Promise; - text(): Promise; - json(): Promise; - blob(): Promise; -} -export type R2Range = - | { - offset: number; - length?: number; - } - | { - offset?: number; - length: number; - } - | { - suffix: number; - }; -export interface R2Conditional { - etagMatches?: string; - etagDoesNotMatch?: string; - uploadedBefore?: Date; - uploadedAfter?: Date; - secondsGranularity?: boolean; -} -export interface R2GetOptions { - onlyIf?: R2Conditional | Headers; - range?: R2Range | Headers; -} -export interface R2PutOptions { - onlyIf?: R2Conditional | Headers; - httpMetadata?: R2HTTPMetadata | Headers; - customMetadata?: Record; - md5?: ArrayBuffer | string; - sha1?: ArrayBuffer | string; - sha256?: ArrayBuffer | string; - sha384?: ArrayBuffer | string; - sha512?: ArrayBuffer | string; -} -export interface R2MultipartOptions { - httpMetadata?: R2HTTPMetadata | Headers; - customMetadata?: Record; -} -export interface R2Checksums { - readonly md5?: ArrayBuffer; - readonly sha1?: ArrayBuffer; - readonly sha256?: ArrayBuffer; - readonly sha384?: ArrayBuffer; - readonly sha512?: ArrayBuffer; - toJSON(): R2StringChecksums; -} -export interface R2StringChecksums { - md5?: string; - sha1?: string; - sha256?: string; - sha384?: string; - sha512?: string; -} -export interface R2HTTPMetadata { - contentType?: string; - contentLanguage?: string; - contentDisposition?: string; - contentEncoding?: string; - cacheControl?: string; - cacheExpiry?: Date; -} -export interface R2Objects { - objects: R2Object[]; - truncated: boolean; - cursor?: string; - delimitedPrefixes: string[]; -} -export declare abstract class ScheduledEvent extends ExtendableEvent { - readonly scheduledTime: number; - readonly cron: string; - noRetry(): void; -} -export interface ScheduledController { - readonly scheduledTime: number; - readonly cron: string; - noRetry(): void; -} -export interface QueuingStrategy { - highWaterMark?: number | bigint; - size?: (chunk: T) => number | bigint; -} -export interface UnderlyingSink { - type?: string; - start?: (controller: WritableStreamDefaultController) => void | Promise; - write?: ( - chunk: W, - controller: WritableStreamDefaultController - ) => void | Promise; - abort?: (reason: any) => void | Promise; - close?: () => void | Promise; -} -export interface UnderlyingByteSource { - type: "bytes"; - autoAllocateChunkSize?: number; - start?: (controller: ReadableByteStreamController) => void | Promise; - pull?: (controller: ReadableByteStreamController) => void | Promise; - cancel?: (reason: any) => void | Promise; -} -export interface UnderlyingSource { - type?: "" | undefined; - start?: ( - controller: ReadableStreamDefaultController - ) => void | Promise; - pull?: ( - controller: ReadableStreamDefaultController - ) => void | Promise; - cancel?: (reason: any) => void | Promise; -} -export interface Transformer { - readableType?: string; - writableType?: string; - start?: ( - controller: TransformStreamDefaultController - ) => void | Promise; - transform?: ( - chunk: I, - controller: TransformStreamDefaultController - ) => void | Promise; - flush?: ( - controller: TransformStreamDefaultController - ) => void | Promise; -} -export interface StreamPipeOptions { - /** - * 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; - preventAbort?: boolean; - preventCancel?: boolean; - signal?: AbortSignal; -} -export type ReadableStreamReadResult = - | { - done: false; - value: R; - } - | { - done: true; - value?: undefined; - }; -/** This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object. */ -export interface ReadableStream { - readonly locked: boolean; - cancel(reason?: any): Promise; - getReader(): ReadableStreamDefaultReader; - getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader; - pipeThrough( - transform: ReadableWritablePair, - options?: StreamPipeOptions - ): ReadableStream; - pipeTo( - destination: WritableStream, - options?: StreamPipeOptions - ): Promise; - tee(): [ReadableStream, ReadableStream]; - values(options?: ReadableStreamValuesOptions): AsyncIterableIterator; - [Symbol.asyncIterator]( - options?: ReadableStreamValuesOptions - ): AsyncIterableIterator; -} -export declare const ReadableStream: { - prototype: ReadableStream; - new ( - underlyingSource: UnderlyingByteSource, - strategy?: QueuingStrategy - ): ReadableStream; - new ( - underlyingSource?: UnderlyingSource, - strategy?: QueuingStrategy - ): ReadableStream; -}; -export declare class ReadableStreamDefaultReader { - constructor(stream: ReadableStream); - readonly closed: Promise; - cancel(reason?: any): Promise; - read(): Promise>; - releaseLock(): void; -} -export declare class ReadableStreamBYOBReader { - constructor(stream: ReadableStream); - readonly closed: Promise; - cancel(reason?: any): Promise; - read( - view: T - ): Promise>; - releaseLock(): void; - readAtLeast( - minElements: number, - view: T - ): Promise>; -} -export interface ReadableStreamGetReaderOptions { - mode: "byob"; -} -export interface ReadableStreamBYOBRequest { - readonly view: Uint8Array | null; - respond(bytesWritten: number): void; - respondWithNewView(view: ArrayBuffer | ArrayBufferView): void; - readonly atLeast: number | null; -} -export interface ReadableStreamDefaultController { - readonly desiredSize: number | null; - close(): void; - enqueue(chunk?: R): void; - error(reason: any): void; -} -export interface ReadableByteStreamController { - readonly byobRequest: ReadableStreamBYOBRequest | null; - readonly desiredSize: number | null; - close(): void; - enqueue(chunk: ArrayBuffer | ArrayBufferView): void; - error(reason: any): void; -} -/** This Streams API interface represents a controller allowing control of a WritableStream's state. When constructing a WritableStream, the underlying sink is given a corresponding WritableStreamDefaultController instance to manipulate. */ -export interface WritableStreamDefaultController { - readonly signal: AbortSignal; - error(reason?: any): void; -} -export interface TransformStreamDefaultController { - get desiredSize(): number | null; - enqueue(chunk?: O): void; - error(reason: any): void; - terminate(): void; -} -export interface ReadableWritablePair { - /** - * 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; - readable: ReadableStream; -} -export declare class WritableStream { - constructor( - underlyingSink?: UnderlyingSink, - queuingStrategy?: QueuingStrategy - ); - readonly locked: boolean; - abort(reason?: any): Promise; - close(): Promise; - getWriter(): WritableStreamDefaultWriter; -} -export declare class WritableStreamDefaultWriter { - constructor(stream: WritableStream); - readonly closed: Promise; - readonly ready: Promise; - readonly desiredSize: number | null; - abort(reason?: any): Promise; - close(): Promise; - write(chunk?: W): Promise; - releaseLock(): void; -} -export declare class TransformStream { - constructor( - transformer?: Transformer, - writableStrategy?: QueuingStrategy, - readableStrategy?: QueuingStrategy - ); - readonly readable: ReadableStream; - readonly writable: WritableStream; -} -export declare class FixedLengthStream extends IdentityTransformStream { - constructor(expectedLength: number | bigint); -} -export declare class IdentityTransformStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(); -} -export interface ReadableStreamValuesOptions { - preventCancel?: boolean; -} -export declare class CompressionStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(format: "gzip" | "deflate" | "deflate-raw"); -} -export declare class DecompressionStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(format: "gzip" | "deflate" | "deflate-raw"); -} -export declare class TextEncoderStream extends TransformStream< - string, - Uint8Array -> { - constructor(); -} -export declare class TextDecoderStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - string -> { - constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit); -} -export interface TextDecoderStreamTextDecoderStreamInit { - fatal?: boolean; -} -export declare class ByteLengthQueuingStrategy - implements QueuingStrategy -{ - constructor(init: QueuingStrategyInit); - get highWaterMark(): number; - get size(): (chunk?: any) => number; -} -export declare class CountQueuingStrategy implements QueuingStrategy { - constructor(init: QueuingStrategyInit); - get highWaterMark(): number; - get size(): (chunk?: any) => number; -} -export 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; -} -export declare abstract class TraceEvent extends ExtendableEvent { - readonly traces: TraceItem[]; -} -export interface TraceItem { - readonly event: - | ( - | TraceItemFetchEventInfo - | TraceItemScheduledEventInfo - | TraceItemAlarmEventInfo - | TraceItemQueueEventInfo - | TraceItemEmailEventInfo - | TraceItemCustomEventInfo - ) - | null; - readonly eventTimestamp: number | null; - readonly logs: TraceLog[]; - readonly exceptions: TraceException[]; - readonly scriptName: string | null; - readonly dispatchNamespace?: string; - readonly scriptTags?: string[]; - readonly outcome: string; -} -export interface TraceItemAlarmEventInfo { - readonly scheduledTime: Date; -} -export interface TraceItemCustomEventInfo {} -export interface TraceItemScheduledEventInfo { - readonly scheduledTime: number; - readonly cron: string; -} -export interface TraceItemQueueEventInfo { - readonly queue: string; - readonly batchSize: number; -} -export interface TraceItemEmailEventInfo { - readonly mailFrom: string; - readonly rcptTo: string; - readonly rawSize: number; -} -export interface TraceItemFetchEventInfo { - readonly response?: TraceItemFetchEventInfoResponse; - readonly request: TraceItemFetchEventInfoRequest; -} -export interface TraceItemFetchEventInfoRequest { - readonly cf?: any; - readonly headers: Record; - readonly method: string; - readonly url: string; - getUnredacted(): TraceItemFetchEventInfoRequest; -} -export interface TraceItemFetchEventInfoResponse { - readonly status: number; -} -export interface TraceLog { - readonly timestamp: number; - readonly level: string; - readonly message: any; -} -export interface TraceException { - readonly timestamp: number; - readonly message: string; - readonly name: string; -} -export interface TraceMetrics { - readonly cpuTime: number; - readonly wallTime: number; -} -export interface UnsafeTraceMetrics { - fromTrace(item: TraceItem): TraceMetrics; -} -export declare class URL { - constructor(url: string | URL, base?: string | URL); - href: string; - readonly origin: string; - protocol: string; - username: string; - password: string; - host: string; - hostname: string; - port: string; - pathname: string; - search: string; - readonly searchParams: URLSearchParams; - hash: string; - toString(): string; - toJSON(): string; -} -export declare class URLSearchParams { - constructor( - init?: - | URLSearchParams - | string - | Record - | [key: string, value: string][] - ); - get size(): number; - append(name: string, value: string): void; - delete(name: string): void; - get(name: string): string | null; - getAll(name: string): string[]; - has(name: string): boolean; - set(name: string, value: string): void; - sort(): void; - entries(): IterableIterator<[key: string, value: string]>; - keys(): IterableIterator; - values(): IterableIterator; - forEach( - callback: ( - this: This, - value: string, - key: string, - parent: URLSearchParams - ) => void, - thisArg?: This - ): void; - toString(): string; - [Symbol.iterator](): IterableIterator<[key: string, value: string]>; -} -export declare class URLPattern { - constructor(input?: string | URLPatternURLPatternInit, baseURL?: string); - get protocol(): string; - get username(): string; - get password(): string; - get hostname(): string; - get port(): string; - get pathname(): string; - get search(): string; - get hash(): string; - test(input?: string | URLPatternURLPatternInit, baseURL?: string): boolean; - exec( - input?: string | URLPatternURLPatternInit, - baseURL?: string - ): URLPatternURLPatternResult | null; -} -export interface URLPatternURLPatternInit { - protocol?: string; - username?: string; - password?: string; - hostname?: string; - port?: string; - pathname?: string; - search?: string; - hash?: string; - baseURL?: string; -} -export interface URLPatternURLPatternComponentResult { - input: string; - groups: Record; -} -export interface URLPatternURLPatternResult { - inputs: (string | URLPatternURLPatternInit)[]; - protocol: URLPatternURLPatternComponentResult; - username: URLPatternURLPatternComponentResult; - password: URLPatternURLPatternComponentResult; - hostname: URLPatternURLPatternComponentResult; - port: URLPatternURLPatternComponentResult; - pathname: URLPatternURLPatternComponentResult; - search: URLPatternURLPatternComponentResult; - hash: URLPatternURLPatternComponentResult; -} -export declare class CloseEvent extends Event { - constructor(type: string, initializer: CloseEventInit); - /** Returns the WebSocket connection close code provided by the server. */ - readonly code: number; - /** Returns the WebSocket connection close reason provided by the server. */ - readonly reason: string; - /** Returns true if the connection closed cleanly; false otherwise. */ - readonly wasClean: boolean; -} -export interface CloseEventInit { - code?: number; - reason?: string; - wasClean?: boolean; -} -export declare class MessageEvent extends Event { - constructor(type: string, initializer: MessageEventInit); - readonly data: ArrayBuffer | string; -} -export interface MessageEventInit { - data: ArrayBuffer | string; -} -/** Events providing information related to errors in scripts or in files. */ -export interface ErrorEvent extends Event { - readonly filename: string; - readonly message: string; - readonly lineno: number; - readonly colno: number; - readonly error: any; -} -export type WebSocketEventMap = { - close: CloseEvent; - message: MessageEvent; - open: Event; - error: ErrorEvent; -}; -export declare class WebSocket extends EventTarget { - constructor(url: string, protocols?: string[] | string); - accept(): void; - send(message: (ArrayBuffer | ArrayBufferView) | string): void; - close(code?: number, reason?: string): void; - static readonly READY_STATE_CONNECTING: number; - static readonly READY_STATE_OPEN: number; - static readonly READY_STATE_CLOSING: number; - static readonly READY_STATE_CLOSED: number; - /** Returns the state of the WebSocket object's connection. It can have the values described below. */ - readonly readyState: number; - /** Returns the URL that was used to establish the WebSocket connection. */ - readonly url: string | null; - /** Returns the subprotocol selected by the server, if any. It can be used in conjunction with the array form of the constructor's second argument to perform subprotocol negotiation. */ - readonly protocol: string | null; - /** Returns the extensions selected by the server, if any. */ - readonly extensions: string | null; -} -export declare const WebSocketPair: { - new (): { - 0: WebSocket; - 1: WebSocket; - }; -}; -export interface BasicImageTransformations { - /** - * Maximum width in image pixels. The value must be an integer. - */ - width?: number; - /** - * Maximum height in image pixels. The value must be an integer. - */ - height?: number; - /** - * Resizing mode as a string. It affects interpretation of width and height - * options: - * - scale-down: Similar to contain, but the image is never enlarged. If - * the image is larger than given width or height, it will be resized. - * Otherwise its original size will be kept. - * - contain: Resizes to maximum size that fits within the given width and - * height. If only a single dimension is given (e.g. only width), the - * image will be shrunk or enlarged to exactly match that dimension. - * Aspect ratio is always preserved. - * - cover: Resizes (shrinks or enlarges) to fill the entire area of width - * and height. If the image has an aspect ratio different from the ratio - * of width and height, it will be cropped to fit. - * - crop: The image will be shrunk and cropped to fit within the area - * specified by width and height. The image will not be enlarged. For images - * smaller than the given dimensions it's the same as scale-down. For - * images larger than the given dimensions, it's the same as cover. - * See also trim. - * - pad: Resizes to the maximum size that fits within the given width and - * height, and then fills the remaining area with a background color - * (white by default). Use of this mode is not recommended, as the same - * effect can be more efficiently achieved with the contain mode and the - * CSS object-fit: contain property. - */ - fit?: "scale-down" | "contain" | "cover" | "crop" | "pad"; - /** - * When cropping with fit: "cover", this defines the side or point that should - * be left uncropped. The value is either a string - * "left", "right", "top", "bottom", "auto", or "center" (the default), - * or an object {x, y} containing focal point coordinates in the original - * image expressed as fractions ranging from 0.0 (top or left) to 1.0 - * (bottom or right), 0.5 being the center. {fit: "cover", gravity: "top"} will - * crop bottom or left and right sides as necessary, but won’t crop anything - * from the top. {fit: "cover", gravity: {x:0.5, y:0.2}} will crop each side to - * preserve as much as possible around a point at 20% of the height of the - * source image. - */ - gravity?: - | "left" - | "right" - | "top" - | "bottom" - | "center" - | "auto" - | BasicImageTransformationsGravityCoordinates; - /** - * Background color to add underneath the image. Applies only to images with - * transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…), - * hsl(…), etc.) - */ - background?: string; - /** - * Number of degrees (90, 180, 270) to rotate the image by. width and height - * options refer to axes after rotation. - */ - rotate?: 0 | 90 | 180 | 270 | 360; -} -export interface BasicImageTransformationsGravityCoordinates { - x: number; - y: number; -} -/** - * In addition to the properties you can set in the RequestInit dict - * that you pass as an argument to the Request constructor, you can - * set certain properties of a `cf` object to control how Cloudflare - * features are applied to that new Request. - * - * Note: Currently, these properties cannot be tested in the - * playground. - */ -export interface RequestInitCfProperties extends Record { - cacheEverything?: boolean; - /** - * A request's cache key is what determines if two requests are - * "the same" for caching purposes. If a request has the same cache key - * as some previous request, then we can serve the same cached response for - * both. (e.g. 'some-key') - * - * Only available for Enterprise customers. - */ - cacheKey?: string; - /** - * This allows you to append additional Cache-Tag response headers - * to the origin response without modifications to the origin server. - * This will allow for greater control over the Purge by Cache Tag feature - * utilizing changes only in the Workers process. - * - * Only available for Enterprise customers. - */ - cacheTags?: string[]; - /** - * Force response to be cached for a given number of seconds. (e.g. 300) - */ - cacheTtl?: number; - /** - * Force response to be cached for a given number of seconds based on the Origin status code. - * (e.g. { '200-299': 86400, '404': 1, '500-599': 0 }) - */ - cacheTtlByStatus?: Record; - scrapeShield?: boolean; - apps?: boolean; - image?: RequestInitCfPropertiesImage; - minify?: RequestInitCfPropertiesImageMinify; - mirage?: boolean; - polish?: "lossy" | "lossless" | "off"; - /** - * Redirects the request to an alternate origin server. You can use this, - * for example, to implement load balancing across several origins. - * (e.g.us-east.example.com) - * - * Note - For security reasons, the hostname set in resolveOverride must - * be proxied on the same Cloudflare zone of the incoming request. - * Otherwise, the setting is ignored. CNAME hosts are allowed, so to - * resolve to a host under a different domain or a DNS only domain first - * declare a CNAME record within your own zone’s DNS mapping to the - * external hostname, set proxy on Cloudflare, then set resolveOverride - * to point to that CNAME record. - */ - resolveOverride?: string; -} -export interface RequestInitCfPropertiesImageDraw - extends BasicImageTransformations { - /** - * Absolute URL of the image file to use for the drawing. It can be any of - * the supported file formats. For drawing of watermarks or non-rectangular - * overlays we recommend using PNG or WebP images. - */ - url: string; - /** - * Floating-point number between 0 (transparent) and 1 (opaque). - * For example, opacity: 0.5 makes overlay semitransparent. - */ - opacity?: number; - /** - * - If set to true, the overlay image will be tiled to cover the entire - * area. This is useful for stock-photo-like watermarks. - * - If set to "x", the overlay image will be tiled horizontally only - * (form a line). - * - If set to "y", the overlay image will be tiled vertically only - * (form a line). - */ - repeat?: true | "x" | "y"; - /** - * Position of the overlay image relative to a given edge. Each property is - * an offset in pixels. 0 aligns exactly to the edge. For example, left: 10 - * positions left side of the overlay 10 pixels from the left edge of the - * image it's drawn over. bottom: 0 aligns bottom of the overlay with bottom - * of the background image. - * - * Setting both left & right, or both top & bottom is an error. - * - * If no position is specified, the image will be centered. - */ - top?: number; - left?: number; - bottom?: number; - right?: number; -} -export interface RequestInitCfPropertiesImage - extends BasicImageTransformations { - /** - * Device Pixel Ratio. Default 1. Multiplier for width/height that makes it - * easier to specify higher-DPI sizes in . - */ - dpr?: number; - /** - * An object with four properties {left, top, right, bottom} that specify - * a number of pixels to cut off on each side. Allows removal of borders - * or cutting out a specific fragment of an image. Trimming is performed - * before resizing or rotation. Takes dpr into account. - */ - trim?: { - left?: number; - top?: number; - right?: number; - bottom?: number; - }; - /** - * Quality setting from 1-100 (useful values are in 60-90 range). Lower values - * make images look worse, but load faster. The default is 85. It applies only - * to JPEG and WebP images. It doesn’t have any effect on PNG. - */ - quality?: number; - /** - * Output format to generate. It can be: - * - avif: generate images in AVIF format. - * - webp: generate images in Google WebP format. Set quality to 100 to get - * the WebP-lossless format. - * - json: instead of generating an image, outputs information about the - * image, in JSON format. The JSON object will contain image size - * (before and after resizing), source image’s MIME type, file size, etc. - * - jpeg: generate images in JPEG format. - * - png: generate images in PNG format. - */ - format?: "avif" | "webp" | "json" | "jpeg" | "png"; - /** - * Whether to preserve animation frames from input files. Default is true. - * Setting it to false reduces animations to still images. This setting is - * recommended when enlarging images or processing arbitrary user content, - * because large GIF animations can weigh tens or even hundreds of megabytes. - * It is also useful to set anim:false when using format:"json" to get the - * response quicker without the number of frames. - */ - anim?: boolean; - /** - * What EXIF data should be preserved in the output image. Note that EXIF - * rotation and embedded color profiles are always applied ("baked in" into - * the image), and aren't affected by this option. Note that if the Polish - * feature is enabled, all metadata may have been removed already and this - * option may have no effect. - * - keep: Preserve most of EXIF metadata, including GPS location if there's - * any. - * - copyright: Only keep the copyright tag, and discard everything else. - * This is the default behavior for JPEG files. - * - none: Discard all invisible EXIF metadata. Currently WebP and PNG - * output formats always discard metadata. - */ - metadata?: "keep" | "copyright" | "none"; - /** - * Strength of sharpening filter to apply to the image. Floating-point - * number between 0 (no sharpening, default) and 10 (maximum). 1.0 is a - * recommended value for downscaled images. - */ - sharpen?: number; - /** - * Radius of a blur filter (approximate gaussian). Maximum supported radius - * is 250. - */ - blur?: number; - /** - * Overlays are drawn in the order they appear in the array (last array - * entry is the topmost layer). - */ - draw?: RequestInitCfPropertiesImageDraw[]; - /** - * Fetching image from authenticated origin. Setting this property will - * pass authentication headers (Authorization, Cookie, etc.) through to - * the origin. - */ - "origin-auth"?: "share-publicly"; - /** - * Adds a border around the image. The border is added after resizing. Border - * width takes dpr into account, and can be specified either using a single - * width property, or individually for each side. - */ - border?: - | { - color: string; - width: number; - } - | { - color: string; - top: number; - right: number; - bottom: number; - left: number; - }; - /** - * Increase brightness by a factor. A value of 1.0 equals no change, a value - * of 0.5 equals half brightness, and a value of 2.0 equals twice as bright. - * 0 is ignored. - */ - brightness?: number; - /** - * Increase contrast by a factor. A value of 1.0 equals no change, a value of - * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is - * ignored. - */ - contrast?: number; - /** - * Increase exposure by a factor. A value of 1.0 equals no change, a value of - * 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored. - */ - gamma?: number; - /** - * Slightly reduces latency on a cache miss by selecting a - * quickest-to-compress file format, at a cost of increased file size and - * lower image quality. It will usually override the format option and choose - * JPEG over WebP or AVIF. We do not recommend using this option, except in - * unusual circumstances like resizing uncacheable dynamically-generated - * images. - */ - compression?: "fast"; -} -export interface RequestInitCfPropertiesImageMinify { - javascript?: boolean; - css?: boolean; - html?: boolean; -} -/** - * Request metadata provided by Cloudflare's edge. - */ -export type IncomingRequestCfProperties = - IncomingRequestCfPropertiesBase & - IncomingRequestCfPropertiesBotManagementEnterprise & - IncomingRequestCfPropertiesCloudflareForSaaSEnterprise & - IncomingRequestCfPropertiesGeographicInformation & - IncomingRequestCfPropertiesCloudflareAccessOrApiShield; -export interface IncomingRequestCfPropertiesBase - extends Record { - /** - * [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request. - * - * @example 395747 - */ - asn: number; - /** - * The organization which owns the ASN of the incoming request. - * - * @example "Google Cloud" - */ - asOrganization: string; - /** - * The original value of the `Accept-Encoding` header if Cloudflare modified it. - * - * @example "gzip, deflate, br" - */ - clientAcceptEncoding?: string; - /** - * The number of milliseconds it took for the request to reach your worker. - * - * @example 22 - */ - clientTcpRtt?: number; - /** - * The three-letter [IATA](https://en.wikipedia.org/wiki/IATA_airport_code) - * airport code of the data center that the request hit. - * - * @example "DFW" - */ - colo: string; - /** - * Represents the upstream's response to a - * [TCP `keepalive` message](https://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html) - * from cloudflare. - * - * For workers with no upstream, this will always be `1`. - * - * @example 3 - */ - edgeRequestKeepAliveStatus: IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus; - /** - * The HTTP Protocol the request used. - * - * @example "HTTP/2" - */ - httpProtocol: string; - /** - * The browser-requested prioritization information in the request object. - * - * If no information was set, defaults to the empty string `""` - * - * @example "weight=192;exclusive=0;group=3;group-weight=127" - * @default "" - */ - requestPriority: string; - /** - * The TLS version of the connection to Cloudflare. - * In requests served over plaintext (without TLS), this property is the empty string `""`. - * - * @example "TLSv1.3" - */ - tlsVersion: string; - /** - * The cipher for the connection to Cloudflare. - * In requests served over plaintext (without TLS), this property is the empty string `""`. - * - * @example "AEAD-AES128-GCM-SHA256" - */ - tlsCipher: string; - /** - * Metadata containing the [`HELLO`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2) and [`FINISHED`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9) messages from this request's TLS handshake. - * - * If the incoming request was served over plaintext (without TLS) this field is undefined. - */ - tlsExportedAuthenticator?: IncomingRequestCfPropertiesExportedAuthenticatorMetadata; -} -export interface IncomingRequestCfPropertiesBotManagementBase { - /** - * Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot, - * represented as an integer percentage between `1` (almost certainly human) - * and `99` (almost certainly a bot). - * - * @example 54 - */ - score: number; - /** - * A boolean value that is true if the request comes from a good bot, like Google or Bing. - * Most customers choose to allow this traffic. For more details, see [Traffic from known bots](https://developers.cloudflare.com/firewall/known-issues-and-faq/#how-does-firewall-rules-handle-traffic-from-known-bots). - */ - verifiedBot: boolean; - /** - * A boolean value that is true if the request originates from a - * Cloudflare-verified proxy service. - */ - corporateProxy: boolean; - /** - * A boolean value that's true if the request matches [file extensions](https://developers.cloudflare.com/bots/reference/static-resources/) for many types of static resources. - */ - staticResource: boolean; - /** - * List of IDs that correlate to the Bot Management heuristic detections made on a request (you can have multiple heuristic detections on the same request). - */ - detectionIds: number[]; -} -export interface IncomingRequestCfPropertiesBotManagement { - /** - * Results of Cloudflare's Bot Management analysis - */ - botManagement: IncomingRequestCfPropertiesBotManagementBase; - /** - * Duplicate of `botManagement.score`. - * - * @deprecated - */ - clientTrustScore: number; -} -export interface IncomingRequestCfPropertiesBotManagementEnterprise - extends IncomingRequestCfPropertiesBotManagement { - /** - * Results of Cloudflare's Bot Management analysis - */ - botManagement: IncomingRequestCfPropertiesBotManagementBase & { - /** - * A [JA3 Fingerprint](https://developers.cloudflare.com/bots/concepts/ja3-fingerprint/) to help profile specific SSL/TLS clients - * across different destination IPs, Ports, and X509 certificates. - */ - ja3Hash: string; - }; -} -export interface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise< - HostMetadata -> { - /** - * Custom metadata set per-host in [Cloudflare for SaaS](https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/). - * - * This field is only present if you have Cloudflare for SaaS enabled on your account - * and you have followed the [required steps to enable it]((https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/domain-support/custom-metadata/)). - */ - hostMetadata: HostMetadata; -} -export interface IncomingRequestCfPropertiesCloudflareAccessOrApiShield { - /** - * Information about the client certificate presented to Cloudflare. - * - * This is populated when the incoming request is served over TLS using - * either Cloudflare Access or API Shield (mTLS) - * and the presented SSL certificate has a valid - * [Certificate Serial Number](https://ldapwiki.com/wiki/Certificate%20Serial%20Number) - * (i.e., not `null` or `""`). - * - * Otherwise, a set of placeholder values are used. - * - * The property `certPresented` will be set to `"1"` when - * the object is populated (i.e. the above conditions were met). - */ - tlsClientAuth: - | IncomingRequestCfPropertiesTLSClientAuth - | IncomingRequestCfPropertiesTLSClientAuthPlaceholder; -} -/** - * Metadata about the request's TLS handshake - */ -export interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata { - /** - * The client's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal - * - * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d" - */ - clientHandshake: string; - /** - * The server's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal - * - * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d" - */ - serverHandshake: string; - /** - * The client's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal - * - * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b" - */ - clientFinished: string; - /** - * The server's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal - * - * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b" - */ - serverFinished: string; -} -/** - * Geographic data about the request's origin. - */ -export interface IncomingRequestCfPropertiesGeographicInformation { - /** - * The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from. - * - * If your worker is [configured to accept TOR connections](https://support.cloudflare.com/hc/en-us/articles/203306930-Understanding-Cloudflare-Tor-support-and-Onion-Routing), this may also be `"T1"`, indicating a request that originated over TOR. - * - * If Cloudflare is unable to determine where the request originated this property is omitted. - * - * The country code `"T1"` is used for requests originating on TOR. - * - * @example "GB" - */ - country?: Iso3166Alpha2Code | "T1"; - /** - * If present, this property indicates that the request originated in the EU - * - * @example "1" - */ - isEUCountry?: "1"; - /** - * A two-letter code indicating the continent the request originated from. - * - * @example "AN" - */ - continent?: ContinentCode; - /** - * The city the request originated from - * - * @example "Austin" - */ - city?: string; - /** - * Postal code of the incoming request - * - * @example "78701" - */ - postalCode?: string; - /** - * Latitude of the incoming request - * - * @example "30.27130" - */ - latitude?: string; - /** - * Longitude of the incoming request - * - * @example "-97.74260" - */ - longitude?: string; - /** - * Timezone of the incoming request - * - * @example "America/Chicago" - */ - timezone?: string; - /** - * If known, the ISO 3166-2 name for the first level region associated with - * the IP address of the incoming request - * - * @example "Texas" - */ - region?: string; - /** - * If known, the ISO 3166-2 code for the first-level region associated with - * the IP address of the incoming request - * - * @example "TX" - */ - regionCode?: string; - /** - * Metro code (DMA) of the incoming request - * - * @example "635" - */ - metroCode?: string; -} -/** Data about the incoming request's TLS certificate */ -export interface IncomingRequestCfPropertiesTLSClientAuth { - /** Always `"1"`, indicating that the certificate was presented */ - certPresented: "1"; - /** - * Result of certificate verification. - * - * @example "FAILED:self signed certificate" - */ - certVerified: Exclude; - /** The presented certificate's revokation status. - * - * - A value of `"1"` indicates the certificate has been revoked - * - A value of `"0"` indicates the certificate has not been revoked - */ - certRevoked: "1" | "0"; - /** - * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) - * - * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certIssuerDN: string; - /** - * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) - * - * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certSubjectDN: string; - /** - * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted) - * - * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certIssuerDNRFC2253: string; - /** - * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted) - * - * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certSubjectDNRFC2253: string; - /** The certificate issuer's distinguished name (legacy policies) */ - certIssuerDNLegacy: string; - /** The certificate subject's distinguished name (legacy policies) */ - certSubjectDNLegacy: string; - /** - * The certificate's serial number - * - * @example "00936EACBE07F201DF" - */ - certSerial: string; - /** - * The certificate issuer's serial number - * - * @example "2489002934BDFEA34" - */ - certIssuerSerial: string; - /** - * The certificate's Subject Key Identifier - * - * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4" - */ - certSKI: string; - /** - * The certificate issuer's Subject Key Identifier - * - * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4" - */ - certIssuerSKI: string; - /** - * The certificate's SHA-1 fingerprint - * - * @example "6b9109f323999e52259cda7373ff0b4d26bd232e" - */ - certFingerprintSHA1: string; - /** - * The certificate's SHA-256 fingerprint - * - * @example "acf77cf37b4156a2708e34c4eb755f9b5dbbe5ebb55adfec8f11493438d19e6ad3f157f81fa3b98278453d5652b0c1fd1d71e5695ae4d709803a4d3f39de9dea" - */ - certFingerprintSHA256: string; - /** - * The effective starting date of the certificate - * - * @example "Dec 22 19:39:00 2018 GMT" - */ - certNotBefore: string; - /** - * The effective expiration date of the certificate - * - * @example "Dec 22 19:39:00 2018 GMT" - */ - certNotAfter: string; -} -/** Placeholder values for TLS Client Authorization */ -export interface IncomingRequestCfPropertiesTLSClientAuthPlaceholder { - certPresented: "0"; - certVerified: "NONE"; - certRevoked: "0"; - certIssuerDN: ""; - certSubjectDN: ""; - certIssuerDNRFC2253: ""; - certSubjectDNRFC2253: ""; - certIssuerDNLegacy: ""; - certSubjectDNLegacy: ""; - certSerial: ""; - certIssuerSerial: ""; - certSKI: ""; - certIssuerSKI: ""; - certFingerprintSHA1: ""; - certFingerprintSHA256: ""; - certNotBefore: ""; - certNotAfter: ""; -} -/** Possible outcomes of TLS verification */ -export type CertVerificationStatus = - /** Authentication succeeded */ - | "SUCCESS" - /** No certificate was presented */ - | "NONE" - /** Failed because the certificate was self-signed */ - | "FAILED:self signed certificate" - /** Failed because the certificate failed a trust chain check */ - | "FAILED:unable to verify the first certificate" - /** Failed because the certificate not yet valid */ - | "FAILED:certificate is not yet valid" - /** Failed because the certificate is expired */ - | "FAILED:certificate has expired" - /** Failed for another unspecified reason */ - | "FAILED"; -/** - * An upstream endpoint's response to a TCP `keepalive` message from Cloudflare. - */ -export type IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus = - | 0 /** Unknown */ - | 1 /** no keepalives (not found) */ - | 2 /** no connection re-use, opening keepalive connection failed */ - | 3 /** no connection re-use, keepalive accepted and saved */ - | 4 /** connection re-use, refused by the origin server (`TCP FIN`) */ - | 5; /** connection re-use, accepted by the origin server */ -/** ISO 3166-1 Alpha-2 codes */ -export type Iso3166Alpha2Code = - | "AD" - | "AE" - | "AF" - | "AG" - | "AI" - | "AL" - | "AM" - | "AO" - | "AQ" - | "AR" - | "AS" - | "AT" - | "AU" - | "AW" - | "AX" - | "AZ" - | "BA" - | "BB" - | "BD" - | "BE" - | "BF" - | "BG" - | "BH" - | "BI" - | "BJ" - | "BL" - | "BM" - | "BN" - | "BO" - | "BQ" - | "BR" - | "BS" - | "BT" - | "BV" - | "BW" - | "BY" - | "BZ" - | "CA" - | "CC" - | "CD" - | "CF" - | "CG" - | "CH" - | "CI" - | "CK" - | "CL" - | "CM" - | "CN" - | "CO" - | "CR" - | "CU" - | "CV" - | "CW" - | "CX" - | "CY" - | "CZ" - | "DE" - | "DJ" - | "DK" - | "DM" - | "DO" - | "DZ" - | "EC" - | "EE" - | "EG" - | "EH" - | "ER" - | "ES" - | "ET" - | "FI" - | "FJ" - | "FK" - | "FM" - | "FO" - | "FR" - | "GA" - | "GB" - | "GD" - | "GE" - | "GF" - | "GG" - | "GH" - | "GI" - | "GL" - | "GM" - | "GN" - | "GP" - | "GQ" - | "GR" - | "GS" - | "GT" - | "GU" - | "GW" - | "GY" - | "HK" - | "HM" - | "HN" - | "HR" - | "HT" - | "HU" - | "ID" - | "IE" - | "IL" - | "IM" - | "IN" - | "IO" - | "IQ" - | "IR" - | "IS" - | "IT" - | "JE" - | "JM" - | "JO" - | "JP" - | "KE" - | "KG" - | "KH" - | "KI" - | "KM" - | "KN" - | "KP" - | "KR" - | "KW" - | "KY" - | "KZ" - | "LA" - | "LB" - | "LC" - | "LI" - | "LK" - | "LR" - | "LS" - | "LT" - | "LU" - | "LV" - | "LY" - | "MA" - | "MC" - | "MD" - | "ME" - | "MF" - | "MG" - | "MH" - | "MK" - | "ML" - | "MM" - | "MN" - | "MO" - | "MP" - | "MQ" - | "MR" - | "MS" - | "MT" - | "MU" - | "MV" - | "MW" - | "MX" - | "MY" - | "MZ" - | "NA" - | "NC" - | "NE" - | "NF" - | "NG" - | "NI" - | "NL" - | "NO" - | "NP" - | "NR" - | "NU" - | "NZ" - | "OM" - | "PA" - | "PE" - | "PF" - | "PG" - | "PH" - | "PK" - | "PL" - | "PM" - | "PN" - | "PR" - | "PS" - | "PT" - | "PW" - | "PY" - | "QA" - | "RE" - | "RO" - | "RS" - | "RU" - | "RW" - | "SA" - | "SB" - | "SC" - | "SD" - | "SE" - | "SG" - | "SH" - | "SI" - | "SJ" - | "SK" - | "SL" - | "SM" - | "SN" - | "SO" - | "SR" - | "SS" - | "ST" - | "SV" - | "SX" - | "SY" - | "SZ" - | "TC" - | "TD" - | "TF" - | "TG" - | "TH" - | "TJ" - | "TK" - | "TL" - | "TM" - | "TN" - | "TO" - | "TR" - | "TT" - | "TV" - | "TW" - | "TZ" - | "UA" - | "UG" - | "UM" - | "US" - | "UY" - | "UZ" - | "VA" - | "VC" - | "VE" - | "VG" - | "VI" - | "VN" - | "VU" - | "WF" - | "WS" - | "YE" - | "YT" - | "ZA" - | "ZM" - | "ZW"; -/** The 2-letter continent codes Cloudflare uses */ -export type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA"; -export type CfProperties = - | IncomingRequestCfProperties - | RequestInitCfProperties; -export interface D1Result { - results?: T[]; - success: boolean; - error?: string; - meta: any; -} -export declare abstract class D1Database { - prepare(query: string): D1PreparedStatement; - dump(): Promise; - batch(statements: D1PreparedStatement[]): Promise[]>; - exec(query: string): Promise>; -} -export declare abstract class D1PreparedStatement { - bind(...values: any[]): D1PreparedStatement; - first(colName?: string): Promise; - run(): Promise>; - all(): Promise>; - raw(): Promise; -} -/** - * A email message that is sent to a consumer Worker. - */ -export interface EmailMessage { - /** - * Envelope From attribute of the email message. - */ - readonly from: string; - /** - * Envelope To attribute of the email message. - */ - readonly to: string; - /** - * A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers). - */ - readonly headers: Headers; - /** - * Stream of the email message content. - */ - readonly raw: ReadableStream; - /** - * Size of the email message content. - */ - readonly rawSize: number; - /** - * Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason. - * @param reason The reject reason. - * @returns void - */ - setReject(reason: string): void; - /** - * Forward this email message to a verified destination address of the account. - * @param rcptTo Verified destination address. - * @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers). - * @returns A promise that resolves when the email message is forwarded. - */ - forward(rcptTo: string, headers?: Headers): Promise; -} -export declare abstract class EmailEvent extends ExtendableEvent { - readonly message: EmailMessage; -} -export type EmailExportedHandler = ( - message: EmailMessage, - env: Env, - ctx: ExecutionContext -) => void | Promise; -export type Params

= Record; -export type EventContext = { - request: Request; - functionPath: string; - waitUntil: (promise: Promise) => void; - passThroughOnException: () => void; - next: (input?: Request | string, init?: RequestInit) => Promise; - env: Env & { - ASSETS: { - fetch: typeof fetch; - }; - }; - params: Params

; - data: Data; -}; -export type PagesFunction< - Env = unknown, - Params extends string = any, - Data extends Record = Record -> = (context: EventContext) => Response | Promise; -export type EventPluginContext = { - request: Request; - functionPath: string; - waitUntil: (promise: Promise) => void; - passThroughOnException: () => void; - next: (input?: Request | string, init?: RequestInit) => Promise; - env: Env & { - ASSETS: { - fetch: typeof fetch; - }; - }; - params: Params

; - data: Data; - pluginArgs: PluginArgs; -}; -export type PagesPluginFunction< - Env = unknown, - Params extends string = any, - Data extends Record = Record, - PluginArgs = unknown -> = ( - context: EventPluginContext -) => Response | Promise; -// https://developers.cloudflare.com/pub-sub/ -// PubSubMessage represents an incoming PubSub message. -// The message includes metadata about the broker, the client, and the payload -// itself. -export interface PubSubMessage { - // Message ID - readonly mid: number; - // MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT - readonly broker: string; - // The MQTT topic the message was sent on. - readonly topic: string; - // The client ID of the client that published this message. - readonly clientId: string; - // The unique identifier (JWT ID) used by the client to authenticate, if token - // auth was used. - readonly jti?: string; - // A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker - // received the message from the client. - readonly receivedAt: number; - // An (optional) string with the MIME type of the payload, if set by the - // client. - readonly contentType: string; - // Set to 1 when the payload is a UTF-8 string - // https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063 - readonly payloadFormatIndicator: number; - // Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays. - // You can use payloadFormatIndicator to inspect this before decoding. - payload: string | Uint8Array; -} -// JsonWebKey extended by kid parameter -export interface JsonWebKeyWithKid extends JsonWebKey { - // Key Identifier of the JWK - readonly kid: string; -} -/** - * A message that is sent to a consumer Worker. - */ -export interface Message { - /** - * A unique, system-generated ID for the message. - */ - readonly id: string; - /** - * A timestamp when the message was sent. - */ - readonly timestamp: Date; - /** - * The body of the message. - */ - readonly body: Body; - /** - * Marks message to be retried. - */ - retry(): void; - /** - * Marks message acknowledged. - */ - ack(): void; -} -/** - * A batch of messages that are sent to a consumer Worker. - */ -export interface MessageBatch { - /** - * The name of the Queue that belongs to this batch. - */ - readonly queue: string; - /** - * An array of messages in the batch. Ordering of messages is not guaranteed. - */ - readonly messages: readonly Message[]; - /** - * Marks every message to be retried in the next batch. - */ - retryAll(): void; - /** - * Marks every message acknowledged in the batch. - */ - ackAll(): void; -} -/** - * A wrapper class used to structure message batches. - */ -export type MessageSendRequest = { - /** - * The body of the message. - */ - body: Body; -}; -/** - * A binding that allows a producer to send messages to a Queue. - */ -export interface Queue { - /** - * Sends a message to the Queue. - * @param message The message can be any type supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types), as long as its size is less than 128 KB. - * @returns A promise that resolves when the message is confirmed to be written to disk. - */ - send(message: Body): Promise; - /** - * Sends a batch of messages to the Queue. - * @param messages Each item in the input must be supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types). A batch can contain up to 100 messages, though items are limited to 128 KB each, and the total size of the array cannot exceed 256 KB. - * @returns A promise that resolves when the messages are confirmed to be written to disk. - */ - sendBatch(messages: Iterable>): Promise; -} diff --git a/packages/denylist_bot/node_modules/@cloudflare/workers-types/2022-01-31/index.d.ts b/packages/denylist_bot/node_modules/@cloudflare/workers-types/2022-01-31/index.d.ts deleted file mode 100755 index a3f486b32..000000000 --- a/packages/denylist_bot/node_modules/@cloudflare/workers-types/2022-01-31/index.d.ts +++ /dev/null @@ -1,2976 +0,0 @@ -/*! ***************************************************************************** -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 class DOMException extends Error { - constructor(message?: string, name?: string); - readonly message: string; - readonly name: string; - readonly code: number; - readonly stack: any; - 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; -} -declare type WorkerGlobalScopeEventMap = { - fetch: FetchEvent; - scheduled: ScheduledEvent; - unhandledrejection: PromiseRejectionEvent; - rejectionhandled: PromiseRejectionEvent; -}; -declare abstract class WorkerGlobalScope extends EventTarget { - EventTarget: typeof EventTarget; -} -declare interface Console { - "assert"(condition?: boolean, ...data: any[]): void; - clear(): void; - count(label?: string): void; - countReset(label?: string): void; - debug(...data: any[]): void; - dir(item?: any, options?: any): void; - dirxml(...data: any[]): void; - error(...data: any[]): void; - group(...data: any[]): void; - groupCollapsed(...data: any[]): void; - groupEnd(): void; - info(...data: any[]): void; - log(...data: any[]): void; - table(tabularData?: any, properties?: string[]): void; - time(label?: string): void; - timeEnd(label?: string): void; - timeLog(label?: string, ...data: any[]): void; - timeStamp(label?: string): void; - trace(...data: any[]): void; - warn(...data: any[]): void; -} -declare const console: Console; -declare type BufferSource = ArrayBufferView | ArrayBuffer; -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; - type Imports = Record; - type ExportValue = Function | Global | Memory | Table; - type Exports = Record; - 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; - function validate(bytes: BufferSource): boolean; -} -/** This ServiceWorker API interface represents the global execution context of a service worker. */ -declare 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( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args - ): number; - clearTimeout(timeoutId: number | null): void; - setInterval(callback: (...args: any[]) => void, msDelay?: number): number; - setInterval( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args - ): number; - clearInterval(timeoutId: number | null): void; - queueMicrotask(task: Function): void; - structuredClone(value: T, options?: StructuredSerializeOptions): T; - fetch( - input: RequestInfo, - init?: RequestInit - ): Promise; - self: ServiceWorkerGlobalScope; - crypto: Crypto; - caches: CacheStorage; - scheduler: Scheduler; - Event: typeof Event; - ExtendableEvent: typeof ExtendableEvent; - PromiseRejectionEvent: typeof PromiseRejectionEvent; - FetchEvent: typeof FetchEvent; - TraceEvent: typeof TraceEvent; - 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; - 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; - AbortController: typeof AbortController; - AbortSignal: typeof AbortSignal; - TextDecoder: typeof TextDecoder; - TextEncoder: typeof TextEncoder; - 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: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetAddEventListenerOptions | boolean -): void; -declare function removeEventListener< - Type extends keyof WorkerGlobalScopeEventMap ->( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetEventListenerOptions | boolean -): void; -/** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */ -declare function dispatchEvent( - event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap] -): boolean; -declare function btoa(data: string): string; -declare function atob(data: string): string; -declare function setTimeout( - callback: (...args: any[]) => void, - msDelay?: number -): number; -declare function setTimeout( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args -): number; -declare function clearTimeout(timeoutId: number | null): void; -declare function setInterval( - callback: (...args: any[]) => void, - msDelay?: number -): number; -declare function setInterval( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args -): number; -declare function clearInterval(timeoutId: number | null): void; -declare function queueMicrotask(task: Function): void; -declare function structuredClone( - value: T, - options?: StructuredSerializeOptions -): T; -declare function fetch( - input: RequestInfo, - init?: RequestInit -): Promise; -declare const self: ServiceWorkerGlobalScope; -declare const crypto: Crypto; -declare const caches: CacheStorage; -declare const scheduler: Scheduler; -declare interface TestController {} -declare interface ExecutionContext { - waitUntil(promise: Promise): void; - passThroughOnException(): void; -} -declare type ExportedHandlerFetchHandler< - Env = unknown, - CfHostMetadata = unknown -> = ( - request: Request>, - env: Env, - ctx: ExecutionContext -) => Response | Promise; -declare type ExportedHandlerTraceHandler = ( - traces: TraceItem[], - env: Env, - ctx: ExecutionContext -) => void | Promise; -declare type ExportedHandlerScheduledHandler = ( - controller: ScheduledController, - env: Env, - ctx: ExecutionContext -) => void | Promise; -declare type ExportedHandlerQueueHandler = ( - batch: MessageBatch, - env: Env, - ctx: ExecutionContext -) => void | Promise; -declare type ExportedHandlerTestHandler = ( - controller: TestController, - env: Env, - ctx: ExecutionContext -) => void | Promise; -declare interface ExportedHandler< - Env = unknown, - QueueMessage = unknown, - CfHostMetadata = unknown -> { - fetch?: ExportedHandlerFetchHandler; - trace?: ExportedHandlerTraceHandler; - scheduled?: ExportedHandlerScheduledHandler; - test?: ExportedHandlerTestHandler; - queue?: ExportedHandlerQueueHandler; -} -declare interface StructuredSerializeOptions { - transfer?: any[]; -} -declare abstract class PromiseRejectionEvent extends Event { - readonly promise: Promise; - readonly reason: any; -} -declare interface DurableObject { - fetch(request: Request): Response | Promise; - alarm?(): void | Promise; -} -declare interface DurableObjectStub extends Fetcher { - readonly id: DurableObjectId; - readonly name?: string; -} -declare interface DurableObjectId { - toString(): string; - equals(other: DurableObjectId): boolean; - readonly name?: string; -} -declare interface DurableObjectNamespace { - newUniqueId( - options?: DurableObjectNamespaceNewUniqueIdOptions - ): DurableObjectId; - idFromName(name: string): DurableObjectId; - idFromString(id: string): DurableObjectId; - get( - id: DurableObjectId, - options?: DurableObjectNamespaceGetDurableObjectOptions - ): DurableObjectStub; - jurisdiction(jurisdiction: string): DurableObjectNamespace; -} -declare interface DurableObjectNamespaceNewUniqueIdOptions { - jurisdiction?: string; -} -declare interface DurableObjectNamespaceGetDurableObjectOptions { - locationHint?: string; -} -declare interface DurableObjectState { - waitUntil(promise: Promise): void; - readonly id: DurableObjectId; - readonly storage: DurableObjectStorage; - blockConcurrencyWhile(callback: () => Promise): Promise; -} -declare interface DurableObjectTransaction { - get( - key: string, - options?: DurableObjectGetOptions - ): Promise; - get( - keys: string[], - options?: DurableObjectGetOptions - ): Promise>; - list( - options?: DurableObjectListOptions - ): Promise>; - put( - key: string, - value: T, - options?: DurableObjectPutOptions - ): Promise; - put( - entries: Record, - options?: DurableObjectPutOptions - ): Promise; - delete(key: string, options?: DurableObjectPutOptions): Promise; - delete(keys: string[], options?: DurableObjectPutOptions): Promise; - rollback(): void; - getAlarm(options?: DurableObjectGetAlarmOptions): Promise; - setAlarm( - scheduledTime: number | Date, - options?: DurableObjectSetAlarmOptions - ): Promise; - deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise; -} -declare interface DurableObjectStorage { - get( - key: string, - options?: DurableObjectGetOptions - ): Promise; - get( - keys: string[], - options?: DurableObjectGetOptions - ): Promise>; - list( - options?: DurableObjectListOptions - ): Promise>; - put( - key: string, - value: T, - options?: DurableObjectPutOptions - ): Promise; - put( - entries: Record, - options?: DurableObjectPutOptions - ): Promise; - delete(key: string, options?: DurableObjectPutOptions): Promise; - delete(keys: string[], options?: DurableObjectPutOptions): Promise; - deleteAll(options?: DurableObjectPutOptions): Promise; - transaction( - closure: (txn: DurableObjectTransaction) => Promise - ): Promise; - getAlarm(options?: DurableObjectGetAlarmOptions): Promise; - setAlarm( - scheduledTime: number | Date, - options?: DurableObjectSetAlarmOptions - ): Promise; - deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise; - sync(): Promise; -} -declare interface DurableObjectListOptions { - start?: string; - startAfter?: string; - end?: string; - prefix?: string; - reverse?: boolean; - limit?: number; - allowConcurrency?: boolean; - noCache?: boolean; -} -declare interface DurableObjectGetOptions { - allowConcurrency?: boolean; - noCache?: boolean; -} -declare interface DurableObjectGetAlarmOptions { - allowConcurrency?: boolean; -} -declare interface DurableObjectPutOptions { - allowConcurrency?: boolean; - allowUnconfirmed?: boolean; - noCache?: boolean; -} -declare interface DurableObjectSetAlarmOptions { - allowConcurrency?: boolean; - allowUnconfirmed?: boolean; -} -declare interface AnalyticsEngineDataset { - writeDataPoint(event?: AnalyticsEngineDataPoint): void; -} -declare interface AnalyticsEngineDataPoint { - indexes?: ((ArrayBuffer | string) | null)[]; - doubles?: number[]; - blobs?: ((ArrayBuffer | string) | null)[]; -} -declare class Event { - constructor(type: string, init?: EventInit); - get type(): string; - get eventPhase(): number; - get composed(): boolean; - get bubbles(): boolean; - get cancelable(): boolean; - get defaultPrevented(): boolean; - get returnValue(): boolean; - get currentTarget(): EventTarget | undefined; - get srcElement(): EventTarget | undefined; - get timeStamp(): number; - get isTrusted(): boolean; - get cancelBubble(): boolean; - set cancelBubble(value: boolean); - stopImmediatePropagation(): void; - preventDefault(): void; - stopPropagation(): void; - composedPath(): EventTarget[]; - static readonly NONE: number; - static readonly CAPTURING_PHASE: number; - static readonly AT_TARGET: number; - static readonly BUBBLING_PHASE: number; -} -declare interface EventInit { - bubbles?: boolean; - cancelable?: boolean; - composed?: boolean; -} -declare type EventListener = ( - event: EventType -) => void; -declare interface EventListenerObject { - handleEvent(event: EventType): void; -} -declare type EventListenerOrEventListenerObject< - EventType extends Event = Event -> = EventListener | EventListenerObject; -declare class EventTarget< - EventMap extends Record = Record -> { - constructor(); - addEventListener( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetAddEventListenerOptions | boolean - ): void; - removeEventListener( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetEventListenerOptions | boolean - ): void; - dispatchEvent(event: EventMap[keyof EventMap]): boolean; -} -declare interface EventTargetEventListenerOptions { - capture?: boolean; -} -declare interface EventTargetAddEventListenerOptions { - capture?: boolean; - passive?: boolean; - once?: boolean; - signal?: AbortSignal; -} -declare interface EventTargetHandlerObject { - handleEvent: (event: Event) => any | undefined; -} -declare class AbortController { - constructor(); - get signal(): AbortSignal; - abort(reason?: any): void; -} -declare abstract class AbortSignal extends EventTarget { - static abort(reason?: any): AbortSignal; - static timeout(delay: number): AbortSignal; - get aborted(): boolean; - get reason(): any; - throwIfAborted(): void; -} -declare interface Scheduler { - wait(delay: number, maybeOptions?: SchedulerWaitOptions): Promise; -} -declare interface SchedulerWaitOptions { - signal?: AbortSignal; -} -declare abstract class ExtendableEvent extends Event { - waitUntil(promise: Promise): void; -} -declare class Blob { - constructor( - bits?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[], - options?: BlobOptions - ); - get size(): number; - get type(): string; - slice(start?: number, end?: number, type?: string): Blob; - arrayBuffer(): Promise; - text(): Promise; - stream(): ReadableStream; -} -declare interface BlobOptions { - type?: string; -} -declare class File extends Blob { - constructor( - bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined, - name: string, - options?: FileOptions - ); - get name(): string; - get lastModified(): number; -} -declare interface FileOptions { - type?: string; - lastModified?: number; -} -declare abstract class CacheStorage { - open(cacheName: string): Promise; - readonly default: Cache; -} -declare abstract class Cache { - delete(request: RequestInfo, options?: CacheQueryOptions): Promise; - match( - request: RequestInfo, - options?: CacheQueryOptions - ): Promise; - put(request: RequestInfo, response: Response): Promise; -} -declare interface CacheQueryOptions { - ignoreMethod?: boolean; -} -declare abstract class Crypto { - get subtle(): SubtleCrypto; - getRandomValues< - T extends - | Int8Array - | Uint8Array - | Int16Array - | Uint16Array - | Int32Array - | Uint32Array - | BigInt64Array - | BigUint64Array - >(buffer: T): T; - randomUUID(): string; - DigestStream: typeof DigestStream; -} -declare abstract class SubtleCrypto { - encrypt( - algorithm: string | SubtleCryptoEncryptAlgorithm, - key: CryptoKey, - plainText: ArrayBuffer | ArrayBufferView - ): Promise; - decrypt( - algorithm: string | SubtleCryptoEncryptAlgorithm, - key: CryptoKey, - cipherText: ArrayBuffer | ArrayBufferView - ): Promise; - sign( - algorithm: string | SubtleCryptoSignAlgorithm, - key: CryptoKey, - data: ArrayBuffer | ArrayBufferView - ): Promise; - verify( - algorithm: string | SubtleCryptoSignAlgorithm, - key: CryptoKey, - signature: ArrayBuffer | ArrayBufferView, - data: ArrayBuffer | ArrayBufferView - ): Promise; - digest( - algorithm: string | SubtleCryptoHashAlgorithm, - data: ArrayBuffer | ArrayBufferView - ): Promise; - generateKey( - algorithm: string | SubtleCryptoGenerateKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - deriveKey( - algorithm: string | SubtleCryptoDeriveKeyAlgorithm, - baseKey: CryptoKey, - derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - deriveBits( - algorithm: string | SubtleCryptoDeriveKeyAlgorithm, - baseKey: CryptoKey, - length: number | null - ): Promise; - importKey( - format: string, - keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey, - algorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - exportKey(format: string, key: CryptoKey): Promise; - wrapKey( - format: string, - key: CryptoKey, - wrappingKey: CryptoKey, - wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm - ): Promise; - unwrapKey( - format: string, - wrappedKey: ArrayBuffer | ArrayBufferView, - unwrappingKey: CryptoKey, - unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm, - unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - timingSafeEqual( - a: ArrayBuffer | ArrayBufferView, - b: ArrayBuffer | ArrayBufferView - ): boolean; -} -declare abstract class CryptoKey { - readonly type: string; - readonly extractable: boolean; - readonly algorithm: - | CryptoKeyKeyAlgorithm - | CryptoKeyAesKeyAlgorithm - | CryptoKeyHmacKeyAlgorithm - | CryptoKeyRsaKeyAlgorithm - | CryptoKeyEllipticKeyAlgorithm - | CryptoKeyArbitraryKeyAlgorithm; - readonly usages: string[]; -} -declare interface CryptoKeyPair { - publicKey: CryptoKey; - privateKey: CryptoKey; -} -declare 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; -} -declare interface RsaOtherPrimesInfo { - r?: string; - d?: string; - t?: string; -} -declare interface SubtleCryptoDeriveKeyAlgorithm { - name: string; - salt?: ArrayBuffer; - iterations?: number; - hash?: string | SubtleCryptoHashAlgorithm; - $public?: CryptoKey; - info?: ArrayBuffer; -} -declare interface SubtleCryptoEncryptAlgorithm { - name: string; - iv?: ArrayBuffer; - additionalData?: ArrayBuffer; - tagLength?: number; - counter?: ArrayBuffer; - length?: number; - label?: ArrayBuffer; -} -declare interface SubtleCryptoGenerateKeyAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - modulusLength?: number; - publicExponent?: ArrayBuffer; - length?: number; - namedCurve?: string; -} -declare interface SubtleCryptoHashAlgorithm { - name: string; -} -declare interface SubtleCryptoImportKeyAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - length?: number; - namedCurve?: string; - compressed?: boolean; -} -declare interface SubtleCryptoSignAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - dataLength?: number; - saltLength?: number; -} -declare interface CryptoKeyKeyAlgorithm { - name: string; -} -declare interface CryptoKeyAesKeyAlgorithm { - name: string; - length: number; -} -declare interface CryptoKeyHmacKeyAlgorithm { - name: string; - hash: CryptoKeyKeyAlgorithm; - length: number; -} -declare interface CryptoKeyRsaKeyAlgorithm { - name: string; - modulusLength: number; - publicExponent: ArrayBuffer; - hash?: CryptoKeyKeyAlgorithm; -} -declare interface CryptoKeyEllipticKeyAlgorithm { - name: string; - namedCurve: string; -} -declare interface CryptoKeyArbitraryKeyAlgorithm { - name: string; - hash?: CryptoKeyKeyAlgorithm; - namedCurve?: string; - length?: number; -} -declare class DigestStream extends WritableStream< - ArrayBuffer | ArrayBufferView -> { - constructor(algorithm: string | SubtleCryptoHashAlgorithm); - get digest(): Promise; -} -declare class TextDecoder { - constructor(decoder?: string, options?: TextDecoderConstructorOptions); - decode( - input?: ArrayBuffer | ArrayBufferView, - options?: TextDecoderDecodeOptions - ): string; - get encoding(): string; - get fatal(): boolean; - get ignoreBOM(): boolean; -} -declare class TextEncoder { - constructor(); - encode(input?: string): Uint8Array; - encodeInto(input: string, buffer: Uint8Array): TextEncoderEncodeIntoResult; - get encoding(): string; -} -declare interface TextDecoderConstructorOptions { - fatal: boolean; - ignoreBOM: boolean; -} -declare interface TextDecoderDecodeOptions { - stream: boolean; -} -declare interface TextEncoderEncodeIntoResult { - read: number; - written: number; -} -declare class FormData { - constructor(); - append(name: string, value: string): void; - append(name: string, value: Blob, filename?: string): void; - delete(name: string): void; - get(name: string): (File | string) | null; - getAll(name: string): (File | string)[]; - has(name: string): boolean; - set(name: string, value: string): void; - set(name: string, value: Blob, filename?: string): void; - entries(): IterableIterator<[key: string, value: File | string]>; - keys(): IterableIterator; - values(): IterableIterator; - forEach( - callback: ( - this: This, - value: File | string, - key: string, - parent: FormData - ) => void, - thisArg?: This - ): void; - [Symbol.iterator](): IterableIterator<[key: string, value: File | string]>; -} -declare interface ContentOptions { - html?: boolean; -} -declare class HTMLRewriter { - constructor(); - on( - selector: string, - handlers: HTMLRewriterElementContentHandlers - ): HTMLRewriter; - onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter; - transform(response: Response): Response; -} -declare interface HTMLRewriterElementContentHandlers { - element?(element: Element): void | Promise; - comments?(comment: Comment): void | Promise; - text?(element: Text): void | Promise; -} -declare interface HTMLRewriterDocumentContentHandlers { - doctype?(doctype: Doctype): void | Promise; - comments?(comment: Comment): void | Promise; - text?(text: Text): void | Promise; - end?(end: DocumentEnd): void | Promise; -} -declare interface Doctype { - readonly name: string | null; - readonly publicId: string | null; - readonly systemId: string | null; -} -declare interface Element { - tagName: string; - readonly attributes: IterableIterator; - 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, options?: ContentOptions): Element; - after(content: string, options?: ContentOptions): Element; - prepend(content: string, options?: ContentOptions): Element; - append(content: string, options?: ContentOptions): Element; - replace(content: string, options?: ContentOptions): Element; - remove(): Element; - removeAndKeepContent(): Element; - setInnerContent(content: string, options?: ContentOptions): Element; - onEndTag(handler: (tag: EndTag) => void | Promise): void; -} -declare interface EndTag { - name: string; - before(content: string, options?: ContentOptions): EndTag; - after(content: string, options?: ContentOptions): EndTag; - remove(): EndTag; -} -declare 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; -} -declare interface Text { - readonly text: string; - readonly lastInTextNode: boolean; - readonly removed: boolean; - before(content: string, options?: ContentOptions): Text; - after(content: string, options?: ContentOptions): Text; - replace(content: string, options?: ContentOptions): Text; - remove(): Text; -} -declare interface DocumentEnd { - append(content: string, options?: ContentOptions): DocumentEnd; -} -declare abstract class FetchEvent extends ExtendableEvent { - readonly request: Request; - respondWith(promise: Response | Promise): void; - passThroughOnException(): void; -} -declare type HeadersInit = - | Headers - | Iterable> - | Record; -declare class Headers { - constructor(init?: HeadersInit); - get(name: string): string | null; - getAll(name: string): string[]; - has(name: string): boolean; - set(name: string, value: string): void; - append(name: string, value: string): void; - delete(name: string): void; - forEach( - callback: (this: This, value: string, key: string, parent: Headers) => void, - thisArg?: This - ): void; - entries(): IterableIterator<[key: string, value: string]>; - keys(): IterableIterator; - values(): IterableIterator; - [Symbol.iterator](): IterableIterator<[key: string, value: string]>; -} -declare type BodyInit = - | ReadableStream - | string - | ArrayBuffer - | ArrayBufferView - | Blob - | URLSearchParams - | FormData; -declare abstract class Body { - get body(): ReadableStream | null; - get bodyUsed(): boolean; - arrayBuffer(): Promise; - text(): Promise; - json(): Promise; - formData(): Promise; - blob(): Promise; -} -declare class Response extends Body { - constructor(body?: BodyInit | null, init?: ResponseInit); - static redirect(url: string, status?: number): Response; - static json(any: any, maybeInit?: ResponseInit | Response): Response; - clone(): Response; - get status(): number; - get statusText(): string; - get headers(): Headers; - get ok(): boolean; - get redirected(): boolean; - get url(): string; - get webSocket(): WebSocket | null; - get cf(): any | undefined; -} -declare interface ResponseInit { - status?: number; - statusText?: string; - headers?: HeadersInit; - cf?: any; - webSocket?: WebSocket | null; - encodeBody?: "automatic" | "manual"; -} -declare type RequestInfo< - CfHostMetadata = unknown, - Cf = CfProperties -> = Request | string | URL; -declare class Request< - CfHostMetadata = unknown, - Cf = CfProperties -> extends Body { - constructor(input: RequestInfo, init?: RequestInit); - clone(): Request; - get method(): string; - get url(): string; - get headers(): Headers; - get redirect(): string; - get fetcher(): Fetcher | null; - get signal(): AbortSignal; - get cf(): Cf | undefined; - get integrity(): string; - get keepalive(): boolean; -} -declare interface RequestInit { - /** 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 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; -} -declare abstract class Fetcher { - fetch(input: RequestInfo, init?: RequestInit): Promise; -} -declare interface FetcherPutOptions { - expiration?: number; - expirationTtl?: number; -} -declare interface KVNamespaceListKey { - name: Key; - expiration?: number; - metadata?: Metadata; -} -declare type KVNamespaceListResult = - | { - list_complete: false; - keys: KVNamespaceListKey[]; - cursor: string; - } - | { - list_complete: true; - keys: KVNamespaceListKey[]; - }; -declare interface KVNamespace { - get( - key: Key, - options?: Partial> - ): Promise; - get(key: Key, type: "text"): Promise; - get( - key: Key, - type: "json" - ): Promise; - get(key: Key, type: "arrayBuffer"): Promise; - get(key: Key, type: "stream"): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"text"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"json"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"arrayBuffer"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"stream"> - ): Promise; - list( - options?: KVNamespaceListOptions - ): Promise>; - put( - key: Key, - value: string | ArrayBuffer | ArrayBufferView | ReadableStream, - options?: KVNamespacePutOptions - ): Promise; - getWithMetadata( - key: Key, - options?: Partial> - ): Promise>; - getWithMetadata( - key: Key, - type: "text" - ): Promise>; - getWithMetadata( - key: Key, - type: "json" - ): Promise>; - getWithMetadata( - key: Key, - type: "arrayBuffer" - ): Promise>; - getWithMetadata( - key: Key, - type: "stream" - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"text"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"json"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"arrayBuffer"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"stream"> - ): Promise>; - delete(key: Key): Promise; -} -declare interface KVNamespaceListOptions { - limit?: number; - prefix?: string | null; - cursor?: string | null; -} -declare interface KVNamespaceGetOptions { - type: Type; - cacheTtl?: number; -} -declare interface KVNamespacePutOptions { - expiration?: number; - expirationTtl?: number; - metadata?: any | null; -} -declare interface KVNamespaceGetWithMetadataResult { - value: Value | null; - metadata: Metadata | null; -} -declare interface R2Error extends Error { - readonly name: string; - readonly code: number; - readonly message: string; - readonly action: string; - readonly stack: any; -} -declare interface R2ListOptions { - limit?: number; - prefix?: string; - cursor?: string; - delimiter?: string; - startAfter?: string; -} -declare abstract class R2Bucket { - head(key: string): Promise; - get( - key: string, - options: R2GetOptions & { - onlyIf: R2Conditional | Headers; - } - ): Promise; - get(key: string, options?: R2GetOptions): Promise; - put( - key: string, - value: - | ReadableStream - | ArrayBuffer - | ArrayBufferView - | string - | null - | Blob, - options?: R2PutOptions - ): Promise; - put( - key: string, - value: - | ReadableStream - | ArrayBuffer - | ArrayBufferView - | string - | null - | Blob, - options?: R2PutOptions & { - onlyIf: R2Conditional | Headers; - } - ): Promise; - createMultipartUpload( - key: string, - options?: R2MultipartOptions - ): Promise; - resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload; - delete(keys: string | string[]): Promise; - list(options?: R2ListOptions): Promise; -} -declare interface R2MultipartUpload { - readonly key: string; - readonly uploadId: string; - uploadPart( - partNumber: number, - value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob - ): Promise; - abort(): Promise; - complete(uploadedParts: R2UploadedPart[]): Promise; -} -declare 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; - readonly range?: R2Range; - writeHttpMetadata(headers: Headers): void; -} -declare interface R2ObjectBody extends R2Object { - get body(): ReadableStream; - get bodyUsed(): boolean; - arrayBuffer(): Promise; - text(): Promise; - json(): Promise; - blob(): Promise; -} -declare type R2Range = - | { - offset: number; - length?: number; - } - | { - offset?: number; - length: number; - } - | { - suffix: number; - }; -declare interface R2Conditional { - etagMatches?: string; - etagDoesNotMatch?: string; - uploadedBefore?: Date; - uploadedAfter?: Date; - secondsGranularity?: boolean; -} -declare interface R2GetOptions { - onlyIf?: R2Conditional | Headers; - range?: R2Range | Headers; -} -declare interface R2PutOptions { - onlyIf?: R2Conditional | Headers; - httpMetadata?: R2HTTPMetadata | Headers; - customMetadata?: Record; - md5?: ArrayBuffer | string; - sha1?: ArrayBuffer | string; - sha256?: ArrayBuffer | string; - sha384?: ArrayBuffer | string; - sha512?: ArrayBuffer | string; -} -declare interface R2MultipartOptions { - httpMetadata?: R2HTTPMetadata | Headers; - customMetadata?: Record; -} -declare interface R2Checksums { - readonly md5?: ArrayBuffer; - readonly sha1?: ArrayBuffer; - readonly sha256?: ArrayBuffer; - readonly sha384?: ArrayBuffer; - readonly sha512?: ArrayBuffer; - toJSON(): R2StringChecksums; -} -declare interface R2StringChecksums { - md5?: string; - sha1?: string; - sha256?: string; - sha384?: string; - sha512?: string; -} -declare interface R2HTTPMetadata { - contentType?: string; - contentLanguage?: string; - contentDisposition?: string; - contentEncoding?: string; - cacheControl?: string; - cacheExpiry?: Date; -} -declare interface R2Objects { - objects: R2Object[]; - truncated: boolean; - cursor?: string; - delimitedPrefixes: string[]; -} -declare abstract class ScheduledEvent extends ExtendableEvent { - readonly scheduledTime: number; - readonly cron: string; - noRetry(): void; -} -declare interface ScheduledController { - readonly scheduledTime: number; - readonly cron: string; - noRetry(): void; -} -declare interface QueuingStrategy { - highWaterMark?: number | bigint; - size?: (chunk: T) => number | bigint; -} -declare interface UnderlyingSink { - type?: string; - start?: (controller: WritableStreamDefaultController) => void | Promise; - write?: ( - chunk: W, - controller: WritableStreamDefaultController - ) => void | Promise; - abort?: (reason: any) => void | Promise; - close?: () => void | Promise; -} -declare interface UnderlyingByteSource { - type: "bytes"; - autoAllocateChunkSize?: number; - start?: (controller: ReadableByteStreamController) => void | Promise; - pull?: (controller: ReadableByteStreamController) => void | Promise; - cancel?: (reason: any) => void | Promise; -} -declare interface UnderlyingSource { - type?: "" | undefined; - start?: ( - controller: ReadableStreamDefaultController - ) => void | Promise; - pull?: ( - controller: ReadableStreamDefaultController - ) => void | Promise; - cancel?: (reason: any) => void | Promise; -} -declare interface Transformer { - readableType?: string; - writableType?: string; - start?: ( - controller: TransformStreamDefaultController - ) => void | Promise; - transform?: ( - chunk: I, - controller: TransformStreamDefaultController - ) => void | Promise; - flush?: ( - controller: TransformStreamDefaultController - ) => void | Promise; -} -declare interface StreamPipeOptions { - /** - * 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; - preventAbort?: boolean; - preventCancel?: boolean; - signal?: AbortSignal; -} -declare type ReadableStreamReadResult = - | { - done: false; - value: R; - } - | { - done: true; - value?: undefined; - }; -/** This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object. */ -declare interface ReadableStream { - get locked(): boolean; - cancel(reason?: any): Promise; - getReader(): ReadableStreamDefaultReader; - getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader; - pipeThrough( - transform: ReadableWritablePair, - options?: StreamPipeOptions - ): ReadableStream; - pipeTo( - destination: WritableStream, - options?: StreamPipeOptions - ): Promise; - tee(): [ReadableStream, ReadableStream]; - values(options?: ReadableStreamValuesOptions): AsyncIterableIterator; - [Symbol.asyncIterator]( - options?: ReadableStreamValuesOptions - ): AsyncIterableIterator; -} -declare const ReadableStream: { - prototype: ReadableStream; - new ( - underlyingSource: UnderlyingByteSource, - strategy?: QueuingStrategy - ): ReadableStream; - new ( - underlyingSource?: UnderlyingSource, - strategy?: QueuingStrategy - ): ReadableStream; -}; -declare class ReadableStreamDefaultReader { - constructor(stream: ReadableStream); - get closed(): Promise; - cancel(reason?: any): Promise; - read(): Promise>; - releaseLock(): void; -} -declare class ReadableStreamBYOBReader { - constructor(stream: ReadableStream); - get closed(): Promise; - cancel(reason?: any): Promise; - read( - view: T - ): Promise>; - releaseLock(): void; - readAtLeast( - minElements: number, - view: T - ): Promise>; -} -declare interface ReadableStreamGetReaderOptions { - mode: "byob"; -} -declare interface ReadableStreamBYOBRequest { - readonly view: Uint8Array | null; - respond(bytesWritten: number): void; - respondWithNewView(view: ArrayBuffer | ArrayBufferView): void; - readonly atLeast: number | null; -} -declare interface ReadableStreamDefaultController { - readonly desiredSize: number | null; - close(): void; - enqueue(chunk?: R): void; - error(reason: any): void; -} -declare interface ReadableByteStreamController { - readonly byobRequest: ReadableStreamBYOBRequest | null; - readonly desiredSize: number | null; - close(): void; - enqueue(chunk: ArrayBuffer | ArrayBufferView): void; - error(reason: any): void; -} -/** This Streams API interface represents a controller allowing control of a WritableStream's state. When constructing a WritableStream, the underlying sink is given a corresponding WritableStreamDefaultController instance to manipulate. */ -declare interface WritableStreamDefaultController { - readonly signal: AbortSignal; - error(reason?: any): void; -} -declare interface TransformStreamDefaultController { - get desiredSize(): number | null; - enqueue(chunk?: O): void; - error(reason: any): void; - terminate(): void; -} -declare interface ReadableWritablePair { - /** - * 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; - readable: ReadableStream; -} -declare class WritableStream { - constructor( - underlyingSink?: UnderlyingSink, - queuingStrategy?: QueuingStrategy - ); - get locked(): boolean; - abort(reason?: any): Promise; - close(): Promise; - getWriter(): WritableStreamDefaultWriter; -} -declare class WritableStreamDefaultWriter { - constructor(stream: WritableStream); - get closed(): Promise; - get ready(): Promise; - get desiredSize(): number | null; - abort(reason?: any): Promise; - close(): Promise; - write(chunk?: W): Promise; - releaseLock(): void; -} -declare class TransformStream { - constructor( - transformer?: Transformer, - writableStrategy?: QueuingStrategy, - readableStrategy?: QueuingStrategy - ); - get readable(): ReadableStream; - get writable(): WritableStream; -} -declare class FixedLengthStream extends IdentityTransformStream { - constructor(expectedLength: number | bigint); -} -declare class IdentityTransformStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(); -} -declare interface ReadableStreamValuesOptions { - preventCancel?: boolean; -} -declare class CompressionStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(format: "gzip" | "deflate" | "deflate-raw"); -} -declare class DecompressionStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(format: "gzip" | "deflate" | "deflate-raw"); -} -declare class TextEncoderStream extends TransformStream { - constructor(); -} -declare class TextDecoderStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - string -> { - constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit); -} -declare interface TextDecoderStreamTextDecoderStreamInit { - fatal?: boolean; -} -declare class ByteLengthQueuingStrategy - implements QueuingStrategy -{ - constructor(init: QueuingStrategyInit); - get highWaterMark(): number; - get size(): (chunk?: any) => number; -} -declare class CountQueuingStrategy implements QueuingStrategy { - constructor(init: QueuingStrategyInit); - get highWaterMark(): number; - get size(): (chunk?: any) => number; -} -declare 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; -} -declare abstract class TraceEvent extends ExtendableEvent { - readonly traces: TraceItem[]; -} -declare interface TraceItem { - readonly event: - | ( - | TraceItemFetchEventInfo - | TraceItemScheduledEventInfo - | TraceItemAlarmEventInfo - | TraceItemQueueEventInfo - | TraceItemEmailEventInfo - | TraceItemCustomEventInfo - ) - | null; - readonly eventTimestamp: number | null; - readonly logs: TraceLog[]; - readonly exceptions: TraceException[]; - readonly scriptName: string | null; - readonly dispatchNamespace?: string; - readonly scriptTags?: string[]; - readonly outcome: string; -} -declare interface TraceItemAlarmEventInfo { - readonly scheduledTime: Date; -} -declare interface TraceItemCustomEventInfo {} -declare interface TraceItemScheduledEventInfo { - readonly scheduledTime: number; - readonly cron: string; -} -declare interface TraceItemQueueEventInfo { - readonly queue: string; - readonly batchSize: number; -} -declare interface TraceItemEmailEventInfo { - readonly mailFrom: string; - readonly rcptTo: string; - readonly rawSize: number; -} -declare interface TraceItemFetchEventInfo { - readonly response?: TraceItemFetchEventInfoResponse; - readonly request: TraceItemFetchEventInfoRequest; -} -declare interface TraceItemFetchEventInfoRequest { - readonly cf?: any; - readonly headers: Record; - readonly method: string; - readonly url: string; - getUnredacted(): TraceItemFetchEventInfoRequest; -} -declare interface TraceItemFetchEventInfoResponse { - readonly status: number; -} -declare interface TraceLog { - readonly timestamp: number; - readonly level: string; - readonly message: any; -} -declare interface TraceException { - readonly timestamp: number; - readonly message: string; - readonly name: string; -} -declare interface TraceMetrics { - readonly cpuTime: number; - readonly wallTime: number; -} -declare interface UnsafeTraceMetrics { - fromTrace(item: TraceItem): TraceMetrics; -} -declare class URL { - constructor(url: string | URL, base?: string | URL); - get href(): string; - set href(value: string); - get origin(): string; - get protocol(): string; - set protocol(value: string); - get username(): string; - set username(value: string); - get password(): string; - set password(value: string); - get host(): string; - set host(value: string); - get hostname(): string; - set hostname(value: string); - get port(): string; - set port(value: string); - get pathname(): string; - set pathname(value: string); - get search(): string; - set search(value: string); - get searchParams(): URLSearchParams; - get hash(): string; - set hash(value: string); - toString(): string; - toJSON(): string; -} -declare class URLSearchParams { - constructor( - init?: - | URLSearchParams - | string - | Record - | [key: string, value: string][] - ); - get size(): number; - append(name: string, value: string): void; - delete(name: string): void; - get(name: string): string | null; - getAll(name: string): string[]; - has(name: string): boolean; - set(name: string, value: string): void; - sort(): void; - entries(): IterableIterator<[key: string, value: string]>; - keys(): IterableIterator; - values(): IterableIterator; - forEach( - callback: ( - this: This, - value: string, - key: string, - parent: URLSearchParams - ) => void, - thisArg?: This - ): void; - toString(): string; - [Symbol.iterator](): IterableIterator<[key: string, value: string]>; -} -declare class URLPattern { - constructor(input?: string | URLPatternURLPatternInit, baseURL?: string); - get protocol(): string; - get username(): string; - get password(): string; - get hostname(): string; - get port(): string; - get pathname(): string; - get search(): string; - get hash(): string; - test(input?: string | URLPatternURLPatternInit, baseURL?: string): boolean; - exec( - input?: string | URLPatternURLPatternInit, - baseURL?: string - ): URLPatternURLPatternResult | null; -} -declare interface URLPatternURLPatternInit { - protocol?: string; - username?: string; - password?: string; - hostname?: string; - port?: string; - pathname?: string; - search?: string; - hash?: string; - baseURL?: string; -} -declare interface URLPatternURLPatternComponentResult { - input: string; - groups: Record; -} -declare interface URLPatternURLPatternResult { - inputs: (string | URLPatternURLPatternInit)[]; - protocol: URLPatternURLPatternComponentResult; - username: URLPatternURLPatternComponentResult; - password: URLPatternURLPatternComponentResult; - hostname: URLPatternURLPatternComponentResult; - port: URLPatternURLPatternComponentResult; - pathname: URLPatternURLPatternComponentResult; - search: URLPatternURLPatternComponentResult; - hash: URLPatternURLPatternComponentResult; -} -declare class CloseEvent extends Event { - constructor(type: string, initializer: CloseEventInit); - /** Returns the WebSocket connection close code provided by the server. */ - readonly code: number; - /** Returns the WebSocket connection close reason provided by the server. */ - readonly reason: string; - /** Returns true if the connection closed cleanly; false otherwise. */ - readonly wasClean: boolean; -} -declare interface CloseEventInit { - code?: number; - reason?: string; - wasClean?: boolean; -} -declare class MessageEvent extends Event { - constructor(type: string, initializer: MessageEventInit); - readonly data: ArrayBuffer | string; -} -declare interface MessageEventInit { - data: ArrayBuffer | string; -} -/** Events providing information related to errors in scripts or in files. */ -declare interface ErrorEvent extends Event { - readonly filename: string; - readonly message: string; - readonly lineno: number; - readonly colno: number; - readonly error: any; -} -declare type WebSocketEventMap = { - close: CloseEvent; - message: MessageEvent; - open: Event; - error: ErrorEvent; -}; -declare class WebSocket extends EventTarget { - constructor(url: string, protocols?: string[] | string); - accept(): void; - send(message: (ArrayBuffer | ArrayBufferView) | string): void; - close(code?: number, reason?: string): void; - static readonly READY_STATE_CONNECTING: number; - static readonly READY_STATE_OPEN: number; - static readonly READY_STATE_CLOSING: number; - static readonly READY_STATE_CLOSED: number; - get readyState(): number; - get url(): string | null; - get protocol(): string | null; - get extensions(): string | null; -} -declare const WebSocketPair: { - new (): { - 0: WebSocket; - 1: WebSocket; - }; -}; -declare interface BasicImageTransformations { - /** - * Maximum width in image pixels. The value must be an integer. - */ - width?: number; - /** - * Maximum height in image pixels. The value must be an integer. - */ - height?: number; - /** - * Resizing mode as a string. It affects interpretation of width and height - * options: - * - scale-down: Similar to contain, but the image is never enlarged. If - * the image is larger than given width or height, it will be resized. - * Otherwise its original size will be kept. - * - contain: Resizes to maximum size that fits within the given width and - * height. If only a single dimension is given (e.g. only width), the - * image will be shrunk or enlarged to exactly match that dimension. - * Aspect ratio is always preserved. - * - cover: Resizes (shrinks or enlarges) to fill the entire area of width - * and height. If the image has an aspect ratio different from the ratio - * of width and height, it will be cropped to fit. - * - crop: The image will be shrunk and cropped to fit within the area - * specified by width and height. The image will not be enlarged. For images - * smaller than the given dimensions it's the same as scale-down. For - * images larger than the given dimensions, it's the same as cover. - * See also trim. - * - pad: Resizes to the maximum size that fits within the given width and - * height, and then fills the remaining area with a background color - * (white by default). Use of this mode is not recommended, as the same - * effect can be more efficiently achieved with the contain mode and the - * CSS object-fit: contain property. - */ - fit?: "scale-down" | "contain" | "cover" | "crop" | "pad"; - /** - * When cropping with fit: "cover", this defines the side or point that should - * be left uncropped. The value is either a string - * "left", "right", "top", "bottom", "auto", or "center" (the default), - * or an object {x, y} containing focal point coordinates in the original - * image expressed as fractions ranging from 0.0 (top or left) to 1.0 - * (bottom or right), 0.5 being the center. {fit: "cover", gravity: "top"} will - * crop bottom or left and right sides as necessary, but won’t crop anything - * from the top. {fit: "cover", gravity: {x:0.5, y:0.2}} will crop each side to - * preserve as much as possible around a point at 20% of the height of the - * source image. - */ - gravity?: - | "left" - | "right" - | "top" - | "bottom" - | "center" - | "auto" - | BasicImageTransformationsGravityCoordinates; - /** - * Background color to add underneath the image. Applies only to images with - * transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…), - * hsl(…), etc.) - */ - background?: string; - /** - * Number of degrees (90, 180, 270) to rotate the image by. width and height - * options refer to axes after rotation. - */ - rotate?: 0 | 90 | 180 | 270 | 360; -} -declare interface BasicImageTransformationsGravityCoordinates { - x: number; - y: number; -} -/** - * In addition to the properties you can set in the RequestInit dict - * that you pass as an argument to the Request constructor, you can - * set certain properties of a `cf` object to control how Cloudflare - * features are applied to that new Request. - * - * Note: Currently, these properties cannot be tested in the - * playground. - */ -declare interface RequestInitCfProperties extends Record { - cacheEverything?: boolean; - /** - * A request's cache key is what determines if two requests are - * "the same" for caching purposes. If a request has the same cache key - * as some previous request, then we can serve the same cached response for - * both. (e.g. 'some-key') - * - * Only available for Enterprise customers. - */ - cacheKey?: string; - /** - * This allows you to append additional Cache-Tag response headers - * to the origin response without modifications to the origin server. - * This will allow for greater control over the Purge by Cache Tag feature - * utilizing changes only in the Workers process. - * - * Only available for Enterprise customers. - */ - cacheTags?: string[]; - /** - * Force response to be cached for a given number of seconds. (e.g. 300) - */ - cacheTtl?: number; - /** - * Force response to be cached for a given number of seconds based on the Origin status code. - * (e.g. { '200-299': 86400, '404': 1, '500-599': 0 }) - */ - cacheTtlByStatus?: Record; - scrapeShield?: boolean; - apps?: boolean; - image?: RequestInitCfPropertiesImage; - minify?: RequestInitCfPropertiesImageMinify; - mirage?: boolean; - polish?: "lossy" | "lossless" | "off"; - /** - * Redirects the request to an alternate origin server. You can use this, - * for example, to implement load balancing across several origins. - * (e.g.us-east.example.com) - * - * Note - For security reasons, the hostname set in resolveOverride must - * be proxied on the same Cloudflare zone of the incoming request. - * Otherwise, the setting is ignored. CNAME hosts are allowed, so to - * resolve to a host under a different domain or a DNS only domain first - * declare a CNAME record within your own zone’s DNS mapping to the - * external hostname, set proxy on Cloudflare, then set resolveOverride - * to point to that CNAME record. - */ - resolveOverride?: string; -} -declare interface RequestInitCfPropertiesImageDraw - extends BasicImageTransformations { - /** - * Absolute URL of the image file to use for the drawing. It can be any of - * the supported file formats. For drawing of watermarks or non-rectangular - * overlays we recommend using PNG or WebP images. - */ - url: string; - /** - * Floating-point number between 0 (transparent) and 1 (opaque). - * For example, opacity: 0.5 makes overlay semitransparent. - */ - opacity?: number; - /** - * - If set to true, the overlay image will be tiled to cover the entire - * area. This is useful for stock-photo-like watermarks. - * - If set to "x", the overlay image will be tiled horizontally only - * (form a line). - * - If set to "y", the overlay image will be tiled vertically only - * (form a line). - */ - repeat?: true | "x" | "y"; - /** - * Position of the overlay image relative to a given edge. Each property is - * an offset in pixels. 0 aligns exactly to the edge. For example, left: 10 - * positions left side of the overlay 10 pixels from the left edge of the - * image it's drawn over. bottom: 0 aligns bottom of the overlay with bottom - * of the background image. - * - * Setting both left & right, or both top & bottom is an error. - * - * If no position is specified, the image will be centered. - */ - top?: number; - left?: number; - bottom?: number; - right?: number; -} -declare interface RequestInitCfPropertiesImage - extends BasicImageTransformations { - /** - * Device Pixel Ratio. Default 1. Multiplier for width/height that makes it - * easier to specify higher-DPI sizes in . - */ - dpr?: number; - /** - * An object with four properties {left, top, right, bottom} that specify - * a number of pixels to cut off on each side. Allows removal of borders - * or cutting out a specific fragment of an image. Trimming is performed - * before resizing or rotation. Takes dpr into account. - */ - trim?: { - left?: number; - top?: number; - right?: number; - bottom?: number; - }; - /** - * Quality setting from 1-100 (useful values are in 60-90 range). Lower values - * make images look worse, but load faster. The default is 85. It applies only - * to JPEG and WebP images. It doesn’t have any effect on PNG. - */ - quality?: number; - /** - * Output format to generate. It can be: - * - avif: generate images in AVIF format. - * - webp: generate images in Google WebP format. Set quality to 100 to get - * the WebP-lossless format. - * - json: instead of generating an image, outputs information about the - * image, in JSON format. The JSON object will contain image size - * (before and after resizing), source image’s MIME type, file size, etc. - * - jpeg: generate images in JPEG format. - * - png: generate images in PNG format. - */ - format?: "avif" | "webp" | "json" | "jpeg" | "png"; - /** - * Whether to preserve animation frames from input files. Default is true. - * Setting it to false reduces animations to still images. This setting is - * recommended when enlarging images or processing arbitrary user content, - * because large GIF animations can weigh tens or even hundreds of megabytes. - * It is also useful to set anim:false when using format:"json" to get the - * response quicker without the number of frames. - */ - anim?: boolean; - /** - * What EXIF data should be preserved in the output image. Note that EXIF - * rotation and embedded color profiles are always applied ("baked in" into - * the image), and aren't affected by this option. Note that if the Polish - * feature is enabled, all metadata may have been removed already and this - * option may have no effect. - * - keep: Preserve most of EXIF metadata, including GPS location if there's - * any. - * - copyright: Only keep the copyright tag, and discard everything else. - * This is the default behavior for JPEG files. - * - none: Discard all invisible EXIF metadata. Currently WebP and PNG - * output formats always discard metadata. - */ - metadata?: "keep" | "copyright" | "none"; - /** - * Strength of sharpening filter to apply to the image. Floating-point - * number between 0 (no sharpening, default) and 10 (maximum). 1.0 is a - * recommended value for downscaled images. - */ - sharpen?: number; - /** - * Radius of a blur filter (approximate gaussian). Maximum supported radius - * is 250. - */ - blur?: number; - /** - * Overlays are drawn in the order they appear in the array (last array - * entry is the topmost layer). - */ - draw?: RequestInitCfPropertiesImageDraw[]; - /** - * Fetching image from authenticated origin. Setting this property will - * pass authentication headers (Authorization, Cookie, etc.) through to - * the origin. - */ - "origin-auth"?: "share-publicly"; - /** - * Adds a border around the image. The border is added after resizing. Border - * width takes dpr into account, and can be specified either using a single - * width property, or individually for each side. - */ - border?: - | { - color: string; - width: number; - } - | { - color: string; - top: number; - right: number; - bottom: number; - left: number; - }; - /** - * Increase brightness by a factor. A value of 1.0 equals no change, a value - * of 0.5 equals half brightness, and a value of 2.0 equals twice as bright. - * 0 is ignored. - */ - brightness?: number; - /** - * Increase contrast by a factor. A value of 1.0 equals no change, a value of - * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is - * ignored. - */ - contrast?: number; - /** - * Increase exposure by a factor. A value of 1.0 equals no change, a value of - * 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored. - */ - gamma?: number; - /** - * Slightly reduces latency on a cache miss by selecting a - * quickest-to-compress file format, at a cost of increased file size and - * lower image quality. It will usually override the format option and choose - * JPEG over WebP or AVIF. We do not recommend using this option, except in - * unusual circumstances like resizing uncacheable dynamically-generated - * images. - */ - compression?: "fast"; -} -declare interface RequestInitCfPropertiesImageMinify { - javascript?: boolean; - css?: boolean; - html?: boolean; -} -/** - * Request metadata provided by Cloudflare's edge. - */ -declare type IncomingRequestCfProperties = - IncomingRequestCfPropertiesBase & - IncomingRequestCfPropertiesBotManagementEnterprise & - IncomingRequestCfPropertiesCloudflareForSaaSEnterprise & - IncomingRequestCfPropertiesGeographicInformation & - IncomingRequestCfPropertiesCloudflareAccessOrApiShield; -declare interface IncomingRequestCfPropertiesBase - extends Record { - /** - * [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request. - * - * @example 395747 - */ - asn: number; - /** - * The organization which owns the ASN of the incoming request. - * - * @example "Google Cloud" - */ - asOrganization: string; - /** - * The original value of the `Accept-Encoding` header if Cloudflare modified it. - * - * @example "gzip, deflate, br" - */ - clientAcceptEncoding?: string; - /** - * The number of milliseconds it took for the request to reach your worker. - * - * @example 22 - */ - clientTcpRtt?: number; - /** - * The three-letter [IATA](https://en.wikipedia.org/wiki/IATA_airport_code) - * airport code of the data center that the request hit. - * - * @example "DFW" - */ - colo: string; - /** - * Represents the upstream's response to a - * [TCP `keepalive` message](https://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html) - * from cloudflare. - * - * For workers with no upstream, this will always be `1`. - * - * @example 3 - */ - edgeRequestKeepAliveStatus: IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus; - /** - * The HTTP Protocol the request used. - * - * @example "HTTP/2" - */ - httpProtocol: string; - /** - * The browser-requested prioritization information in the request object. - * - * If no information was set, defaults to the empty string `""` - * - * @example "weight=192;exclusive=0;group=3;group-weight=127" - * @default "" - */ - requestPriority: string; - /** - * The TLS version of the connection to Cloudflare. - * In requests served over plaintext (without TLS), this property is the empty string `""`. - * - * @example "TLSv1.3" - */ - tlsVersion: string; - /** - * The cipher for the connection to Cloudflare. - * In requests served over plaintext (without TLS), this property is the empty string `""`. - * - * @example "AEAD-AES128-GCM-SHA256" - */ - tlsCipher: string; - /** - * Metadata containing the [`HELLO`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2) and [`FINISHED`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9) messages from this request's TLS handshake. - * - * If the incoming request was served over plaintext (without TLS) this field is undefined. - */ - tlsExportedAuthenticator?: IncomingRequestCfPropertiesExportedAuthenticatorMetadata; -} -declare interface IncomingRequestCfPropertiesBotManagementBase { - /** - * Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot, - * represented as an integer percentage between `1` (almost certainly human) - * and `99` (almost certainly a bot). - * - * @example 54 - */ - score: number; - /** - * A boolean value that is true if the request comes from a good bot, like Google or Bing. - * Most customers choose to allow this traffic. For more details, see [Traffic from known bots](https://developers.cloudflare.com/firewall/known-issues-and-faq/#how-does-firewall-rules-handle-traffic-from-known-bots). - */ - verifiedBot: boolean; - /** - * A boolean value that is true if the request originates from a - * Cloudflare-verified proxy service. - */ - corporateProxy: boolean; - /** - * A boolean value that's true if the request matches [file extensions](https://developers.cloudflare.com/bots/reference/static-resources/) for many types of static resources. - */ - staticResource: boolean; - /** - * List of IDs that correlate to the Bot Management heuristic detections made on a request (you can have multiple heuristic detections on the same request). - */ - detectionIds: number[]; -} -declare interface IncomingRequestCfPropertiesBotManagement { - /** - * Results of Cloudflare's Bot Management analysis - */ - botManagement: IncomingRequestCfPropertiesBotManagementBase; - /** - * Duplicate of `botManagement.score`. - * - * @deprecated - */ - clientTrustScore: number; -} -declare interface IncomingRequestCfPropertiesBotManagementEnterprise - extends IncomingRequestCfPropertiesBotManagement { - /** - * Results of Cloudflare's Bot Management analysis - */ - botManagement: IncomingRequestCfPropertiesBotManagementBase & { - /** - * A [JA3 Fingerprint](https://developers.cloudflare.com/bots/concepts/ja3-fingerprint/) to help profile specific SSL/TLS clients - * across different destination IPs, Ports, and X509 certificates. - */ - ja3Hash: string; - }; -} -declare interface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise< - HostMetadata -> { - /** - * Custom metadata set per-host in [Cloudflare for SaaS](https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/). - * - * This field is only present if you have Cloudflare for SaaS enabled on your account - * and you have followed the [required steps to enable it]((https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/domain-support/custom-metadata/)). - */ - hostMetadata: HostMetadata; -} -declare interface IncomingRequestCfPropertiesCloudflareAccessOrApiShield { - /** - * Information about the client certificate presented to Cloudflare. - * - * This is populated when the incoming request is served over TLS using - * either Cloudflare Access or API Shield (mTLS) - * and the presented SSL certificate has a valid - * [Certificate Serial Number](https://ldapwiki.com/wiki/Certificate%20Serial%20Number) - * (i.e., not `null` or `""`). - * - * Otherwise, a set of placeholder values are used. - * - * The property `certPresented` will be set to `"1"` when - * the object is populated (i.e. the above conditions were met). - */ - tlsClientAuth: - | IncomingRequestCfPropertiesTLSClientAuth - | IncomingRequestCfPropertiesTLSClientAuthPlaceholder; -} -/** - * Metadata about the request's TLS handshake - */ -declare interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata { - /** - * The client's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal - * - * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d" - */ - clientHandshake: string; - /** - * The server's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal - * - * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d" - */ - serverHandshake: string; - /** - * The client's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal - * - * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b" - */ - clientFinished: string; - /** - * The server's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal - * - * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b" - */ - serverFinished: string; -} -/** - * Geographic data about the request's origin. - */ -declare interface IncomingRequestCfPropertiesGeographicInformation { - /** - * The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from. - * - * If your worker is [configured to accept TOR connections](https://support.cloudflare.com/hc/en-us/articles/203306930-Understanding-Cloudflare-Tor-support-and-Onion-Routing), this may also be `"T1"`, indicating a request that originated over TOR. - * - * If Cloudflare is unable to determine where the request originated this property is omitted. - * - * The country code `"T1"` is used for requests originating on TOR. - * - * @example "GB" - */ - country?: Iso3166Alpha2Code | "T1"; - /** - * If present, this property indicates that the request originated in the EU - * - * @example "1" - */ - isEUCountry?: "1"; - /** - * A two-letter code indicating the continent the request originated from. - * - * @example "AN" - */ - continent?: ContinentCode; - /** - * The city the request originated from - * - * @example "Austin" - */ - city?: string; - /** - * Postal code of the incoming request - * - * @example "78701" - */ - postalCode?: string; - /** - * Latitude of the incoming request - * - * @example "30.27130" - */ - latitude?: string; - /** - * Longitude of the incoming request - * - * @example "-97.74260" - */ - longitude?: string; - /** - * Timezone of the incoming request - * - * @example "America/Chicago" - */ - timezone?: string; - /** - * If known, the ISO 3166-2 name for the first level region associated with - * the IP address of the incoming request - * - * @example "Texas" - */ - region?: string; - /** - * If known, the ISO 3166-2 code for the first-level region associated with - * the IP address of the incoming request - * - * @example "TX" - */ - regionCode?: string; - /** - * Metro code (DMA) of the incoming request - * - * @example "635" - */ - metroCode?: string; -} -/** Data about the incoming request's TLS certificate */ -declare interface IncomingRequestCfPropertiesTLSClientAuth { - /** Always `"1"`, indicating that the certificate was presented */ - certPresented: "1"; - /** - * Result of certificate verification. - * - * @example "FAILED:self signed certificate" - */ - certVerified: Exclude; - /** The presented certificate's revokation status. - * - * - A value of `"1"` indicates the certificate has been revoked - * - A value of `"0"` indicates the certificate has not been revoked - */ - certRevoked: "1" | "0"; - /** - * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) - * - * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certIssuerDN: string; - /** - * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) - * - * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certSubjectDN: string; - /** - * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted) - * - * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certIssuerDNRFC2253: string; - /** - * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted) - * - * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certSubjectDNRFC2253: string; - /** The certificate issuer's distinguished name (legacy policies) */ - certIssuerDNLegacy: string; - /** The certificate subject's distinguished name (legacy policies) */ - certSubjectDNLegacy: string; - /** - * The certificate's serial number - * - * @example "00936EACBE07F201DF" - */ - certSerial: string; - /** - * The certificate issuer's serial number - * - * @example "2489002934BDFEA34" - */ - certIssuerSerial: string; - /** - * The certificate's Subject Key Identifier - * - * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4" - */ - certSKI: string; - /** - * The certificate issuer's Subject Key Identifier - * - * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4" - */ - certIssuerSKI: string; - /** - * The certificate's SHA-1 fingerprint - * - * @example "6b9109f323999e52259cda7373ff0b4d26bd232e" - */ - certFingerprintSHA1: string; - /** - * The certificate's SHA-256 fingerprint - * - * @example "acf77cf37b4156a2708e34c4eb755f9b5dbbe5ebb55adfec8f11493438d19e6ad3f157f81fa3b98278453d5652b0c1fd1d71e5695ae4d709803a4d3f39de9dea" - */ - certFingerprintSHA256: string; - /** - * The effective starting date of the certificate - * - * @example "Dec 22 19:39:00 2018 GMT" - */ - certNotBefore: string; - /** - * The effective expiration date of the certificate - * - * @example "Dec 22 19:39:00 2018 GMT" - */ - certNotAfter: string; -} -/** Placeholder values for TLS Client Authorization */ -declare interface IncomingRequestCfPropertiesTLSClientAuthPlaceholder { - certPresented: "0"; - certVerified: "NONE"; - certRevoked: "0"; - certIssuerDN: ""; - certSubjectDN: ""; - certIssuerDNRFC2253: ""; - certSubjectDNRFC2253: ""; - certIssuerDNLegacy: ""; - certSubjectDNLegacy: ""; - certSerial: ""; - certIssuerSerial: ""; - certSKI: ""; - certIssuerSKI: ""; - certFingerprintSHA1: ""; - certFingerprintSHA256: ""; - certNotBefore: ""; - certNotAfter: ""; -} -/** Possible outcomes of TLS verification */ -declare type CertVerificationStatus = - /** Authentication succeeded */ - | "SUCCESS" - /** No certificate was presented */ - | "NONE" - /** Failed because the certificate was self-signed */ - | "FAILED:self signed certificate" - /** Failed because the certificate failed a trust chain check */ - | "FAILED:unable to verify the first certificate" - /** Failed because the certificate not yet valid */ - | "FAILED:certificate is not yet valid" - /** Failed because the certificate is expired */ - | "FAILED:certificate has expired" - /** Failed for another unspecified reason */ - | "FAILED"; -/** - * An upstream endpoint's response to a TCP `keepalive` message from Cloudflare. - */ -declare type IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus = - | 0 /** Unknown */ - | 1 /** no keepalives (not found) */ - | 2 /** no connection re-use, opening keepalive connection failed */ - | 3 /** no connection re-use, keepalive accepted and saved */ - | 4 /** connection re-use, refused by the origin server (`TCP FIN`) */ - | 5; /** connection re-use, accepted by the origin server */ -/** ISO 3166-1 Alpha-2 codes */ -declare type Iso3166Alpha2Code = - | "AD" - | "AE" - | "AF" - | "AG" - | "AI" - | "AL" - | "AM" - | "AO" - | "AQ" - | "AR" - | "AS" - | "AT" - | "AU" - | "AW" - | "AX" - | "AZ" - | "BA" - | "BB" - | "BD" - | "BE" - | "BF" - | "BG" - | "BH" - | "BI" - | "BJ" - | "BL" - | "BM" - | "BN" - | "BO" - | "BQ" - | "BR" - | "BS" - | "BT" - | "BV" - | "BW" - | "BY" - | "BZ" - | "CA" - | "CC" - | "CD" - | "CF" - | "CG" - | "CH" - | "CI" - | "CK" - | "CL" - | "CM" - | "CN" - | "CO" - | "CR" - | "CU" - | "CV" - | "CW" - | "CX" - | "CY" - | "CZ" - | "DE" - | "DJ" - | "DK" - | "DM" - | "DO" - | "DZ" - | "EC" - | "EE" - | "EG" - | "EH" - | "ER" - | "ES" - | "ET" - | "FI" - | "FJ" - | "FK" - | "FM" - | "FO" - | "FR" - | "GA" - | "GB" - | "GD" - | "GE" - | "GF" - | "GG" - | "GH" - | "GI" - | "GL" - | "GM" - | "GN" - | "GP" - | "GQ" - | "GR" - | "GS" - | "GT" - | "GU" - | "GW" - | "GY" - | "HK" - | "HM" - | "HN" - | "HR" - | "HT" - | "HU" - | "ID" - | "IE" - | "IL" - | "IM" - | "IN" - | "IO" - | "IQ" - | "IR" - | "IS" - | "IT" - | "JE" - | "JM" - | "JO" - | "JP" - | "KE" - | "KG" - | "KH" - | "KI" - | "KM" - | "KN" - | "KP" - | "KR" - | "KW" - | "KY" - | "KZ" - | "LA" - | "LB" - | "LC" - | "LI" - | "LK" - | "LR" - | "LS" - | "LT" - | "LU" - | "LV" - | "LY" - | "MA" - | "MC" - | "MD" - | "ME" - | "MF" - | "MG" - | "MH" - | "MK" - | "ML" - | "MM" - | "MN" - | "MO" - | "MP" - | "MQ" - | "MR" - | "MS" - | "MT" - | "MU" - | "MV" - | "MW" - | "MX" - | "MY" - | "MZ" - | "NA" - | "NC" - | "NE" - | "NF" - | "NG" - | "NI" - | "NL" - | "NO" - | "NP" - | "NR" - | "NU" - | "NZ" - | "OM" - | "PA" - | "PE" - | "PF" - | "PG" - | "PH" - | "PK" - | "PL" - | "PM" - | "PN" - | "PR" - | "PS" - | "PT" - | "PW" - | "PY" - | "QA" - | "RE" - | "RO" - | "RS" - | "RU" - | "RW" - | "SA" - | "SB" - | "SC" - | "SD" - | "SE" - | "SG" - | "SH" - | "SI" - | "SJ" - | "SK" - | "SL" - | "SM" - | "SN" - | "SO" - | "SR" - | "SS" - | "ST" - | "SV" - | "SX" - | "SY" - | "SZ" - | "TC" - | "TD" - | "TF" - | "TG" - | "TH" - | "TJ" - | "TK" - | "TL" - | "TM" - | "TN" - | "TO" - | "TR" - | "TT" - | "TV" - | "TW" - | "TZ" - | "UA" - | "UG" - | "UM" - | "US" - | "UY" - | "UZ" - | "VA" - | "VC" - | "VE" - | "VG" - | "VI" - | "VN" - | "VU" - | "WF" - | "WS" - | "YE" - | "YT" - | "ZA" - | "ZM" - | "ZW"; -/** The 2-letter continent codes Cloudflare uses */ -declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA"; -declare type CfProperties = - | IncomingRequestCfProperties - | RequestInitCfProperties; -declare interface D1Result { - results?: T[]; - success: boolean; - error?: string; - meta: any; -} -declare abstract class D1Database { - prepare(query: string): D1PreparedStatement; - dump(): Promise; - batch(statements: D1PreparedStatement[]): Promise[]>; - exec(query: string): Promise>; -} -declare abstract class D1PreparedStatement { - bind(...values: any[]): D1PreparedStatement; - first(colName?: string): Promise; - run(): Promise>; - all(): Promise>; - raw(): Promise; -} -/** - * A email message that is sent to a consumer Worker. - */ -declare interface EmailMessage { - /** - * Envelope From attribute of the email message. - */ - readonly from: string; - /** - * Envelope To attribute of the email message. - */ - readonly to: string; - /** - * A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers). - */ - readonly headers: Headers; - /** - * Stream of the email message content. - */ - readonly raw: ReadableStream; - /** - * Size of the email message content. - */ - readonly rawSize: number; - /** - * Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason. - * @param reason The reject reason. - * @returns void - */ - setReject(reason: string): void; - /** - * Forward this email message to a verified destination address of the account. - * @param rcptTo Verified destination address. - * @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers). - * @returns A promise that resolves when the email message is forwarded. - */ - forward(rcptTo: string, headers?: Headers): Promise; -} -declare abstract class EmailEvent extends ExtendableEvent { - readonly message: EmailMessage; -} -declare type EmailExportedHandler = ( - message: EmailMessage, - env: Env, - ctx: ExecutionContext -) => void | Promise; -declare type Params

= Record; -declare type EventContext = { - request: Request; - functionPath: string; - waitUntil: (promise: Promise) => void; - passThroughOnException: () => void; - next: (input?: Request | string, init?: RequestInit) => Promise; - env: Env & { - ASSETS: { - fetch: typeof fetch; - }; - }; - params: Params

; - data: Data; -}; -declare type PagesFunction< - Env = unknown, - Params extends string = any, - Data extends Record = Record -> = (context: EventContext) => Response | Promise; -declare type EventPluginContext = { - request: Request; - functionPath: string; - waitUntil: (promise: Promise) => void; - passThroughOnException: () => void; - next: (input?: Request | string, init?: RequestInit) => Promise; - env: Env & { - ASSETS: { - fetch: typeof fetch; - }; - }; - params: Params

; - data: Data; - pluginArgs: PluginArgs; -}; -declare type PagesPluginFunction< - Env = unknown, - Params extends string = any, - Data extends Record = Record, - PluginArgs = unknown -> = ( - context: EventPluginContext -) => Response | Promise; -declare module "assets:*" { - export const onRequest: PagesFunction; -} -// https://developers.cloudflare.com/pub-sub/ -// PubSubMessage represents an incoming PubSub message. -// The message includes metadata about the broker, the client, and the payload -// itself. -declare interface PubSubMessage { - // Message ID - readonly mid: number; - // MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT - readonly broker: string; - // The MQTT topic the message was sent on. - readonly topic: string; - // The client ID of the client that published this message. - readonly clientId: string; - // The unique identifier (JWT ID) used by the client to authenticate, if token - // auth was used. - readonly jti?: string; - // A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker - // received the message from the client. - readonly receivedAt: number; - // An (optional) string with the MIME type of the payload, if set by the - // client. - readonly contentType: string; - // Set to 1 when the payload is a UTF-8 string - // https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063 - readonly payloadFormatIndicator: number; - // Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays. - // You can use payloadFormatIndicator to inspect this before decoding. - payload: string | Uint8Array; -} -// JsonWebKey extended by kid parameter -declare interface JsonWebKeyWithKid extends JsonWebKey { - // Key Identifier of the JWK - readonly kid: string; -} -/** - * A message that is sent to a consumer Worker. - */ -declare interface Message { - /** - * A unique, system-generated ID for the message. - */ - readonly id: string; - /** - * A timestamp when the message was sent. - */ - readonly timestamp: Date; - /** - * The body of the message. - */ - readonly body: Body; - /** - * Marks message to be retried. - */ - retry(): void; - /** - * Marks message acknowledged. - */ - ack(): void; -} -/** - * A batch of messages that are sent to a consumer Worker. - */ -declare interface MessageBatch { - /** - * The name of the Queue that belongs to this batch. - */ - readonly queue: string; - /** - * An array of messages in the batch. Ordering of messages is not guaranteed. - */ - readonly messages: readonly Message[]; - /** - * Marks every message to be retried in the next batch. - */ - retryAll(): void; - /** - * Marks every message acknowledged in the batch. - */ - ackAll(): void; -} -/** - * A wrapper class used to structure message batches. - */ -declare type MessageSendRequest = { - /** - * The body of the message. - */ - body: Body; -}; -/** - * A binding that allows a producer to send messages to a Queue. - */ -declare interface Queue { - /** - * Sends a message to the Queue. - * @param message The message can be any type supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types), as long as its size is less than 128 KB. - * @returns A promise that resolves when the message is confirmed to be written to disk. - */ - send(message: Body): Promise; - /** - * Sends a batch of messages to the Queue. - * @param messages Each item in the input must be supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types). A batch can contain up to 100 messages, though items are limited to 128 KB each, and the total size of the array cannot exceed 256 KB. - * @returns A promise that resolves when the messages are confirmed to be written to disk. - */ - sendBatch(messages: Iterable>): Promise; -} diff --git a/packages/denylist_bot/node_modules/@cloudflare/workers-types/2022-01-31/index.ts b/packages/denylist_bot/node_modules/@cloudflare/workers-types/2022-01-31/index.ts deleted file mode 100755 index a3e359964..000000000 --- a/packages/denylist_bot/node_modules/@cloudflare/workers-types/2022-01-31/index.ts +++ /dev/null @@ -1,2978 +0,0 @@ -/*! ***************************************************************************** -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 -export declare class DOMException extends Error { - constructor(message?: string, name?: string); - readonly message: string; - readonly name: string; - readonly code: number; - readonly stack: any; - 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; -} -export type WorkerGlobalScopeEventMap = { - fetch: FetchEvent; - scheduled: ScheduledEvent; - unhandledrejection: PromiseRejectionEvent; - rejectionhandled: PromiseRejectionEvent; -}; -export declare abstract class WorkerGlobalScope extends EventTarget { - EventTarget: typeof EventTarget; -} -export interface Console { - "assert"(condition?: boolean, ...data: any[]): void; - clear(): void; - count(label?: string): void; - countReset(label?: string): void; - debug(...data: any[]): void; - dir(item?: any, options?: any): void; - dirxml(...data: any[]): void; - error(...data: any[]): void; - group(...data: any[]): void; - groupCollapsed(...data: any[]): void; - groupEnd(): void; - info(...data: any[]): void; - log(...data: any[]): void; - table(tabularData?: any, properties?: string[]): void; - time(label?: string): void; - timeEnd(label?: string): void; - timeLog(label?: string, ...data: any[]): void; - timeStamp(label?: string): void; - trace(...data: any[]): void; - warn(...data: any[]): void; -} -export declare const console: Console; -export type BufferSource = ArrayBufferView | ArrayBuffer; -export 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; - type Imports = Record; - type ExportValue = Function | Global | Memory | Table; - type Exports = Record; - 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; - function validate(bytes: BufferSource): boolean; -} -/** This ServiceWorker API interface represents the global execution context of a service worker. */ -export 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( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args - ): number; - clearTimeout(timeoutId: number | null): void; - setInterval(callback: (...args: any[]) => void, msDelay?: number): number; - setInterval( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args - ): number; - clearInterval(timeoutId: number | null): void; - queueMicrotask(task: Function): void; - structuredClone(value: T, options?: StructuredSerializeOptions): T; - fetch( - input: RequestInfo, - init?: RequestInit - ): Promise; - self: ServiceWorkerGlobalScope; - crypto: Crypto; - caches: CacheStorage; - scheduler: Scheduler; - Event: typeof Event; - ExtendableEvent: typeof ExtendableEvent; - PromiseRejectionEvent: typeof PromiseRejectionEvent; - FetchEvent: typeof FetchEvent; - TraceEvent: typeof TraceEvent; - 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; - 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; - AbortController: typeof AbortController; - AbortSignal: typeof AbortSignal; - TextDecoder: typeof TextDecoder; - TextEncoder: typeof TextEncoder; - 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; -} -export declare function addEventListener< - Type extends keyof WorkerGlobalScopeEventMap ->( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetAddEventListenerOptions | boolean -): void; -export declare function removeEventListener< - Type extends keyof WorkerGlobalScopeEventMap ->( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetEventListenerOptions | boolean -): void; -/** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */ -export declare function dispatchEvent( - event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap] -): boolean; -export declare function btoa(data: string): string; -export declare function atob(data: string): string; -export declare function setTimeout( - callback: (...args: any[]) => void, - msDelay?: number -): number; -export declare function setTimeout( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args -): number; -export declare function clearTimeout(timeoutId: number | null): void; -export declare function setInterval( - callback: (...args: any[]) => void, - msDelay?: number -): number; -export declare function setInterval( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args -): number; -export declare function clearInterval(timeoutId: number | null): void; -export declare function queueMicrotask(task: Function): void; -export declare function structuredClone( - value: T, - options?: StructuredSerializeOptions -): T; -export declare function fetch( - input: RequestInfo, - init?: RequestInit -): Promise; -export declare const self: ServiceWorkerGlobalScope; -export declare const crypto: Crypto; -export declare const caches: CacheStorage; -export declare const scheduler: Scheduler; -export interface TestController {} -export interface ExecutionContext { - waitUntil(promise: Promise): void; - passThroughOnException(): void; -} -export type ExportedHandlerFetchHandler< - Env = unknown, - CfHostMetadata = unknown -> = ( - request: Request>, - env: Env, - ctx: ExecutionContext -) => Response | Promise; -export type ExportedHandlerTraceHandler = ( - traces: TraceItem[], - env: Env, - ctx: ExecutionContext -) => void | Promise; -export type ExportedHandlerScheduledHandler = ( - controller: ScheduledController, - env: Env, - ctx: ExecutionContext -) => void | Promise; -export type ExportedHandlerQueueHandler = ( - batch: MessageBatch, - env: Env, - ctx: ExecutionContext -) => void | Promise; -export type ExportedHandlerTestHandler = ( - controller: TestController, - env: Env, - ctx: ExecutionContext -) => void | Promise; -export interface ExportedHandler< - Env = unknown, - QueueMessage = unknown, - CfHostMetadata = unknown -> { - fetch?: ExportedHandlerFetchHandler; - trace?: ExportedHandlerTraceHandler; - scheduled?: ExportedHandlerScheduledHandler; - test?: ExportedHandlerTestHandler; - queue?: ExportedHandlerQueueHandler; -} -export interface StructuredSerializeOptions { - transfer?: any[]; -} -export declare abstract class PromiseRejectionEvent extends Event { - readonly promise: Promise; - readonly reason: any; -} -export interface DurableObject { - fetch(request: Request): Response | Promise; - alarm?(): void | Promise; -} -export interface DurableObjectStub extends Fetcher { - readonly id: DurableObjectId; - readonly name?: string; -} -export interface DurableObjectId { - toString(): string; - equals(other: DurableObjectId): boolean; - readonly name?: string; -} -export interface DurableObjectNamespace { - newUniqueId( - options?: DurableObjectNamespaceNewUniqueIdOptions - ): DurableObjectId; - idFromName(name: string): DurableObjectId; - idFromString(id: string): DurableObjectId; - get( - id: DurableObjectId, - options?: DurableObjectNamespaceGetDurableObjectOptions - ): DurableObjectStub; - jurisdiction(jurisdiction: string): DurableObjectNamespace; -} -export interface DurableObjectNamespaceNewUniqueIdOptions { - jurisdiction?: string; -} -export interface DurableObjectNamespaceGetDurableObjectOptions { - locationHint?: string; -} -export interface DurableObjectState { - waitUntil(promise: Promise): void; - readonly id: DurableObjectId; - readonly storage: DurableObjectStorage; - blockConcurrencyWhile(callback: () => Promise): Promise; -} -export interface DurableObjectTransaction { - get( - key: string, - options?: DurableObjectGetOptions - ): Promise; - get( - keys: string[], - options?: DurableObjectGetOptions - ): Promise>; - list( - options?: DurableObjectListOptions - ): Promise>; - put( - key: string, - value: T, - options?: DurableObjectPutOptions - ): Promise; - put( - entries: Record, - options?: DurableObjectPutOptions - ): Promise; - delete(key: string, options?: DurableObjectPutOptions): Promise; - delete(keys: string[], options?: DurableObjectPutOptions): Promise; - rollback(): void; - getAlarm(options?: DurableObjectGetAlarmOptions): Promise; - setAlarm( - scheduledTime: number | Date, - options?: DurableObjectSetAlarmOptions - ): Promise; - deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise; -} -export interface DurableObjectStorage { - get( - key: string, - options?: DurableObjectGetOptions - ): Promise; - get( - keys: string[], - options?: DurableObjectGetOptions - ): Promise>; - list( - options?: DurableObjectListOptions - ): Promise>; - put( - key: string, - value: T, - options?: DurableObjectPutOptions - ): Promise; - put( - entries: Record, - options?: DurableObjectPutOptions - ): Promise; - delete(key: string, options?: DurableObjectPutOptions): Promise; - delete(keys: string[], options?: DurableObjectPutOptions): Promise; - deleteAll(options?: DurableObjectPutOptions): Promise; - transaction( - closure: (txn: DurableObjectTransaction) => Promise - ): Promise; - getAlarm(options?: DurableObjectGetAlarmOptions): Promise; - setAlarm( - scheduledTime: number | Date, - options?: DurableObjectSetAlarmOptions - ): Promise; - deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise; - sync(): Promise; -} -export interface DurableObjectListOptions { - start?: string; - startAfter?: string; - end?: string; - prefix?: string; - reverse?: boolean; - limit?: number; - allowConcurrency?: boolean; - noCache?: boolean; -} -export interface DurableObjectGetOptions { - allowConcurrency?: boolean; - noCache?: boolean; -} -export interface DurableObjectGetAlarmOptions { - allowConcurrency?: boolean; -} -export interface DurableObjectPutOptions { - allowConcurrency?: boolean; - allowUnconfirmed?: boolean; - noCache?: boolean; -} -export interface DurableObjectSetAlarmOptions { - allowConcurrency?: boolean; - allowUnconfirmed?: boolean; -} -export interface AnalyticsEngineDataset { - writeDataPoint(event?: AnalyticsEngineDataPoint): void; -} -export interface AnalyticsEngineDataPoint { - indexes?: ((ArrayBuffer | string) | null)[]; - doubles?: number[]; - blobs?: ((ArrayBuffer | string) | null)[]; -} -export declare class Event { - constructor(type: string, init?: EventInit); - get type(): string; - get eventPhase(): number; - get composed(): boolean; - get bubbles(): boolean; - get cancelable(): boolean; - get defaultPrevented(): boolean; - get returnValue(): boolean; - get currentTarget(): EventTarget | undefined; - get srcElement(): EventTarget | undefined; - get timeStamp(): number; - get isTrusted(): boolean; - get cancelBubble(): boolean; - set cancelBubble(value: boolean); - stopImmediatePropagation(): void; - preventDefault(): void; - stopPropagation(): void; - composedPath(): EventTarget[]; - static readonly NONE: number; - static readonly CAPTURING_PHASE: number; - static readonly AT_TARGET: number; - static readonly BUBBLING_PHASE: number; -} -export interface EventInit { - bubbles?: boolean; - cancelable?: boolean; - composed?: boolean; -} -export type EventListener = ( - event: EventType -) => void; -export interface EventListenerObject { - handleEvent(event: EventType): void; -} -export type EventListenerOrEventListenerObject< - EventType extends Event = Event -> = EventListener | EventListenerObject; -export declare class EventTarget< - EventMap extends Record = Record -> { - constructor(); - addEventListener( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetAddEventListenerOptions | boolean - ): void; - removeEventListener( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetEventListenerOptions | boolean - ): void; - dispatchEvent(event: EventMap[keyof EventMap]): boolean; -} -export interface EventTargetEventListenerOptions { - capture?: boolean; -} -export interface EventTargetAddEventListenerOptions { - capture?: boolean; - passive?: boolean; - once?: boolean; - signal?: AbortSignal; -} -export interface EventTargetHandlerObject { - handleEvent: (event: Event) => any | undefined; -} -export declare class AbortController { - constructor(); - get signal(): AbortSignal; - abort(reason?: any): void; -} -export declare abstract class AbortSignal extends EventTarget { - static abort(reason?: any): AbortSignal; - static timeout(delay: number): AbortSignal; - get aborted(): boolean; - get reason(): any; - throwIfAborted(): void; -} -export interface Scheduler { - wait(delay: number, maybeOptions?: SchedulerWaitOptions): Promise; -} -export interface SchedulerWaitOptions { - signal?: AbortSignal; -} -export declare abstract class ExtendableEvent extends Event { - waitUntil(promise: Promise): void; -} -export declare class Blob { - constructor( - bits?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[], - options?: BlobOptions - ); - get size(): number; - get type(): string; - slice(start?: number, end?: number, type?: string): Blob; - arrayBuffer(): Promise; - text(): Promise; - stream(): ReadableStream; -} -export interface BlobOptions { - type?: string; -} -export declare class File extends Blob { - constructor( - bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined, - name: string, - options?: FileOptions - ); - get name(): string; - get lastModified(): number; -} -export interface FileOptions { - type?: string; - lastModified?: number; -} -export declare abstract class CacheStorage { - open(cacheName: string): Promise; - readonly default: Cache; -} -export declare abstract class Cache { - delete(request: RequestInfo, options?: CacheQueryOptions): Promise; - match( - request: RequestInfo, - options?: CacheQueryOptions - ): Promise; - put(request: RequestInfo, response: Response): Promise; -} -export interface CacheQueryOptions { - ignoreMethod?: boolean; -} -export declare abstract class Crypto { - get subtle(): SubtleCrypto; - getRandomValues< - T extends - | Int8Array - | Uint8Array - | Int16Array - | Uint16Array - | Int32Array - | Uint32Array - | BigInt64Array - | BigUint64Array - >(buffer: T): T; - randomUUID(): string; - DigestStream: typeof DigestStream; -} -export declare abstract class SubtleCrypto { - encrypt( - algorithm: string | SubtleCryptoEncryptAlgorithm, - key: CryptoKey, - plainText: ArrayBuffer | ArrayBufferView - ): Promise; - decrypt( - algorithm: string | SubtleCryptoEncryptAlgorithm, - key: CryptoKey, - cipherText: ArrayBuffer | ArrayBufferView - ): Promise; - sign( - algorithm: string | SubtleCryptoSignAlgorithm, - key: CryptoKey, - data: ArrayBuffer | ArrayBufferView - ): Promise; - verify( - algorithm: string | SubtleCryptoSignAlgorithm, - key: CryptoKey, - signature: ArrayBuffer | ArrayBufferView, - data: ArrayBuffer | ArrayBufferView - ): Promise; - digest( - algorithm: string | SubtleCryptoHashAlgorithm, - data: ArrayBuffer | ArrayBufferView - ): Promise; - generateKey( - algorithm: string | SubtleCryptoGenerateKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - deriveKey( - algorithm: string | SubtleCryptoDeriveKeyAlgorithm, - baseKey: CryptoKey, - derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - deriveBits( - algorithm: string | SubtleCryptoDeriveKeyAlgorithm, - baseKey: CryptoKey, - length: number | null - ): Promise; - importKey( - format: string, - keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey, - algorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - exportKey(format: string, key: CryptoKey): Promise; - wrapKey( - format: string, - key: CryptoKey, - wrappingKey: CryptoKey, - wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm - ): Promise; - unwrapKey( - format: string, - wrappedKey: ArrayBuffer | ArrayBufferView, - unwrappingKey: CryptoKey, - unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm, - unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - timingSafeEqual( - a: ArrayBuffer | ArrayBufferView, - b: ArrayBuffer | ArrayBufferView - ): boolean; -} -export declare abstract class CryptoKey { - readonly type: string; - readonly extractable: boolean; - readonly algorithm: - | CryptoKeyKeyAlgorithm - | CryptoKeyAesKeyAlgorithm - | CryptoKeyHmacKeyAlgorithm - | CryptoKeyRsaKeyAlgorithm - | CryptoKeyEllipticKeyAlgorithm - | CryptoKeyArbitraryKeyAlgorithm; - readonly usages: string[]; -} -export interface CryptoKeyPair { - publicKey: CryptoKey; - privateKey: CryptoKey; -} -export 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; -} -export interface RsaOtherPrimesInfo { - r?: string; - d?: string; - t?: string; -} -export interface SubtleCryptoDeriveKeyAlgorithm { - name: string; - salt?: ArrayBuffer; - iterations?: number; - hash?: string | SubtleCryptoHashAlgorithm; - $public?: CryptoKey; - info?: ArrayBuffer; -} -export interface SubtleCryptoEncryptAlgorithm { - name: string; - iv?: ArrayBuffer; - additionalData?: ArrayBuffer; - tagLength?: number; - counter?: ArrayBuffer; - length?: number; - label?: ArrayBuffer; -} -export interface SubtleCryptoGenerateKeyAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - modulusLength?: number; - publicExponent?: ArrayBuffer; - length?: number; - namedCurve?: string; -} -export interface SubtleCryptoHashAlgorithm { - name: string; -} -export interface SubtleCryptoImportKeyAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - length?: number; - namedCurve?: string; - compressed?: boolean; -} -export interface SubtleCryptoSignAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - dataLength?: number; - saltLength?: number; -} -export interface CryptoKeyKeyAlgorithm { - name: string; -} -export interface CryptoKeyAesKeyAlgorithm { - name: string; - length: number; -} -export interface CryptoKeyHmacKeyAlgorithm { - name: string; - hash: CryptoKeyKeyAlgorithm; - length: number; -} -export interface CryptoKeyRsaKeyAlgorithm { - name: string; - modulusLength: number; - publicExponent: ArrayBuffer; - hash?: CryptoKeyKeyAlgorithm; -} -export interface CryptoKeyEllipticKeyAlgorithm { - name: string; - namedCurve: string; -} -export interface CryptoKeyArbitraryKeyAlgorithm { - name: string; - hash?: CryptoKeyKeyAlgorithm; - namedCurve?: string; - length?: number; -} -export declare class DigestStream extends WritableStream< - ArrayBuffer | ArrayBufferView -> { - constructor(algorithm: string | SubtleCryptoHashAlgorithm); - get digest(): Promise; -} -export declare class TextDecoder { - constructor(decoder?: string, options?: TextDecoderConstructorOptions); - decode( - input?: ArrayBuffer | ArrayBufferView, - options?: TextDecoderDecodeOptions - ): string; - get encoding(): string; - get fatal(): boolean; - get ignoreBOM(): boolean; -} -export declare class TextEncoder { - constructor(); - encode(input?: string): Uint8Array; - encodeInto(input: string, buffer: Uint8Array): TextEncoderEncodeIntoResult; - get encoding(): string; -} -export interface TextDecoderConstructorOptions { - fatal: boolean; - ignoreBOM: boolean; -} -export interface TextDecoderDecodeOptions { - stream: boolean; -} -export interface TextEncoderEncodeIntoResult { - read: number; - written: number; -} -export declare class FormData { - constructor(); - append(name: string, value: string): void; - append(name: string, value: Blob, filename?: string): void; - delete(name: string): void; - get(name: string): (File | string) | null; - getAll(name: string): (File | string)[]; - has(name: string): boolean; - set(name: string, value: string): void; - set(name: string, value: Blob, filename?: string): void; - entries(): IterableIterator<[key: string, value: File | string]>; - keys(): IterableIterator; - values(): IterableIterator; - forEach( - callback: ( - this: This, - value: File | string, - key: string, - parent: FormData - ) => void, - thisArg?: This - ): void; - [Symbol.iterator](): IterableIterator<[key: string, value: File | string]>; -} -export interface ContentOptions { - html?: boolean; -} -export declare class HTMLRewriter { - constructor(); - on( - selector: string, - handlers: HTMLRewriterElementContentHandlers - ): HTMLRewriter; - onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter; - transform(response: Response): Response; -} -export interface HTMLRewriterElementContentHandlers { - element?(element: Element): void | Promise; - comments?(comment: Comment): void | Promise; - text?(element: Text): void | Promise; -} -export interface HTMLRewriterDocumentContentHandlers { - doctype?(doctype: Doctype): void | Promise; - comments?(comment: Comment): void | Promise; - text?(text: Text): void | Promise; - end?(end: DocumentEnd): void | Promise; -} -export interface Doctype { - readonly name: string | null; - readonly publicId: string | null; - readonly systemId: string | null; -} -export interface Element { - tagName: string; - readonly attributes: IterableIterator; - 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, options?: ContentOptions): Element; - after(content: string, options?: ContentOptions): Element; - prepend(content: string, options?: ContentOptions): Element; - append(content: string, options?: ContentOptions): Element; - replace(content: string, options?: ContentOptions): Element; - remove(): Element; - removeAndKeepContent(): Element; - setInnerContent(content: string, options?: ContentOptions): Element; - onEndTag(handler: (tag: EndTag) => void | Promise): void; -} -export interface EndTag { - name: string; - before(content: string, options?: ContentOptions): EndTag; - after(content: string, options?: ContentOptions): EndTag; - remove(): EndTag; -} -export 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; -} -export interface Text { - readonly text: string; - readonly lastInTextNode: boolean; - readonly removed: boolean; - before(content: string, options?: ContentOptions): Text; - after(content: string, options?: ContentOptions): Text; - replace(content: string, options?: ContentOptions): Text; - remove(): Text; -} -export interface DocumentEnd { - append(content: string, options?: ContentOptions): DocumentEnd; -} -export declare abstract class FetchEvent extends ExtendableEvent { - readonly request: Request; - respondWith(promise: Response | Promise): void; - passThroughOnException(): void; -} -export type HeadersInit = - | Headers - | Iterable> - | Record; -export declare class Headers { - constructor(init?: HeadersInit); - get(name: string): string | null; - getAll(name: string): string[]; - has(name: string): boolean; - set(name: string, value: string): void; - append(name: string, value: string): void; - delete(name: string): void; - forEach( - callback: (this: This, value: string, key: string, parent: Headers) => void, - thisArg?: This - ): void; - entries(): IterableIterator<[key: string, value: string]>; - keys(): IterableIterator; - values(): IterableIterator; - [Symbol.iterator](): IterableIterator<[key: string, value: string]>; -} -export type BodyInit = - | ReadableStream - | string - | ArrayBuffer - | ArrayBufferView - | Blob - | URLSearchParams - | FormData; -export declare abstract class Body { - get body(): ReadableStream | null; - get bodyUsed(): boolean; - arrayBuffer(): Promise; - text(): Promise; - json(): Promise; - formData(): Promise; - blob(): Promise; -} -export declare class Response extends Body { - constructor(body?: BodyInit | null, init?: ResponseInit); - static redirect(url: string, status?: number): Response; - static json(any: any, maybeInit?: ResponseInit | Response): Response; - clone(): Response; - get status(): number; - get statusText(): string; - get headers(): Headers; - get ok(): boolean; - get redirected(): boolean; - get url(): string; - get webSocket(): WebSocket | null; - get cf(): any | undefined; -} -export interface ResponseInit { - status?: number; - statusText?: string; - headers?: HeadersInit; - cf?: any; - webSocket?: WebSocket | null; - encodeBody?: "automatic" | "manual"; -} -export type RequestInfo< - CfHostMetadata = unknown, - Cf = CfProperties -> = Request | string | URL; -export declare class Request< - CfHostMetadata = unknown, - Cf = CfProperties -> extends Body { - constructor(input: RequestInfo, init?: RequestInit); - clone(): Request; - get method(): string; - get url(): string; - get headers(): Headers; - get redirect(): string; - get fetcher(): Fetcher | null; - get signal(): AbortSignal; - get cf(): Cf | undefined; - get integrity(): string; - get keepalive(): boolean; -} -export interface RequestInit { - /** 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 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; -} -export declare abstract class Fetcher { - fetch(input: RequestInfo, init?: RequestInit): Promise; -} -export interface FetcherPutOptions { - expiration?: number; - expirationTtl?: number; -} -export interface KVNamespaceListKey { - name: Key; - expiration?: number; - metadata?: Metadata; -} -export type KVNamespaceListResult = - | { - list_complete: false; - keys: KVNamespaceListKey[]; - cursor: string; - } - | { - list_complete: true; - keys: KVNamespaceListKey[]; - }; -export interface KVNamespace { - get( - key: Key, - options?: Partial> - ): Promise; - get(key: Key, type: "text"): Promise; - get( - key: Key, - type: "json" - ): Promise; - get(key: Key, type: "arrayBuffer"): Promise; - get(key: Key, type: "stream"): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"text"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"json"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"arrayBuffer"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"stream"> - ): Promise; - list( - options?: KVNamespaceListOptions - ): Promise>; - put( - key: Key, - value: string | ArrayBuffer | ArrayBufferView | ReadableStream, - options?: KVNamespacePutOptions - ): Promise; - getWithMetadata( - key: Key, - options?: Partial> - ): Promise>; - getWithMetadata( - key: Key, - type: "text" - ): Promise>; - getWithMetadata( - key: Key, - type: "json" - ): Promise>; - getWithMetadata( - key: Key, - type: "arrayBuffer" - ): Promise>; - getWithMetadata( - key: Key, - type: "stream" - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"text"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"json"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"arrayBuffer"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"stream"> - ): Promise>; - delete(key: Key): Promise; -} -export interface KVNamespaceListOptions { - limit?: number; - prefix?: string | null; - cursor?: string | null; -} -export interface KVNamespaceGetOptions { - type: Type; - cacheTtl?: number; -} -export interface KVNamespacePutOptions { - expiration?: number; - expirationTtl?: number; - metadata?: any | null; -} -export interface KVNamespaceGetWithMetadataResult { - value: Value | null; - metadata: Metadata | null; -} -export interface R2Error extends Error { - readonly name: string; - readonly code: number; - readonly message: string; - readonly action: string; - readonly stack: any; -} -export interface R2ListOptions { - limit?: number; - prefix?: string; - cursor?: string; - delimiter?: string; - startAfter?: string; -} -export declare abstract class R2Bucket { - head(key: string): Promise; - get( - key: string, - options: R2GetOptions & { - onlyIf: R2Conditional | Headers; - } - ): Promise; - get(key: string, options?: R2GetOptions): Promise; - put( - key: string, - value: - | ReadableStream - | ArrayBuffer - | ArrayBufferView - | string - | null - | Blob, - options?: R2PutOptions - ): Promise; - put( - key: string, - value: - | ReadableStream - | ArrayBuffer - | ArrayBufferView - | string - | null - | Blob, - options?: R2PutOptions & { - onlyIf: R2Conditional | Headers; - } - ): Promise; - createMultipartUpload( - key: string, - options?: R2MultipartOptions - ): Promise; - resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload; - delete(keys: string | string[]): Promise; - list(options?: R2ListOptions): Promise; -} -export interface R2MultipartUpload { - readonly key: string; - readonly uploadId: string; - uploadPart( - partNumber: number, - value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob - ): Promise; - abort(): Promise; - complete(uploadedParts: R2UploadedPart[]): Promise; -} -export interface R2UploadedPart { - partNumber: number; - etag: string; -} -export 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; - readonly range?: R2Range; - writeHttpMetadata(headers: Headers): void; -} -export interface R2ObjectBody extends R2Object { - get body(): ReadableStream; - get bodyUsed(): boolean; - arrayBuffer(): Promise; - text(): Promise; - json(): Promise; - blob(): Promise; -} -export type R2Range = - | { - offset: number; - length?: number; - } - | { - offset?: number; - length: number; - } - | { - suffix: number; - }; -export interface R2Conditional { - etagMatches?: string; - etagDoesNotMatch?: string; - uploadedBefore?: Date; - uploadedAfter?: Date; - secondsGranularity?: boolean; -} -export interface R2GetOptions { - onlyIf?: R2Conditional | Headers; - range?: R2Range | Headers; -} -export interface R2PutOptions { - onlyIf?: R2Conditional | Headers; - httpMetadata?: R2HTTPMetadata | Headers; - customMetadata?: Record; - md5?: ArrayBuffer | string; - sha1?: ArrayBuffer | string; - sha256?: ArrayBuffer | string; - sha384?: ArrayBuffer | string; - sha512?: ArrayBuffer | string; -} -export interface R2MultipartOptions { - httpMetadata?: R2HTTPMetadata | Headers; - customMetadata?: Record; -} -export interface R2Checksums { - readonly md5?: ArrayBuffer; - readonly sha1?: ArrayBuffer; - readonly sha256?: ArrayBuffer; - readonly sha384?: ArrayBuffer; - readonly sha512?: ArrayBuffer; - toJSON(): R2StringChecksums; -} -export interface R2StringChecksums { - md5?: string; - sha1?: string; - sha256?: string; - sha384?: string; - sha512?: string; -} -export interface R2HTTPMetadata { - contentType?: string; - contentLanguage?: string; - contentDisposition?: string; - contentEncoding?: string; - cacheControl?: string; - cacheExpiry?: Date; -} -export interface R2Objects { - objects: R2Object[]; - truncated: boolean; - cursor?: string; - delimitedPrefixes: string[]; -} -export declare abstract class ScheduledEvent extends ExtendableEvent { - readonly scheduledTime: number; - readonly cron: string; - noRetry(): void; -} -export interface ScheduledController { - readonly scheduledTime: number; - readonly cron: string; - noRetry(): void; -} -export interface QueuingStrategy { - highWaterMark?: number | bigint; - size?: (chunk: T) => number | bigint; -} -export interface UnderlyingSink { - type?: string; - start?: (controller: WritableStreamDefaultController) => void | Promise; - write?: ( - chunk: W, - controller: WritableStreamDefaultController - ) => void | Promise; - abort?: (reason: any) => void | Promise; - close?: () => void | Promise; -} -export interface UnderlyingByteSource { - type: "bytes"; - autoAllocateChunkSize?: number; - start?: (controller: ReadableByteStreamController) => void | Promise; - pull?: (controller: ReadableByteStreamController) => void | Promise; - cancel?: (reason: any) => void | Promise; -} -export interface UnderlyingSource { - type?: "" | undefined; - start?: ( - controller: ReadableStreamDefaultController - ) => void | Promise; - pull?: ( - controller: ReadableStreamDefaultController - ) => void | Promise; - cancel?: (reason: any) => void | Promise; -} -export interface Transformer { - readableType?: string; - writableType?: string; - start?: ( - controller: TransformStreamDefaultController - ) => void | Promise; - transform?: ( - chunk: I, - controller: TransformStreamDefaultController - ) => void | Promise; - flush?: ( - controller: TransformStreamDefaultController - ) => void | Promise; -} -export interface StreamPipeOptions { - /** - * 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; - preventAbort?: boolean; - preventCancel?: boolean; - signal?: AbortSignal; -} -export type ReadableStreamReadResult = - | { - done: false; - value: R; - } - | { - done: true; - value?: undefined; - }; -/** This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object. */ -export interface ReadableStream { - get locked(): boolean; - cancel(reason?: any): Promise; - getReader(): ReadableStreamDefaultReader; - getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader; - pipeThrough( - transform: ReadableWritablePair, - options?: StreamPipeOptions - ): ReadableStream; - pipeTo( - destination: WritableStream, - options?: StreamPipeOptions - ): Promise; - tee(): [ReadableStream, ReadableStream]; - values(options?: ReadableStreamValuesOptions): AsyncIterableIterator; - [Symbol.asyncIterator]( - options?: ReadableStreamValuesOptions - ): AsyncIterableIterator; -} -export declare const ReadableStream: { - prototype: ReadableStream; - new ( - underlyingSource: UnderlyingByteSource, - strategy?: QueuingStrategy - ): ReadableStream; - new ( - underlyingSource?: UnderlyingSource, - strategy?: QueuingStrategy - ): ReadableStream; -}; -export declare class ReadableStreamDefaultReader { - constructor(stream: ReadableStream); - get closed(): Promise; - cancel(reason?: any): Promise; - read(): Promise>; - releaseLock(): void; -} -export declare class ReadableStreamBYOBReader { - constructor(stream: ReadableStream); - get closed(): Promise; - cancel(reason?: any): Promise; - read( - view: T - ): Promise>; - releaseLock(): void; - readAtLeast( - minElements: number, - view: T - ): Promise>; -} -export interface ReadableStreamGetReaderOptions { - mode: "byob"; -} -export interface ReadableStreamBYOBRequest { - readonly view: Uint8Array | null; - respond(bytesWritten: number): void; - respondWithNewView(view: ArrayBuffer | ArrayBufferView): void; - readonly atLeast: number | null; -} -export interface ReadableStreamDefaultController { - readonly desiredSize: number | null; - close(): void; - enqueue(chunk?: R): void; - error(reason: any): void; -} -export interface ReadableByteStreamController { - readonly byobRequest: ReadableStreamBYOBRequest | null; - readonly desiredSize: number | null; - close(): void; - enqueue(chunk: ArrayBuffer | ArrayBufferView): void; - error(reason: any): void; -} -/** This Streams API interface represents a controller allowing control of a WritableStream's state. When constructing a WritableStream, the underlying sink is given a corresponding WritableStreamDefaultController instance to manipulate. */ -export interface WritableStreamDefaultController { - readonly signal: AbortSignal; - error(reason?: any): void; -} -export interface TransformStreamDefaultController { - get desiredSize(): number | null; - enqueue(chunk?: O): void; - error(reason: any): void; - terminate(): void; -} -export interface ReadableWritablePair { - /** - * 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; - readable: ReadableStream; -} -export declare class WritableStream { - constructor( - underlyingSink?: UnderlyingSink, - queuingStrategy?: QueuingStrategy - ); - get locked(): boolean; - abort(reason?: any): Promise; - close(): Promise; - getWriter(): WritableStreamDefaultWriter; -} -export declare class WritableStreamDefaultWriter { - constructor(stream: WritableStream); - get closed(): Promise; - get ready(): Promise; - get desiredSize(): number | null; - abort(reason?: any): Promise; - close(): Promise; - write(chunk?: W): Promise; - releaseLock(): void; -} -export declare class TransformStream { - constructor( - transformer?: Transformer, - writableStrategy?: QueuingStrategy, - readableStrategy?: QueuingStrategy - ); - get readable(): ReadableStream; - get writable(): WritableStream; -} -export declare class FixedLengthStream extends IdentityTransformStream { - constructor(expectedLength: number | bigint); -} -export declare class IdentityTransformStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(); -} -export interface ReadableStreamValuesOptions { - preventCancel?: boolean; -} -export declare class CompressionStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(format: "gzip" | "deflate" | "deflate-raw"); -} -export declare class DecompressionStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(format: "gzip" | "deflate" | "deflate-raw"); -} -export declare class TextEncoderStream extends TransformStream< - string, - Uint8Array -> { - constructor(); -} -export declare class TextDecoderStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - string -> { - constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit); -} -export interface TextDecoderStreamTextDecoderStreamInit { - fatal?: boolean; -} -export declare class ByteLengthQueuingStrategy - implements QueuingStrategy -{ - constructor(init: QueuingStrategyInit); - get highWaterMark(): number; - get size(): (chunk?: any) => number; -} -export declare class CountQueuingStrategy implements QueuingStrategy { - constructor(init: QueuingStrategyInit); - get highWaterMark(): number; - get size(): (chunk?: any) => number; -} -export 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; -} -export declare abstract class TraceEvent extends ExtendableEvent { - readonly traces: TraceItem[]; -} -export interface TraceItem { - readonly event: - | ( - | TraceItemFetchEventInfo - | TraceItemScheduledEventInfo - | TraceItemAlarmEventInfo - | TraceItemQueueEventInfo - | TraceItemEmailEventInfo - | TraceItemCustomEventInfo - ) - | null; - readonly eventTimestamp: number | null; - readonly logs: TraceLog[]; - readonly exceptions: TraceException[]; - readonly scriptName: string | null; - readonly dispatchNamespace?: string; - readonly scriptTags?: string[]; - readonly outcome: string; -} -export interface TraceItemAlarmEventInfo { - readonly scheduledTime: Date; -} -export interface TraceItemCustomEventInfo {} -export interface TraceItemScheduledEventInfo { - readonly scheduledTime: number; - readonly cron: string; -} -export interface TraceItemQueueEventInfo { - readonly queue: string; - readonly batchSize: number; -} -export interface TraceItemEmailEventInfo { - readonly mailFrom: string; - readonly rcptTo: string; - readonly rawSize: number; -} -export interface TraceItemFetchEventInfo { - readonly response?: TraceItemFetchEventInfoResponse; - readonly request: TraceItemFetchEventInfoRequest; -} -export interface TraceItemFetchEventInfoRequest { - readonly cf?: any; - readonly headers: Record; - readonly method: string; - readonly url: string; - getUnredacted(): TraceItemFetchEventInfoRequest; -} -export interface TraceItemFetchEventInfoResponse { - readonly status: number; -} -export interface TraceLog { - readonly timestamp: number; - readonly level: string; - readonly message: any; -} -export interface TraceException { - readonly timestamp: number; - readonly message: string; - readonly name: string; -} -export interface TraceMetrics { - readonly cpuTime: number; - readonly wallTime: number; -} -export interface UnsafeTraceMetrics { - fromTrace(item: TraceItem): TraceMetrics; -} -export declare class URL { - constructor(url: string | URL, base?: string | URL); - get href(): string; - set href(value: string); - get origin(): string; - get protocol(): string; - set protocol(value: string); - get username(): string; - set username(value: string); - get password(): string; - set password(value: string); - get host(): string; - set host(value: string); - get hostname(): string; - set hostname(value: string); - get port(): string; - set port(value: string); - get pathname(): string; - set pathname(value: string); - get search(): string; - set search(value: string); - get searchParams(): URLSearchParams; - get hash(): string; - set hash(value: string); - toString(): string; - toJSON(): string; -} -export declare class URLSearchParams { - constructor( - init?: - | URLSearchParams - | string - | Record - | [key: string, value: string][] - ); - get size(): number; - append(name: string, value: string): void; - delete(name: string): void; - get(name: string): string | null; - getAll(name: string): string[]; - has(name: string): boolean; - set(name: string, value: string): void; - sort(): void; - entries(): IterableIterator<[key: string, value: string]>; - keys(): IterableIterator; - values(): IterableIterator; - forEach( - callback: ( - this: This, - value: string, - key: string, - parent: URLSearchParams - ) => void, - thisArg?: This - ): void; - toString(): string; - [Symbol.iterator](): IterableIterator<[key: string, value: string]>; -} -export declare class URLPattern { - constructor(input?: string | URLPatternURLPatternInit, baseURL?: string); - get protocol(): string; - get username(): string; - get password(): string; - get hostname(): string; - get port(): string; - get pathname(): string; - get search(): string; - get hash(): string; - test(input?: string | URLPatternURLPatternInit, baseURL?: string): boolean; - exec( - input?: string | URLPatternURLPatternInit, - baseURL?: string - ): URLPatternURLPatternResult | null; -} -export interface URLPatternURLPatternInit { - protocol?: string; - username?: string; - password?: string; - hostname?: string; - port?: string; - pathname?: string; - search?: string; - hash?: string; - baseURL?: string; -} -export interface URLPatternURLPatternComponentResult { - input: string; - groups: Record; -} -export interface URLPatternURLPatternResult { - inputs: (string | URLPatternURLPatternInit)[]; - protocol: URLPatternURLPatternComponentResult; - username: URLPatternURLPatternComponentResult; - password: URLPatternURLPatternComponentResult; - hostname: URLPatternURLPatternComponentResult; - port: URLPatternURLPatternComponentResult; - pathname: URLPatternURLPatternComponentResult; - search: URLPatternURLPatternComponentResult; - hash: URLPatternURLPatternComponentResult; -} -export declare class CloseEvent extends Event { - constructor(type: string, initializer: CloseEventInit); - /** Returns the WebSocket connection close code provided by the server. */ - readonly code: number; - /** Returns the WebSocket connection close reason provided by the server. */ - readonly reason: string; - /** Returns true if the connection closed cleanly; false otherwise. */ - readonly wasClean: boolean; -} -export interface CloseEventInit { - code?: number; - reason?: string; - wasClean?: boolean; -} -export declare class MessageEvent extends Event { - constructor(type: string, initializer: MessageEventInit); - readonly data: ArrayBuffer | string; -} -export interface MessageEventInit { - data: ArrayBuffer | string; -} -/** Events providing information related to errors in scripts or in files. */ -export interface ErrorEvent extends Event { - readonly filename: string; - readonly message: string; - readonly lineno: number; - readonly colno: number; - readonly error: any; -} -export type WebSocketEventMap = { - close: CloseEvent; - message: MessageEvent; - open: Event; - error: ErrorEvent; -}; -export declare class WebSocket extends EventTarget { - constructor(url: string, protocols?: string[] | string); - accept(): void; - send(message: (ArrayBuffer | ArrayBufferView) | string): void; - close(code?: number, reason?: string): void; - static readonly READY_STATE_CONNECTING: number; - static readonly READY_STATE_OPEN: number; - static readonly READY_STATE_CLOSING: number; - static readonly READY_STATE_CLOSED: number; - get readyState(): number; - get url(): string | null; - get protocol(): string | null; - get extensions(): string | null; -} -export declare const WebSocketPair: { - new (): { - 0: WebSocket; - 1: WebSocket; - }; -}; -export interface BasicImageTransformations { - /** - * Maximum width in image pixels. The value must be an integer. - */ - width?: number; - /** - * Maximum height in image pixels. The value must be an integer. - */ - height?: number; - /** - * Resizing mode as a string. It affects interpretation of width and height - * options: - * - scale-down: Similar to contain, but the image is never enlarged. If - * the image is larger than given width or height, it will be resized. - * Otherwise its original size will be kept. - * - contain: Resizes to maximum size that fits within the given width and - * height. If only a single dimension is given (e.g. only width), the - * image will be shrunk or enlarged to exactly match that dimension. - * Aspect ratio is always preserved. - * - cover: Resizes (shrinks or enlarges) to fill the entire area of width - * and height. If the image has an aspect ratio different from the ratio - * of width and height, it will be cropped to fit. - * - crop: The image will be shrunk and cropped to fit within the area - * specified by width and height. The image will not be enlarged. For images - * smaller than the given dimensions it's the same as scale-down. For - * images larger than the given dimensions, it's the same as cover. - * See also trim. - * - pad: Resizes to the maximum size that fits within the given width and - * height, and then fills the remaining area with a background color - * (white by default). Use of this mode is not recommended, as the same - * effect can be more efficiently achieved with the contain mode and the - * CSS object-fit: contain property. - */ - fit?: "scale-down" | "contain" | "cover" | "crop" | "pad"; - /** - * When cropping with fit: "cover", this defines the side or point that should - * be left uncropped. The value is either a string - * "left", "right", "top", "bottom", "auto", or "center" (the default), - * or an object {x, y} containing focal point coordinates in the original - * image expressed as fractions ranging from 0.0 (top or left) to 1.0 - * (bottom or right), 0.5 being the center. {fit: "cover", gravity: "top"} will - * crop bottom or left and right sides as necessary, but won’t crop anything - * from the top. {fit: "cover", gravity: {x:0.5, y:0.2}} will crop each side to - * preserve as much as possible around a point at 20% of the height of the - * source image. - */ - gravity?: - | "left" - | "right" - | "top" - | "bottom" - | "center" - | "auto" - | BasicImageTransformationsGravityCoordinates; - /** - * Background color to add underneath the image. Applies only to images with - * transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…), - * hsl(…), etc.) - */ - background?: string; - /** - * Number of degrees (90, 180, 270) to rotate the image by. width and height - * options refer to axes after rotation. - */ - rotate?: 0 | 90 | 180 | 270 | 360; -} -export interface BasicImageTransformationsGravityCoordinates { - x: number; - y: number; -} -/** - * In addition to the properties you can set in the RequestInit dict - * that you pass as an argument to the Request constructor, you can - * set certain properties of a `cf` object to control how Cloudflare - * features are applied to that new Request. - * - * Note: Currently, these properties cannot be tested in the - * playground. - */ -export interface RequestInitCfProperties extends Record { - cacheEverything?: boolean; - /** - * A request's cache key is what determines if two requests are - * "the same" for caching purposes. If a request has the same cache key - * as some previous request, then we can serve the same cached response for - * both. (e.g. 'some-key') - * - * Only available for Enterprise customers. - */ - cacheKey?: string; - /** - * This allows you to append additional Cache-Tag response headers - * to the origin response without modifications to the origin server. - * This will allow for greater control over the Purge by Cache Tag feature - * utilizing changes only in the Workers process. - * - * Only available for Enterprise customers. - */ - cacheTags?: string[]; - /** - * Force response to be cached for a given number of seconds. (e.g. 300) - */ - cacheTtl?: number; - /** - * Force response to be cached for a given number of seconds based on the Origin status code. - * (e.g. { '200-299': 86400, '404': 1, '500-599': 0 }) - */ - cacheTtlByStatus?: Record; - scrapeShield?: boolean; - apps?: boolean; - image?: RequestInitCfPropertiesImage; - minify?: RequestInitCfPropertiesImageMinify; - mirage?: boolean; - polish?: "lossy" | "lossless" | "off"; - /** - * Redirects the request to an alternate origin server. You can use this, - * for example, to implement load balancing across several origins. - * (e.g.us-east.example.com) - * - * Note - For security reasons, the hostname set in resolveOverride must - * be proxied on the same Cloudflare zone of the incoming request. - * Otherwise, the setting is ignored. CNAME hosts are allowed, so to - * resolve to a host under a different domain or a DNS only domain first - * declare a CNAME record within your own zone’s DNS mapping to the - * external hostname, set proxy on Cloudflare, then set resolveOverride - * to point to that CNAME record. - */ - resolveOverride?: string; -} -export interface RequestInitCfPropertiesImageDraw - extends BasicImageTransformations { - /** - * Absolute URL of the image file to use for the drawing. It can be any of - * the supported file formats. For drawing of watermarks or non-rectangular - * overlays we recommend using PNG or WebP images. - */ - url: string; - /** - * Floating-point number between 0 (transparent) and 1 (opaque). - * For example, opacity: 0.5 makes overlay semitransparent. - */ - opacity?: number; - /** - * - If set to true, the overlay image will be tiled to cover the entire - * area. This is useful for stock-photo-like watermarks. - * - If set to "x", the overlay image will be tiled horizontally only - * (form a line). - * - If set to "y", the overlay image will be tiled vertically only - * (form a line). - */ - repeat?: true | "x" | "y"; - /** - * Position of the overlay image relative to a given edge. Each property is - * an offset in pixels. 0 aligns exactly to the edge. For example, left: 10 - * positions left side of the overlay 10 pixels from the left edge of the - * image it's drawn over. bottom: 0 aligns bottom of the overlay with bottom - * of the background image. - * - * Setting both left & right, or both top & bottom is an error. - * - * If no position is specified, the image will be centered. - */ - top?: number; - left?: number; - bottom?: number; - right?: number; -} -export interface RequestInitCfPropertiesImage - extends BasicImageTransformations { - /** - * Device Pixel Ratio. Default 1. Multiplier for width/height that makes it - * easier to specify higher-DPI sizes in . - */ - dpr?: number; - /** - * An object with four properties {left, top, right, bottom} that specify - * a number of pixels to cut off on each side. Allows removal of borders - * or cutting out a specific fragment of an image. Trimming is performed - * before resizing or rotation. Takes dpr into account. - */ - trim?: { - left?: number; - top?: number; - right?: number; - bottom?: number; - }; - /** - * Quality setting from 1-100 (useful values are in 60-90 range). Lower values - * make images look worse, but load faster. The default is 85. It applies only - * to JPEG and WebP images. It doesn’t have any effect on PNG. - */ - quality?: number; - /** - * Output format to generate. It can be: - * - avif: generate images in AVIF format. - * - webp: generate images in Google WebP format. Set quality to 100 to get - * the WebP-lossless format. - * - json: instead of generating an image, outputs information about the - * image, in JSON format. The JSON object will contain image size - * (before and after resizing), source image’s MIME type, file size, etc. - * - jpeg: generate images in JPEG format. - * - png: generate images in PNG format. - */ - format?: "avif" | "webp" | "json" | "jpeg" | "png"; - /** - * Whether to preserve animation frames from input files. Default is true. - * Setting it to false reduces animations to still images. This setting is - * recommended when enlarging images or processing arbitrary user content, - * because large GIF animations can weigh tens or even hundreds of megabytes. - * It is also useful to set anim:false when using format:"json" to get the - * response quicker without the number of frames. - */ - anim?: boolean; - /** - * What EXIF data should be preserved in the output image. Note that EXIF - * rotation and embedded color profiles are always applied ("baked in" into - * the image), and aren't affected by this option. Note that if the Polish - * feature is enabled, all metadata may have been removed already and this - * option may have no effect. - * - keep: Preserve most of EXIF metadata, including GPS location if there's - * any. - * - copyright: Only keep the copyright tag, and discard everything else. - * This is the default behavior for JPEG files. - * - none: Discard all invisible EXIF metadata. Currently WebP and PNG - * output formats always discard metadata. - */ - metadata?: "keep" | "copyright" | "none"; - /** - * Strength of sharpening filter to apply to the image. Floating-point - * number between 0 (no sharpening, default) and 10 (maximum). 1.0 is a - * recommended value for downscaled images. - */ - sharpen?: number; - /** - * Radius of a blur filter (approximate gaussian). Maximum supported radius - * is 250. - */ - blur?: number; - /** - * Overlays are drawn in the order they appear in the array (last array - * entry is the topmost layer). - */ - draw?: RequestInitCfPropertiesImageDraw[]; - /** - * Fetching image from authenticated origin. Setting this property will - * pass authentication headers (Authorization, Cookie, etc.) through to - * the origin. - */ - "origin-auth"?: "share-publicly"; - /** - * Adds a border around the image. The border is added after resizing. Border - * width takes dpr into account, and can be specified either using a single - * width property, or individually for each side. - */ - border?: - | { - color: string; - width: number; - } - | { - color: string; - top: number; - right: number; - bottom: number; - left: number; - }; - /** - * Increase brightness by a factor. A value of 1.0 equals no change, a value - * of 0.5 equals half brightness, and a value of 2.0 equals twice as bright. - * 0 is ignored. - */ - brightness?: number; - /** - * Increase contrast by a factor. A value of 1.0 equals no change, a value of - * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is - * ignored. - */ - contrast?: number; - /** - * Increase exposure by a factor. A value of 1.0 equals no change, a value of - * 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored. - */ - gamma?: number; - /** - * Slightly reduces latency on a cache miss by selecting a - * quickest-to-compress file format, at a cost of increased file size and - * lower image quality. It will usually override the format option and choose - * JPEG over WebP or AVIF. We do not recommend using this option, except in - * unusual circumstances like resizing uncacheable dynamically-generated - * images. - */ - compression?: "fast"; -} -export interface RequestInitCfPropertiesImageMinify { - javascript?: boolean; - css?: boolean; - html?: boolean; -} -/** - * Request metadata provided by Cloudflare's edge. - */ -export type IncomingRequestCfProperties = - IncomingRequestCfPropertiesBase & - IncomingRequestCfPropertiesBotManagementEnterprise & - IncomingRequestCfPropertiesCloudflareForSaaSEnterprise & - IncomingRequestCfPropertiesGeographicInformation & - IncomingRequestCfPropertiesCloudflareAccessOrApiShield; -export interface IncomingRequestCfPropertiesBase - extends Record { - /** - * [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request. - * - * @example 395747 - */ - asn: number; - /** - * The organization which owns the ASN of the incoming request. - * - * @example "Google Cloud" - */ - asOrganization: string; - /** - * The original value of the `Accept-Encoding` header if Cloudflare modified it. - * - * @example "gzip, deflate, br" - */ - clientAcceptEncoding?: string; - /** - * The number of milliseconds it took for the request to reach your worker. - * - * @example 22 - */ - clientTcpRtt?: number; - /** - * The three-letter [IATA](https://en.wikipedia.org/wiki/IATA_airport_code) - * airport code of the data center that the request hit. - * - * @example "DFW" - */ - colo: string; - /** - * Represents the upstream's response to a - * [TCP `keepalive` message](https://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html) - * from cloudflare. - * - * For workers with no upstream, this will always be `1`. - * - * @example 3 - */ - edgeRequestKeepAliveStatus: IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus; - /** - * The HTTP Protocol the request used. - * - * @example "HTTP/2" - */ - httpProtocol: string; - /** - * The browser-requested prioritization information in the request object. - * - * If no information was set, defaults to the empty string `""` - * - * @example "weight=192;exclusive=0;group=3;group-weight=127" - * @default "" - */ - requestPriority: string; - /** - * The TLS version of the connection to Cloudflare. - * In requests served over plaintext (without TLS), this property is the empty string `""`. - * - * @example "TLSv1.3" - */ - tlsVersion: string; - /** - * The cipher for the connection to Cloudflare. - * In requests served over plaintext (without TLS), this property is the empty string `""`. - * - * @example "AEAD-AES128-GCM-SHA256" - */ - tlsCipher: string; - /** - * Metadata containing the [`HELLO`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2) and [`FINISHED`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9) messages from this request's TLS handshake. - * - * If the incoming request was served over plaintext (without TLS) this field is undefined. - */ - tlsExportedAuthenticator?: IncomingRequestCfPropertiesExportedAuthenticatorMetadata; -} -export interface IncomingRequestCfPropertiesBotManagementBase { - /** - * Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot, - * represented as an integer percentage between `1` (almost certainly human) - * and `99` (almost certainly a bot). - * - * @example 54 - */ - score: number; - /** - * A boolean value that is true if the request comes from a good bot, like Google or Bing. - * Most customers choose to allow this traffic. For more details, see [Traffic from known bots](https://developers.cloudflare.com/firewall/known-issues-and-faq/#how-does-firewall-rules-handle-traffic-from-known-bots). - */ - verifiedBot: boolean; - /** - * A boolean value that is true if the request originates from a - * Cloudflare-verified proxy service. - */ - corporateProxy: boolean; - /** - * A boolean value that's true if the request matches [file extensions](https://developers.cloudflare.com/bots/reference/static-resources/) for many types of static resources. - */ - staticResource: boolean; - /** - * List of IDs that correlate to the Bot Management heuristic detections made on a request (you can have multiple heuristic detections on the same request). - */ - detectionIds: number[]; -} -export interface IncomingRequestCfPropertiesBotManagement { - /** - * Results of Cloudflare's Bot Management analysis - */ - botManagement: IncomingRequestCfPropertiesBotManagementBase; - /** - * Duplicate of `botManagement.score`. - * - * @deprecated - */ - clientTrustScore: number; -} -export interface IncomingRequestCfPropertiesBotManagementEnterprise - extends IncomingRequestCfPropertiesBotManagement { - /** - * Results of Cloudflare's Bot Management analysis - */ - botManagement: IncomingRequestCfPropertiesBotManagementBase & { - /** - * A [JA3 Fingerprint](https://developers.cloudflare.com/bots/concepts/ja3-fingerprint/) to help profile specific SSL/TLS clients - * across different destination IPs, Ports, and X509 certificates. - */ - ja3Hash: string; - }; -} -export interface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise< - HostMetadata -> { - /** - * Custom metadata set per-host in [Cloudflare for SaaS](https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/). - * - * This field is only present if you have Cloudflare for SaaS enabled on your account - * and you have followed the [required steps to enable it]((https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/domain-support/custom-metadata/)). - */ - hostMetadata: HostMetadata; -} -export interface IncomingRequestCfPropertiesCloudflareAccessOrApiShield { - /** - * Information about the client certificate presented to Cloudflare. - * - * This is populated when the incoming request is served over TLS using - * either Cloudflare Access or API Shield (mTLS) - * and the presented SSL certificate has a valid - * [Certificate Serial Number](https://ldapwiki.com/wiki/Certificate%20Serial%20Number) - * (i.e., not `null` or `""`). - * - * Otherwise, a set of placeholder values are used. - * - * The property `certPresented` will be set to `"1"` when - * the object is populated (i.e. the above conditions were met). - */ - tlsClientAuth: - | IncomingRequestCfPropertiesTLSClientAuth - | IncomingRequestCfPropertiesTLSClientAuthPlaceholder; -} -/** - * Metadata about the request's TLS handshake - */ -export interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata { - /** - * The client's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal - * - * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d" - */ - clientHandshake: string; - /** - * The server's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal - * - * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d" - */ - serverHandshake: string; - /** - * The client's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal - * - * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b" - */ - clientFinished: string; - /** - * The server's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal - * - * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b" - */ - serverFinished: string; -} -/** - * Geographic data about the request's origin. - */ -export interface IncomingRequestCfPropertiesGeographicInformation { - /** - * The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from. - * - * If your worker is [configured to accept TOR connections](https://support.cloudflare.com/hc/en-us/articles/203306930-Understanding-Cloudflare-Tor-support-and-Onion-Routing), this may also be `"T1"`, indicating a request that originated over TOR. - * - * If Cloudflare is unable to determine where the request originated this property is omitted. - * - * The country code `"T1"` is used for requests originating on TOR. - * - * @example "GB" - */ - country?: Iso3166Alpha2Code | "T1"; - /** - * If present, this property indicates that the request originated in the EU - * - * @example "1" - */ - isEUCountry?: "1"; - /** - * A two-letter code indicating the continent the request originated from. - * - * @example "AN" - */ - continent?: ContinentCode; - /** - * The city the request originated from - * - * @example "Austin" - */ - city?: string; - /** - * Postal code of the incoming request - * - * @example "78701" - */ - postalCode?: string; - /** - * Latitude of the incoming request - * - * @example "30.27130" - */ - latitude?: string; - /** - * Longitude of the incoming request - * - * @example "-97.74260" - */ - longitude?: string; - /** - * Timezone of the incoming request - * - * @example "America/Chicago" - */ - timezone?: string; - /** - * If known, the ISO 3166-2 name for the first level region associated with - * the IP address of the incoming request - * - * @example "Texas" - */ - region?: string; - /** - * If known, the ISO 3166-2 code for the first-level region associated with - * the IP address of the incoming request - * - * @example "TX" - */ - regionCode?: string; - /** - * Metro code (DMA) of the incoming request - * - * @example "635" - */ - metroCode?: string; -} -/** Data about the incoming request's TLS certificate */ -export interface IncomingRequestCfPropertiesTLSClientAuth { - /** Always `"1"`, indicating that the certificate was presented */ - certPresented: "1"; - /** - * Result of certificate verification. - * - * @example "FAILED:self signed certificate" - */ - certVerified: Exclude; - /** The presented certificate's revokation status. - * - * - A value of `"1"` indicates the certificate has been revoked - * - A value of `"0"` indicates the certificate has not been revoked - */ - certRevoked: "1" | "0"; - /** - * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) - * - * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certIssuerDN: string; - /** - * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) - * - * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certSubjectDN: string; - /** - * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted) - * - * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certIssuerDNRFC2253: string; - /** - * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted) - * - * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certSubjectDNRFC2253: string; - /** The certificate issuer's distinguished name (legacy policies) */ - certIssuerDNLegacy: string; - /** The certificate subject's distinguished name (legacy policies) */ - certSubjectDNLegacy: string; - /** - * The certificate's serial number - * - * @example "00936EACBE07F201DF" - */ - certSerial: string; - /** - * The certificate issuer's serial number - * - * @example "2489002934BDFEA34" - */ - certIssuerSerial: string; - /** - * The certificate's Subject Key Identifier - * - * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4" - */ - certSKI: string; - /** - * The certificate issuer's Subject Key Identifier - * - * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4" - */ - certIssuerSKI: string; - /** - * The certificate's SHA-1 fingerprint - * - * @example "6b9109f323999e52259cda7373ff0b4d26bd232e" - */ - certFingerprintSHA1: string; - /** - * The certificate's SHA-256 fingerprint - * - * @example "acf77cf37b4156a2708e34c4eb755f9b5dbbe5ebb55adfec8f11493438d19e6ad3f157f81fa3b98278453d5652b0c1fd1d71e5695ae4d709803a4d3f39de9dea" - */ - certFingerprintSHA256: string; - /** - * The effective starting date of the certificate - * - * @example "Dec 22 19:39:00 2018 GMT" - */ - certNotBefore: string; - /** - * The effective expiration date of the certificate - * - * @example "Dec 22 19:39:00 2018 GMT" - */ - certNotAfter: string; -} -/** Placeholder values for TLS Client Authorization */ -export interface IncomingRequestCfPropertiesTLSClientAuthPlaceholder { - certPresented: "0"; - certVerified: "NONE"; - certRevoked: "0"; - certIssuerDN: ""; - certSubjectDN: ""; - certIssuerDNRFC2253: ""; - certSubjectDNRFC2253: ""; - certIssuerDNLegacy: ""; - certSubjectDNLegacy: ""; - certSerial: ""; - certIssuerSerial: ""; - certSKI: ""; - certIssuerSKI: ""; - certFingerprintSHA1: ""; - certFingerprintSHA256: ""; - certNotBefore: ""; - certNotAfter: ""; -} -/** Possible outcomes of TLS verification */ -export type CertVerificationStatus = - /** Authentication succeeded */ - | "SUCCESS" - /** No certificate was presented */ - | "NONE" - /** Failed because the certificate was self-signed */ - | "FAILED:self signed certificate" - /** Failed because the certificate failed a trust chain check */ - | "FAILED:unable to verify the first certificate" - /** Failed because the certificate not yet valid */ - | "FAILED:certificate is not yet valid" - /** Failed because the certificate is expired */ - | "FAILED:certificate has expired" - /** Failed for another unspecified reason */ - | "FAILED"; -/** - * An upstream endpoint's response to a TCP `keepalive` message from Cloudflare. - */ -export type IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus = - | 0 /** Unknown */ - | 1 /** no keepalives (not found) */ - | 2 /** no connection re-use, opening keepalive connection failed */ - | 3 /** no connection re-use, keepalive accepted and saved */ - | 4 /** connection re-use, refused by the origin server (`TCP FIN`) */ - | 5; /** connection re-use, accepted by the origin server */ -/** ISO 3166-1 Alpha-2 codes */ -export type Iso3166Alpha2Code = - | "AD" - | "AE" - | "AF" - | "AG" - | "AI" - | "AL" - | "AM" - | "AO" - | "AQ" - | "AR" - | "AS" - | "AT" - | "AU" - | "AW" - | "AX" - | "AZ" - | "BA" - | "BB" - | "BD" - | "BE" - | "BF" - | "BG" - | "BH" - | "BI" - | "BJ" - | "BL" - | "BM" - | "BN" - | "BO" - | "BQ" - | "BR" - | "BS" - | "BT" - | "BV" - | "BW" - | "BY" - | "BZ" - | "CA" - | "CC" - | "CD" - | "CF" - | "CG" - | "CH" - | "CI" - | "CK" - | "CL" - | "CM" - | "CN" - | "CO" - | "CR" - | "CU" - | "CV" - | "CW" - | "CX" - | "CY" - | "CZ" - | "DE" - | "DJ" - | "DK" - | "DM" - | "DO" - | "DZ" - | "EC" - | "EE" - | "EG" - | "EH" - | "ER" - | "ES" - | "ET" - | "FI" - | "FJ" - | "FK" - | "FM" - | "FO" - | "FR" - | "GA" - | "GB" - | "GD" - | "GE" - | "GF" - | "GG" - | "GH" - | "GI" - | "GL" - | "GM" - | "GN" - | "GP" - | "GQ" - | "GR" - | "GS" - | "GT" - | "GU" - | "GW" - | "GY" - | "HK" - | "HM" - | "HN" - | "HR" - | "HT" - | "HU" - | "ID" - | "IE" - | "IL" - | "IM" - | "IN" - | "IO" - | "IQ" - | "IR" - | "IS" - | "IT" - | "JE" - | "JM" - | "JO" - | "JP" - | "KE" - | "KG" - | "KH" - | "KI" - | "KM" - | "KN" - | "KP" - | "KR" - | "KW" - | "KY" - | "KZ" - | "LA" - | "LB" - | "LC" - | "LI" - | "LK" - | "LR" - | "LS" - | "LT" - | "LU" - | "LV" - | "LY" - | "MA" - | "MC" - | "MD" - | "ME" - | "MF" - | "MG" - | "MH" - | "MK" - | "ML" - | "MM" - | "MN" - | "MO" - | "MP" - | "MQ" - | "MR" - | "MS" - | "MT" - | "MU" - | "MV" - | "MW" - | "MX" - | "MY" - | "MZ" - | "NA" - | "NC" - | "NE" - | "NF" - | "NG" - | "NI" - | "NL" - | "NO" - | "NP" - | "NR" - | "NU" - | "NZ" - | "OM" - | "PA" - | "PE" - | "PF" - | "PG" - | "PH" - | "PK" - | "PL" - | "PM" - | "PN" - | "PR" - | "PS" - | "PT" - | "PW" - | "PY" - | "QA" - | "RE" - | "RO" - | "RS" - | "RU" - | "RW" - | "SA" - | "SB" - | "SC" - | "SD" - | "SE" - | "SG" - | "SH" - | "SI" - | "SJ" - | "SK" - | "SL" - | "SM" - | "SN" - | "SO" - | "SR" - | "SS" - | "ST" - | "SV" - | "SX" - | "SY" - | "SZ" - | "TC" - | "TD" - | "TF" - | "TG" - | "TH" - | "TJ" - | "TK" - | "TL" - | "TM" - | "TN" - | "TO" - | "TR" - | "TT" - | "TV" - | "TW" - | "TZ" - | "UA" - | "UG" - | "UM" - | "US" - | "UY" - | "UZ" - | "VA" - | "VC" - | "VE" - | "VG" - | "VI" - | "VN" - | "VU" - | "WF" - | "WS" - | "YE" - | "YT" - | "ZA" - | "ZM" - | "ZW"; -/** The 2-letter continent codes Cloudflare uses */ -export type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA"; -export type CfProperties = - | IncomingRequestCfProperties - | RequestInitCfProperties; -export interface D1Result { - results?: T[]; - success: boolean; - error?: string; - meta: any; -} -export declare abstract class D1Database { - prepare(query: string): D1PreparedStatement; - dump(): Promise; - batch(statements: D1PreparedStatement[]): Promise[]>; - exec(query: string): Promise>; -} -export declare abstract class D1PreparedStatement { - bind(...values: any[]): D1PreparedStatement; - first(colName?: string): Promise; - run(): Promise>; - all(): Promise>; - raw(): Promise; -} -/** - * A email message that is sent to a consumer Worker. - */ -export interface EmailMessage { - /** - * Envelope From attribute of the email message. - */ - readonly from: string; - /** - * Envelope To attribute of the email message. - */ - readonly to: string; - /** - * A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers). - */ - readonly headers: Headers; - /** - * Stream of the email message content. - */ - readonly raw: ReadableStream; - /** - * Size of the email message content. - */ - readonly rawSize: number; - /** - * Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason. - * @param reason The reject reason. - * @returns void - */ - setReject(reason: string): void; - /** - * Forward this email message to a verified destination address of the account. - * @param rcptTo Verified destination address. - * @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers). - * @returns A promise that resolves when the email message is forwarded. - */ - forward(rcptTo: string, headers?: Headers): Promise; -} -export declare abstract class EmailEvent extends ExtendableEvent { - readonly message: EmailMessage; -} -export type EmailExportedHandler = ( - message: EmailMessage, - env: Env, - ctx: ExecutionContext -) => void | Promise; -export type Params

= Record; -export type EventContext = { - request: Request; - functionPath: string; - waitUntil: (promise: Promise) => void; - passThroughOnException: () => void; - next: (input?: Request | string, init?: RequestInit) => Promise; - env: Env & { - ASSETS: { - fetch: typeof fetch; - }; - }; - params: Params

; - data: Data; -}; -export type PagesFunction< - Env = unknown, - Params extends string = any, - Data extends Record = Record -> = (context: EventContext) => Response | Promise; -export type EventPluginContext = { - request: Request; - functionPath: string; - waitUntil: (promise: Promise) => void; - passThroughOnException: () => void; - next: (input?: Request | string, init?: RequestInit) => Promise; - env: Env & { - ASSETS: { - fetch: typeof fetch; - }; - }; - params: Params

; - data: Data; - pluginArgs: PluginArgs; -}; -export type PagesPluginFunction< - Env = unknown, - Params extends string = any, - Data extends Record = Record, - PluginArgs = unknown -> = ( - context: EventPluginContext -) => Response | Promise; -// https://developers.cloudflare.com/pub-sub/ -// PubSubMessage represents an incoming PubSub message. -// The message includes metadata about the broker, the client, and the payload -// itself. -export interface PubSubMessage { - // Message ID - readonly mid: number; - // MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT - readonly broker: string; - // The MQTT topic the message was sent on. - readonly topic: string; - // The client ID of the client that published this message. - readonly clientId: string; - // The unique identifier (JWT ID) used by the client to authenticate, if token - // auth was used. - readonly jti?: string; - // A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker - // received the message from the client. - readonly receivedAt: number; - // An (optional) string with the MIME type of the payload, if set by the - // client. - readonly contentType: string; - // Set to 1 when the payload is a UTF-8 string - // https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063 - readonly payloadFormatIndicator: number; - // Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays. - // You can use payloadFormatIndicator to inspect this before decoding. - payload: string | Uint8Array; -} -// JsonWebKey extended by kid parameter -export interface JsonWebKeyWithKid extends JsonWebKey { - // Key Identifier of the JWK - readonly kid: string; -} -/** - * A message that is sent to a consumer Worker. - */ -export interface Message { - /** - * A unique, system-generated ID for the message. - */ - readonly id: string; - /** - * A timestamp when the message was sent. - */ - readonly timestamp: Date; - /** - * The body of the message. - */ - readonly body: Body; - /** - * Marks message to be retried. - */ - retry(): void; - /** - * Marks message acknowledged. - */ - ack(): void; -} -/** - * A batch of messages that are sent to a consumer Worker. - */ -export interface MessageBatch { - /** - * The name of the Queue that belongs to this batch. - */ - readonly queue: string; - /** - * An array of messages in the batch. Ordering of messages is not guaranteed. - */ - readonly messages: readonly Message[]; - /** - * Marks every message to be retried in the next batch. - */ - retryAll(): void; - /** - * Marks every message acknowledged in the batch. - */ - ackAll(): void; -} -/** - * A wrapper class used to structure message batches. - */ -export type MessageSendRequest = { - /** - * The body of the message. - */ - body: Body; -}; -/** - * A binding that allows a producer to send messages to a Queue. - */ -export interface Queue { - /** - * Sends a message to the Queue. - * @param message The message can be any type supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types), as long as its size is less than 128 KB. - * @returns A promise that resolves when the message is confirmed to be written to disk. - */ - send(message: Body): Promise; - /** - * Sends a batch of messages to the Queue. - * @param messages Each item in the input must be supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types). A batch can contain up to 100 messages, though items are limited to 128 KB each, and the total size of the array cannot exceed 256 KB. - * @returns A promise that resolves when the messages are confirmed to be written to disk. - */ - sendBatch(messages: Iterable>): Promise; -} diff --git a/packages/denylist_bot/node_modules/@cloudflare/workers-types/2022-03-21/index.d.ts b/packages/denylist_bot/node_modules/@cloudflare/workers-types/2022-03-21/index.d.ts deleted file mode 100755 index e9018a612..000000000 --- a/packages/denylist_bot/node_modules/@cloudflare/workers-types/2022-03-21/index.d.ts +++ /dev/null @@ -1,2982 +0,0 @@ -/*! ***************************************************************************** -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 class DOMException extends Error { - constructor(message?: string, name?: string); - readonly message: string; - readonly name: string; - readonly code: number; - readonly stack: any; - 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; -} -declare type WorkerGlobalScopeEventMap = { - fetch: FetchEvent; - scheduled: ScheduledEvent; - unhandledrejection: PromiseRejectionEvent; - rejectionhandled: PromiseRejectionEvent; -}; -declare abstract class WorkerGlobalScope extends EventTarget { - EventTarget: typeof EventTarget; -} -declare interface Console { - "assert"(condition?: boolean, ...data: any[]): void; - clear(): void; - count(label?: string): void; - countReset(label?: string): void; - debug(...data: any[]): void; - dir(item?: any, options?: any): void; - dirxml(...data: any[]): void; - error(...data: any[]): void; - group(...data: any[]): void; - groupCollapsed(...data: any[]): void; - groupEnd(): void; - info(...data: any[]): void; - log(...data: any[]): void; - table(tabularData?: any, properties?: string[]): void; - time(label?: string): void; - timeEnd(label?: string): void; - timeLog(label?: string, ...data: any[]): void; - timeStamp(label?: string): void; - trace(...data: any[]): void; - warn(...data: any[]): void; -} -declare const console: Console; -declare type BufferSource = ArrayBufferView | ArrayBuffer; -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; - type Imports = Record; - type ExportValue = Function | Global | Memory | Table; - type Exports = Record; - 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; - function validate(bytes: BufferSource): boolean; -} -/** This ServiceWorker API interface represents the global execution context of a service worker. */ -declare 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( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args - ): number; - clearTimeout(timeoutId: number | null): void; - setInterval(callback: (...args: any[]) => void, msDelay?: number): number; - setInterval( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args - ): number; - clearInterval(timeoutId: number | null): void; - queueMicrotask(task: Function): void; - structuredClone(value: T, options?: StructuredSerializeOptions): T; - fetch( - input: RequestInfo, - init?: RequestInit - ): Promise; - self: ServiceWorkerGlobalScope; - crypto: Crypto; - caches: CacheStorage; - scheduler: Scheduler; - Event: typeof Event; - ExtendableEvent: typeof ExtendableEvent; - PromiseRejectionEvent: typeof PromiseRejectionEvent; - FetchEvent: typeof FetchEvent; - TraceEvent: typeof TraceEvent; - 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; - 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; - 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: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetAddEventListenerOptions | boolean -): void; -declare function removeEventListener< - Type extends keyof WorkerGlobalScopeEventMap ->( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetEventListenerOptions | boolean -): void; -/** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */ -declare function dispatchEvent( - event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap] -): boolean; -declare function btoa(data: string): string; -declare function atob(data: string): string; -declare function setTimeout( - callback: (...args: any[]) => void, - msDelay?: number -): number; -declare function setTimeout( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args -): number; -declare function clearTimeout(timeoutId: number | null): void; -declare function setInterval( - callback: (...args: any[]) => void, - msDelay?: number -): number; -declare function setInterval( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args -): number; -declare function clearInterval(timeoutId: number | null): void; -declare function queueMicrotask(task: Function): void; -declare function structuredClone( - value: T, - options?: StructuredSerializeOptions -): T; -declare function fetch( - input: RequestInfo, - init?: RequestInit -): Promise; -declare const self: ServiceWorkerGlobalScope; -declare const crypto: Crypto; -declare const caches: CacheStorage; -declare const scheduler: Scheduler; -declare const navigator: Navigator; -declare interface TestController {} -declare interface ExecutionContext { - waitUntil(promise: Promise): void; - passThroughOnException(): void; -} -declare type ExportedHandlerFetchHandler< - Env = unknown, - CfHostMetadata = unknown -> = ( - request: Request>, - env: Env, - ctx: ExecutionContext -) => Response | Promise; -declare type ExportedHandlerTraceHandler = ( - traces: TraceItem[], - env: Env, - ctx: ExecutionContext -) => void | Promise; -declare type ExportedHandlerScheduledHandler = ( - controller: ScheduledController, - env: Env, - ctx: ExecutionContext -) => void | Promise; -declare type ExportedHandlerQueueHandler = ( - batch: MessageBatch, - env: Env, - ctx: ExecutionContext -) => void | Promise; -declare type ExportedHandlerTestHandler = ( - controller: TestController, - env: Env, - ctx: ExecutionContext -) => void | Promise; -declare interface ExportedHandler< - Env = unknown, - QueueMessage = unknown, - CfHostMetadata = unknown -> { - fetch?: ExportedHandlerFetchHandler; - trace?: ExportedHandlerTraceHandler; - scheduled?: ExportedHandlerScheduledHandler; - test?: ExportedHandlerTestHandler; - queue?: ExportedHandlerQueueHandler; -} -declare interface StructuredSerializeOptions { - transfer?: any[]; -} -declare abstract class PromiseRejectionEvent extends Event { - readonly promise: Promise; - readonly reason: any; -} -declare abstract class Navigator { - readonly userAgent: string; -} -declare interface DurableObject { - fetch(request: Request): Response | Promise; - alarm?(): void | Promise; -} -declare interface DurableObjectStub extends Fetcher { - readonly id: DurableObjectId; - readonly name?: string; -} -declare interface DurableObjectId { - toString(): string; - equals(other: DurableObjectId): boolean; - readonly name?: string; -} -declare interface DurableObjectNamespace { - newUniqueId( - options?: DurableObjectNamespaceNewUniqueIdOptions - ): DurableObjectId; - idFromName(name: string): DurableObjectId; - idFromString(id: string): DurableObjectId; - get( - id: DurableObjectId, - options?: DurableObjectNamespaceGetDurableObjectOptions - ): DurableObjectStub; - jurisdiction(jurisdiction: string): DurableObjectNamespace; -} -declare interface DurableObjectNamespaceNewUniqueIdOptions { - jurisdiction?: string; -} -declare interface DurableObjectNamespaceGetDurableObjectOptions { - locationHint?: string; -} -declare interface DurableObjectState { - waitUntil(promise: Promise): void; - readonly id: DurableObjectId; - readonly storage: DurableObjectStorage; - blockConcurrencyWhile(callback: () => Promise): Promise; -} -declare interface DurableObjectTransaction { - get( - key: string, - options?: DurableObjectGetOptions - ): Promise; - get( - keys: string[], - options?: DurableObjectGetOptions - ): Promise>; - list( - options?: DurableObjectListOptions - ): Promise>; - put( - key: string, - value: T, - options?: DurableObjectPutOptions - ): Promise; - put( - entries: Record, - options?: DurableObjectPutOptions - ): Promise; - delete(key: string, options?: DurableObjectPutOptions): Promise; - delete(keys: string[], options?: DurableObjectPutOptions): Promise; - rollback(): void; - getAlarm(options?: DurableObjectGetAlarmOptions): Promise; - setAlarm( - scheduledTime: number | Date, - options?: DurableObjectSetAlarmOptions - ): Promise; - deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise; -} -declare interface DurableObjectStorage { - get( - key: string, - options?: DurableObjectGetOptions - ): Promise; - get( - keys: string[], - options?: DurableObjectGetOptions - ): Promise>; - list( - options?: DurableObjectListOptions - ): Promise>; - put( - key: string, - value: T, - options?: DurableObjectPutOptions - ): Promise; - put( - entries: Record, - options?: DurableObjectPutOptions - ): Promise; - delete(key: string, options?: DurableObjectPutOptions): Promise; - delete(keys: string[], options?: DurableObjectPutOptions): Promise; - deleteAll(options?: DurableObjectPutOptions): Promise; - transaction( - closure: (txn: DurableObjectTransaction) => Promise - ): Promise; - getAlarm(options?: DurableObjectGetAlarmOptions): Promise; - setAlarm( - scheduledTime: number | Date, - options?: DurableObjectSetAlarmOptions - ): Promise; - deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise; - sync(): Promise; -} -declare interface DurableObjectListOptions { - start?: string; - startAfter?: string; - end?: string; - prefix?: string; - reverse?: boolean; - limit?: number; - allowConcurrency?: boolean; - noCache?: boolean; -} -declare interface DurableObjectGetOptions { - allowConcurrency?: boolean; - noCache?: boolean; -} -declare interface DurableObjectGetAlarmOptions { - allowConcurrency?: boolean; -} -declare interface DurableObjectPutOptions { - allowConcurrency?: boolean; - allowUnconfirmed?: boolean; - noCache?: boolean; -} -declare interface DurableObjectSetAlarmOptions { - allowConcurrency?: boolean; - allowUnconfirmed?: boolean; -} -declare interface AnalyticsEngineDataset { - writeDataPoint(event?: AnalyticsEngineDataPoint): void; -} -declare interface AnalyticsEngineDataPoint { - indexes?: ((ArrayBuffer | string) | null)[]; - doubles?: number[]; - blobs?: ((ArrayBuffer | string) | null)[]; -} -declare class Event { - constructor(type: string, init?: EventInit); - get type(): string; - get eventPhase(): number; - get composed(): boolean; - get bubbles(): boolean; - get cancelable(): boolean; - get defaultPrevented(): boolean; - get returnValue(): boolean; - get currentTarget(): EventTarget | undefined; - get srcElement(): EventTarget | undefined; - get timeStamp(): number; - get isTrusted(): boolean; - get cancelBubble(): boolean; - set cancelBubble(value: boolean); - stopImmediatePropagation(): void; - preventDefault(): void; - stopPropagation(): void; - composedPath(): EventTarget[]; - static readonly NONE: number; - static readonly CAPTURING_PHASE: number; - static readonly AT_TARGET: number; - static readonly BUBBLING_PHASE: number; -} -declare interface EventInit { - bubbles?: boolean; - cancelable?: boolean; - composed?: boolean; -} -declare type EventListener = ( - event: EventType -) => void; -declare interface EventListenerObject { - handleEvent(event: EventType): void; -} -declare type EventListenerOrEventListenerObject< - EventType extends Event = Event -> = EventListener | EventListenerObject; -declare class EventTarget< - EventMap extends Record = Record -> { - constructor(); - addEventListener( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetAddEventListenerOptions | boolean - ): void; - removeEventListener( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetEventListenerOptions | boolean - ): void; - dispatchEvent(event: EventMap[keyof EventMap]): boolean; -} -declare interface EventTargetEventListenerOptions { - capture?: boolean; -} -declare interface EventTargetAddEventListenerOptions { - capture?: boolean; - passive?: boolean; - once?: boolean; - signal?: AbortSignal; -} -declare interface EventTargetHandlerObject { - handleEvent: (event: Event) => any | undefined; -} -declare class AbortController { - constructor(); - get signal(): AbortSignal; - abort(reason?: any): void; -} -declare abstract class AbortSignal extends EventTarget { - static abort(reason?: any): AbortSignal; - static timeout(delay: number): AbortSignal; - get aborted(): boolean; - get reason(): any; - throwIfAborted(): void; -} -declare interface Scheduler { - wait(delay: number, maybeOptions?: SchedulerWaitOptions): Promise; -} -declare interface SchedulerWaitOptions { - signal?: AbortSignal; -} -declare abstract class ExtendableEvent extends Event { - waitUntil(promise: Promise): void; -} -declare class Blob { - constructor( - bits?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[], - options?: BlobOptions - ); - get size(): number; - get type(): string; - slice(start?: number, end?: number, type?: string): Blob; - arrayBuffer(): Promise; - text(): Promise; - stream(): ReadableStream; -} -declare interface BlobOptions { - type?: string; -} -declare class File extends Blob { - constructor( - bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined, - name: string, - options?: FileOptions - ); - get name(): string; - get lastModified(): number; -} -declare interface FileOptions { - type?: string; - lastModified?: number; -} -declare abstract class CacheStorage { - open(cacheName: string): Promise; - readonly default: Cache; -} -declare abstract class Cache { - delete(request: RequestInfo, options?: CacheQueryOptions): Promise; - match( - request: RequestInfo, - options?: CacheQueryOptions - ): Promise; - put(request: RequestInfo, response: Response): Promise; -} -declare interface CacheQueryOptions { - ignoreMethod?: boolean; -} -declare abstract class Crypto { - get subtle(): SubtleCrypto; - getRandomValues< - T extends - | Int8Array - | Uint8Array - | Int16Array - | Uint16Array - | Int32Array - | Uint32Array - | BigInt64Array - | BigUint64Array - >(buffer: T): T; - randomUUID(): string; - DigestStream: typeof DigestStream; -} -declare abstract class SubtleCrypto { - encrypt( - algorithm: string | SubtleCryptoEncryptAlgorithm, - key: CryptoKey, - plainText: ArrayBuffer | ArrayBufferView - ): Promise; - decrypt( - algorithm: string | SubtleCryptoEncryptAlgorithm, - key: CryptoKey, - cipherText: ArrayBuffer | ArrayBufferView - ): Promise; - sign( - algorithm: string | SubtleCryptoSignAlgorithm, - key: CryptoKey, - data: ArrayBuffer | ArrayBufferView - ): Promise; - verify( - algorithm: string | SubtleCryptoSignAlgorithm, - key: CryptoKey, - signature: ArrayBuffer | ArrayBufferView, - data: ArrayBuffer | ArrayBufferView - ): Promise; - digest( - algorithm: string | SubtleCryptoHashAlgorithm, - data: ArrayBuffer | ArrayBufferView - ): Promise; - generateKey( - algorithm: string | SubtleCryptoGenerateKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - deriveKey( - algorithm: string | SubtleCryptoDeriveKeyAlgorithm, - baseKey: CryptoKey, - derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - deriveBits( - algorithm: string | SubtleCryptoDeriveKeyAlgorithm, - baseKey: CryptoKey, - length: number | null - ): Promise; - importKey( - format: string, - keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey, - algorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - exportKey(format: string, key: CryptoKey): Promise; - wrapKey( - format: string, - key: CryptoKey, - wrappingKey: CryptoKey, - wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm - ): Promise; - unwrapKey( - format: string, - wrappedKey: ArrayBuffer | ArrayBufferView, - unwrappingKey: CryptoKey, - unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm, - unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - timingSafeEqual( - a: ArrayBuffer | ArrayBufferView, - b: ArrayBuffer | ArrayBufferView - ): boolean; -} -declare abstract class CryptoKey { - readonly type: string; - readonly extractable: boolean; - readonly algorithm: - | CryptoKeyKeyAlgorithm - | CryptoKeyAesKeyAlgorithm - | CryptoKeyHmacKeyAlgorithm - | CryptoKeyRsaKeyAlgorithm - | CryptoKeyEllipticKeyAlgorithm - | CryptoKeyArbitraryKeyAlgorithm; - readonly usages: string[]; -} -declare interface CryptoKeyPair { - publicKey: CryptoKey; - privateKey: CryptoKey; -} -declare 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; -} -declare interface RsaOtherPrimesInfo { - r?: string; - d?: string; - t?: string; -} -declare interface SubtleCryptoDeriveKeyAlgorithm { - name: string; - salt?: ArrayBuffer; - iterations?: number; - hash?: string | SubtleCryptoHashAlgorithm; - $public?: CryptoKey; - info?: ArrayBuffer; -} -declare interface SubtleCryptoEncryptAlgorithm { - name: string; - iv?: ArrayBuffer; - additionalData?: ArrayBuffer; - tagLength?: number; - counter?: ArrayBuffer; - length?: number; - label?: ArrayBuffer; -} -declare interface SubtleCryptoGenerateKeyAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - modulusLength?: number; - publicExponent?: ArrayBuffer; - length?: number; - namedCurve?: string; -} -declare interface SubtleCryptoHashAlgorithm { - name: string; -} -declare interface SubtleCryptoImportKeyAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - length?: number; - namedCurve?: string; - compressed?: boolean; -} -declare interface SubtleCryptoSignAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - dataLength?: number; - saltLength?: number; -} -declare interface CryptoKeyKeyAlgorithm { - name: string; -} -declare interface CryptoKeyAesKeyAlgorithm { - name: string; - length: number; -} -declare interface CryptoKeyHmacKeyAlgorithm { - name: string; - hash: CryptoKeyKeyAlgorithm; - length: number; -} -declare interface CryptoKeyRsaKeyAlgorithm { - name: string; - modulusLength: number; - publicExponent: ArrayBuffer; - hash?: CryptoKeyKeyAlgorithm; -} -declare interface CryptoKeyEllipticKeyAlgorithm { - name: string; - namedCurve: string; -} -declare interface CryptoKeyArbitraryKeyAlgorithm { - name: string; - hash?: CryptoKeyKeyAlgorithm; - namedCurve?: string; - length?: number; -} -declare class DigestStream extends WritableStream< - ArrayBuffer | ArrayBufferView -> { - constructor(algorithm: string | SubtleCryptoHashAlgorithm); - get digest(): Promise; -} -declare class TextDecoder { - constructor(decoder?: string, options?: TextDecoderConstructorOptions); - decode( - input?: ArrayBuffer | ArrayBufferView, - options?: TextDecoderDecodeOptions - ): string; - get encoding(): string; - get fatal(): boolean; - get ignoreBOM(): boolean; -} -declare class TextEncoder { - constructor(); - encode(input?: string): Uint8Array; - encodeInto(input: string, buffer: Uint8Array): TextEncoderEncodeIntoResult; - get encoding(): string; -} -declare interface TextDecoderConstructorOptions { - fatal: boolean; - ignoreBOM: boolean; -} -declare interface TextDecoderDecodeOptions { - stream: boolean; -} -declare interface TextEncoderEncodeIntoResult { - read: number; - written: number; -} -declare class FormData { - constructor(); - append(name: string, value: string): void; - append(name: string, value: Blob, filename?: string): void; - delete(name: string): void; - get(name: string): (File | string) | null; - getAll(name: string): (File | string)[]; - has(name: string): boolean; - set(name: string, value: string): void; - set(name: string, value: Blob, filename?: string): void; - entries(): IterableIterator<[key: string, value: File | string]>; - keys(): IterableIterator; - values(): IterableIterator; - forEach( - callback: ( - this: This, - value: File | string, - key: string, - parent: FormData - ) => void, - thisArg?: This - ): void; - [Symbol.iterator](): IterableIterator<[key: string, value: File | string]>; -} -declare interface ContentOptions { - html?: boolean; -} -declare class HTMLRewriter { - constructor(); - on( - selector: string, - handlers: HTMLRewriterElementContentHandlers - ): HTMLRewriter; - onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter; - transform(response: Response): Response; -} -declare interface HTMLRewriterElementContentHandlers { - element?(element: Element): void | Promise; - comments?(comment: Comment): void | Promise; - text?(element: Text): void | Promise; -} -declare interface HTMLRewriterDocumentContentHandlers { - doctype?(doctype: Doctype): void | Promise; - comments?(comment: Comment): void | Promise; - text?(text: Text): void | Promise; - end?(end: DocumentEnd): void | Promise; -} -declare interface Doctype { - readonly name: string | null; - readonly publicId: string | null; - readonly systemId: string | null; -} -declare interface Element { - tagName: string; - readonly attributes: IterableIterator; - 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, options?: ContentOptions): Element; - after(content: string, options?: ContentOptions): Element; - prepend(content: string, options?: ContentOptions): Element; - append(content: string, options?: ContentOptions): Element; - replace(content: string, options?: ContentOptions): Element; - remove(): Element; - removeAndKeepContent(): Element; - setInnerContent(content: string, options?: ContentOptions): Element; - onEndTag(handler: (tag: EndTag) => void | Promise): void; -} -declare interface EndTag { - name: string; - before(content: string, options?: ContentOptions): EndTag; - after(content: string, options?: ContentOptions): EndTag; - remove(): EndTag; -} -declare 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; -} -declare interface Text { - readonly text: string; - readonly lastInTextNode: boolean; - readonly removed: boolean; - before(content: string, options?: ContentOptions): Text; - after(content: string, options?: ContentOptions): Text; - replace(content: string, options?: ContentOptions): Text; - remove(): Text; -} -declare interface DocumentEnd { - append(content: string, options?: ContentOptions): DocumentEnd; -} -declare abstract class FetchEvent extends ExtendableEvent { - readonly request: Request; - respondWith(promise: Response | Promise): void; - passThroughOnException(): void; -} -declare type HeadersInit = - | Headers - | Iterable> - | Record; -declare class Headers { - constructor(init?: HeadersInit); - get(name: string): string | null; - getAll(name: string): string[]; - has(name: string): boolean; - set(name: string, value: string): void; - append(name: string, value: string): void; - delete(name: string): void; - forEach( - callback: (this: This, value: string, key: string, parent: Headers) => void, - thisArg?: This - ): void; - entries(): IterableIterator<[key: string, value: string]>; - keys(): IterableIterator; - values(): IterableIterator; - [Symbol.iterator](): IterableIterator<[key: string, value: string]>; -} -declare type BodyInit = - | ReadableStream - | string - | ArrayBuffer - | ArrayBufferView - | Blob - | URLSearchParams - | FormData; -declare abstract class Body { - get body(): ReadableStream | null; - get bodyUsed(): boolean; - arrayBuffer(): Promise; - text(): Promise; - json(): Promise; - formData(): Promise; - blob(): Promise; -} -declare class Response extends Body { - constructor(body?: BodyInit | null, init?: ResponseInit); - static redirect(url: string, status?: number): Response; - static json(any: any, maybeInit?: ResponseInit | Response): Response; - clone(): Response; - get status(): number; - get statusText(): string; - get headers(): Headers; - get ok(): boolean; - get redirected(): boolean; - get url(): string; - get webSocket(): WebSocket | null; - get cf(): any | undefined; -} -declare interface ResponseInit { - status?: number; - statusText?: string; - headers?: HeadersInit; - cf?: any; - webSocket?: WebSocket | null; - encodeBody?: "automatic" | "manual"; -} -declare type RequestInfo< - CfHostMetadata = unknown, - Cf = CfProperties -> = Request | string | URL; -declare class Request< - CfHostMetadata = unknown, - Cf = CfProperties -> extends Body { - constructor(input: RequestInfo, init?: RequestInit); - clone(): Request; - get method(): string; - get url(): string; - get headers(): Headers; - get redirect(): string; - get fetcher(): Fetcher | null; - get signal(): AbortSignal; - get cf(): Cf | undefined; - get integrity(): string; - get keepalive(): boolean; -} -declare interface RequestInit { - /** 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 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; -} -declare abstract class Fetcher { - fetch(input: RequestInfo, init?: RequestInit): Promise; -} -declare interface FetcherPutOptions { - expiration?: number; - expirationTtl?: number; -} -declare interface KVNamespaceListKey { - name: Key; - expiration?: number; - metadata?: Metadata; -} -declare type KVNamespaceListResult = - | { - list_complete: false; - keys: KVNamespaceListKey[]; - cursor: string; - } - | { - list_complete: true; - keys: KVNamespaceListKey[]; - }; -declare interface KVNamespace { - get( - key: Key, - options?: Partial> - ): Promise; - get(key: Key, type: "text"): Promise; - get( - key: Key, - type: "json" - ): Promise; - get(key: Key, type: "arrayBuffer"): Promise; - get(key: Key, type: "stream"): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"text"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"json"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"arrayBuffer"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"stream"> - ): Promise; - list( - options?: KVNamespaceListOptions - ): Promise>; - put( - key: Key, - value: string | ArrayBuffer | ArrayBufferView | ReadableStream, - options?: KVNamespacePutOptions - ): Promise; - getWithMetadata( - key: Key, - options?: Partial> - ): Promise>; - getWithMetadata( - key: Key, - type: "text" - ): Promise>; - getWithMetadata( - key: Key, - type: "json" - ): Promise>; - getWithMetadata( - key: Key, - type: "arrayBuffer" - ): Promise>; - getWithMetadata( - key: Key, - type: "stream" - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"text"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"json"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"arrayBuffer"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"stream"> - ): Promise>; - delete(key: Key): Promise; -} -declare interface KVNamespaceListOptions { - limit?: number; - prefix?: string | null; - cursor?: string | null; -} -declare interface KVNamespaceGetOptions { - type: Type; - cacheTtl?: number; -} -declare interface KVNamespacePutOptions { - expiration?: number; - expirationTtl?: number; - metadata?: any | null; -} -declare interface KVNamespaceGetWithMetadataResult { - value: Value | null; - metadata: Metadata | null; -} -declare interface R2Error extends Error { - readonly name: string; - readonly code: number; - readonly message: string; - readonly action: string; - readonly stack: any; -} -declare interface R2ListOptions { - limit?: number; - prefix?: string; - cursor?: string; - delimiter?: string; - startAfter?: string; -} -declare abstract class R2Bucket { - head(key: string): Promise; - get( - key: string, - options: R2GetOptions & { - onlyIf: R2Conditional | Headers; - } - ): Promise; - get(key: string, options?: R2GetOptions): Promise; - put( - key: string, - value: - | ReadableStream - | ArrayBuffer - | ArrayBufferView - | string - | null - | Blob, - options?: R2PutOptions - ): Promise; - put( - key: string, - value: - | ReadableStream - | ArrayBuffer - | ArrayBufferView - | string - | null - | Blob, - options?: R2PutOptions & { - onlyIf: R2Conditional | Headers; - } - ): Promise; - createMultipartUpload( - key: string, - options?: R2MultipartOptions - ): Promise; - resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload; - delete(keys: string | string[]): Promise; - list(options?: R2ListOptions): Promise; -} -declare interface R2MultipartUpload { - readonly key: string; - readonly uploadId: string; - uploadPart( - partNumber: number, - value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob - ): Promise; - abort(): Promise; - complete(uploadedParts: R2UploadedPart[]): Promise; -} -declare 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; - readonly range?: R2Range; - writeHttpMetadata(headers: Headers): void; -} -declare interface R2ObjectBody extends R2Object { - get body(): ReadableStream; - get bodyUsed(): boolean; - arrayBuffer(): Promise; - text(): Promise; - json(): Promise; - blob(): Promise; -} -declare type R2Range = - | { - offset: number; - length?: number; - } - | { - offset?: number; - length: number; - } - | { - suffix: number; - }; -declare interface R2Conditional { - etagMatches?: string; - etagDoesNotMatch?: string; - uploadedBefore?: Date; - uploadedAfter?: Date; - secondsGranularity?: boolean; -} -declare interface R2GetOptions { - onlyIf?: R2Conditional | Headers; - range?: R2Range | Headers; -} -declare interface R2PutOptions { - onlyIf?: R2Conditional | Headers; - httpMetadata?: R2HTTPMetadata | Headers; - customMetadata?: Record; - md5?: ArrayBuffer | string; - sha1?: ArrayBuffer | string; - sha256?: ArrayBuffer | string; - sha384?: ArrayBuffer | string; - sha512?: ArrayBuffer | string; -} -declare interface R2MultipartOptions { - httpMetadata?: R2HTTPMetadata | Headers; - customMetadata?: Record; -} -declare interface R2Checksums { - readonly md5?: ArrayBuffer; - readonly sha1?: ArrayBuffer; - readonly sha256?: ArrayBuffer; - readonly sha384?: ArrayBuffer; - readonly sha512?: ArrayBuffer; - toJSON(): R2StringChecksums; -} -declare interface R2StringChecksums { - md5?: string; - sha1?: string; - sha256?: string; - sha384?: string; - sha512?: string; -} -declare interface R2HTTPMetadata { - contentType?: string; - contentLanguage?: string; - contentDisposition?: string; - contentEncoding?: string; - cacheControl?: string; - cacheExpiry?: Date; -} -declare interface R2Objects { - objects: R2Object[]; - truncated: boolean; - cursor?: string; - delimitedPrefixes: string[]; -} -declare abstract class ScheduledEvent extends ExtendableEvent { - readonly scheduledTime: number; - readonly cron: string; - noRetry(): void; -} -declare interface ScheduledController { - readonly scheduledTime: number; - readonly cron: string; - noRetry(): void; -} -declare interface QueuingStrategy { - highWaterMark?: number | bigint; - size?: (chunk: T) => number | bigint; -} -declare interface UnderlyingSink { - type?: string; - start?: (controller: WritableStreamDefaultController) => void | Promise; - write?: ( - chunk: W, - controller: WritableStreamDefaultController - ) => void | Promise; - abort?: (reason: any) => void | Promise; - close?: () => void | Promise; -} -declare interface UnderlyingByteSource { - type: "bytes"; - autoAllocateChunkSize?: number; - start?: (controller: ReadableByteStreamController) => void | Promise; - pull?: (controller: ReadableByteStreamController) => void | Promise; - cancel?: (reason: any) => void | Promise; -} -declare interface UnderlyingSource { - type?: "" | undefined; - start?: ( - controller: ReadableStreamDefaultController - ) => void | Promise; - pull?: ( - controller: ReadableStreamDefaultController - ) => void | Promise; - cancel?: (reason: any) => void | Promise; -} -declare interface Transformer { - readableType?: string; - writableType?: string; - start?: ( - controller: TransformStreamDefaultController - ) => void | Promise; - transform?: ( - chunk: I, - controller: TransformStreamDefaultController - ) => void | Promise; - flush?: ( - controller: TransformStreamDefaultController - ) => void | Promise; -} -declare interface StreamPipeOptions { - /** - * 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; - preventAbort?: boolean; - preventCancel?: boolean; - signal?: AbortSignal; -} -declare type ReadableStreamReadResult = - | { - done: false; - value: R; - } - | { - done: true; - value?: undefined; - }; -/** This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object. */ -declare interface ReadableStream { - get locked(): boolean; - cancel(reason?: any): Promise; - getReader(): ReadableStreamDefaultReader; - getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader; - pipeThrough( - transform: ReadableWritablePair, - options?: StreamPipeOptions - ): ReadableStream; - pipeTo( - destination: WritableStream, - options?: StreamPipeOptions - ): Promise; - tee(): [ReadableStream, ReadableStream]; - values(options?: ReadableStreamValuesOptions): AsyncIterableIterator; - [Symbol.asyncIterator]( - options?: ReadableStreamValuesOptions - ): AsyncIterableIterator; -} -declare const ReadableStream: { - prototype: ReadableStream; - new ( - underlyingSource: UnderlyingByteSource, - strategy?: QueuingStrategy - ): ReadableStream; - new ( - underlyingSource?: UnderlyingSource, - strategy?: QueuingStrategy - ): ReadableStream; -}; -declare class ReadableStreamDefaultReader { - constructor(stream: ReadableStream); - get closed(): Promise; - cancel(reason?: any): Promise; - read(): Promise>; - releaseLock(): void; -} -declare class ReadableStreamBYOBReader { - constructor(stream: ReadableStream); - get closed(): Promise; - cancel(reason?: any): Promise; - read( - view: T - ): Promise>; - releaseLock(): void; - readAtLeast( - minElements: number, - view: T - ): Promise>; -} -declare interface ReadableStreamGetReaderOptions { - mode: "byob"; -} -declare interface ReadableStreamBYOBRequest { - readonly view: Uint8Array | null; - respond(bytesWritten: number): void; - respondWithNewView(view: ArrayBuffer | ArrayBufferView): void; - readonly atLeast: number | null; -} -declare interface ReadableStreamDefaultController { - readonly desiredSize: number | null; - close(): void; - enqueue(chunk?: R): void; - error(reason: any): void; -} -declare interface ReadableByteStreamController { - readonly byobRequest: ReadableStreamBYOBRequest | null; - readonly desiredSize: number | null; - close(): void; - enqueue(chunk: ArrayBuffer | ArrayBufferView): void; - error(reason: any): void; -} -/** This Streams API interface represents a controller allowing control of a WritableStream's state. When constructing a WritableStream, the underlying sink is given a corresponding WritableStreamDefaultController instance to manipulate. */ -declare interface WritableStreamDefaultController { - readonly signal: AbortSignal; - error(reason?: any): void; -} -declare interface TransformStreamDefaultController { - get desiredSize(): number | null; - enqueue(chunk?: O): void; - error(reason: any): void; - terminate(): void; -} -declare interface ReadableWritablePair { - /** - * 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; - readable: ReadableStream; -} -declare class WritableStream { - constructor( - underlyingSink?: UnderlyingSink, - queuingStrategy?: QueuingStrategy - ); - get locked(): boolean; - abort(reason?: any): Promise; - close(): Promise; - getWriter(): WritableStreamDefaultWriter; -} -declare class WritableStreamDefaultWriter { - constructor(stream: WritableStream); - get closed(): Promise; - get ready(): Promise; - get desiredSize(): number | null; - abort(reason?: any): Promise; - close(): Promise; - write(chunk?: W): Promise; - releaseLock(): void; -} -declare class TransformStream { - constructor( - transformer?: Transformer, - writableStrategy?: QueuingStrategy, - readableStrategy?: QueuingStrategy - ); - get readable(): ReadableStream; - get writable(): WritableStream; -} -declare class FixedLengthStream extends IdentityTransformStream { - constructor(expectedLength: number | bigint); -} -declare class IdentityTransformStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(); -} -declare interface ReadableStreamValuesOptions { - preventCancel?: boolean; -} -declare class CompressionStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(format: "gzip" | "deflate" | "deflate-raw"); -} -declare class DecompressionStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(format: "gzip" | "deflate" | "deflate-raw"); -} -declare class TextEncoderStream extends TransformStream { - constructor(); -} -declare class TextDecoderStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - string -> { - constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit); -} -declare interface TextDecoderStreamTextDecoderStreamInit { - fatal?: boolean; -} -declare class ByteLengthQueuingStrategy - implements QueuingStrategy -{ - constructor(init: QueuingStrategyInit); - get highWaterMark(): number; - get size(): (chunk?: any) => number; -} -declare class CountQueuingStrategy implements QueuingStrategy { - constructor(init: QueuingStrategyInit); - get highWaterMark(): number; - get size(): (chunk?: any) => number; -} -declare 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; -} -declare abstract class TraceEvent extends ExtendableEvent { - readonly traces: TraceItem[]; -} -declare interface TraceItem { - readonly event: - | ( - | TraceItemFetchEventInfo - | TraceItemScheduledEventInfo - | TraceItemAlarmEventInfo - | TraceItemQueueEventInfo - | TraceItemEmailEventInfo - | TraceItemCustomEventInfo - ) - | null; - readonly eventTimestamp: number | null; - readonly logs: TraceLog[]; - readonly exceptions: TraceException[]; - readonly scriptName: string | null; - readonly dispatchNamespace?: string; - readonly scriptTags?: string[]; - readonly outcome: string; -} -declare interface TraceItemAlarmEventInfo { - readonly scheduledTime: Date; -} -declare interface TraceItemCustomEventInfo {} -declare interface TraceItemScheduledEventInfo { - readonly scheduledTime: number; - readonly cron: string; -} -declare interface TraceItemQueueEventInfo { - readonly queue: string; - readonly batchSize: number; -} -declare interface TraceItemEmailEventInfo { - readonly mailFrom: string; - readonly rcptTo: string; - readonly rawSize: number; -} -declare interface TraceItemFetchEventInfo { - readonly response?: TraceItemFetchEventInfoResponse; - readonly request: TraceItemFetchEventInfoRequest; -} -declare interface TraceItemFetchEventInfoRequest { - readonly cf?: any; - readonly headers: Record; - readonly method: string; - readonly url: string; - getUnredacted(): TraceItemFetchEventInfoRequest; -} -declare interface TraceItemFetchEventInfoResponse { - readonly status: number; -} -declare interface TraceLog { - readonly timestamp: number; - readonly level: string; - readonly message: any; -} -declare interface TraceException { - readonly timestamp: number; - readonly message: string; - readonly name: string; -} -declare interface TraceMetrics { - readonly cpuTime: number; - readonly wallTime: number; -} -declare interface UnsafeTraceMetrics { - fromTrace(item: TraceItem): TraceMetrics; -} -declare class URL { - constructor(url: string | URL, base?: string | URL); - get href(): string; - set href(value: string); - get origin(): string; - get protocol(): string; - set protocol(value: string); - get username(): string; - set username(value: string); - get password(): string; - set password(value: string); - get host(): string; - set host(value: string); - get hostname(): string; - set hostname(value: string); - get port(): string; - set port(value: string); - get pathname(): string; - set pathname(value: string); - get search(): string; - set search(value: string); - get searchParams(): URLSearchParams; - get hash(): string; - set hash(value: string); - toString(): string; - toJSON(): string; -} -declare class URLSearchParams { - constructor( - init?: - | URLSearchParams - | string - | Record - | [key: string, value: string][] - ); - get size(): number; - append(name: string, value: string): void; - delete(name: string): void; - get(name: string): string | null; - getAll(name: string): string[]; - has(name: string): boolean; - set(name: string, value: string): void; - sort(): void; - entries(): IterableIterator<[key: string, value: string]>; - keys(): IterableIterator; - values(): IterableIterator; - forEach( - callback: ( - this: This, - value: string, - key: string, - parent: URLSearchParams - ) => void, - thisArg?: This - ): void; - toString(): string; - [Symbol.iterator](): IterableIterator<[key: string, value: string]>; -} -declare class URLPattern { - constructor(input?: string | URLPatternURLPatternInit, baseURL?: string); - get protocol(): string; - get username(): string; - get password(): string; - get hostname(): string; - get port(): string; - get pathname(): string; - get search(): string; - get hash(): string; - test(input?: string | URLPatternURLPatternInit, baseURL?: string): boolean; - exec( - input?: string | URLPatternURLPatternInit, - baseURL?: string - ): URLPatternURLPatternResult | null; -} -declare interface URLPatternURLPatternInit { - protocol?: string; - username?: string; - password?: string; - hostname?: string; - port?: string; - pathname?: string; - search?: string; - hash?: string; - baseURL?: string; -} -declare interface URLPatternURLPatternComponentResult { - input: string; - groups: Record; -} -declare interface URLPatternURLPatternResult { - inputs: (string | URLPatternURLPatternInit)[]; - protocol: URLPatternURLPatternComponentResult; - username: URLPatternURLPatternComponentResult; - password: URLPatternURLPatternComponentResult; - hostname: URLPatternURLPatternComponentResult; - port: URLPatternURLPatternComponentResult; - pathname: URLPatternURLPatternComponentResult; - search: URLPatternURLPatternComponentResult; - hash: URLPatternURLPatternComponentResult; -} -declare class CloseEvent extends Event { - constructor(type: string, initializer: CloseEventInit); - /** Returns the WebSocket connection close code provided by the server. */ - readonly code: number; - /** Returns the WebSocket connection close reason provided by the server. */ - readonly reason: string; - /** Returns true if the connection closed cleanly; false otherwise. */ - readonly wasClean: boolean; -} -declare interface CloseEventInit { - code?: number; - reason?: string; - wasClean?: boolean; -} -declare class MessageEvent extends Event { - constructor(type: string, initializer: MessageEventInit); - readonly data: ArrayBuffer | string; -} -declare interface MessageEventInit { - data: ArrayBuffer | string; -} -/** Events providing information related to errors in scripts or in files. */ -declare interface ErrorEvent extends Event { - readonly filename: string; - readonly message: string; - readonly lineno: number; - readonly colno: number; - readonly error: any; -} -declare type WebSocketEventMap = { - close: CloseEvent; - message: MessageEvent; - open: Event; - error: ErrorEvent; -}; -declare class WebSocket extends EventTarget { - constructor(url: string, protocols?: string[] | string); - accept(): void; - send(message: (ArrayBuffer | ArrayBufferView) | string): void; - close(code?: number, reason?: string): void; - static readonly READY_STATE_CONNECTING: number; - static readonly READY_STATE_OPEN: number; - static readonly READY_STATE_CLOSING: number; - static readonly READY_STATE_CLOSED: number; - get readyState(): number; - get url(): string | null; - get protocol(): string | null; - get extensions(): string | null; -} -declare const WebSocketPair: { - new (): { - 0: WebSocket; - 1: WebSocket; - }; -}; -declare interface BasicImageTransformations { - /** - * Maximum width in image pixels. The value must be an integer. - */ - width?: number; - /** - * Maximum height in image pixels. The value must be an integer. - */ - height?: number; - /** - * Resizing mode as a string. It affects interpretation of width and height - * options: - * - scale-down: Similar to contain, but the image is never enlarged. If - * the image is larger than given width or height, it will be resized. - * Otherwise its original size will be kept. - * - contain: Resizes to maximum size that fits within the given width and - * height. If only a single dimension is given (e.g. only width), the - * image will be shrunk or enlarged to exactly match that dimension. - * Aspect ratio is always preserved. - * - cover: Resizes (shrinks or enlarges) to fill the entire area of width - * and height. If the image has an aspect ratio different from the ratio - * of width and height, it will be cropped to fit. - * - crop: The image will be shrunk and cropped to fit within the area - * specified by width and height. The image will not be enlarged. For images - * smaller than the given dimensions it's the same as scale-down. For - * images larger than the given dimensions, it's the same as cover. - * See also trim. - * - pad: Resizes to the maximum size that fits within the given width and - * height, and then fills the remaining area with a background color - * (white by default). Use of this mode is not recommended, as the same - * effect can be more efficiently achieved with the contain mode and the - * CSS object-fit: contain property. - */ - fit?: "scale-down" | "contain" | "cover" | "crop" | "pad"; - /** - * When cropping with fit: "cover", this defines the side or point that should - * be left uncropped. The value is either a string - * "left", "right", "top", "bottom", "auto", or "center" (the default), - * or an object {x, y} containing focal point coordinates in the original - * image expressed as fractions ranging from 0.0 (top or left) to 1.0 - * (bottom or right), 0.5 being the center. {fit: "cover", gravity: "top"} will - * crop bottom or left and right sides as necessary, but won’t crop anything - * from the top. {fit: "cover", gravity: {x:0.5, y:0.2}} will crop each side to - * preserve as much as possible around a point at 20% of the height of the - * source image. - */ - gravity?: - | "left" - | "right" - | "top" - | "bottom" - | "center" - | "auto" - | BasicImageTransformationsGravityCoordinates; - /** - * Background color to add underneath the image. Applies only to images with - * transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…), - * hsl(…), etc.) - */ - background?: string; - /** - * Number of degrees (90, 180, 270) to rotate the image by. width and height - * options refer to axes after rotation. - */ - rotate?: 0 | 90 | 180 | 270 | 360; -} -declare interface BasicImageTransformationsGravityCoordinates { - x: number; - y: number; -} -/** - * In addition to the properties you can set in the RequestInit dict - * that you pass as an argument to the Request constructor, you can - * set certain properties of a `cf` object to control how Cloudflare - * features are applied to that new Request. - * - * Note: Currently, these properties cannot be tested in the - * playground. - */ -declare interface RequestInitCfProperties extends Record { - cacheEverything?: boolean; - /** - * A request's cache key is what determines if two requests are - * "the same" for caching purposes. If a request has the same cache key - * as some previous request, then we can serve the same cached response for - * both. (e.g. 'some-key') - * - * Only available for Enterprise customers. - */ - cacheKey?: string; - /** - * This allows you to append additional Cache-Tag response headers - * to the origin response without modifications to the origin server. - * This will allow for greater control over the Purge by Cache Tag feature - * utilizing changes only in the Workers process. - * - * Only available for Enterprise customers. - */ - cacheTags?: string[]; - /** - * Force response to be cached for a given number of seconds. (e.g. 300) - */ - cacheTtl?: number; - /** - * Force response to be cached for a given number of seconds based on the Origin status code. - * (e.g. { '200-299': 86400, '404': 1, '500-599': 0 }) - */ - cacheTtlByStatus?: Record; - scrapeShield?: boolean; - apps?: boolean; - image?: RequestInitCfPropertiesImage; - minify?: RequestInitCfPropertiesImageMinify; - mirage?: boolean; - polish?: "lossy" | "lossless" | "off"; - /** - * Redirects the request to an alternate origin server. You can use this, - * for example, to implement load balancing across several origins. - * (e.g.us-east.example.com) - * - * Note - For security reasons, the hostname set in resolveOverride must - * be proxied on the same Cloudflare zone of the incoming request. - * Otherwise, the setting is ignored. CNAME hosts are allowed, so to - * resolve to a host under a different domain or a DNS only domain first - * declare a CNAME record within your own zone’s DNS mapping to the - * external hostname, set proxy on Cloudflare, then set resolveOverride - * to point to that CNAME record. - */ - resolveOverride?: string; -} -declare interface RequestInitCfPropertiesImageDraw - extends BasicImageTransformations { - /** - * Absolute URL of the image file to use for the drawing. It can be any of - * the supported file formats. For drawing of watermarks or non-rectangular - * overlays we recommend using PNG or WebP images. - */ - url: string; - /** - * Floating-point number between 0 (transparent) and 1 (opaque). - * For example, opacity: 0.5 makes overlay semitransparent. - */ - opacity?: number; - /** - * - If set to true, the overlay image will be tiled to cover the entire - * area. This is useful for stock-photo-like watermarks. - * - If set to "x", the overlay image will be tiled horizontally only - * (form a line). - * - If set to "y", the overlay image will be tiled vertically only - * (form a line). - */ - repeat?: true | "x" | "y"; - /** - * Position of the overlay image relative to a given edge. Each property is - * an offset in pixels. 0 aligns exactly to the edge. For example, left: 10 - * positions left side of the overlay 10 pixels from the left edge of the - * image it's drawn over. bottom: 0 aligns bottom of the overlay with bottom - * of the background image. - * - * Setting both left & right, or both top & bottom is an error. - * - * If no position is specified, the image will be centered. - */ - top?: number; - left?: number; - bottom?: number; - right?: number; -} -declare interface RequestInitCfPropertiesImage - extends BasicImageTransformations { - /** - * Device Pixel Ratio. Default 1. Multiplier for width/height that makes it - * easier to specify higher-DPI sizes in . - */ - dpr?: number; - /** - * An object with four properties {left, top, right, bottom} that specify - * a number of pixels to cut off on each side. Allows removal of borders - * or cutting out a specific fragment of an image. Trimming is performed - * before resizing or rotation. Takes dpr into account. - */ - trim?: { - left?: number; - top?: number; - right?: number; - bottom?: number; - }; - /** - * Quality setting from 1-100 (useful values are in 60-90 range). Lower values - * make images look worse, but load faster. The default is 85. It applies only - * to JPEG and WebP images. It doesn’t have any effect on PNG. - */ - quality?: number; - /** - * Output format to generate. It can be: - * - avif: generate images in AVIF format. - * - webp: generate images in Google WebP format. Set quality to 100 to get - * the WebP-lossless format. - * - json: instead of generating an image, outputs information about the - * image, in JSON format. The JSON object will contain image size - * (before and after resizing), source image’s MIME type, file size, etc. - * - jpeg: generate images in JPEG format. - * - png: generate images in PNG format. - */ - format?: "avif" | "webp" | "json" | "jpeg" | "png"; - /** - * Whether to preserve animation frames from input files. Default is true. - * Setting it to false reduces animations to still images. This setting is - * recommended when enlarging images or processing arbitrary user content, - * because large GIF animations can weigh tens or even hundreds of megabytes. - * It is also useful to set anim:false when using format:"json" to get the - * response quicker without the number of frames. - */ - anim?: boolean; - /** - * What EXIF data should be preserved in the output image. Note that EXIF - * rotation and embedded color profiles are always applied ("baked in" into - * the image), and aren't affected by this option. Note that if the Polish - * feature is enabled, all metadata may have been removed already and this - * option may have no effect. - * - keep: Preserve most of EXIF metadata, including GPS location if there's - * any. - * - copyright: Only keep the copyright tag, and discard everything else. - * This is the default behavior for JPEG files. - * - none: Discard all invisible EXIF metadata. Currently WebP and PNG - * output formats always discard metadata. - */ - metadata?: "keep" | "copyright" | "none"; - /** - * Strength of sharpening filter to apply to the image. Floating-point - * number between 0 (no sharpening, default) and 10 (maximum). 1.0 is a - * recommended value for downscaled images. - */ - sharpen?: number; - /** - * Radius of a blur filter (approximate gaussian). Maximum supported radius - * is 250. - */ - blur?: number; - /** - * Overlays are drawn in the order they appear in the array (last array - * entry is the topmost layer). - */ - draw?: RequestInitCfPropertiesImageDraw[]; - /** - * Fetching image from authenticated origin. Setting this property will - * pass authentication headers (Authorization, Cookie, etc.) through to - * the origin. - */ - "origin-auth"?: "share-publicly"; - /** - * Adds a border around the image. The border is added after resizing. Border - * width takes dpr into account, and can be specified either using a single - * width property, or individually for each side. - */ - border?: - | { - color: string; - width: number; - } - | { - color: string; - top: number; - right: number; - bottom: number; - left: number; - }; - /** - * Increase brightness by a factor. A value of 1.0 equals no change, a value - * of 0.5 equals half brightness, and a value of 2.0 equals twice as bright. - * 0 is ignored. - */ - brightness?: number; - /** - * Increase contrast by a factor. A value of 1.0 equals no change, a value of - * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is - * ignored. - */ - contrast?: number; - /** - * Increase exposure by a factor. A value of 1.0 equals no change, a value of - * 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored. - */ - gamma?: number; - /** - * Slightly reduces latency on a cache miss by selecting a - * quickest-to-compress file format, at a cost of increased file size and - * lower image quality. It will usually override the format option and choose - * JPEG over WebP or AVIF. We do not recommend using this option, except in - * unusual circumstances like resizing uncacheable dynamically-generated - * images. - */ - compression?: "fast"; -} -declare interface RequestInitCfPropertiesImageMinify { - javascript?: boolean; - css?: boolean; - html?: boolean; -} -/** - * Request metadata provided by Cloudflare's edge. - */ -declare type IncomingRequestCfProperties = - IncomingRequestCfPropertiesBase & - IncomingRequestCfPropertiesBotManagementEnterprise & - IncomingRequestCfPropertiesCloudflareForSaaSEnterprise & - IncomingRequestCfPropertiesGeographicInformation & - IncomingRequestCfPropertiesCloudflareAccessOrApiShield; -declare interface IncomingRequestCfPropertiesBase - extends Record { - /** - * [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request. - * - * @example 395747 - */ - asn: number; - /** - * The organization which owns the ASN of the incoming request. - * - * @example "Google Cloud" - */ - asOrganization: string; - /** - * The original value of the `Accept-Encoding` header if Cloudflare modified it. - * - * @example "gzip, deflate, br" - */ - clientAcceptEncoding?: string; - /** - * The number of milliseconds it took for the request to reach your worker. - * - * @example 22 - */ - clientTcpRtt?: number; - /** - * The three-letter [IATA](https://en.wikipedia.org/wiki/IATA_airport_code) - * airport code of the data center that the request hit. - * - * @example "DFW" - */ - colo: string; - /** - * Represents the upstream's response to a - * [TCP `keepalive` message](https://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html) - * from cloudflare. - * - * For workers with no upstream, this will always be `1`. - * - * @example 3 - */ - edgeRequestKeepAliveStatus: IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus; - /** - * The HTTP Protocol the request used. - * - * @example "HTTP/2" - */ - httpProtocol: string; - /** - * The browser-requested prioritization information in the request object. - * - * If no information was set, defaults to the empty string `""` - * - * @example "weight=192;exclusive=0;group=3;group-weight=127" - * @default "" - */ - requestPriority: string; - /** - * The TLS version of the connection to Cloudflare. - * In requests served over plaintext (without TLS), this property is the empty string `""`. - * - * @example "TLSv1.3" - */ - tlsVersion: string; - /** - * The cipher for the connection to Cloudflare. - * In requests served over plaintext (without TLS), this property is the empty string `""`. - * - * @example "AEAD-AES128-GCM-SHA256" - */ - tlsCipher: string; - /** - * Metadata containing the [`HELLO`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2) and [`FINISHED`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9) messages from this request's TLS handshake. - * - * If the incoming request was served over plaintext (without TLS) this field is undefined. - */ - tlsExportedAuthenticator?: IncomingRequestCfPropertiesExportedAuthenticatorMetadata; -} -declare interface IncomingRequestCfPropertiesBotManagementBase { - /** - * Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot, - * represented as an integer percentage between `1` (almost certainly human) - * and `99` (almost certainly a bot). - * - * @example 54 - */ - score: number; - /** - * A boolean value that is true if the request comes from a good bot, like Google or Bing. - * Most customers choose to allow this traffic. For more details, see [Traffic from known bots](https://developers.cloudflare.com/firewall/known-issues-and-faq/#how-does-firewall-rules-handle-traffic-from-known-bots). - */ - verifiedBot: boolean; - /** - * A boolean value that is true if the request originates from a - * Cloudflare-verified proxy service. - */ - corporateProxy: boolean; - /** - * A boolean value that's true if the request matches [file extensions](https://developers.cloudflare.com/bots/reference/static-resources/) for many types of static resources. - */ - staticResource: boolean; - /** - * List of IDs that correlate to the Bot Management heuristic detections made on a request (you can have multiple heuristic detections on the same request). - */ - detectionIds: number[]; -} -declare interface IncomingRequestCfPropertiesBotManagement { - /** - * Results of Cloudflare's Bot Management analysis - */ - botManagement: IncomingRequestCfPropertiesBotManagementBase; - /** - * Duplicate of `botManagement.score`. - * - * @deprecated - */ - clientTrustScore: number; -} -declare interface IncomingRequestCfPropertiesBotManagementEnterprise - extends IncomingRequestCfPropertiesBotManagement { - /** - * Results of Cloudflare's Bot Management analysis - */ - botManagement: IncomingRequestCfPropertiesBotManagementBase & { - /** - * A [JA3 Fingerprint](https://developers.cloudflare.com/bots/concepts/ja3-fingerprint/) to help profile specific SSL/TLS clients - * across different destination IPs, Ports, and X509 certificates. - */ - ja3Hash: string; - }; -} -declare interface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise< - HostMetadata -> { - /** - * Custom metadata set per-host in [Cloudflare for SaaS](https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/). - * - * This field is only present if you have Cloudflare for SaaS enabled on your account - * and you have followed the [required steps to enable it]((https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/domain-support/custom-metadata/)). - */ - hostMetadata: HostMetadata; -} -declare interface IncomingRequestCfPropertiesCloudflareAccessOrApiShield { - /** - * Information about the client certificate presented to Cloudflare. - * - * This is populated when the incoming request is served over TLS using - * either Cloudflare Access or API Shield (mTLS) - * and the presented SSL certificate has a valid - * [Certificate Serial Number](https://ldapwiki.com/wiki/Certificate%20Serial%20Number) - * (i.e., not `null` or `""`). - * - * Otherwise, a set of placeholder values are used. - * - * The property `certPresented` will be set to `"1"` when - * the object is populated (i.e. the above conditions were met). - */ - tlsClientAuth: - | IncomingRequestCfPropertiesTLSClientAuth - | IncomingRequestCfPropertiesTLSClientAuthPlaceholder; -} -/** - * Metadata about the request's TLS handshake - */ -declare interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata { - /** - * The client's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal - * - * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d" - */ - clientHandshake: string; - /** - * The server's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal - * - * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d" - */ - serverHandshake: string; - /** - * The client's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal - * - * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b" - */ - clientFinished: string; - /** - * The server's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal - * - * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b" - */ - serverFinished: string; -} -/** - * Geographic data about the request's origin. - */ -declare interface IncomingRequestCfPropertiesGeographicInformation { - /** - * The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from. - * - * If your worker is [configured to accept TOR connections](https://support.cloudflare.com/hc/en-us/articles/203306930-Understanding-Cloudflare-Tor-support-and-Onion-Routing), this may also be `"T1"`, indicating a request that originated over TOR. - * - * If Cloudflare is unable to determine where the request originated this property is omitted. - * - * The country code `"T1"` is used for requests originating on TOR. - * - * @example "GB" - */ - country?: Iso3166Alpha2Code | "T1"; - /** - * If present, this property indicates that the request originated in the EU - * - * @example "1" - */ - isEUCountry?: "1"; - /** - * A two-letter code indicating the continent the request originated from. - * - * @example "AN" - */ - continent?: ContinentCode; - /** - * The city the request originated from - * - * @example "Austin" - */ - city?: string; - /** - * Postal code of the incoming request - * - * @example "78701" - */ - postalCode?: string; - /** - * Latitude of the incoming request - * - * @example "30.27130" - */ - latitude?: string; - /** - * Longitude of the incoming request - * - * @example "-97.74260" - */ - longitude?: string; - /** - * Timezone of the incoming request - * - * @example "America/Chicago" - */ - timezone?: string; - /** - * If known, the ISO 3166-2 name for the first level region associated with - * the IP address of the incoming request - * - * @example "Texas" - */ - region?: string; - /** - * If known, the ISO 3166-2 code for the first-level region associated with - * the IP address of the incoming request - * - * @example "TX" - */ - regionCode?: string; - /** - * Metro code (DMA) of the incoming request - * - * @example "635" - */ - metroCode?: string; -} -/** Data about the incoming request's TLS certificate */ -declare interface IncomingRequestCfPropertiesTLSClientAuth { - /** Always `"1"`, indicating that the certificate was presented */ - certPresented: "1"; - /** - * Result of certificate verification. - * - * @example "FAILED:self signed certificate" - */ - certVerified: Exclude; - /** The presented certificate's revokation status. - * - * - A value of `"1"` indicates the certificate has been revoked - * - A value of `"0"` indicates the certificate has not been revoked - */ - certRevoked: "1" | "0"; - /** - * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) - * - * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certIssuerDN: string; - /** - * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) - * - * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certSubjectDN: string; - /** - * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted) - * - * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certIssuerDNRFC2253: string; - /** - * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted) - * - * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certSubjectDNRFC2253: string; - /** The certificate issuer's distinguished name (legacy policies) */ - certIssuerDNLegacy: string; - /** The certificate subject's distinguished name (legacy policies) */ - certSubjectDNLegacy: string; - /** - * The certificate's serial number - * - * @example "00936EACBE07F201DF" - */ - certSerial: string; - /** - * The certificate issuer's serial number - * - * @example "2489002934BDFEA34" - */ - certIssuerSerial: string; - /** - * The certificate's Subject Key Identifier - * - * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4" - */ - certSKI: string; - /** - * The certificate issuer's Subject Key Identifier - * - * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4" - */ - certIssuerSKI: string; - /** - * The certificate's SHA-1 fingerprint - * - * @example "6b9109f323999e52259cda7373ff0b4d26bd232e" - */ - certFingerprintSHA1: string; - /** - * The certificate's SHA-256 fingerprint - * - * @example "acf77cf37b4156a2708e34c4eb755f9b5dbbe5ebb55adfec8f11493438d19e6ad3f157f81fa3b98278453d5652b0c1fd1d71e5695ae4d709803a4d3f39de9dea" - */ - certFingerprintSHA256: string; - /** - * The effective starting date of the certificate - * - * @example "Dec 22 19:39:00 2018 GMT" - */ - certNotBefore: string; - /** - * The effective expiration date of the certificate - * - * @example "Dec 22 19:39:00 2018 GMT" - */ - certNotAfter: string; -} -/** Placeholder values for TLS Client Authorization */ -declare interface IncomingRequestCfPropertiesTLSClientAuthPlaceholder { - certPresented: "0"; - certVerified: "NONE"; - certRevoked: "0"; - certIssuerDN: ""; - certSubjectDN: ""; - certIssuerDNRFC2253: ""; - certSubjectDNRFC2253: ""; - certIssuerDNLegacy: ""; - certSubjectDNLegacy: ""; - certSerial: ""; - certIssuerSerial: ""; - certSKI: ""; - certIssuerSKI: ""; - certFingerprintSHA1: ""; - certFingerprintSHA256: ""; - certNotBefore: ""; - certNotAfter: ""; -} -/** Possible outcomes of TLS verification */ -declare type CertVerificationStatus = - /** Authentication succeeded */ - | "SUCCESS" - /** No certificate was presented */ - | "NONE" - /** Failed because the certificate was self-signed */ - | "FAILED:self signed certificate" - /** Failed because the certificate failed a trust chain check */ - | "FAILED:unable to verify the first certificate" - /** Failed because the certificate not yet valid */ - | "FAILED:certificate is not yet valid" - /** Failed because the certificate is expired */ - | "FAILED:certificate has expired" - /** Failed for another unspecified reason */ - | "FAILED"; -/** - * An upstream endpoint's response to a TCP `keepalive` message from Cloudflare. - */ -declare type IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus = - | 0 /** Unknown */ - | 1 /** no keepalives (not found) */ - | 2 /** no connection re-use, opening keepalive connection failed */ - | 3 /** no connection re-use, keepalive accepted and saved */ - | 4 /** connection re-use, refused by the origin server (`TCP FIN`) */ - | 5; /** connection re-use, accepted by the origin server */ -/** ISO 3166-1 Alpha-2 codes */ -declare type Iso3166Alpha2Code = - | "AD" - | "AE" - | "AF" - | "AG" - | "AI" - | "AL" - | "AM" - | "AO" - | "AQ" - | "AR" - | "AS" - | "AT" - | "AU" - | "AW" - | "AX" - | "AZ" - | "BA" - | "BB" - | "BD" - | "BE" - | "BF" - | "BG" - | "BH" - | "BI" - | "BJ" - | "BL" - | "BM" - | "BN" - | "BO" - | "BQ" - | "BR" - | "BS" - | "BT" - | "BV" - | "BW" - | "BY" - | "BZ" - | "CA" - | "CC" - | "CD" - | "CF" - | "CG" - | "CH" - | "CI" - | "CK" - | "CL" - | "CM" - | "CN" - | "CO" - | "CR" - | "CU" - | "CV" - | "CW" - | "CX" - | "CY" - | "CZ" - | "DE" - | "DJ" - | "DK" - | "DM" - | "DO" - | "DZ" - | "EC" - | "EE" - | "EG" - | "EH" - | "ER" - | "ES" - | "ET" - | "FI" - | "FJ" - | "FK" - | "FM" - | "FO" - | "FR" - | "GA" - | "GB" - | "GD" - | "GE" - | "GF" - | "GG" - | "GH" - | "GI" - | "GL" - | "GM" - | "GN" - | "GP" - | "GQ" - | "GR" - | "GS" - | "GT" - | "GU" - | "GW" - | "GY" - | "HK" - | "HM" - | "HN" - | "HR" - | "HT" - | "HU" - | "ID" - | "IE" - | "IL" - | "IM" - | "IN" - | "IO" - | "IQ" - | "IR" - | "IS" - | "IT" - | "JE" - | "JM" - | "JO" - | "JP" - | "KE" - | "KG" - | "KH" - | "KI" - | "KM" - | "KN" - | "KP" - | "KR" - | "KW" - | "KY" - | "KZ" - | "LA" - | "LB" - | "LC" - | "LI" - | "LK" - | "LR" - | "LS" - | "LT" - | "LU" - | "LV" - | "LY" - | "MA" - | "MC" - | "MD" - | "ME" - | "MF" - | "MG" - | "MH" - | "MK" - | "ML" - | "MM" - | "MN" - | "MO" - | "MP" - | "MQ" - | "MR" - | "MS" - | "MT" - | "MU" - | "MV" - | "MW" - | "MX" - | "MY" - | "MZ" - | "NA" - | "NC" - | "NE" - | "NF" - | "NG" - | "NI" - | "NL" - | "NO" - | "NP" - | "NR" - | "NU" - | "NZ" - | "OM" - | "PA" - | "PE" - | "PF" - | "PG" - | "PH" - | "PK" - | "PL" - | "PM" - | "PN" - | "PR" - | "PS" - | "PT" - | "PW" - | "PY" - | "QA" - | "RE" - | "RO" - | "RS" - | "RU" - | "RW" - | "SA" - | "SB" - | "SC" - | "SD" - | "SE" - | "SG" - | "SH" - | "SI" - | "SJ" - | "SK" - | "SL" - | "SM" - | "SN" - | "SO" - | "SR" - | "SS" - | "ST" - | "SV" - | "SX" - | "SY" - | "SZ" - | "TC" - | "TD" - | "TF" - | "TG" - | "TH" - | "TJ" - | "TK" - | "TL" - | "TM" - | "TN" - | "TO" - | "TR" - | "TT" - | "TV" - | "TW" - | "TZ" - | "UA" - | "UG" - | "UM" - | "US" - | "UY" - | "UZ" - | "VA" - | "VC" - | "VE" - | "VG" - | "VI" - | "VN" - | "VU" - | "WF" - | "WS" - | "YE" - | "YT" - | "ZA" - | "ZM" - | "ZW"; -/** The 2-letter continent codes Cloudflare uses */ -declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA"; -declare type CfProperties = - | IncomingRequestCfProperties - | RequestInitCfProperties; -declare interface D1Result { - results?: T[]; - success: boolean; - error?: string; - meta: any; -} -declare abstract class D1Database { - prepare(query: string): D1PreparedStatement; - dump(): Promise; - batch(statements: D1PreparedStatement[]): Promise[]>; - exec(query: string): Promise>; -} -declare abstract class D1PreparedStatement { - bind(...values: any[]): D1PreparedStatement; - first(colName?: string): Promise; - run(): Promise>; - all(): Promise>; - raw(): Promise; -} -/** - * A email message that is sent to a consumer Worker. - */ -declare interface EmailMessage { - /** - * Envelope From attribute of the email message. - */ - readonly from: string; - /** - * Envelope To attribute of the email message. - */ - readonly to: string; - /** - * A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers). - */ - readonly headers: Headers; - /** - * Stream of the email message content. - */ - readonly raw: ReadableStream; - /** - * Size of the email message content. - */ - readonly rawSize: number; - /** - * Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason. - * @param reason The reject reason. - * @returns void - */ - setReject(reason: string): void; - /** - * Forward this email message to a verified destination address of the account. - * @param rcptTo Verified destination address. - * @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers). - * @returns A promise that resolves when the email message is forwarded. - */ - forward(rcptTo: string, headers?: Headers): Promise; -} -declare abstract class EmailEvent extends ExtendableEvent { - readonly message: EmailMessage; -} -declare type EmailExportedHandler = ( - message: EmailMessage, - env: Env, - ctx: ExecutionContext -) => void | Promise; -declare type Params

= Record; -declare type EventContext = { - request: Request; - functionPath: string; - waitUntil: (promise: Promise) => void; - passThroughOnException: () => void; - next: (input?: Request | string, init?: RequestInit) => Promise; - env: Env & { - ASSETS: { - fetch: typeof fetch; - }; - }; - params: Params

; - data: Data; -}; -declare type PagesFunction< - Env = unknown, - Params extends string = any, - Data extends Record = Record -> = (context: EventContext) => Response | Promise; -declare type EventPluginContext = { - request: Request; - functionPath: string; - waitUntil: (promise: Promise) => void; - passThroughOnException: () => void; - next: (input?: Request | string, init?: RequestInit) => Promise; - env: Env & { - ASSETS: { - fetch: typeof fetch; - }; - }; - params: Params

; - data: Data; - pluginArgs: PluginArgs; -}; -declare type PagesPluginFunction< - Env = unknown, - Params extends string = any, - Data extends Record = Record, - PluginArgs = unknown -> = ( - context: EventPluginContext -) => Response | Promise; -declare module "assets:*" { - export const onRequest: PagesFunction; -} -// https://developers.cloudflare.com/pub-sub/ -// PubSubMessage represents an incoming PubSub message. -// The message includes metadata about the broker, the client, and the payload -// itself. -declare interface PubSubMessage { - // Message ID - readonly mid: number; - // MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT - readonly broker: string; - // The MQTT topic the message was sent on. - readonly topic: string; - // The client ID of the client that published this message. - readonly clientId: string; - // The unique identifier (JWT ID) used by the client to authenticate, if token - // auth was used. - readonly jti?: string; - // A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker - // received the message from the client. - readonly receivedAt: number; - // An (optional) string with the MIME type of the payload, if set by the - // client. - readonly contentType: string; - // Set to 1 when the payload is a UTF-8 string - // https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063 - readonly payloadFormatIndicator: number; - // Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays. - // You can use payloadFormatIndicator to inspect this before decoding. - payload: string | Uint8Array; -} -// JsonWebKey extended by kid parameter -declare interface JsonWebKeyWithKid extends JsonWebKey { - // Key Identifier of the JWK - readonly kid: string; -} -/** - * A message that is sent to a consumer Worker. - */ -declare interface Message { - /** - * A unique, system-generated ID for the message. - */ - readonly id: string; - /** - * A timestamp when the message was sent. - */ - readonly timestamp: Date; - /** - * The body of the message. - */ - readonly body: Body; - /** - * Marks message to be retried. - */ - retry(): void; - /** - * Marks message acknowledged. - */ - ack(): void; -} -/** - * A batch of messages that are sent to a consumer Worker. - */ -declare interface MessageBatch { - /** - * The name of the Queue that belongs to this batch. - */ - readonly queue: string; - /** - * An array of messages in the batch. Ordering of messages is not guaranteed. - */ - readonly messages: readonly Message[]; - /** - * Marks every message to be retried in the next batch. - */ - retryAll(): void; - /** - * Marks every message acknowledged in the batch. - */ - ackAll(): void; -} -/** - * A wrapper class used to structure message batches. - */ -declare type MessageSendRequest = { - /** - * The body of the message. - */ - body: Body; -}; -/** - * A binding that allows a producer to send messages to a Queue. - */ -declare interface Queue { - /** - * Sends a message to the Queue. - * @param message The message can be any type supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types), as long as its size is less than 128 KB. - * @returns A promise that resolves when the message is confirmed to be written to disk. - */ - send(message: Body): Promise; - /** - * Sends a batch of messages to the Queue. - * @param messages Each item in the input must be supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types). A batch can contain up to 100 messages, though items are limited to 128 KB each, and the total size of the array cannot exceed 256 KB. - * @returns A promise that resolves when the messages are confirmed to be written to disk. - */ - sendBatch(messages: Iterable>): Promise; -} diff --git a/packages/denylist_bot/node_modules/@cloudflare/workers-types/2022-03-21/index.ts b/packages/denylist_bot/node_modules/@cloudflare/workers-types/2022-03-21/index.ts deleted file mode 100755 index 62b1a5851..000000000 --- a/packages/denylist_bot/node_modules/@cloudflare/workers-types/2022-03-21/index.ts +++ /dev/null @@ -1,2984 +0,0 @@ -/*! ***************************************************************************** -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 -export declare class DOMException extends Error { - constructor(message?: string, name?: string); - readonly message: string; - readonly name: string; - readonly code: number; - readonly stack: any; - 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; -} -export type WorkerGlobalScopeEventMap = { - fetch: FetchEvent; - scheduled: ScheduledEvent; - unhandledrejection: PromiseRejectionEvent; - rejectionhandled: PromiseRejectionEvent; -}; -export declare abstract class WorkerGlobalScope extends EventTarget { - EventTarget: typeof EventTarget; -} -export interface Console { - "assert"(condition?: boolean, ...data: any[]): void; - clear(): void; - count(label?: string): void; - countReset(label?: string): void; - debug(...data: any[]): void; - dir(item?: any, options?: any): void; - dirxml(...data: any[]): void; - error(...data: any[]): void; - group(...data: any[]): void; - groupCollapsed(...data: any[]): void; - groupEnd(): void; - info(...data: any[]): void; - log(...data: any[]): void; - table(tabularData?: any, properties?: string[]): void; - time(label?: string): void; - timeEnd(label?: string): void; - timeLog(label?: string, ...data: any[]): void; - timeStamp(label?: string): void; - trace(...data: any[]): void; - warn(...data: any[]): void; -} -export declare const console: Console; -export type BufferSource = ArrayBufferView | ArrayBuffer; -export 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; - type Imports = Record; - type ExportValue = Function | Global | Memory | Table; - type Exports = Record; - 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; - function validate(bytes: BufferSource): boolean; -} -/** This ServiceWorker API interface represents the global execution context of a service worker. */ -export 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( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args - ): number; - clearTimeout(timeoutId: number | null): void; - setInterval(callback: (...args: any[]) => void, msDelay?: number): number; - setInterval( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args - ): number; - clearInterval(timeoutId: number | null): void; - queueMicrotask(task: Function): void; - structuredClone(value: T, options?: StructuredSerializeOptions): T; - fetch( - input: RequestInfo, - init?: RequestInit - ): Promise; - self: ServiceWorkerGlobalScope; - crypto: Crypto; - caches: CacheStorage; - scheduler: Scheduler; - Event: typeof Event; - ExtendableEvent: typeof ExtendableEvent; - PromiseRejectionEvent: typeof PromiseRejectionEvent; - FetchEvent: typeof FetchEvent; - TraceEvent: typeof TraceEvent; - 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; - 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; - 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; -} -export declare function addEventListener< - Type extends keyof WorkerGlobalScopeEventMap ->( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetAddEventListenerOptions | boolean -): void; -export declare function removeEventListener< - Type extends keyof WorkerGlobalScopeEventMap ->( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetEventListenerOptions | boolean -): void; -/** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */ -export declare function dispatchEvent( - event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap] -): boolean; -export declare function btoa(data: string): string; -export declare function atob(data: string): string; -export declare function setTimeout( - callback: (...args: any[]) => void, - msDelay?: number -): number; -export declare function setTimeout( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args -): number; -export declare function clearTimeout(timeoutId: number | null): void; -export declare function setInterval( - callback: (...args: any[]) => void, - msDelay?: number -): number; -export declare function setInterval( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args -): number; -export declare function clearInterval(timeoutId: number | null): void; -export declare function queueMicrotask(task: Function): void; -export declare function structuredClone( - value: T, - options?: StructuredSerializeOptions -): T; -export declare function fetch( - input: RequestInfo, - init?: RequestInit -): Promise; -export declare const self: ServiceWorkerGlobalScope; -export declare const crypto: Crypto; -export declare const caches: CacheStorage; -export declare const scheduler: Scheduler; -export declare const navigator: Navigator; -export interface TestController {} -export interface ExecutionContext { - waitUntil(promise: Promise): void; - passThroughOnException(): void; -} -export type ExportedHandlerFetchHandler< - Env = unknown, - CfHostMetadata = unknown -> = ( - request: Request>, - env: Env, - ctx: ExecutionContext -) => Response | Promise; -export type ExportedHandlerTraceHandler = ( - traces: TraceItem[], - env: Env, - ctx: ExecutionContext -) => void | Promise; -export type ExportedHandlerScheduledHandler = ( - controller: ScheduledController, - env: Env, - ctx: ExecutionContext -) => void | Promise; -export type ExportedHandlerQueueHandler = ( - batch: MessageBatch, - env: Env, - ctx: ExecutionContext -) => void | Promise; -export type ExportedHandlerTestHandler = ( - controller: TestController, - env: Env, - ctx: ExecutionContext -) => void | Promise; -export interface ExportedHandler< - Env = unknown, - QueueMessage = unknown, - CfHostMetadata = unknown -> { - fetch?: ExportedHandlerFetchHandler; - trace?: ExportedHandlerTraceHandler; - scheduled?: ExportedHandlerScheduledHandler; - test?: ExportedHandlerTestHandler; - queue?: ExportedHandlerQueueHandler; -} -export interface StructuredSerializeOptions { - transfer?: any[]; -} -export declare abstract class PromiseRejectionEvent extends Event { - readonly promise: Promise; - readonly reason: any; -} -export declare abstract class Navigator { - readonly userAgent: string; -} -export interface DurableObject { - fetch(request: Request): Response | Promise; - alarm?(): void | Promise; -} -export interface DurableObjectStub extends Fetcher { - readonly id: DurableObjectId; - readonly name?: string; -} -export interface DurableObjectId { - toString(): string; - equals(other: DurableObjectId): boolean; - readonly name?: string; -} -export interface DurableObjectNamespace { - newUniqueId( - options?: DurableObjectNamespaceNewUniqueIdOptions - ): DurableObjectId; - idFromName(name: string): DurableObjectId; - idFromString(id: string): DurableObjectId; - get( - id: DurableObjectId, - options?: DurableObjectNamespaceGetDurableObjectOptions - ): DurableObjectStub; - jurisdiction(jurisdiction: string): DurableObjectNamespace; -} -export interface DurableObjectNamespaceNewUniqueIdOptions { - jurisdiction?: string; -} -export interface DurableObjectNamespaceGetDurableObjectOptions { - locationHint?: string; -} -export interface DurableObjectState { - waitUntil(promise: Promise): void; - readonly id: DurableObjectId; - readonly storage: DurableObjectStorage; - blockConcurrencyWhile(callback: () => Promise): Promise; -} -export interface DurableObjectTransaction { - get( - key: string, - options?: DurableObjectGetOptions - ): Promise; - get( - keys: string[], - options?: DurableObjectGetOptions - ): Promise>; - list( - options?: DurableObjectListOptions - ): Promise>; - put( - key: string, - value: T, - options?: DurableObjectPutOptions - ): Promise; - put( - entries: Record, - options?: DurableObjectPutOptions - ): Promise; - delete(key: string, options?: DurableObjectPutOptions): Promise; - delete(keys: string[], options?: DurableObjectPutOptions): Promise; - rollback(): void; - getAlarm(options?: DurableObjectGetAlarmOptions): Promise; - setAlarm( - scheduledTime: number | Date, - options?: DurableObjectSetAlarmOptions - ): Promise; - deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise; -} -export interface DurableObjectStorage { - get( - key: string, - options?: DurableObjectGetOptions - ): Promise; - get( - keys: string[], - options?: DurableObjectGetOptions - ): Promise>; - list( - options?: DurableObjectListOptions - ): Promise>; - put( - key: string, - value: T, - options?: DurableObjectPutOptions - ): Promise; - put( - entries: Record, - options?: DurableObjectPutOptions - ): Promise; - delete(key: string, options?: DurableObjectPutOptions): Promise; - delete(keys: string[], options?: DurableObjectPutOptions): Promise; - deleteAll(options?: DurableObjectPutOptions): Promise; - transaction( - closure: (txn: DurableObjectTransaction) => Promise - ): Promise; - getAlarm(options?: DurableObjectGetAlarmOptions): Promise; - setAlarm( - scheduledTime: number | Date, - options?: DurableObjectSetAlarmOptions - ): Promise; - deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise; - sync(): Promise; -} -export interface DurableObjectListOptions { - start?: string; - startAfter?: string; - end?: string; - prefix?: string; - reverse?: boolean; - limit?: number; - allowConcurrency?: boolean; - noCache?: boolean; -} -export interface DurableObjectGetOptions { - allowConcurrency?: boolean; - noCache?: boolean; -} -export interface DurableObjectGetAlarmOptions { - allowConcurrency?: boolean; -} -export interface DurableObjectPutOptions { - allowConcurrency?: boolean; - allowUnconfirmed?: boolean; - noCache?: boolean; -} -export interface DurableObjectSetAlarmOptions { - allowConcurrency?: boolean; - allowUnconfirmed?: boolean; -} -export interface AnalyticsEngineDataset { - writeDataPoint(event?: AnalyticsEngineDataPoint): void; -} -export interface AnalyticsEngineDataPoint { - indexes?: ((ArrayBuffer | string) | null)[]; - doubles?: number[]; - blobs?: ((ArrayBuffer | string) | null)[]; -} -export declare class Event { - constructor(type: string, init?: EventInit); - get type(): string; - get eventPhase(): number; - get composed(): boolean; - get bubbles(): boolean; - get cancelable(): boolean; - get defaultPrevented(): boolean; - get returnValue(): boolean; - get currentTarget(): EventTarget | undefined; - get srcElement(): EventTarget | undefined; - get timeStamp(): number; - get isTrusted(): boolean; - get cancelBubble(): boolean; - set cancelBubble(value: boolean); - stopImmediatePropagation(): void; - preventDefault(): void; - stopPropagation(): void; - composedPath(): EventTarget[]; - static readonly NONE: number; - static readonly CAPTURING_PHASE: number; - static readonly AT_TARGET: number; - static readonly BUBBLING_PHASE: number; -} -export interface EventInit { - bubbles?: boolean; - cancelable?: boolean; - composed?: boolean; -} -export type EventListener = ( - event: EventType -) => void; -export interface EventListenerObject { - handleEvent(event: EventType): void; -} -export type EventListenerOrEventListenerObject< - EventType extends Event = Event -> = EventListener | EventListenerObject; -export declare class EventTarget< - EventMap extends Record = Record -> { - constructor(); - addEventListener( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetAddEventListenerOptions | boolean - ): void; - removeEventListener( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetEventListenerOptions | boolean - ): void; - dispatchEvent(event: EventMap[keyof EventMap]): boolean; -} -export interface EventTargetEventListenerOptions { - capture?: boolean; -} -export interface EventTargetAddEventListenerOptions { - capture?: boolean; - passive?: boolean; - once?: boolean; - signal?: AbortSignal; -} -export interface EventTargetHandlerObject { - handleEvent: (event: Event) => any | undefined; -} -export declare class AbortController { - constructor(); - get signal(): AbortSignal; - abort(reason?: any): void; -} -export declare abstract class AbortSignal extends EventTarget { - static abort(reason?: any): AbortSignal; - static timeout(delay: number): AbortSignal; - get aborted(): boolean; - get reason(): any; - throwIfAborted(): void; -} -export interface Scheduler { - wait(delay: number, maybeOptions?: SchedulerWaitOptions): Promise; -} -export interface SchedulerWaitOptions { - signal?: AbortSignal; -} -export declare abstract class ExtendableEvent extends Event { - waitUntil(promise: Promise): void; -} -export declare class Blob { - constructor( - bits?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[], - options?: BlobOptions - ); - get size(): number; - get type(): string; - slice(start?: number, end?: number, type?: string): Blob; - arrayBuffer(): Promise; - text(): Promise; - stream(): ReadableStream; -} -export interface BlobOptions { - type?: string; -} -export declare class File extends Blob { - constructor( - bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined, - name: string, - options?: FileOptions - ); - get name(): string; - get lastModified(): number; -} -export interface FileOptions { - type?: string; - lastModified?: number; -} -export declare abstract class CacheStorage { - open(cacheName: string): Promise; - readonly default: Cache; -} -export declare abstract class Cache { - delete(request: RequestInfo, options?: CacheQueryOptions): Promise; - match( - request: RequestInfo, - options?: CacheQueryOptions - ): Promise; - put(request: RequestInfo, response: Response): Promise; -} -export interface CacheQueryOptions { - ignoreMethod?: boolean; -} -export declare abstract class Crypto { - get subtle(): SubtleCrypto; - getRandomValues< - T extends - | Int8Array - | Uint8Array - | Int16Array - | Uint16Array - | Int32Array - | Uint32Array - | BigInt64Array - | BigUint64Array - >(buffer: T): T; - randomUUID(): string; - DigestStream: typeof DigestStream; -} -export declare abstract class SubtleCrypto { - encrypt( - algorithm: string | SubtleCryptoEncryptAlgorithm, - key: CryptoKey, - plainText: ArrayBuffer | ArrayBufferView - ): Promise; - decrypt( - algorithm: string | SubtleCryptoEncryptAlgorithm, - key: CryptoKey, - cipherText: ArrayBuffer | ArrayBufferView - ): Promise; - sign( - algorithm: string | SubtleCryptoSignAlgorithm, - key: CryptoKey, - data: ArrayBuffer | ArrayBufferView - ): Promise; - verify( - algorithm: string | SubtleCryptoSignAlgorithm, - key: CryptoKey, - signature: ArrayBuffer | ArrayBufferView, - data: ArrayBuffer | ArrayBufferView - ): Promise; - digest( - algorithm: string | SubtleCryptoHashAlgorithm, - data: ArrayBuffer | ArrayBufferView - ): Promise; - generateKey( - algorithm: string | SubtleCryptoGenerateKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - deriveKey( - algorithm: string | SubtleCryptoDeriveKeyAlgorithm, - baseKey: CryptoKey, - derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - deriveBits( - algorithm: string | SubtleCryptoDeriveKeyAlgorithm, - baseKey: CryptoKey, - length: number | null - ): Promise; - importKey( - format: string, - keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey, - algorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - exportKey(format: string, key: CryptoKey): Promise; - wrapKey( - format: string, - key: CryptoKey, - wrappingKey: CryptoKey, - wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm - ): Promise; - unwrapKey( - format: string, - wrappedKey: ArrayBuffer | ArrayBufferView, - unwrappingKey: CryptoKey, - unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm, - unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - timingSafeEqual( - a: ArrayBuffer | ArrayBufferView, - b: ArrayBuffer | ArrayBufferView - ): boolean; -} -export declare abstract class CryptoKey { - readonly type: string; - readonly extractable: boolean; - readonly algorithm: - | CryptoKeyKeyAlgorithm - | CryptoKeyAesKeyAlgorithm - | CryptoKeyHmacKeyAlgorithm - | CryptoKeyRsaKeyAlgorithm - | CryptoKeyEllipticKeyAlgorithm - | CryptoKeyArbitraryKeyAlgorithm; - readonly usages: string[]; -} -export interface CryptoKeyPair { - publicKey: CryptoKey; - privateKey: CryptoKey; -} -export 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; -} -export interface RsaOtherPrimesInfo { - r?: string; - d?: string; - t?: string; -} -export interface SubtleCryptoDeriveKeyAlgorithm { - name: string; - salt?: ArrayBuffer; - iterations?: number; - hash?: string | SubtleCryptoHashAlgorithm; - $public?: CryptoKey; - info?: ArrayBuffer; -} -export interface SubtleCryptoEncryptAlgorithm { - name: string; - iv?: ArrayBuffer; - additionalData?: ArrayBuffer; - tagLength?: number; - counter?: ArrayBuffer; - length?: number; - label?: ArrayBuffer; -} -export interface SubtleCryptoGenerateKeyAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - modulusLength?: number; - publicExponent?: ArrayBuffer; - length?: number; - namedCurve?: string; -} -export interface SubtleCryptoHashAlgorithm { - name: string; -} -export interface SubtleCryptoImportKeyAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - length?: number; - namedCurve?: string; - compressed?: boolean; -} -export interface SubtleCryptoSignAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - dataLength?: number; - saltLength?: number; -} -export interface CryptoKeyKeyAlgorithm { - name: string; -} -export interface CryptoKeyAesKeyAlgorithm { - name: string; - length: number; -} -export interface CryptoKeyHmacKeyAlgorithm { - name: string; - hash: CryptoKeyKeyAlgorithm; - length: number; -} -export interface CryptoKeyRsaKeyAlgorithm { - name: string; - modulusLength: number; - publicExponent: ArrayBuffer; - hash?: CryptoKeyKeyAlgorithm; -} -export interface CryptoKeyEllipticKeyAlgorithm { - name: string; - namedCurve: string; -} -export interface CryptoKeyArbitraryKeyAlgorithm { - name: string; - hash?: CryptoKeyKeyAlgorithm; - namedCurve?: string; - length?: number; -} -export declare class DigestStream extends WritableStream< - ArrayBuffer | ArrayBufferView -> { - constructor(algorithm: string | SubtleCryptoHashAlgorithm); - get digest(): Promise; -} -export declare class TextDecoder { - constructor(decoder?: string, options?: TextDecoderConstructorOptions); - decode( - input?: ArrayBuffer | ArrayBufferView, - options?: TextDecoderDecodeOptions - ): string; - get encoding(): string; - get fatal(): boolean; - get ignoreBOM(): boolean; -} -export declare class TextEncoder { - constructor(); - encode(input?: string): Uint8Array; - encodeInto(input: string, buffer: Uint8Array): TextEncoderEncodeIntoResult; - get encoding(): string; -} -export interface TextDecoderConstructorOptions { - fatal: boolean; - ignoreBOM: boolean; -} -export interface TextDecoderDecodeOptions { - stream: boolean; -} -export interface TextEncoderEncodeIntoResult { - read: number; - written: number; -} -export declare class FormData { - constructor(); - append(name: string, value: string): void; - append(name: string, value: Blob, filename?: string): void; - delete(name: string): void; - get(name: string): (File | string) | null; - getAll(name: string): (File | string)[]; - has(name: string): boolean; - set(name: string, value: string): void; - set(name: string, value: Blob, filename?: string): void; - entries(): IterableIterator<[key: string, value: File | string]>; - keys(): IterableIterator; - values(): IterableIterator; - forEach( - callback: ( - this: This, - value: File | string, - key: string, - parent: FormData - ) => void, - thisArg?: This - ): void; - [Symbol.iterator](): IterableIterator<[key: string, value: File | string]>; -} -export interface ContentOptions { - html?: boolean; -} -export declare class HTMLRewriter { - constructor(); - on( - selector: string, - handlers: HTMLRewriterElementContentHandlers - ): HTMLRewriter; - onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter; - transform(response: Response): Response; -} -export interface HTMLRewriterElementContentHandlers { - element?(element: Element): void | Promise; - comments?(comment: Comment): void | Promise; - text?(element: Text): void | Promise; -} -export interface HTMLRewriterDocumentContentHandlers { - doctype?(doctype: Doctype): void | Promise; - comments?(comment: Comment): void | Promise; - text?(text: Text): void | Promise; - end?(end: DocumentEnd): void | Promise; -} -export interface Doctype { - readonly name: string | null; - readonly publicId: string | null; - readonly systemId: string | null; -} -export interface Element { - tagName: string; - readonly attributes: IterableIterator; - 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, options?: ContentOptions): Element; - after(content: string, options?: ContentOptions): Element; - prepend(content: string, options?: ContentOptions): Element; - append(content: string, options?: ContentOptions): Element; - replace(content: string, options?: ContentOptions): Element; - remove(): Element; - removeAndKeepContent(): Element; - setInnerContent(content: string, options?: ContentOptions): Element; - onEndTag(handler: (tag: EndTag) => void | Promise): void; -} -export interface EndTag { - name: string; - before(content: string, options?: ContentOptions): EndTag; - after(content: string, options?: ContentOptions): EndTag; - remove(): EndTag; -} -export 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; -} -export interface Text { - readonly text: string; - readonly lastInTextNode: boolean; - readonly removed: boolean; - before(content: string, options?: ContentOptions): Text; - after(content: string, options?: ContentOptions): Text; - replace(content: string, options?: ContentOptions): Text; - remove(): Text; -} -export interface DocumentEnd { - append(content: string, options?: ContentOptions): DocumentEnd; -} -export declare abstract class FetchEvent extends ExtendableEvent { - readonly request: Request; - respondWith(promise: Response | Promise): void; - passThroughOnException(): void; -} -export type HeadersInit = - | Headers - | Iterable> - | Record; -export declare class Headers { - constructor(init?: HeadersInit); - get(name: string): string | null; - getAll(name: string): string[]; - has(name: string): boolean; - set(name: string, value: string): void; - append(name: string, value: string): void; - delete(name: string): void; - forEach( - callback: (this: This, value: string, key: string, parent: Headers) => void, - thisArg?: This - ): void; - entries(): IterableIterator<[key: string, value: string]>; - keys(): IterableIterator; - values(): IterableIterator; - [Symbol.iterator](): IterableIterator<[key: string, value: string]>; -} -export type BodyInit = - | ReadableStream - | string - | ArrayBuffer - | ArrayBufferView - | Blob - | URLSearchParams - | FormData; -export declare abstract class Body { - get body(): ReadableStream | null; - get bodyUsed(): boolean; - arrayBuffer(): Promise; - text(): Promise; - json(): Promise; - formData(): Promise; - blob(): Promise; -} -export declare class Response extends Body { - constructor(body?: BodyInit | null, init?: ResponseInit); - static redirect(url: string, status?: number): Response; - static json(any: any, maybeInit?: ResponseInit | Response): Response; - clone(): Response; - get status(): number; - get statusText(): string; - get headers(): Headers; - get ok(): boolean; - get redirected(): boolean; - get url(): string; - get webSocket(): WebSocket | null; - get cf(): any | undefined; -} -export interface ResponseInit { - status?: number; - statusText?: string; - headers?: HeadersInit; - cf?: any; - webSocket?: WebSocket | null; - encodeBody?: "automatic" | "manual"; -} -export type RequestInfo< - CfHostMetadata = unknown, - Cf = CfProperties -> = Request | string | URL; -export declare class Request< - CfHostMetadata = unknown, - Cf = CfProperties -> extends Body { - constructor(input: RequestInfo, init?: RequestInit); - clone(): Request; - get method(): string; - get url(): string; - get headers(): Headers; - get redirect(): string; - get fetcher(): Fetcher | null; - get signal(): AbortSignal; - get cf(): Cf | undefined; - get integrity(): string; - get keepalive(): boolean; -} -export interface RequestInit { - /** 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 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; -} -export declare abstract class Fetcher { - fetch(input: RequestInfo, init?: RequestInit): Promise; -} -export interface FetcherPutOptions { - expiration?: number; - expirationTtl?: number; -} -export interface KVNamespaceListKey { - name: Key; - expiration?: number; - metadata?: Metadata; -} -export type KVNamespaceListResult = - | { - list_complete: false; - keys: KVNamespaceListKey[]; - cursor: string; - } - | { - list_complete: true; - keys: KVNamespaceListKey[]; - }; -export interface KVNamespace { - get( - key: Key, - options?: Partial> - ): Promise; - get(key: Key, type: "text"): Promise; - get( - key: Key, - type: "json" - ): Promise; - get(key: Key, type: "arrayBuffer"): Promise; - get(key: Key, type: "stream"): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"text"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"json"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"arrayBuffer"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"stream"> - ): Promise; - list( - options?: KVNamespaceListOptions - ): Promise>; - put( - key: Key, - value: string | ArrayBuffer | ArrayBufferView | ReadableStream, - options?: KVNamespacePutOptions - ): Promise; - getWithMetadata( - key: Key, - options?: Partial> - ): Promise>; - getWithMetadata( - key: Key, - type: "text" - ): Promise>; - getWithMetadata( - key: Key, - type: "json" - ): Promise>; - getWithMetadata( - key: Key, - type: "arrayBuffer" - ): Promise>; - getWithMetadata( - key: Key, - type: "stream" - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"text"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"json"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"arrayBuffer"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"stream"> - ): Promise>; - delete(key: Key): Promise; -} -export interface KVNamespaceListOptions { - limit?: number; - prefix?: string | null; - cursor?: string | null; -} -export interface KVNamespaceGetOptions { - type: Type; - cacheTtl?: number; -} -export interface KVNamespacePutOptions { - expiration?: number; - expirationTtl?: number; - metadata?: any | null; -} -export interface KVNamespaceGetWithMetadataResult { - value: Value | null; - metadata: Metadata | null; -} -export interface R2Error extends Error { - readonly name: string; - readonly code: number; - readonly message: string; - readonly action: string; - readonly stack: any; -} -export interface R2ListOptions { - limit?: number; - prefix?: string; - cursor?: string; - delimiter?: string; - startAfter?: string; -} -export declare abstract class R2Bucket { - head(key: string): Promise; - get( - key: string, - options: R2GetOptions & { - onlyIf: R2Conditional | Headers; - } - ): Promise; - get(key: string, options?: R2GetOptions): Promise; - put( - key: string, - value: - | ReadableStream - | ArrayBuffer - | ArrayBufferView - | string - | null - | Blob, - options?: R2PutOptions - ): Promise; - put( - key: string, - value: - | ReadableStream - | ArrayBuffer - | ArrayBufferView - | string - | null - | Blob, - options?: R2PutOptions & { - onlyIf: R2Conditional | Headers; - } - ): Promise; - createMultipartUpload( - key: string, - options?: R2MultipartOptions - ): Promise; - resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload; - delete(keys: string | string[]): Promise; - list(options?: R2ListOptions): Promise; -} -export interface R2MultipartUpload { - readonly key: string; - readonly uploadId: string; - uploadPart( - partNumber: number, - value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob - ): Promise; - abort(): Promise; - complete(uploadedParts: R2UploadedPart[]): Promise; -} -export interface R2UploadedPart { - partNumber: number; - etag: string; -} -export 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; - readonly range?: R2Range; - writeHttpMetadata(headers: Headers): void; -} -export interface R2ObjectBody extends R2Object { - get body(): ReadableStream; - get bodyUsed(): boolean; - arrayBuffer(): Promise; - text(): Promise; - json(): Promise; - blob(): Promise; -} -export type R2Range = - | { - offset: number; - length?: number; - } - | { - offset?: number; - length: number; - } - | { - suffix: number; - }; -export interface R2Conditional { - etagMatches?: string; - etagDoesNotMatch?: string; - uploadedBefore?: Date; - uploadedAfter?: Date; - secondsGranularity?: boolean; -} -export interface R2GetOptions { - onlyIf?: R2Conditional | Headers; - range?: R2Range | Headers; -} -export interface R2PutOptions { - onlyIf?: R2Conditional | Headers; - httpMetadata?: R2HTTPMetadata | Headers; - customMetadata?: Record; - md5?: ArrayBuffer | string; - sha1?: ArrayBuffer | string; - sha256?: ArrayBuffer | string; - sha384?: ArrayBuffer | string; - sha512?: ArrayBuffer | string; -} -export interface R2MultipartOptions { - httpMetadata?: R2HTTPMetadata | Headers; - customMetadata?: Record; -} -export interface R2Checksums { - readonly md5?: ArrayBuffer; - readonly sha1?: ArrayBuffer; - readonly sha256?: ArrayBuffer; - readonly sha384?: ArrayBuffer; - readonly sha512?: ArrayBuffer; - toJSON(): R2StringChecksums; -} -export interface R2StringChecksums { - md5?: string; - sha1?: string; - sha256?: string; - sha384?: string; - sha512?: string; -} -export interface R2HTTPMetadata { - contentType?: string; - contentLanguage?: string; - contentDisposition?: string; - contentEncoding?: string; - cacheControl?: string; - cacheExpiry?: Date; -} -export interface R2Objects { - objects: R2Object[]; - truncated: boolean; - cursor?: string; - delimitedPrefixes: string[]; -} -export declare abstract class ScheduledEvent extends ExtendableEvent { - readonly scheduledTime: number; - readonly cron: string; - noRetry(): void; -} -export interface ScheduledController { - readonly scheduledTime: number; - readonly cron: string; - noRetry(): void; -} -export interface QueuingStrategy { - highWaterMark?: number | bigint; - size?: (chunk: T) => number | bigint; -} -export interface UnderlyingSink { - type?: string; - start?: (controller: WritableStreamDefaultController) => void | Promise; - write?: ( - chunk: W, - controller: WritableStreamDefaultController - ) => void | Promise; - abort?: (reason: any) => void | Promise; - close?: () => void | Promise; -} -export interface UnderlyingByteSource { - type: "bytes"; - autoAllocateChunkSize?: number; - start?: (controller: ReadableByteStreamController) => void | Promise; - pull?: (controller: ReadableByteStreamController) => void | Promise; - cancel?: (reason: any) => void | Promise; -} -export interface UnderlyingSource { - type?: "" | undefined; - start?: ( - controller: ReadableStreamDefaultController - ) => void | Promise; - pull?: ( - controller: ReadableStreamDefaultController - ) => void | Promise; - cancel?: (reason: any) => void | Promise; -} -export interface Transformer { - readableType?: string; - writableType?: string; - start?: ( - controller: TransformStreamDefaultController - ) => void | Promise; - transform?: ( - chunk: I, - controller: TransformStreamDefaultController - ) => void | Promise; - flush?: ( - controller: TransformStreamDefaultController - ) => void | Promise; -} -export interface StreamPipeOptions { - /** - * 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; - preventAbort?: boolean; - preventCancel?: boolean; - signal?: AbortSignal; -} -export type ReadableStreamReadResult = - | { - done: false; - value: R; - } - | { - done: true; - value?: undefined; - }; -/** This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object. */ -export interface ReadableStream { - get locked(): boolean; - cancel(reason?: any): Promise; - getReader(): ReadableStreamDefaultReader; - getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader; - pipeThrough( - transform: ReadableWritablePair, - options?: StreamPipeOptions - ): ReadableStream; - pipeTo( - destination: WritableStream, - options?: StreamPipeOptions - ): Promise; - tee(): [ReadableStream, ReadableStream]; - values(options?: ReadableStreamValuesOptions): AsyncIterableIterator; - [Symbol.asyncIterator]( - options?: ReadableStreamValuesOptions - ): AsyncIterableIterator; -} -export declare const ReadableStream: { - prototype: ReadableStream; - new ( - underlyingSource: UnderlyingByteSource, - strategy?: QueuingStrategy - ): ReadableStream; - new ( - underlyingSource?: UnderlyingSource, - strategy?: QueuingStrategy - ): ReadableStream; -}; -export declare class ReadableStreamDefaultReader { - constructor(stream: ReadableStream); - get closed(): Promise; - cancel(reason?: any): Promise; - read(): Promise>; - releaseLock(): void; -} -export declare class ReadableStreamBYOBReader { - constructor(stream: ReadableStream); - get closed(): Promise; - cancel(reason?: any): Promise; - read( - view: T - ): Promise>; - releaseLock(): void; - readAtLeast( - minElements: number, - view: T - ): Promise>; -} -export interface ReadableStreamGetReaderOptions { - mode: "byob"; -} -export interface ReadableStreamBYOBRequest { - readonly view: Uint8Array | null; - respond(bytesWritten: number): void; - respondWithNewView(view: ArrayBuffer | ArrayBufferView): void; - readonly atLeast: number | null; -} -export interface ReadableStreamDefaultController { - readonly desiredSize: number | null; - close(): void; - enqueue(chunk?: R): void; - error(reason: any): void; -} -export interface ReadableByteStreamController { - readonly byobRequest: ReadableStreamBYOBRequest | null; - readonly desiredSize: number | null; - close(): void; - enqueue(chunk: ArrayBuffer | ArrayBufferView): void; - error(reason: any): void; -} -/** This Streams API interface represents a controller allowing control of a WritableStream's state. When constructing a WritableStream, the underlying sink is given a corresponding WritableStreamDefaultController instance to manipulate. */ -export interface WritableStreamDefaultController { - readonly signal: AbortSignal; - error(reason?: any): void; -} -export interface TransformStreamDefaultController { - get desiredSize(): number | null; - enqueue(chunk?: O): void; - error(reason: any): void; - terminate(): void; -} -export interface ReadableWritablePair { - /** - * 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; - readable: ReadableStream; -} -export declare class WritableStream { - constructor( - underlyingSink?: UnderlyingSink, - queuingStrategy?: QueuingStrategy - ); - get locked(): boolean; - abort(reason?: any): Promise; - close(): Promise; - getWriter(): WritableStreamDefaultWriter; -} -export declare class WritableStreamDefaultWriter { - constructor(stream: WritableStream); - get closed(): Promise; - get ready(): Promise; - get desiredSize(): number | null; - abort(reason?: any): Promise; - close(): Promise; - write(chunk?: W): Promise; - releaseLock(): void; -} -export declare class TransformStream { - constructor( - transformer?: Transformer, - writableStrategy?: QueuingStrategy, - readableStrategy?: QueuingStrategy - ); - get readable(): ReadableStream; - get writable(): WritableStream; -} -export declare class FixedLengthStream extends IdentityTransformStream { - constructor(expectedLength: number | bigint); -} -export declare class IdentityTransformStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(); -} -export interface ReadableStreamValuesOptions { - preventCancel?: boolean; -} -export declare class CompressionStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(format: "gzip" | "deflate" | "deflate-raw"); -} -export declare class DecompressionStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(format: "gzip" | "deflate" | "deflate-raw"); -} -export declare class TextEncoderStream extends TransformStream< - string, - Uint8Array -> { - constructor(); -} -export declare class TextDecoderStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - string -> { - constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit); -} -export interface TextDecoderStreamTextDecoderStreamInit { - fatal?: boolean; -} -export declare class ByteLengthQueuingStrategy - implements QueuingStrategy -{ - constructor(init: QueuingStrategyInit); - get highWaterMark(): number; - get size(): (chunk?: any) => number; -} -export declare class CountQueuingStrategy implements QueuingStrategy { - constructor(init: QueuingStrategyInit); - get highWaterMark(): number; - get size(): (chunk?: any) => number; -} -export 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; -} -export declare abstract class TraceEvent extends ExtendableEvent { - readonly traces: TraceItem[]; -} -export interface TraceItem { - readonly event: - | ( - | TraceItemFetchEventInfo - | TraceItemScheduledEventInfo - | TraceItemAlarmEventInfo - | TraceItemQueueEventInfo - | TraceItemEmailEventInfo - | TraceItemCustomEventInfo - ) - | null; - readonly eventTimestamp: number | null; - readonly logs: TraceLog[]; - readonly exceptions: TraceException[]; - readonly scriptName: string | null; - readonly dispatchNamespace?: string; - readonly scriptTags?: string[]; - readonly outcome: string; -} -export interface TraceItemAlarmEventInfo { - readonly scheduledTime: Date; -} -export interface TraceItemCustomEventInfo {} -export interface TraceItemScheduledEventInfo { - readonly scheduledTime: number; - readonly cron: string; -} -export interface TraceItemQueueEventInfo { - readonly queue: string; - readonly batchSize: number; -} -export interface TraceItemEmailEventInfo { - readonly mailFrom: string; - readonly rcptTo: string; - readonly rawSize: number; -} -export interface TraceItemFetchEventInfo { - readonly response?: TraceItemFetchEventInfoResponse; - readonly request: TraceItemFetchEventInfoRequest; -} -export interface TraceItemFetchEventInfoRequest { - readonly cf?: any; - readonly headers: Record; - readonly method: string; - readonly url: string; - getUnredacted(): TraceItemFetchEventInfoRequest; -} -export interface TraceItemFetchEventInfoResponse { - readonly status: number; -} -export interface TraceLog { - readonly timestamp: number; - readonly level: string; - readonly message: any; -} -export interface TraceException { - readonly timestamp: number; - readonly message: string; - readonly name: string; -} -export interface TraceMetrics { - readonly cpuTime: number; - readonly wallTime: number; -} -export interface UnsafeTraceMetrics { - fromTrace(item: TraceItem): TraceMetrics; -} -export declare class URL { - constructor(url: string | URL, base?: string | URL); - get href(): string; - set href(value: string); - get origin(): string; - get protocol(): string; - set protocol(value: string); - get username(): string; - set username(value: string); - get password(): string; - set password(value: string); - get host(): string; - set host(value: string); - get hostname(): string; - set hostname(value: string); - get port(): string; - set port(value: string); - get pathname(): string; - set pathname(value: string); - get search(): string; - set search(value: string); - get searchParams(): URLSearchParams; - get hash(): string; - set hash(value: string); - toString(): string; - toJSON(): string; -} -export declare class URLSearchParams { - constructor( - init?: - | URLSearchParams - | string - | Record - | [key: string, value: string][] - ); - get size(): number; - append(name: string, value: string): void; - delete(name: string): void; - get(name: string): string | null; - getAll(name: string): string[]; - has(name: string): boolean; - set(name: string, value: string): void; - sort(): void; - entries(): IterableIterator<[key: string, value: string]>; - keys(): IterableIterator; - values(): IterableIterator; - forEach( - callback: ( - this: This, - value: string, - key: string, - parent: URLSearchParams - ) => void, - thisArg?: This - ): void; - toString(): string; - [Symbol.iterator](): IterableIterator<[key: string, value: string]>; -} -export declare class URLPattern { - constructor(input?: string | URLPatternURLPatternInit, baseURL?: string); - get protocol(): string; - get username(): string; - get password(): string; - get hostname(): string; - get port(): string; - get pathname(): string; - get search(): string; - get hash(): string; - test(input?: string | URLPatternURLPatternInit, baseURL?: string): boolean; - exec( - input?: string | URLPatternURLPatternInit, - baseURL?: string - ): URLPatternURLPatternResult | null; -} -export interface URLPatternURLPatternInit { - protocol?: string; - username?: string; - password?: string; - hostname?: string; - port?: string; - pathname?: string; - search?: string; - hash?: string; - baseURL?: string; -} -export interface URLPatternURLPatternComponentResult { - input: string; - groups: Record; -} -export interface URLPatternURLPatternResult { - inputs: (string | URLPatternURLPatternInit)[]; - protocol: URLPatternURLPatternComponentResult; - username: URLPatternURLPatternComponentResult; - password: URLPatternURLPatternComponentResult; - hostname: URLPatternURLPatternComponentResult; - port: URLPatternURLPatternComponentResult; - pathname: URLPatternURLPatternComponentResult; - search: URLPatternURLPatternComponentResult; - hash: URLPatternURLPatternComponentResult; -} -export declare class CloseEvent extends Event { - constructor(type: string, initializer: CloseEventInit); - /** Returns the WebSocket connection close code provided by the server. */ - readonly code: number; - /** Returns the WebSocket connection close reason provided by the server. */ - readonly reason: string; - /** Returns true if the connection closed cleanly; false otherwise. */ - readonly wasClean: boolean; -} -export interface CloseEventInit { - code?: number; - reason?: string; - wasClean?: boolean; -} -export declare class MessageEvent extends Event { - constructor(type: string, initializer: MessageEventInit); - readonly data: ArrayBuffer | string; -} -export interface MessageEventInit { - data: ArrayBuffer | string; -} -/** Events providing information related to errors in scripts or in files. */ -export interface ErrorEvent extends Event { - readonly filename: string; - readonly message: string; - readonly lineno: number; - readonly colno: number; - readonly error: any; -} -export type WebSocketEventMap = { - close: CloseEvent; - message: MessageEvent; - open: Event; - error: ErrorEvent; -}; -export declare class WebSocket extends EventTarget { - constructor(url: string, protocols?: string[] | string); - accept(): void; - send(message: (ArrayBuffer | ArrayBufferView) | string): void; - close(code?: number, reason?: string): void; - static readonly READY_STATE_CONNECTING: number; - static readonly READY_STATE_OPEN: number; - static readonly READY_STATE_CLOSING: number; - static readonly READY_STATE_CLOSED: number; - get readyState(): number; - get url(): string | null; - get protocol(): string | null; - get extensions(): string | null; -} -export declare const WebSocketPair: { - new (): { - 0: WebSocket; - 1: WebSocket; - }; -}; -export interface BasicImageTransformations { - /** - * Maximum width in image pixels. The value must be an integer. - */ - width?: number; - /** - * Maximum height in image pixels. The value must be an integer. - */ - height?: number; - /** - * Resizing mode as a string. It affects interpretation of width and height - * options: - * - scale-down: Similar to contain, but the image is never enlarged. If - * the image is larger than given width or height, it will be resized. - * Otherwise its original size will be kept. - * - contain: Resizes to maximum size that fits within the given width and - * height. If only a single dimension is given (e.g. only width), the - * image will be shrunk or enlarged to exactly match that dimension. - * Aspect ratio is always preserved. - * - cover: Resizes (shrinks or enlarges) to fill the entire area of width - * and height. If the image has an aspect ratio different from the ratio - * of width and height, it will be cropped to fit. - * - crop: The image will be shrunk and cropped to fit within the area - * specified by width and height. The image will not be enlarged. For images - * smaller than the given dimensions it's the same as scale-down. For - * images larger than the given dimensions, it's the same as cover. - * See also trim. - * - pad: Resizes to the maximum size that fits within the given width and - * height, and then fills the remaining area with a background color - * (white by default). Use of this mode is not recommended, as the same - * effect can be more efficiently achieved with the contain mode and the - * CSS object-fit: contain property. - */ - fit?: "scale-down" | "contain" | "cover" | "crop" | "pad"; - /** - * When cropping with fit: "cover", this defines the side or point that should - * be left uncropped. The value is either a string - * "left", "right", "top", "bottom", "auto", or "center" (the default), - * or an object {x, y} containing focal point coordinates in the original - * image expressed as fractions ranging from 0.0 (top or left) to 1.0 - * (bottom or right), 0.5 being the center. {fit: "cover", gravity: "top"} will - * crop bottom or left and right sides as necessary, but won’t crop anything - * from the top. {fit: "cover", gravity: {x:0.5, y:0.2}} will crop each side to - * preserve as much as possible around a point at 20% of the height of the - * source image. - */ - gravity?: - | "left" - | "right" - | "top" - | "bottom" - | "center" - | "auto" - | BasicImageTransformationsGravityCoordinates; - /** - * Background color to add underneath the image. Applies only to images with - * transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…), - * hsl(…), etc.) - */ - background?: string; - /** - * Number of degrees (90, 180, 270) to rotate the image by. width and height - * options refer to axes after rotation. - */ - rotate?: 0 | 90 | 180 | 270 | 360; -} -export interface BasicImageTransformationsGravityCoordinates { - x: number; - y: number; -} -/** - * In addition to the properties you can set in the RequestInit dict - * that you pass as an argument to the Request constructor, you can - * set certain properties of a `cf` object to control how Cloudflare - * features are applied to that new Request. - * - * Note: Currently, these properties cannot be tested in the - * playground. - */ -export interface RequestInitCfProperties extends Record { - cacheEverything?: boolean; - /** - * A request's cache key is what determines if two requests are - * "the same" for caching purposes. If a request has the same cache key - * as some previous request, then we can serve the same cached response for - * both. (e.g. 'some-key') - * - * Only available for Enterprise customers. - */ - cacheKey?: string; - /** - * This allows you to append additional Cache-Tag response headers - * to the origin response without modifications to the origin server. - * This will allow for greater control over the Purge by Cache Tag feature - * utilizing changes only in the Workers process. - * - * Only available for Enterprise customers. - */ - cacheTags?: string[]; - /** - * Force response to be cached for a given number of seconds. (e.g. 300) - */ - cacheTtl?: number; - /** - * Force response to be cached for a given number of seconds based on the Origin status code. - * (e.g. { '200-299': 86400, '404': 1, '500-599': 0 }) - */ - cacheTtlByStatus?: Record; - scrapeShield?: boolean; - apps?: boolean; - image?: RequestInitCfPropertiesImage; - minify?: RequestInitCfPropertiesImageMinify; - mirage?: boolean; - polish?: "lossy" | "lossless" | "off"; - /** - * Redirects the request to an alternate origin server. You can use this, - * for example, to implement load balancing across several origins. - * (e.g.us-east.example.com) - * - * Note - For security reasons, the hostname set in resolveOverride must - * be proxied on the same Cloudflare zone of the incoming request. - * Otherwise, the setting is ignored. CNAME hosts are allowed, so to - * resolve to a host under a different domain or a DNS only domain first - * declare a CNAME record within your own zone’s DNS mapping to the - * external hostname, set proxy on Cloudflare, then set resolveOverride - * to point to that CNAME record. - */ - resolveOverride?: string; -} -export interface RequestInitCfPropertiesImageDraw - extends BasicImageTransformations { - /** - * Absolute URL of the image file to use for the drawing. It can be any of - * the supported file formats. For drawing of watermarks or non-rectangular - * overlays we recommend using PNG or WebP images. - */ - url: string; - /** - * Floating-point number between 0 (transparent) and 1 (opaque). - * For example, opacity: 0.5 makes overlay semitransparent. - */ - opacity?: number; - /** - * - If set to true, the overlay image will be tiled to cover the entire - * area. This is useful for stock-photo-like watermarks. - * - If set to "x", the overlay image will be tiled horizontally only - * (form a line). - * - If set to "y", the overlay image will be tiled vertically only - * (form a line). - */ - repeat?: true | "x" | "y"; - /** - * Position of the overlay image relative to a given edge. Each property is - * an offset in pixels. 0 aligns exactly to the edge. For example, left: 10 - * positions left side of the overlay 10 pixels from the left edge of the - * image it's drawn over. bottom: 0 aligns bottom of the overlay with bottom - * of the background image. - * - * Setting both left & right, or both top & bottom is an error. - * - * If no position is specified, the image will be centered. - */ - top?: number; - left?: number; - bottom?: number; - right?: number; -} -export interface RequestInitCfPropertiesImage - extends BasicImageTransformations { - /** - * Device Pixel Ratio. Default 1. Multiplier for width/height that makes it - * easier to specify higher-DPI sizes in . - */ - dpr?: number; - /** - * An object with four properties {left, top, right, bottom} that specify - * a number of pixels to cut off on each side. Allows removal of borders - * or cutting out a specific fragment of an image. Trimming is performed - * before resizing or rotation. Takes dpr into account. - */ - trim?: { - left?: number; - top?: number; - right?: number; - bottom?: number; - }; - /** - * Quality setting from 1-100 (useful values are in 60-90 range). Lower values - * make images look worse, but load faster. The default is 85. It applies only - * to JPEG and WebP images. It doesn’t have any effect on PNG. - */ - quality?: number; - /** - * Output format to generate. It can be: - * - avif: generate images in AVIF format. - * - webp: generate images in Google WebP format. Set quality to 100 to get - * the WebP-lossless format. - * - json: instead of generating an image, outputs information about the - * image, in JSON format. The JSON object will contain image size - * (before and after resizing), source image’s MIME type, file size, etc. - * - jpeg: generate images in JPEG format. - * - png: generate images in PNG format. - */ - format?: "avif" | "webp" | "json" | "jpeg" | "png"; - /** - * Whether to preserve animation frames from input files. Default is true. - * Setting it to false reduces animations to still images. This setting is - * recommended when enlarging images or processing arbitrary user content, - * because large GIF animations can weigh tens or even hundreds of megabytes. - * It is also useful to set anim:false when using format:"json" to get the - * response quicker without the number of frames. - */ - anim?: boolean; - /** - * What EXIF data should be preserved in the output image. Note that EXIF - * rotation and embedded color profiles are always applied ("baked in" into - * the image), and aren't affected by this option. Note that if the Polish - * feature is enabled, all metadata may have been removed already and this - * option may have no effect. - * - keep: Preserve most of EXIF metadata, including GPS location if there's - * any. - * - copyright: Only keep the copyright tag, and discard everything else. - * This is the default behavior for JPEG files. - * - none: Discard all invisible EXIF metadata. Currently WebP and PNG - * output formats always discard metadata. - */ - metadata?: "keep" | "copyright" | "none"; - /** - * Strength of sharpening filter to apply to the image. Floating-point - * number between 0 (no sharpening, default) and 10 (maximum). 1.0 is a - * recommended value for downscaled images. - */ - sharpen?: number; - /** - * Radius of a blur filter (approximate gaussian). Maximum supported radius - * is 250. - */ - blur?: number; - /** - * Overlays are drawn in the order they appear in the array (last array - * entry is the topmost layer). - */ - draw?: RequestInitCfPropertiesImageDraw[]; - /** - * Fetching image from authenticated origin. Setting this property will - * pass authentication headers (Authorization, Cookie, etc.) through to - * the origin. - */ - "origin-auth"?: "share-publicly"; - /** - * Adds a border around the image. The border is added after resizing. Border - * width takes dpr into account, and can be specified either using a single - * width property, or individually for each side. - */ - border?: - | { - color: string; - width: number; - } - | { - color: string; - top: number; - right: number; - bottom: number; - left: number; - }; - /** - * Increase brightness by a factor. A value of 1.0 equals no change, a value - * of 0.5 equals half brightness, and a value of 2.0 equals twice as bright. - * 0 is ignored. - */ - brightness?: number; - /** - * Increase contrast by a factor. A value of 1.0 equals no change, a value of - * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is - * ignored. - */ - contrast?: number; - /** - * Increase exposure by a factor. A value of 1.0 equals no change, a value of - * 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored. - */ - gamma?: number; - /** - * Slightly reduces latency on a cache miss by selecting a - * quickest-to-compress file format, at a cost of increased file size and - * lower image quality. It will usually override the format option and choose - * JPEG over WebP or AVIF. We do not recommend using this option, except in - * unusual circumstances like resizing uncacheable dynamically-generated - * images. - */ - compression?: "fast"; -} -export interface RequestInitCfPropertiesImageMinify { - javascript?: boolean; - css?: boolean; - html?: boolean; -} -/** - * Request metadata provided by Cloudflare's edge. - */ -export type IncomingRequestCfProperties = - IncomingRequestCfPropertiesBase & - IncomingRequestCfPropertiesBotManagementEnterprise & - IncomingRequestCfPropertiesCloudflareForSaaSEnterprise & - IncomingRequestCfPropertiesGeographicInformation & - IncomingRequestCfPropertiesCloudflareAccessOrApiShield; -export interface IncomingRequestCfPropertiesBase - extends Record { - /** - * [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request. - * - * @example 395747 - */ - asn: number; - /** - * The organization which owns the ASN of the incoming request. - * - * @example "Google Cloud" - */ - asOrganization: string; - /** - * The original value of the `Accept-Encoding` header if Cloudflare modified it. - * - * @example "gzip, deflate, br" - */ - clientAcceptEncoding?: string; - /** - * The number of milliseconds it took for the request to reach your worker. - * - * @example 22 - */ - clientTcpRtt?: number; - /** - * The three-letter [IATA](https://en.wikipedia.org/wiki/IATA_airport_code) - * airport code of the data center that the request hit. - * - * @example "DFW" - */ - colo: string; - /** - * Represents the upstream's response to a - * [TCP `keepalive` message](https://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html) - * from cloudflare. - * - * For workers with no upstream, this will always be `1`. - * - * @example 3 - */ - edgeRequestKeepAliveStatus: IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus; - /** - * The HTTP Protocol the request used. - * - * @example "HTTP/2" - */ - httpProtocol: string; - /** - * The browser-requested prioritization information in the request object. - * - * If no information was set, defaults to the empty string `""` - * - * @example "weight=192;exclusive=0;group=3;group-weight=127" - * @default "" - */ - requestPriority: string; - /** - * The TLS version of the connection to Cloudflare. - * In requests served over plaintext (without TLS), this property is the empty string `""`. - * - * @example "TLSv1.3" - */ - tlsVersion: string; - /** - * The cipher for the connection to Cloudflare. - * In requests served over plaintext (without TLS), this property is the empty string `""`. - * - * @example "AEAD-AES128-GCM-SHA256" - */ - tlsCipher: string; - /** - * Metadata containing the [`HELLO`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2) and [`FINISHED`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9) messages from this request's TLS handshake. - * - * If the incoming request was served over plaintext (without TLS) this field is undefined. - */ - tlsExportedAuthenticator?: IncomingRequestCfPropertiesExportedAuthenticatorMetadata; -} -export interface IncomingRequestCfPropertiesBotManagementBase { - /** - * Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot, - * represented as an integer percentage between `1` (almost certainly human) - * and `99` (almost certainly a bot). - * - * @example 54 - */ - score: number; - /** - * A boolean value that is true if the request comes from a good bot, like Google or Bing. - * Most customers choose to allow this traffic. For more details, see [Traffic from known bots](https://developers.cloudflare.com/firewall/known-issues-and-faq/#how-does-firewall-rules-handle-traffic-from-known-bots). - */ - verifiedBot: boolean; - /** - * A boolean value that is true if the request originates from a - * Cloudflare-verified proxy service. - */ - corporateProxy: boolean; - /** - * A boolean value that's true if the request matches [file extensions](https://developers.cloudflare.com/bots/reference/static-resources/) for many types of static resources. - */ - staticResource: boolean; - /** - * List of IDs that correlate to the Bot Management heuristic detections made on a request (you can have multiple heuristic detections on the same request). - */ - detectionIds: number[]; -} -export interface IncomingRequestCfPropertiesBotManagement { - /** - * Results of Cloudflare's Bot Management analysis - */ - botManagement: IncomingRequestCfPropertiesBotManagementBase; - /** - * Duplicate of `botManagement.score`. - * - * @deprecated - */ - clientTrustScore: number; -} -export interface IncomingRequestCfPropertiesBotManagementEnterprise - extends IncomingRequestCfPropertiesBotManagement { - /** - * Results of Cloudflare's Bot Management analysis - */ - botManagement: IncomingRequestCfPropertiesBotManagementBase & { - /** - * A [JA3 Fingerprint](https://developers.cloudflare.com/bots/concepts/ja3-fingerprint/) to help profile specific SSL/TLS clients - * across different destination IPs, Ports, and X509 certificates. - */ - ja3Hash: string; - }; -} -export interface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise< - HostMetadata -> { - /** - * Custom metadata set per-host in [Cloudflare for SaaS](https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/). - * - * This field is only present if you have Cloudflare for SaaS enabled on your account - * and you have followed the [required steps to enable it]((https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/domain-support/custom-metadata/)). - */ - hostMetadata: HostMetadata; -} -export interface IncomingRequestCfPropertiesCloudflareAccessOrApiShield { - /** - * Information about the client certificate presented to Cloudflare. - * - * This is populated when the incoming request is served over TLS using - * either Cloudflare Access or API Shield (mTLS) - * and the presented SSL certificate has a valid - * [Certificate Serial Number](https://ldapwiki.com/wiki/Certificate%20Serial%20Number) - * (i.e., not `null` or `""`). - * - * Otherwise, a set of placeholder values are used. - * - * The property `certPresented` will be set to `"1"` when - * the object is populated (i.e. the above conditions were met). - */ - tlsClientAuth: - | IncomingRequestCfPropertiesTLSClientAuth - | IncomingRequestCfPropertiesTLSClientAuthPlaceholder; -} -/** - * Metadata about the request's TLS handshake - */ -export interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata { - /** - * The client's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal - * - * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d" - */ - clientHandshake: string; - /** - * The server's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal - * - * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d" - */ - serverHandshake: string; - /** - * The client's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal - * - * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b" - */ - clientFinished: string; - /** - * The server's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal - * - * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b" - */ - serverFinished: string; -} -/** - * Geographic data about the request's origin. - */ -export interface IncomingRequestCfPropertiesGeographicInformation { - /** - * The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from. - * - * If your worker is [configured to accept TOR connections](https://support.cloudflare.com/hc/en-us/articles/203306930-Understanding-Cloudflare-Tor-support-and-Onion-Routing), this may also be `"T1"`, indicating a request that originated over TOR. - * - * If Cloudflare is unable to determine where the request originated this property is omitted. - * - * The country code `"T1"` is used for requests originating on TOR. - * - * @example "GB" - */ - country?: Iso3166Alpha2Code | "T1"; - /** - * If present, this property indicates that the request originated in the EU - * - * @example "1" - */ - isEUCountry?: "1"; - /** - * A two-letter code indicating the continent the request originated from. - * - * @example "AN" - */ - continent?: ContinentCode; - /** - * The city the request originated from - * - * @example "Austin" - */ - city?: string; - /** - * Postal code of the incoming request - * - * @example "78701" - */ - postalCode?: string; - /** - * Latitude of the incoming request - * - * @example "30.27130" - */ - latitude?: string; - /** - * Longitude of the incoming request - * - * @example "-97.74260" - */ - longitude?: string; - /** - * Timezone of the incoming request - * - * @example "America/Chicago" - */ - timezone?: string; - /** - * If known, the ISO 3166-2 name for the first level region associated with - * the IP address of the incoming request - * - * @example "Texas" - */ - region?: string; - /** - * If known, the ISO 3166-2 code for the first-level region associated with - * the IP address of the incoming request - * - * @example "TX" - */ - regionCode?: string; - /** - * Metro code (DMA) of the incoming request - * - * @example "635" - */ - metroCode?: string; -} -/** Data about the incoming request's TLS certificate */ -export interface IncomingRequestCfPropertiesTLSClientAuth { - /** Always `"1"`, indicating that the certificate was presented */ - certPresented: "1"; - /** - * Result of certificate verification. - * - * @example "FAILED:self signed certificate" - */ - certVerified: Exclude; - /** The presented certificate's revokation status. - * - * - A value of `"1"` indicates the certificate has been revoked - * - A value of `"0"` indicates the certificate has not been revoked - */ - certRevoked: "1" | "0"; - /** - * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) - * - * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certIssuerDN: string; - /** - * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) - * - * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certSubjectDN: string; - /** - * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted) - * - * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certIssuerDNRFC2253: string; - /** - * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted) - * - * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certSubjectDNRFC2253: string; - /** The certificate issuer's distinguished name (legacy policies) */ - certIssuerDNLegacy: string; - /** The certificate subject's distinguished name (legacy policies) */ - certSubjectDNLegacy: string; - /** - * The certificate's serial number - * - * @example "00936EACBE07F201DF" - */ - certSerial: string; - /** - * The certificate issuer's serial number - * - * @example "2489002934BDFEA34" - */ - certIssuerSerial: string; - /** - * The certificate's Subject Key Identifier - * - * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4" - */ - certSKI: string; - /** - * The certificate issuer's Subject Key Identifier - * - * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4" - */ - certIssuerSKI: string; - /** - * The certificate's SHA-1 fingerprint - * - * @example "6b9109f323999e52259cda7373ff0b4d26bd232e" - */ - certFingerprintSHA1: string; - /** - * The certificate's SHA-256 fingerprint - * - * @example "acf77cf37b4156a2708e34c4eb755f9b5dbbe5ebb55adfec8f11493438d19e6ad3f157f81fa3b98278453d5652b0c1fd1d71e5695ae4d709803a4d3f39de9dea" - */ - certFingerprintSHA256: string; - /** - * The effective starting date of the certificate - * - * @example "Dec 22 19:39:00 2018 GMT" - */ - certNotBefore: string; - /** - * The effective expiration date of the certificate - * - * @example "Dec 22 19:39:00 2018 GMT" - */ - certNotAfter: string; -} -/** Placeholder values for TLS Client Authorization */ -export interface IncomingRequestCfPropertiesTLSClientAuthPlaceholder { - certPresented: "0"; - certVerified: "NONE"; - certRevoked: "0"; - certIssuerDN: ""; - certSubjectDN: ""; - certIssuerDNRFC2253: ""; - certSubjectDNRFC2253: ""; - certIssuerDNLegacy: ""; - certSubjectDNLegacy: ""; - certSerial: ""; - certIssuerSerial: ""; - certSKI: ""; - certIssuerSKI: ""; - certFingerprintSHA1: ""; - certFingerprintSHA256: ""; - certNotBefore: ""; - certNotAfter: ""; -} -/** Possible outcomes of TLS verification */ -export type CertVerificationStatus = - /** Authentication succeeded */ - | "SUCCESS" - /** No certificate was presented */ - | "NONE" - /** Failed because the certificate was self-signed */ - | "FAILED:self signed certificate" - /** Failed because the certificate failed a trust chain check */ - | "FAILED:unable to verify the first certificate" - /** Failed because the certificate not yet valid */ - | "FAILED:certificate is not yet valid" - /** Failed because the certificate is expired */ - | "FAILED:certificate has expired" - /** Failed for another unspecified reason */ - | "FAILED"; -/** - * An upstream endpoint's response to a TCP `keepalive` message from Cloudflare. - */ -export type IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus = - | 0 /** Unknown */ - | 1 /** no keepalives (not found) */ - | 2 /** no connection re-use, opening keepalive connection failed */ - | 3 /** no connection re-use, keepalive accepted and saved */ - | 4 /** connection re-use, refused by the origin server (`TCP FIN`) */ - | 5; /** connection re-use, accepted by the origin server */ -/** ISO 3166-1 Alpha-2 codes */ -export type Iso3166Alpha2Code = - | "AD" - | "AE" - | "AF" - | "AG" - | "AI" - | "AL" - | "AM" - | "AO" - | "AQ" - | "AR" - | "AS" - | "AT" - | "AU" - | "AW" - | "AX" - | "AZ" - | "BA" - | "BB" - | "BD" - | "BE" - | "BF" - | "BG" - | "BH" - | "BI" - | "BJ" - | "BL" - | "BM" - | "BN" - | "BO" - | "BQ" - | "BR" - | "BS" - | "BT" - | "BV" - | "BW" - | "BY" - | "BZ" - | "CA" - | "CC" - | "CD" - | "CF" - | "CG" - | "CH" - | "CI" - | "CK" - | "CL" - | "CM" - | "CN" - | "CO" - | "CR" - | "CU" - | "CV" - | "CW" - | "CX" - | "CY" - | "CZ" - | "DE" - | "DJ" - | "DK" - | "DM" - | "DO" - | "DZ" - | "EC" - | "EE" - | "EG" - | "EH" - | "ER" - | "ES" - | "ET" - | "FI" - | "FJ" - | "FK" - | "FM" - | "FO" - | "FR" - | "GA" - | "GB" - | "GD" - | "GE" - | "GF" - | "GG" - | "GH" - | "GI" - | "GL" - | "GM" - | "GN" - | "GP" - | "GQ" - | "GR" - | "GS" - | "GT" - | "GU" - | "GW" - | "GY" - | "HK" - | "HM" - | "HN" - | "HR" - | "HT" - | "HU" - | "ID" - | "IE" - | "IL" - | "IM" - | "IN" - | "IO" - | "IQ" - | "IR" - | "IS" - | "IT" - | "JE" - | "JM" - | "JO" - | "JP" - | "KE" - | "KG" - | "KH" - | "KI" - | "KM" - | "KN" - | "KP" - | "KR" - | "KW" - | "KY" - | "KZ" - | "LA" - | "LB" - | "LC" - | "LI" - | "LK" - | "LR" - | "LS" - | "LT" - | "LU" - | "LV" - | "LY" - | "MA" - | "MC" - | "MD" - | "ME" - | "MF" - | "MG" - | "MH" - | "MK" - | "ML" - | "MM" - | "MN" - | "MO" - | "MP" - | "MQ" - | "MR" - | "MS" - | "MT" - | "MU" - | "MV" - | "MW" - | "MX" - | "MY" - | "MZ" - | "NA" - | "NC" - | "NE" - | "NF" - | "NG" - | "NI" - | "NL" - | "NO" - | "NP" - | "NR" - | "NU" - | "NZ" - | "OM" - | "PA" - | "PE" - | "PF" - | "PG" - | "PH" - | "PK" - | "PL" - | "PM" - | "PN" - | "PR" - | "PS" - | "PT" - | "PW" - | "PY" - | "QA" - | "RE" - | "RO" - | "RS" - | "RU" - | "RW" - | "SA" - | "SB" - | "SC" - | "SD" - | "SE" - | "SG" - | "SH" - | "SI" - | "SJ" - | "SK" - | "SL" - | "SM" - | "SN" - | "SO" - | "SR" - | "SS" - | "ST" - | "SV" - | "SX" - | "SY" - | "SZ" - | "TC" - | "TD" - | "TF" - | "TG" - | "TH" - | "TJ" - | "TK" - | "TL" - | "TM" - | "TN" - | "TO" - | "TR" - | "TT" - | "TV" - | "TW" - | "TZ" - | "UA" - | "UG" - | "UM" - | "US" - | "UY" - | "UZ" - | "VA" - | "VC" - | "VE" - | "VG" - | "VI" - | "VN" - | "VU" - | "WF" - | "WS" - | "YE" - | "YT" - | "ZA" - | "ZM" - | "ZW"; -/** The 2-letter continent codes Cloudflare uses */ -export type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA"; -export type CfProperties = - | IncomingRequestCfProperties - | RequestInitCfProperties; -export interface D1Result { - results?: T[]; - success: boolean; - error?: string; - meta: any; -} -export declare abstract class D1Database { - prepare(query: string): D1PreparedStatement; - dump(): Promise; - batch(statements: D1PreparedStatement[]): Promise[]>; - exec(query: string): Promise>; -} -export declare abstract class D1PreparedStatement { - bind(...values: any[]): D1PreparedStatement; - first(colName?: string): Promise; - run(): Promise>; - all(): Promise>; - raw(): Promise; -} -/** - * A email message that is sent to a consumer Worker. - */ -export interface EmailMessage { - /** - * Envelope From attribute of the email message. - */ - readonly from: string; - /** - * Envelope To attribute of the email message. - */ - readonly to: string; - /** - * A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers). - */ - readonly headers: Headers; - /** - * Stream of the email message content. - */ - readonly raw: ReadableStream; - /** - * Size of the email message content. - */ - readonly rawSize: number; - /** - * Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason. - * @param reason The reject reason. - * @returns void - */ - setReject(reason: string): void; - /** - * Forward this email message to a verified destination address of the account. - * @param rcptTo Verified destination address. - * @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers). - * @returns A promise that resolves when the email message is forwarded. - */ - forward(rcptTo: string, headers?: Headers): Promise; -} -export declare abstract class EmailEvent extends ExtendableEvent { - readonly message: EmailMessage; -} -export type EmailExportedHandler = ( - message: EmailMessage, - env: Env, - ctx: ExecutionContext -) => void | Promise; -export type Params

= Record; -export type EventContext = { - request: Request; - functionPath: string; - waitUntil: (promise: Promise) => void; - passThroughOnException: () => void; - next: (input?: Request | string, init?: RequestInit) => Promise; - env: Env & { - ASSETS: { - fetch: typeof fetch; - }; - }; - params: Params

; - data: Data; -}; -export type PagesFunction< - Env = unknown, - Params extends string = any, - Data extends Record = Record -> = (context: EventContext) => Response | Promise; -export type EventPluginContext = { - request: Request; - functionPath: string; - waitUntil: (promise: Promise) => void; - passThroughOnException: () => void; - next: (input?: Request | string, init?: RequestInit) => Promise; - env: Env & { - ASSETS: { - fetch: typeof fetch; - }; - }; - params: Params

; - data: Data; - pluginArgs: PluginArgs; -}; -export type PagesPluginFunction< - Env = unknown, - Params extends string = any, - Data extends Record = Record, - PluginArgs = unknown -> = ( - context: EventPluginContext -) => Response | Promise; -// https://developers.cloudflare.com/pub-sub/ -// PubSubMessage represents an incoming PubSub message. -// The message includes metadata about the broker, the client, and the payload -// itself. -export interface PubSubMessage { - // Message ID - readonly mid: number; - // MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT - readonly broker: string; - // The MQTT topic the message was sent on. - readonly topic: string; - // The client ID of the client that published this message. - readonly clientId: string; - // The unique identifier (JWT ID) used by the client to authenticate, if token - // auth was used. - readonly jti?: string; - // A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker - // received the message from the client. - readonly receivedAt: number; - // An (optional) string with the MIME type of the payload, if set by the - // client. - readonly contentType: string; - // Set to 1 when the payload is a UTF-8 string - // https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063 - readonly payloadFormatIndicator: number; - // Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays. - // You can use payloadFormatIndicator to inspect this before decoding. - payload: string | Uint8Array; -} -// JsonWebKey extended by kid parameter -export interface JsonWebKeyWithKid extends JsonWebKey { - // Key Identifier of the JWK - readonly kid: string; -} -/** - * A message that is sent to a consumer Worker. - */ -export interface Message { - /** - * A unique, system-generated ID for the message. - */ - readonly id: string; - /** - * A timestamp when the message was sent. - */ - readonly timestamp: Date; - /** - * The body of the message. - */ - readonly body: Body; - /** - * Marks message to be retried. - */ - retry(): void; - /** - * Marks message acknowledged. - */ - ack(): void; -} -/** - * A batch of messages that are sent to a consumer Worker. - */ -export interface MessageBatch { - /** - * The name of the Queue that belongs to this batch. - */ - readonly queue: string; - /** - * An array of messages in the batch. Ordering of messages is not guaranteed. - */ - readonly messages: readonly Message[]; - /** - * Marks every message to be retried in the next batch. - */ - retryAll(): void; - /** - * Marks every message acknowledged in the batch. - */ - ackAll(): void; -} -/** - * A wrapper class used to structure message batches. - */ -export type MessageSendRequest = { - /** - * The body of the message. - */ - body: Body; -}; -/** - * A binding that allows a producer to send messages to a Queue. - */ -export interface Queue { - /** - * Sends a message to the Queue. - * @param message The message can be any type supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types), as long as its size is less than 128 KB. - * @returns A promise that resolves when the message is confirmed to be written to disk. - */ - send(message: Body): Promise; - /** - * Sends a batch of messages to the Queue. - * @param messages Each item in the input must be supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types). A batch can contain up to 100 messages, though items are limited to 128 KB each, and the total size of the array cannot exceed 256 KB. - * @returns A promise that resolves when the messages are confirmed to be written to disk. - */ - sendBatch(messages: Iterable>): Promise; -} diff --git a/packages/denylist_bot/node_modules/@cloudflare/workers-types/2022-08-04/index.d.ts b/packages/denylist_bot/node_modules/@cloudflare/workers-types/2022-08-04/index.d.ts deleted file mode 100755 index c6eb4d929..000000000 --- a/packages/denylist_bot/node_modules/@cloudflare/workers-types/2022-08-04/index.d.ts +++ /dev/null @@ -1,2983 +0,0 @@ -/*! ***************************************************************************** -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 class DOMException extends Error { - constructor(message?: string, name?: string); - readonly message: string; - readonly name: string; - readonly code: number; - readonly stack: any; - 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; -} -declare type WorkerGlobalScopeEventMap = { - fetch: FetchEvent; - scheduled: ScheduledEvent; - unhandledrejection: PromiseRejectionEvent; - rejectionhandled: PromiseRejectionEvent; -}; -declare abstract class WorkerGlobalScope extends EventTarget { - EventTarget: typeof EventTarget; -} -declare interface Console { - "assert"(condition?: boolean, ...data: any[]): void; - clear(): void; - count(label?: string): void; - countReset(label?: string): void; - debug(...data: any[]): void; - dir(item?: any, options?: any): void; - dirxml(...data: any[]): void; - error(...data: any[]): void; - group(...data: any[]): void; - groupCollapsed(...data: any[]): void; - groupEnd(): void; - info(...data: any[]): void; - log(...data: any[]): void; - table(tabularData?: any, properties?: string[]): void; - time(label?: string): void; - timeEnd(label?: string): void; - timeLog(label?: string, ...data: any[]): void; - timeStamp(label?: string): void; - trace(...data: any[]): void; - warn(...data: any[]): void; -} -declare const console: Console; -declare type BufferSource = ArrayBufferView | ArrayBuffer; -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; - type Imports = Record; - type ExportValue = Function | Global | Memory | Table; - type Exports = Record; - 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; - function validate(bytes: BufferSource): boolean; -} -/** This ServiceWorker API interface represents the global execution context of a service worker. */ -declare 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( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args - ): number; - clearTimeout(timeoutId: number | null): void; - setInterval(callback: (...args: any[]) => void, msDelay?: number): number; - setInterval( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args - ): number; - clearInterval(timeoutId: number | null): void; - queueMicrotask(task: Function): void; - structuredClone(value: T, options?: StructuredSerializeOptions): T; - fetch( - input: RequestInfo, - init?: RequestInit - ): Promise; - self: ServiceWorkerGlobalScope; - crypto: Crypto; - caches: CacheStorage; - scheduler: Scheduler; - Event: typeof Event; - ExtendableEvent: typeof ExtendableEvent; - PromiseRejectionEvent: typeof PromiseRejectionEvent; - FetchEvent: typeof FetchEvent; - TraceEvent: typeof TraceEvent; - 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; - 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; - 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: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetAddEventListenerOptions | boolean -): void; -declare function removeEventListener< - Type extends keyof WorkerGlobalScopeEventMap ->( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetEventListenerOptions | boolean -): void; -/** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */ -declare function dispatchEvent( - event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap] -): boolean; -declare function btoa(data: string): string; -declare function atob(data: string): string; -declare function setTimeout( - callback: (...args: any[]) => void, - msDelay?: number -): number; -declare function setTimeout( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args -): number; -declare function clearTimeout(timeoutId: number | null): void; -declare function setInterval( - callback: (...args: any[]) => void, - msDelay?: number -): number; -declare function setInterval( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args -): number; -declare function clearInterval(timeoutId: number | null): void; -declare function queueMicrotask(task: Function): void; -declare function structuredClone( - value: T, - options?: StructuredSerializeOptions -): T; -declare function fetch( - input: RequestInfo, - init?: RequestInit -): Promise; -declare const self: ServiceWorkerGlobalScope; -declare const crypto: Crypto; -declare const caches: CacheStorage; -declare const scheduler: Scheduler; -declare const navigator: Navigator; -declare interface TestController {} -declare interface ExecutionContext { - waitUntil(promise: Promise): void; - passThroughOnException(): void; -} -declare type ExportedHandlerFetchHandler< - Env = unknown, - CfHostMetadata = unknown -> = ( - request: Request>, - env: Env, - ctx: ExecutionContext -) => Response | Promise; -declare type ExportedHandlerTraceHandler = ( - traces: TraceItem[], - env: Env, - ctx: ExecutionContext -) => void | Promise; -declare type ExportedHandlerScheduledHandler = ( - controller: ScheduledController, - env: Env, - ctx: ExecutionContext -) => void | Promise; -declare type ExportedHandlerQueueHandler = ( - batch: MessageBatch, - env: Env, - ctx: ExecutionContext -) => void | Promise; -declare type ExportedHandlerTestHandler = ( - controller: TestController, - env: Env, - ctx: ExecutionContext -) => void | Promise; -declare interface ExportedHandler< - Env = unknown, - QueueMessage = unknown, - CfHostMetadata = unknown -> { - fetch?: ExportedHandlerFetchHandler; - trace?: ExportedHandlerTraceHandler; - scheduled?: ExportedHandlerScheduledHandler; - test?: ExportedHandlerTestHandler; - queue?: ExportedHandlerQueueHandler; -} -declare interface StructuredSerializeOptions { - transfer?: any[]; -} -declare abstract class PromiseRejectionEvent extends Event { - readonly promise: Promise; - readonly reason: any; -} -declare abstract class Navigator { - readonly userAgent: string; -} -declare interface DurableObject { - fetch(request: Request): Response | Promise; - alarm?(): void | Promise; -} -declare interface DurableObjectStub extends Fetcher { - readonly id: DurableObjectId; - readonly name?: string; -} -declare interface DurableObjectId { - toString(): string; - equals(other: DurableObjectId): boolean; - readonly name?: string; -} -declare interface DurableObjectNamespace { - newUniqueId( - options?: DurableObjectNamespaceNewUniqueIdOptions - ): DurableObjectId; - idFromName(name: string): DurableObjectId; - idFromString(id: string): DurableObjectId; - get( - id: DurableObjectId, - options?: DurableObjectNamespaceGetDurableObjectOptions - ): DurableObjectStub; - jurisdiction(jurisdiction: string): DurableObjectNamespace; -} -declare interface DurableObjectNamespaceNewUniqueIdOptions { - jurisdiction?: string; -} -declare interface DurableObjectNamespaceGetDurableObjectOptions { - locationHint?: string; -} -declare interface DurableObjectState { - waitUntil(promise: Promise): void; - readonly id: DurableObjectId; - readonly storage: DurableObjectStorage; - blockConcurrencyWhile(callback: () => Promise): Promise; -} -declare interface DurableObjectTransaction { - get( - key: string, - options?: DurableObjectGetOptions - ): Promise; - get( - keys: string[], - options?: DurableObjectGetOptions - ): Promise>; - list( - options?: DurableObjectListOptions - ): Promise>; - put( - key: string, - value: T, - options?: DurableObjectPutOptions - ): Promise; - put( - entries: Record, - options?: DurableObjectPutOptions - ): Promise; - delete(key: string, options?: DurableObjectPutOptions): Promise; - delete(keys: string[], options?: DurableObjectPutOptions): Promise; - rollback(): void; - getAlarm(options?: DurableObjectGetAlarmOptions): Promise; - setAlarm( - scheduledTime: number | Date, - options?: DurableObjectSetAlarmOptions - ): Promise; - deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise; -} -declare interface DurableObjectStorage { - get( - key: string, - options?: DurableObjectGetOptions - ): Promise; - get( - keys: string[], - options?: DurableObjectGetOptions - ): Promise>; - list( - options?: DurableObjectListOptions - ): Promise>; - put( - key: string, - value: T, - options?: DurableObjectPutOptions - ): Promise; - put( - entries: Record, - options?: DurableObjectPutOptions - ): Promise; - delete(key: string, options?: DurableObjectPutOptions): Promise; - delete(keys: string[], options?: DurableObjectPutOptions): Promise; - deleteAll(options?: DurableObjectPutOptions): Promise; - transaction( - closure: (txn: DurableObjectTransaction) => Promise - ): Promise; - getAlarm(options?: DurableObjectGetAlarmOptions): Promise; - setAlarm( - scheduledTime: number | Date, - options?: DurableObjectSetAlarmOptions - ): Promise; - deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise; - sync(): Promise; -} -declare interface DurableObjectListOptions { - start?: string; - startAfter?: string; - end?: string; - prefix?: string; - reverse?: boolean; - limit?: number; - allowConcurrency?: boolean; - noCache?: boolean; -} -declare interface DurableObjectGetOptions { - allowConcurrency?: boolean; - noCache?: boolean; -} -declare interface DurableObjectGetAlarmOptions { - allowConcurrency?: boolean; -} -declare interface DurableObjectPutOptions { - allowConcurrency?: boolean; - allowUnconfirmed?: boolean; - noCache?: boolean; -} -declare interface DurableObjectSetAlarmOptions { - allowConcurrency?: boolean; - allowUnconfirmed?: boolean; -} -declare interface AnalyticsEngineDataset { - writeDataPoint(event?: AnalyticsEngineDataPoint): void; -} -declare interface AnalyticsEngineDataPoint { - indexes?: ((ArrayBuffer | string) | null)[]; - doubles?: number[]; - blobs?: ((ArrayBuffer | string) | null)[]; -} -declare class Event { - constructor(type: string, init?: EventInit); - get type(): string; - get eventPhase(): number; - get composed(): boolean; - get bubbles(): boolean; - get cancelable(): boolean; - get defaultPrevented(): boolean; - get returnValue(): boolean; - get currentTarget(): EventTarget | undefined; - get srcElement(): EventTarget | undefined; - get timeStamp(): number; - get isTrusted(): boolean; - get cancelBubble(): boolean; - set cancelBubble(value: boolean); - stopImmediatePropagation(): void; - preventDefault(): void; - stopPropagation(): void; - composedPath(): EventTarget[]; - static readonly NONE: number; - static readonly CAPTURING_PHASE: number; - static readonly AT_TARGET: number; - static readonly BUBBLING_PHASE: number; -} -declare interface EventInit { - bubbles?: boolean; - cancelable?: boolean; - composed?: boolean; -} -declare type EventListener = ( - event: EventType -) => void; -declare interface EventListenerObject { - handleEvent(event: EventType): void; -} -declare type EventListenerOrEventListenerObject< - EventType extends Event = Event -> = EventListener | EventListenerObject; -declare class EventTarget< - EventMap extends Record = Record -> { - constructor(); - addEventListener( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetAddEventListenerOptions | boolean - ): void; - removeEventListener( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetEventListenerOptions | boolean - ): void; - dispatchEvent(event: EventMap[keyof EventMap]): boolean; -} -declare interface EventTargetEventListenerOptions { - capture?: boolean; -} -declare interface EventTargetAddEventListenerOptions { - capture?: boolean; - passive?: boolean; - once?: boolean; - signal?: AbortSignal; -} -declare interface EventTargetHandlerObject { - handleEvent: (event: Event) => any | undefined; -} -declare class AbortController { - constructor(); - get signal(): AbortSignal; - abort(reason?: any): void; -} -declare abstract class AbortSignal extends EventTarget { - static abort(reason?: any): AbortSignal; - static timeout(delay: number): AbortSignal; - get aborted(): boolean; - get reason(): any; - throwIfAborted(): void; -} -declare interface Scheduler { - wait(delay: number, maybeOptions?: SchedulerWaitOptions): Promise; -} -declare interface SchedulerWaitOptions { - signal?: AbortSignal; -} -declare abstract class ExtendableEvent extends Event { - waitUntil(promise: Promise): void; -} -declare class Blob { - constructor( - bits?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[], - options?: BlobOptions - ); - get size(): number; - get type(): string; - slice(start?: number, end?: number, type?: string): Blob; - arrayBuffer(): Promise; - text(): Promise; - stream(): ReadableStream; -} -declare interface BlobOptions { - type?: string; -} -declare class File extends Blob { - constructor( - bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined, - name: string, - options?: FileOptions - ); - get name(): string; - get lastModified(): number; -} -declare interface FileOptions { - type?: string; - lastModified?: number; -} -declare abstract class CacheStorage { - open(cacheName: string): Promise; - readonly default: Cache; -} -declare abstract class Cache { - delete(request: RequestInfo, options?: CacheQueryOptions): Promise; - match( - request: RequestInfo, - options?: CacheQueryOptions - ): Promise; - put(request: RequestInfo, response: Response): Promise; -} -declare interface CacheQueryOptions { - ignoreMethod?: boolean; -} -declare abstract class Crypto { - get subtle(): SubtleCrypto; - getRandomValues< - T extends - | Int8Array - | Uint8Array - | Int16Array - | Uint16Array - | Int32Array - | Uint32Array - | BigInt64Array - | BigUint64Array - >(buffer: T): T; - randomUUID(): string; - DigestStream: typeof DigestStream; -} -declare abstract class SubtleCrypto { - encrypt( - algorithm: string | SubtleCryptoEncryptAlgorithm, - key: CryptoKey, - plainText: ArrayBuffer | ArrayBufferView - ): Promise; - decrypt( - algorithm: string | SubtleCryptoEncryptAlgorithm, - key: CryptoKey, - cipherText: ArrayBuffer | ArrayBufferView - ): Promise; - sign( - algorithm: string | SubtleCryptoSignAlgorithm, - key: CryptoKey, - data: ArrayBuffer | ArrayBufferView - ): Promise; - verify( - algorithm: string | SubtleCryptoSignAlgorithm, - key: CryptoKey, - signature: ArrayBuffer | ArrayBufferView, - data: ArrayBuffer | ArrayBufferView - ): Promise; - digest( - algorithm: string | SubtleCryptoHashAlgorithm, - data: ArrayBuffer | ArrayBufferView - ): Promise; - generateKey( - algorithm: string | SubtleCryptoGenerateKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - deriveKey( - algorithm: string | SubtleCryptoDeriveKeyAlgorithm, - baseKey: CryptoKey, - derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - deriveBits( - algorithm: string | SubtleCryptoDeriveKeyAlgorithm, - baseKey: CryptoKey, - length: number | null - ): Promise; - importKey( - format: string, - keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey, - algorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - exportKey(format: string, key: CryptoKey): Promise; - wrapKey( - format: string, - key: CryptoKey, - wrappingKey: CryptoKey, - wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm - ): Promise; - unwrapKey( - format: string, - wrappedKey: ArrayBuffer | ArrayBufferView, - unwrappingKey: CryptoKey, - unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm, - unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - timingSafeEqual( - a: ArrayBuffer | ArrayBufferView, - b: ArrayBuffer | ArrayBufferView - ): boolean; -} -declare abstract class CryptoKey { - readonly type: string; - readonly extractable: boolean; - readonly algorithm: - | CryptoKeyKeyAlgorithm - | CryptoKeyAesKeyAlgorithm - | CryptoKeyHmacKeyAlgorithm - | CryptoKeyRsaKeyAlgorithm - | CryptoKeyEllipticKeyAlgorithm - | CryptoKeyArbitraryKeyAlgorithm; - readonly usages: string[]; -} -declare interface CryptoKeyPair { - publicKey: CryptoKey; - privateKey: CryptoKey; -} -declare 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; -} -declare interface RsaOtherPrimesInfo { - r?: string; - d?: string; - t?: string; -} -declare interface SubtleCryptoDeriveKeyAlgorithm { - name: string; - salt?: ArrayBuffer; - iterations?: number; - hash?: string | SubtleCryptoHashAlgorithm; - $public?: CryptoKey; - info?: ArrayBuffer; -} -declare interface SubtleCryptoEncryptAlgorithm { - name: string; - iv?: ArrayBuffer; - additionalData?: ArrayBuffer; - tagLength?: number; - counter?: ArrayBuffer; - length?: number; - label?: ArrayBuffer; -} -declare interface SubtleCryptoGenerateKeyAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - modulusLength?: number; - publicExponent?: ArrayBuffer; - length?: number; - namedCurve?: string; -} -declare interface SubtleCryptoHashAlgorithm { - name: string; -} -declare interface SubtleCryptoImportKeyAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - length?: number; - namedCurve?: string; - compressed?: boolean; -} -declare interface SubtleCryptoSignAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - dataLength?: number; - saltLength?: number; -} -declare interface CryptoKeyKeyAlgorithm { - name: string; -} -declare interface CryptoKeyAesKeyAlgorithm { - name: string; - length: number; -} -declare interface CryptoKeyHmacKeyAlgorithm { - name: string; - hash: CryptoKeyKeyAlgorithm; - length: number; -} -declare interface CryptoKeyRsaKeyAlgorithm { - name: string; - modulusLength: number; - publicExponent: ArrayBuffer; - hash?: CryptoKeyKeyAlgorithm; -} -declare interface CryptoKeyEllipticKeyAlgorithm { - name: string; - namedCurve: string; -} -declare interface CryptoKeyArbitraryKeyAlgorithm { - name: string; - hash?: CryptoKeyKeyAlgorithm; - namedCurve?: string; - length?: number; -} -declare class DigestStream extends WritableStream< - ArrayBuffer | ArrayBufferView -> { - constructor(algorithm: string | SubtleCryptoHashAlgorithm); - get digest(): Promise; -} -declare class TextDecoder { - constructor(decoder?: string, options?: TextDecoderConstructorOptions); - decode( - input?: ArrayBuffer | ArrayBufferView, - options?: TextDecoderDecodeOptions - ): string; - get encoding(): string; - get fatal(): boolean; - get ignoreBOM(): boolean; -} -declare class TextEncoder { - constructor(); - encode(input?: string): Uint8Array; - encodeInto(input: string, buffer: Uint8Array): TextEncoderEncodeIntoResult; - get encoding(): string; -} -declare interface TextDecoderConstructorOptions { - fatal: boolean; - ignoreBOM: boolean; -} -declare interface TextDecoderDecodeOptions { - stream: boolean; -} -declare interface TextEncoderEncodeIntoResult { - read: number; - written: number; -} -declare class FormData { - constructor(); - append(name: string, value: string): void; - append(name: string, value: Blob, filename?: string): void; - delete(name: string): void; - get(name: string): (File | string) | null; - getAll(name: string): (File | string)[]; - has(name: string): boolean; - set(name: string, value: string): void; - set(name: string, value: Blob, filename?: string): void; - entries(): IterableIterator<[key: string, value: File | string]>; - keys(): IterableIterator; - values(): IterableIterator; - forEach( - callback: ( - this: This, - value: File | string, - key: string, - parent: FormData - ) => void, - thisArg?: This - ): void; - [Symbol.iterator](): IterableIterator<[key: string, value: File | string]>; -} -declare interface ContentOptions { - html?: boolean; -} -declare class HTMLRewriter { - constructor(); - on( - selector: string, - handlers: HTMLRewriterElementContentHandlers - ): HTMLRewriter; - onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter; - transform(response: Response): Response; -} -declare interface HTMLRewriterElementContentHandlers { - element?(element: Element): void | Promise; - comments?(comment: Comment): void | Promise; - text?(element: Text): void | Promise; -} -declare interface HTMLRewriterDocumentContentHandlers { - doctype?(doctype: Doctype): void | Promise; - comments?(comment: Comment): void | Promise; - text?(text: Text): void | Promise; - end?(end: DocumentEnd): void | Promise; -} -declare interface Doctype { - readonly name: string | null; - readonly publicId: string | null; - readonly systemId: string | null; -} -declare interface Element { - tagName: string; - readonly attributes: IterableIterator; - 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, options?: ContentOptions): Element; - after(content: string, options?: ContentOptions): Element; - prepend(content: string, options?: ContentOptions): Element; - append(content: string, options?: ContentOptions): Element; - replace(content: string, options?: ContentOptions): Element; - remove(): Element; - removeAndKeepContent(): Element; - setInnerContent(content: string, options?: ContentOptions): Element; - onEndTag(handler: (tag: EndTag) => void | Promise): void; -} -declare interface EndTag { - name: string; - before(content: string, options?: ContentOptions): EndTag; - after(content: string, options?: ContentOptions): EndTag; - remove(): EndTag; -} -declare 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; -} -declare interface Text { - readonly text: string; - readonly lastInTextNode: boolean; - readonly removed: boolean; - before(content: string, options?: ContentOptions): Text; - after(content: string, options?: ContentOptions): Text; - replace(content: string, options?: ContentOptions): Text; - remove(): Text; -} -declare interface DocumentEnd { - append(content: string, options?: ContentOptions): DocumentEnd; -} -declare abstract class FetchEvent extends ExtendableEvent { - readonly request: Request; - respondWith(promise: Response | Promise): void; - passThroughOnException(): void; -} -declare type HeadersInit = - | Headers - | Iterable> - | Record; -declare class Headers { - constructor(init?: HeadersInit); - get(name: string): string | null; - getAll(name: string): string[]; - has(name: string): boolean; - set(name: string, value: string): void; - append(name: string, value: string): void; - delete(name: string): void; - forEach( - callback: (this: This, value: string, key: string, parent: Headers) => void, - thisArg?: This - ): void; - entries(): IterableIterator<[key: string, value: string]>; - keys(): IterableIterator; - values(): IterableIterator; - [Symbol.iterator](): IterableIterator<[key: string, value: string]>; -} -declare type BodyInit = - | ReadableStream - | string - | ArrayBuffer - | ArrayBufferView - | Blob - | URLSearchParams - | FormData; -declare abstract class Body { - get body(): ReadableStream | null; - get bodyUsed(): boolean; - arrayBuffer(): Promise; - text(): Promise; - json(): Promise; - formData(): Promise; - blob(): Promise; -} -declare class Response extends Body { - constructor(body?: BodyInit | null, init?: ResponseInit); - static redirect(url: string, status?: number): Response; - static json(any: any, maybeInit?: ResponseInit | Response): Response; - clone(): Response; - get status(): number; - get statusText(): string; - get headers(): Headers; - get ok(): boolean; - get redirected(): boolean; - get url(): string; - get webSocket(): WebSocket | null; - get cf(): any | undefined; -} -declare interface ResponseInit { - status?: number; - statusText?: string; - headers?: HeadersInit; - cf?: any; - webSocket?: WebSocket | null; - encodeBody?: "automatic" | "manual"; -} -declare type RequestInfo< - CfHostMetadata = unknown, - Cf = CfProperties -> = Request | string | URL; -declare class Request< - CfHostMetadata = unknown, - Cf = CfProperties -> extends Body { - constructor(input: RequestInfo, init?: RequestInit); - clone(): Request; - get method(): string; - get url(): string; - get headers(): Headers; - get redirect(): string; - get fetcher(): Fetcher | null; - get signal(): AbortSignal; - get cf(): Cf | undefined; - get integrity(): string; - get keepalive(): boolean; -} -declare interface RequestInit { - /** 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 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; -} -declare abstract class Fetcher { - fetch(input: RequestInfo, init?: RequestInit): Promise; -} -declare interface FetcherPutOptions { - expiration?: number; - expirationTtl?: number; -} -declare interface KVNamespaceListKey { - name: Key; - expiration?: number; - metadata?: Metadata; -} -declare type KVNamespaceListResult = - | { - list_complete: false; - keys: KVNamespaceListKey[]; - cursor: string; - } - | { - list_complete: true; - keys: KVNamespaceListKey[]; - }; -declare interface KVNamespace { - get( - key: Key, - options?: Partial> - ): Promise; - get(key: Key, type: "text"): Promise; - get( - key: Key, - type: "json" - ): Promise; - get(key: Key, type: "arrayBuffer"): Promise; - get(key: Key, type: "stream"): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"text"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"json"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"arrayBuffer"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"stream"> - ): Promise; - list( - options?: KVNamespaceListOptions - ): Promise>; - put( - key: Key, - value: string | ArrayBuffer | ArrayBufferView | ReadableStream, - options?: KVNamespacePutOptions - ): Promise; - getWithMetadata( - key: Key, - options?: Partial> - ): Promise>; - getWithMetadata( - key: Key, - type: "text" - ): Promise>; - getWithMetadata( - key: Key, - type: "json" - ): Promise>; - getWithMetadata( - key: Key, - type: "arrayBuffer" - ): Promise>; - getWithMetadata( - key: Key, - type: "stream" - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"text"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"json"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"arrayBuffer"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"stream"> - ): Promise>; - delete(key: Key): Promise; -} -declare interface KVNamespaceListOptions { - limit?: number; - prefix?: string | null; - cursor?: string | null; -} -declare interface KVNamespaceGetOptions { - type: Type; - cacheTtl?: number; -} -declare interface KVNamespacePutOptions { - expiration?: number; - expirationTtl?: number; - metadata?: any | null; -} -declare interface KVNamespaceGetWithMetadataResult { - value: Value | null; - metadata: Metadata | null; -} -declare interface R2Error extends Error { - readonly name: string; - readonly code: number; - readonly message: string; - readonly action: string; - readonly stack: any; -} -declare interface R2ListOptions { - limit?: number; - prefix?: string; - cursor?: string; - delimiter?: string; - startAfter?: string; - include?: ("httpMetadata" | "customMetadata")[]; -} -declare abstract class R2Bucket { - head(key: string): Promise; - get( - key: string, - options: R2GetOptions & { - onlyIf: R2Conditional | Headers; - } - ): Promise; - get(key: string, options?: R2GetOptions): Promise; - put( - key: string, - value: - | ReadableStream - | ArrayBuffer - | ArrayBufferView - | string - | null - | Blob, - options?: R2PutOptions - ): Promise; - put( - key: string, - value: - | ReadableStream - | ArrayBuffer - | ArrayBufferView - | string - | null - | Blob, - options?: R2PutOptions & { - onlyIf: R2Conditional | Headers; - } - ): Promise; - createMultipartUpload( - key: string, - options?: R2MultipartOptions - ): Promise; - resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload; - delete(keys: string | string[]): Promise; - list(options?: R2ListOptions): Promise; -} -declare interface R2MultipartUpload { - readonly key: string; - readonly uploadId: string; - uploadPart( - partNumber: number, - value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob - ): Promise; - abort(): Promise; - complete(uploadedParts: R2UploadedPart[]): Promise; -} -declare 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; - readonly range?: R2Range; - writeHttpMetadata(headers: Headers): void; -} -declare interface R2ObjectBody extends R2Object { - get body(): ReadableStream; - get bodyUsed(): boolean; - arrayBuffer(): Promise; - text(): Promise; - json(): Promise; - blob(): Promise; -} -declare type R2Range = - | { - offset: number; - length?: number; - } - | { - offset?: number; - length: number; - } - | { - suffix: number; - }; -declare interface R2Conditional { - etagMatches?: string; - etagDoesNotMatch?: string; - uploadedBefore?: Date; - uploadedAfter?: Date; - secondsGranularity?: boolean; -} -declare interface R2GetOptions { - onlyIf?: R2Conditional | Headers; - range?: R2Range | Headers; -} -declare interface R2PutOptions { - onlyIf?: R2Conditional | Headers; - httpMetadata?: R2HTTPMetadata | Headers; - customMetadata?: Record; - md5?: ArrayBuffer | string; - sha1?: ArrayBuffer | string; - sha256?: ArrayBuffer | string; - sha384?: ArrayBuffer | string; - sha512?: ArrayBuffer | string; -} -declare interface R2MultipartOptions { - httpMetadata?: R2HTTPMetadata | Headers; - customMetadata?: Record; -} -declare interface R2Checksums { - readonly md5?: ArrayBuffer; - readonly sha1?: ArrayBuffer; - readonly sha256?: ArrayBuffer; - readonly sha384?: ArrayBuffer; - readonly sha512?: ArrayBuffer; - toJSON(): R2StringChecksums; -} -declare interface R2StringChecksums { - md5?: string; - sha1?: string; - sha256?: string; - sha384?: string; - sha512?: string; -} -declare interface R2HTTPMetadata { - contentType?: string; - contentLanguage?: string; - contentDisposition?: string; - contentEncoding?: string; - cacheControl?: string; - cacheExpiry?: Date; -} -declare interface R2Objects { - objects: R2Object[]; - truncated: boolean; - cursor?: string; - delimitedPrefixes: string[]; -} -declare abstract class ScheduledEvent extends ExtendableEvent { - readonly scheduledTime: number; - readonly cron: string; - noRetry(): void; -} -declare interface ScheduledController { - readonly scheduledTime: number; - readonly cron: string; - noRetry(): void; -} -declare interface QueuingStrategy { - highWaterMark?: number | bigint; - size?: (chunk: T) => number | bigint; -} -declare interface UnderlyingSink { - type?: string; - start?: (controller: WritableStreamDefaultController) => void | Promise; - write?: ( - chunk: W, - controller: WritableStreamDefaultController - ) => void | Promise; - abort?: (reason: any) => void | Promise; - close?: () => void | Promise; -} -declare interface UnderlyingByteSource { - type: "bytes"; - autoAllocateChunkSize?: number; - start?: (controller: ReadableByteStreamController) => void | Promise; - pull?: (controller: ReadableByteStreamController) => void | Promise; - cancel?: (reason: any) => void | Promise; -} -declare interface UnderlyingSource { - type?: "" | undefined; - start?: ( - controller: ReadableStreamDefaultController - ) => void | Promise; - pull?: ( - controller: ReadableStreamDefaultController - ) => void | Promise; - cancel?: (reason: any) => void | Promise; -} -declare interface Transformer { - readableType?: string; - writableType?: string; - start?: ( - controller: TransformStreamDefaultController - ) => void | Promise; - transform?: ( - chunk: I, - controller: TransformStreamDefaultController - ) => void | Promise; - flush?: ( - controller: TransformStreamDefaultController - ) => void | Promise; -} -declare interface StreamPipeOptions { - /** - * 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; - preventAbort?: boolean; - preventCancel?: boolean; - signal?: AbortSignal; -} -declare type ReadableStreamReadResult = - | { - done: false; - value: R; - } - | { - done: true; - value?: undefined; - }; -/** This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object. */ -declare interface ReadableStream { - get locked(): boolean; - cancel(reason?: any): Promise; - getReader(): ReadableStreamDefaultReader; - getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader; - pipeThrough( - transform: ReadableWritablePair, - options?: StreamPipeOptions - ): ReadableStream; - pipeTo( - destination: WritableStream, - options?: StreamPipeOptions - ): Promise; - tee(): [ReadableStream, ReadableStream]; - values(options?: ReadableStreamValuesOptions): AsyncIterableIterator; - [Symbol.asyncIterator]( - options?: ReadableStreamValuesOptions - ): AsyncIterableIterator; -} -declare const ReadableStream: { - prototype: ReadableStream; - new ( - underlyingSource: UnderlyingByteSource, - strategy?: QueuingStrategy - ): ReadableStream; - new ( - underlyingSource?: UnderlyingSource, - strategy?: QueuingStrategy - ): ReadableStream; -}; -declare class ReadableStreamDefaultReader { - constructor(stream: ReadableStream); - get closed(): Promise; - cancel(reason?: any): Promise; - read(): Promise>; - releaseLock(): void; -} -declare class ReadableStreamBYOBReader { - constructor(stream: ReadableStream); - get closed(): Promise; - cancel(reason?: any): Promise; - read( - view: T - ): Promise>; - releaseLock(): void; - readAtLeast( - minElements: number, - view: T - ): Promise>; -} -declare interface ReadableStreamGetReaderOptions { - mode: "byob"; -} -declare interface ReadableStreamBYOBRequest { - readonly view: Uint8Array | null; - respond(bytesWritten: number): void; - respondWithNewView(view: ArrayBuffer | ArrayBufferView): void; - readonly atLeast: number | null; -} -declare interface ReadableStreamDefaultController { - readonly desiredSize: number | null; - close(): void; - enqueue(chunk?: R): void; - error(reason: any): void; -} -declare interface ReadableByteStreamController { - readonly byobRequest: ReadableStreamBYOBRequest | null; - readonly desiredSize: number | null; - close(): void; - enqueue(chunk: ArrayBuffer | ArrayBufferView): void; - error(reason: any): void; -} -/** This Streams API interface represents a controller allowing control of a WritableStream's state. When constructing a WritableStream, the underlying sink is given a corresponding WritableStreamDefaultController instance to manipulate. */ -declare interface WritableStreamDefaultController { - readonly signal: AbortSignal; - error(reason?: any): void; -} -declare interface TransformStreamDefaultController { - get desiredSize(): number | null; - enqueue(chunk?: O): void; - error(reason: any): void; - terminate(): void; -} -declare interface ReadableWritablePair { - /** - * 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; - readable: ReadableStream; -} -declare class WritableStream { - constructor( - underlyingSink?: UnderlyingSink, - queuingStrategy?: QueuingStrategy - ); - get locked(): boolean; - abort(reason?: any): Promise; - close(): Promise; - getWriter(): WritableStreamDefaultWriter; -} -declare class WritableStreamDefaultWriter { - constructor(stream: WritableStream); - get closed(): Promise; - get ready(): Promise; - get desiredSize(): number | null; - abort(reason?: any): Promise; - close(): Promise; - write(chunk?: W): Promise; - releaseLock(): void; -} -declare class TransformStream { - constructor( - transformer?: Transformer, - writableStrategy?: QueuingStrategy, - readableStrategy?: QueuingStrategy - ); - get readable(): ReadableStream; - get writable(): WritableStream; -} -declare class FixedLengthStream extends IdentityTransformStream { - constructor(expectedLength: number | bigint); -} -declare class IdentityTransformStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(); -} -declare interface ReadableStreamValuesOptions { - preventCancel?: boolean; -} -declare class CompressionStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(format: "gzip" | "deflate" | "deflate-raw"); -} -declare class DecompressionStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(format: "gzip" | "deflate" | "deflate-raw"); -} -declare class TextEncoderStream extends TransformStream { - constructor(); -} -declare class TextDecoderStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - string -> { - constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit); -} -declare interface TextDecoderStreamTextDecoderStreamInit { - fatal?: boolean; -} -declare class ByteLengthQueuingStrategy - implements QueuingStrategy -{ - constructor(init: QueuingStrategyInit); - get highWaterMark(): number; - get size(): (chunk?: any) => number; -} -declare class CountQueuingStrategy implements QueuingStrategy { - constructor(init: QueuingStrategyInit); - get highWaterMark(): number; - get size(): (chunk?: any) => number; -} -declare 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; -} -declare abstract class TraceEvent extends ExtendableEvent { - readonly traces: TraceItem[]; -} -declare interface TraceItem { - readonly event: - | ( - | TraceItemFetchEventInfo - | TraceItemScheduledEventInfo - | TraceItemAlarmEventInfo - | TraceItemQueueEventInfo - | TraceItemEmailEventInfo - | TraceItemCustomEventInfo - ) - | null; - readonly eventTimestamp: number | null; - readonly logs: TraceLog[]; - readonly exceptions: TraceException[]; - readonly scriptName: string | null; - readonly dispatchNamespace?: string; - readonly scriptTags?: string[]; - readonly outcome: string; -} -declare interface TraceItemAlarmEventInfo { - readonly scheduledTime: Date; -} -declare interface TraceItemCustomEventInfo {} -declare interface TraceItemScheduledEventInfo { - readonly scheduledTime: number; - readonly cron: string; -} -declare interface TraceItemQueueEventInfo { - readonly queue: string; - readonly batchSize: number; -} -declare interface TraceItemEmailEventInfo { - readonly mailFrom: string; - readonly rcptTo: string; - readonly rawSize: number; -} -declare interface TraceItemFetchEventInfo { - readonly response?: TraceItemFetchEventInfoResponse; - readonly request: TraceItemFetchEventInfoRequest; -} -declare interface TraceItemFetchEventInfoRequest { - readonly cf?: any; - readonly headers: Record; - readonly method: string; - readonly url: string; - getUnredacted(): TraceItemFetchEventInfoRequest; -} -declare interface TraceItemFetchEventInfoResponse { - readonly status: number; -} -declare interface TraceLog { - readonly timestamp: number; - readonly level: string; - readonly message: any; -} -declare interface TraceException { - readonly timestamp: number; - readonly message: string; - readonly name: string; -} -declare interface TraceMetrics { - readonly cpuTime: number; - readonly wallTime: number; -} -declare interface UnsafeTraceMetrics { - fromTrace(item: TraceItem): TraceMetrics; -} -declare class URL { - constructor(url: string | URL, base?: string | URL); - get href(): string; - set href(value: string); - get origin(): string; - get protocol(): string; - set protocol(value: string); - get username(): string; - set username(value: string); - get password(): string; - set password(value: string); - get host(): string; - set host(value: string); - get hostname(): string; - set hostname(value: string); - get port(): string; - set port(value: string); - get pathname(): string; - set pathname(value: string); - get search(): string; - set search(value: string); - get searchParams(): URLSearchParams; - get hash(): string; - set hash(value: string); - toString(): string; - toJSON(): string; -} -declare class URLSearchParams { - constructor( - init?: - | URLSearchParams - | string - | Record - | [key: string, value: string][] - ); - get size(): number; - append(name: string, value: string): void; - delete(name: string): void; - get(name: string): string | null; - getAll(name: string): string[]; - has(name: string): boolean; - set(name: string, value: string): void; - sort(): void; - entries(): IterableIterator<[key: string, value: string]>; - keys(): IterableIterator; - values(): IterableIterator; - forEach( - callback: ( - this: This, - value: string, - key: string, - parent: URLSearchParams - ) => void, - thisArg?: This - ): void; - toString(): string; - [Symbol.iterator](): IterableIterator<[key: string, value: string]>; -} -declare class URLPattern { - constructor(input?: string | URLPatternURLPatternInit, baseURL?: string); - get protocol(): string; - get username(): string; - get password(): string; - get hostname(): string; - get port(): string; - get pathname(): string; - get search(): string; - get hash(): string; - test(input?: string | URLPatternURLPatternInit, baseURL?: string): boolean; - exec( - input?: string | URLPatternURLPatternInit, - baseURL?: string - ): URLPatternURLPatternResult | null; -} -declare interface URLPatternURLPatternInit { - protocol?: string; - username?: string; - password?: string; - hostname?: string; - port?: string; - pathname?: string; - search?: string; - hash?: string; - baseURL?: string; -} -declare interface URLPatternURLPatternComponentResult { - input: string; - groups: Record; -} -declare interface URLPatternURLPatternResult { - inputs: (string | URLPatternURLPatternInit)[]; - protocol: URLPatternURLPatternComponentResult; - username: URLPatternURLPatternComponentResult; - password: URLPatternURLPatternComponentResult; - hostname: URLPatternURLPatternComponentResult; - port: URLPatternURLPatternComponentResult; - pathname: URLPatternURLPatternComponentResult; - search: URLPatternURLPatternComponentResult; - hash: URLPatternURLPatternComponentResult; -} -declare class CloseEvent extends Event { - constructor(type: string, initializer: CloseEventInit); - /** Returns the WebSocket connection close code provided by the server. */ - readonly code: number; - /** Returns the WebSocket connection close reason provided by the server. */ - readonly reason: string; - /** Returns true if the connection closed cleanly; false otherwise. */ - readonly wasClean: boolean; -} -declare interface CloseEventInit { - code?: number; - reason?: string; - wasClean?: boolean; -} -declare class MessageEvent extends Event { - constructor(type: string, initializer: MessageEventInit); - readonly data: ArrayBuffer | string; -} -declare interface MessageEventInit { - data: ArrayBuffer | string; -} -/** Events providing information related to errors in scripts or in files. */ -declare interface ErrorEvent extends Event { - readonly filename: string; - readonly message: string; - readonly lineno: number; - readonly colno: number; - readonly error: any; -} -declare type WebSocketEventMap = { - close: CloseEvent; - message: MessageEvent; - open: Event; - error: ErrorEvent; -}; -declare class WebSocket extends EventTarget { - constructor(url: string, protocols?: string[] | string); - accept(): void; - send(message: (ArrayBuffer | ArrayBufferView) | string): void; - close(code?: number, reason?: string): void; - static readonly READY_STATE_CONNECTING: number; - static readonly READY_STATE_OPEN: number; - static readonly READY_STATE_CLOSING: number; - static readonly READY_STATE_CLOSED: number; - get readyState(): number; - get url(): string | null; - get protocol(): string | null; - get extensions(): string | null; -} -declare const WebSocketPair: { - new (): { - 0: WebSocket; - 1: WebSocket; - }; -}; -declare interface BasicImageTransformations { - /** - * Maximum width in image pixels. The value must be an integer. - */ - width?: number; - /** - * Maximum height in image pixels. The value must be an integer. - */ - height?: number; - /** - * Resizing mode as a string. It affects interpretation of width and height - * options: - * - scale-down: Similar to contain, but the image is never enlarged. If - * the image is larger than given width or height, it will be resized. - * Otherwise its original size will be kept. - * - contain: Resizes to maximum size that fits within the given width and - * height. If only a single dimension is given (e.g. only width), the - * image will be shrunk or enlarged to exactly match that dimension. - * Aspect ratio is always preserved. - * - cover: Resizes (shrinks or enlarges) to fill the entire area of width - * and height. If the image has an aspect ratio different from the ratio - * of width and height, it will be cropped to fit. - * - crop: The image will be shrunk and cropped to fit within the area - * specified by width and height. The image will not be enlarged. For images - * smaller than the given dimensions it's the same as scale-down. For - * images larger than the given dimensions, it's the same as cover. - * See also trim. - * - pad: Resizes to the maximum size that fits within the given width and - * height, and then fills the remaining area with a background color - * (white by default). Use of this mode is not recommended, as the same - * effect can be more efficiently achieved with the contain mode and the - * CSS object-fit: contain property. - */ - fit?: "scale-down" | "contain" | "cover" | "crop" | "pad"; - /** - * When cropping with fit: "cover", this defines the side or point that should - * be left uncropped. The value is either a string - * "left", "right", "top", "bottom", "auto", or "center" (the default), - * or an object {x, y} containing focal point coordinates in the original - * image expressed as fractions ranging from 0.0 (top or left) to 1.0 - * (bottom or right), 0.5 being the center. {fit: "cover", gravity: "top"} will - * crop bottom or left and right sides as necessary, but won’t crop anything - * from the top. {fit: "cover", gravity: {x:0.5, y:0.2}} will crop each side to - * preserve as much as possible around a point at 20% of the height of the - * source image. - */ - gravity?: - | "left" - | "right" - | "top" - | "bottom" - | "center" - | "auto" - | BasicImageTransformationsGravityCoordinates; - /** - * Background color to add underneath the image. Applies only to images with - * transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…), - * hsl(…), etc.) - */ - background?: string; - /** - * Number of degrees (90, 180, 270) to rotate the image by. width and height - * options refer to axes after rotation. - */ - rotate?: 0 | 90 | 180 | 270 | 360; -} -declare interface BasicImageTransformationsGravityCoordinates { - x: number; - y: number; -} -/** - * In addition to the properties you can set in the RequestInit dict - * that you pass as an argument to the Request constructor, you can - * set certain properties of a `cf` object to control how Cloudflare - * features are applied to that new Request. - * - * Note: Currently, these properties cannot be tested in the - * playground. - */ -declare interface RequestInitCfProperties extends Record { - cacheEverything?: boolean; - /** - * A request's cache key is what determines if two requests are - * "the same" for caching purposes. If a request has the same cache key - * as some previous request, then we can serve the same cached response for - * both. (e.g. 'some-key') - * - * Only available for Enterprise customers. - */ - cacheKey?: string; - /** - * This allows you to append additional Cache-Tag response headers - * to the origin response without modifications to the origin server. - * This will allow for greater control over the Purge by Cache Tag feature - * utilizing changes only in the Workers process. - * - * Only available for Enterprise customers. - */ - cacheTags?: string[]; - /** - * Force response to be cached for a given number of seconds. (e.g. 300) - */ - cacheTtl?: number; - /** - * Force response to be cached for a given number of seconds based on the Origin status code. - * (e.g. { '200-299': 86400, '404': 1, '500-599': 0 }) - */ - cacheTtlByStatus?: Record; - scrapeShield?: boolean; - apps?: boolean; - image?: RequestInitCfPropertiesImage; - minify?: RequestInitCfPropertiesImageMinify; - mirage?: boolean; - polish?: "lossy" | "lossless" | "off"; - /** - * Redirects the request to an alternate origin server. You can use this, - * for example, to implement load balancing across several origins. - * (e.g.us-east.example.com) - * - * Note - For security reasons, the hostname set in resolveOverride must - * be proxied on the same Cloudflare zone of the incoming request. - * Otherwise, the setting is ignored. CNAME hosts are allowed, so to - * resolve to a host under a different domain or a DNS only domain first - * declare a CNAME record within your own zone’s DNS mapping to the - * external hostname, set proxy on Cloudflare, then set resolveOverride - * to point to that CNAME record. - */ - resolveOverride?: string; -} -declare interface RequestInitCfPropertiesImageDraw - extends BasicImageTransformations { - /** - * Absolute URL of the image file to use for the drawing. It can be any of - * the supported file formats. For drawing of watermarks or non-rectangular - * overlays we recommend using PNG or WebP images. - */ - url: string; - /** - * Floating-point number between 0 (transparent) and 1 (opaque). - * For example, opacity: 0.5 makes overlay semitransparent. - */ - opacity?: number; - /** - * - If set to true, the overlay image will be tiled to cover the entire - * area. This is useful for stock-photo-like watermarks. - * - If set to "x", the overlay image will be tiled horizontally only - * (form a line). - * - If set to "y", the overlay image will be tiled vertically only - * (form a line). - */ - repeat?: true | "x" | "y"; - /** - * Position of the overlay image relative to a given edge. Each property is - * an offset in pixels. 0 aligns exactly to the edge. For example, left: 10 - * positions left side of the overlay 10 pixels from the left edge of the - * image it's drawn over. bottom: 0 aligns bottom of the overlay with bottom - * of the background image. - * - * Setting both left & right, or both top & bottom is an error. - * - * If no position is specified, the image will be centered. - */ - top?: number; - left?: number; - bottom?: number; - right?: number; -} -declare interface RequestInitCfPropertiesImage - extends BasicImageTransformations { - /** - * Device Pixel Ratio. Default 1. Multiplier for width/height that makes it - * easier to specify higher-DPI sizes in . - */ - dpr?: number; - /** - * An object with four properties {left, top, right, bottom} that specify - * a number of pixels to cut off on each side. Allows removal of borders - * or cutting out a specific fragment of an image. Trimming is performed - * before resizing or rotation. Takes dpr into account. - */ - trim?: { - left?: number; - top?: number; - right?: number; - bottom?: number; - }; - /** - * Quality setting from 1-100 (useful values are in 60-90 range). Lower values - * make images look worse, but load faster. The default is 85. It applies only - * to JPEG and WebP images. It doesn’t have any effect on PNG. - */ - quality?: number; - /** - * Output format to generate. It can be: - * - avif: generate images in AVIF format. - * - webp: generate images in Google WebP format. Set quality to 100 to get - * the WebP-lossless format. - * - json: instead of generating an image, outputs information about the - * image, in JSON format. The JSON object will contain image size - * (before and after resizing), source image’s MIME type, file size, etc. - * - jpeg: generate images in JPEG format. - * - png: generate images in PNG format. - */ - format?: "avif" | "webp" | "json" | "jpeg" | "png"; - /** - * Whether to preserve animation frames from input files. Default is true. - * Setting it to false reduces animations to still images. This setting is - * recommended when enlarging images or processing arbitrary user content, - * because large GIF animations can weigh tens or even hundreds of megabytes. - * It is also useful to set anim:false when using format:"json" to get the - * response quicker without the number of frames. - */ - anim?: boolean; - /** - * What EXIF data should be preserved in the output image. Note that EXIF - * rotation and embedded color profiles are always applied ("baked in" into - * the image), and aren't affected by this option. Note that if the Polish - * feature is enabled, all metadata may have been removed already and this - * option may have no effect. - * - keep: Preserve most of EXIF metadata, including GPS location if there's - * any. - * - copyright: Only keep the copyright tag, and discard everything else. - * This is the default behavior for JPEG files. - * - none: Discard all invisible EXIF metadata. Currently WebP and PNG - * output formats always discard metadata. - */ - metadata?: "keep" | "copyright" | "none"; - /** - * Strength of sharpening filter to apply to the image. Floating-point - * number between 0 (no sharpening, default) and 10 (maximum). 1.0 is a - * recommended value for downscaled images. - */ - sharpen?: number; - /** - * Radius of a blur filter (approximate gaussian). Maximum supported radius - * is 250. - */ - blur?: number; - /** - * Overlays are drawn in the order they appear in the array (last array - * entry is the topmost layer). - */ - draw?: RequestInitCfPropertiesImageDraw[]; - /** - * Fetching image from authenticated origin. Setting this property will - * pass authentication headers (Authorization, Cookie, etc.) through to - * the origin. - */ - "origin-auth"?: "share-publicly"; - /** - * Adds a border around the image. The border is added after resizing. Border - * width takes dpr into account, and can be specified either using a single - * width property, or individually for each side. - */ - border?: - | { - color: string; - width: number; - } - | { - color: string; - top: number; - right: number; - bottom: number; - left: number; - }; - /** - * Increase brightness by a factor. A value of 1.0 equals no change, a value - * of 0.5 equals half brightness, and a value of 2.0 equals twice as bright. - * 0 is ignored. - */ - brightness?: number; - /** - * Increase contrast by a factor. A value of 1.0 equals no change, a value of - * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is - * ignored. - */ - contrast?: number; - /** - * Increase exposure by a factor. A value of 1.0 equals no change, a value of - * 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored. - */ - gamma?: number; - /** - * Slightly reduces latency on a cache miss by selecting a - * quickest-to-compress file format, at a cost of increased file size and - * lower image quality. It will usually override the format option and choose - * JPEG over WebP or AVIF. We do not recommend using this option, except in - * unusual circumstances like resizing uncacheable dynamically-generated - * images. - */ - compression?: "fast"; -} -declare interface RequestInitCfPropertiesImageMinify { - javascript?: boolean; - css?: boolean; - html?: boolean; -} -/** - * Request metadata provided by Cloudflare's edge. - */ -declare type IncomingRequestCfProperties = - IncomingRequestCfPropertiesBase & - IncomingRequestCfPropertiesBotManagementEnterprise & - IncomingRequestCfPropertiesCloudflareForSaaSEnterprise & - IncomingRequestCfPropertiesGeographicInformation & - IncomingRequestCfPropertiesCloudflareAccessOrApiShield; -declare interface IncomingRequestCfPropertiesBase - extends Record { - /** - * [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request. - * - * @example 395747 - */ - asn: number; - /** - * The organization which owns the ASN of the incoming request. - * - * @example "Google Cloud" - */ - asOrganization: string; - /** - * The original value of the `Accept-Encoding` header if Cloudflare modified it. - * - * @example "gzip, deflate, br" - */ - clientAcceptEncoding?: string; - /** - * The number of milliseconds it took for the request to reach your worker. - * - * @example 22 - */ - clientTcpRtt?: number; - /** - * The three-letter [IATA](https://en.wikipedia.org/wiki/IATA_airport_code) - * airport code of the data center that the request hit. - * - * @example "DFW" - */ - colo: string; - /** - * Represents the upstream's response to a - * [TCP `keepalive` message](https://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html) - * from cloudflare. - * - * For workers with no upstream, this will always be `1`. - * - * @example 3 - */ - edgeRequestKeepAliveStatus: IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus; - /** - * The HTTP Protocol the request used. - * - * @example "HTTP/2" - */ - httpProtocol: string; - /** - * The browser-requested prioritization information in the request object. - * - * If no information was set, defaults to the empty string `""` - * - * @example "weight=192;exclusive=0;group=3;group-weight=127" - * @default "" - */ - requestPriority: string; - /** - * The TLS version of the connection to Cloudflare. - * In requests served over plaintext (without TLS), this property is the empty string `""`. - * - * @example "TLSv1.3" - */ - tlsVersion: string; - /** - * The cipher for the connection to Cloudflare. - * In requests served over plaintext (without TLS), this property is the empty string `""`. - * - * @example "AEAD-AES128-GCM-SHA256" - */ - tlsCipher: string; - /** - * Metadata containing the [`HELLO`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2) and [`FINISHED`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9) messages from this request's TLS handshake. - * - * If the incoming request was served over plaintext (without TLS) this field is undefined. - */ - tlsExportedAuthenticator?: IncomingRequestCfPropertiesExportedAuthenticatorMetadata; -} -declare interface IncomingRequestCfPropertiesBotManagementBase { - /** - * Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot, - * represented as an integer percentage between `1` (almost certainly human) - * and `99` (almost certainly a bot). - * - * @example 54 - */ - score: number; - /** - * A boolean value that is true if the request comes from a good bot, like Google or Bing. - * Most customers choose to allow this traffic. For more details, see [Traffic from known bots](https://developers.cloudflare.com/firewall/known-issues-and-faq/#how-does-firewall-rules-handle-traffic-from-known-bots). - */ - verifiedBot: boolean; - /** - * A boolean value that is true if the request originates from a - * Cloudflare-verified proxy service. - */ - corporateProxy: boolean; - /** - * A boolean value that's true if the request matches [file extensions](https://developers.cloudflare.com/bots/reference/static-resources/) for many types of static resources. - */ - staticResource: boolean; - /** - * List of IDs that correlate to the Bot Management heuristic detections made on a request (you can have multiple heuristic detections on the same request). - */ - detectionIds: number[]; -} -declare interface IncomingRequestCfPropertiesBotManagement { - /** - * Results of Cloudflare's Bot Management analysis - */ - botManagement: IncomingRequestCfPropertiesBotManagementBase; - /** - * Duplicate of `botManagement.score`. - * - * @deprecated - */ - clientTrustScore: number; -} -declare interface IncomingRequestCfPropertiesBotManagementEnterprise - extends IncomingRequestCfPropertiesBotManagement { - /** - * Results of Cloudflare's Bot Management analysis - */ - botManagement: IncomingRequestCfPropertiesBotManagementBase & { - /** - * A [JA3 Fingerprint](https://developers.cloudflare.com/bots/concepts/ja3-fingerprint/) to help profile specific SSL/TLS clients - * across different destination IPs, Ports, and X509 certificates. - */ - ja3Hash: string; - }; -} -declare interface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise< - HostMetadata -> { - /** - * Custom metadata set per-host in [Cloudflare for SaaS](https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/). - * - * This field is only present if you have Cloudflare for SaaS enabled on your account - * and you have followed the [required steps to enable it]((https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/domain-support/custom-metadata/)). - */ - hostMetadata: HostMetadata; -} -declare interface IncomingRequestCfPropertiesCloudflareAccessOrApiShield { - /** - * Information about the client certificate presented to Cloudflare. - * - * This is populated when the incoming request is served over TLS using - * either Cloudflare Access or API Shield (mTLS) - * and the presented SSL certificate has a valid - * [Certificate Serial Number](https://ldapwiki.com/wiki/Certificate%20Serial%20Number) - * (i.e., not `null` or `""`). - * - * Otherwise, a set of placeholder values are used. - * - * The property `certPresented` will be set to `"1"` when - * the object is populated (i.e. the above conditions were met). - */ - tlsClientAuth: - | IncomingRequestCfPropertiesTLSClientAuth - | IncomingRequestCfPropertiesTLSClientAuthPlaceholder; -} -/** - * Metadata about the request's TLS handshake - */ -declare interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata { - /** - * The client's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal - * - * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d" - */ - clientHandshake: string; - /** - * The server's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal - * - * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d" - */ - serverHandshake: string; - /** - * The client's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal - * - * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b" - */ - clientFinished: string; - /** - * The server's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal - * - * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b" - */ - serverFinished: string; -} -/** - * Geographic data about the request's origin. - */ -declare interface IncomingRequestCfPropertiesGeographicInformation { - /** - * The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from. - * - * If your worker is [configured to accept TOR connections](https://support.cloudflare.com/hc/en-us/articles/203306930-Understanding-Cloudflare-Tor-support-and-Onion-Routing), this may also be `"T1"`, indicating a request that originated over TOR. - * - * If Cloudflare is unable to determine where the request originated this property is omitted. - * - * The country code `"T1"` is used for requests originating on TOR. - * - * @example "GB" - */ - country?: Iso3166Alpha2Code | "T1"; - /** - * If present, this property indicates that the request originated in the EU - * - * @example "1" - */ - isEUCountry?: "1"; - /** - * A two-letter code indicating the continent the request originated from. - * - * @example "AN" - */ - continent?: ContinentCode; - /** - * The city the request originated from - * - * @example "Austin" - */ - city?: string; - /** - * Postal code of the incoming request - * - * @example "78701" - */ - postalCode?: string; - /** - * Latitude of the incoming request - * - * @example "30.27130" - */ - latitude?: string; - /** - * Longitude of the incoming request - * - * @example "-97.74260" - */ - longitude?: string; - /** - * Timezone of the incoming request - * - * @example "America/Chicago" - */ - timezone?: string; - /** - * If known, the ISO 3166-2 name for the first level region associated with - * the IP address of the incoming request - * - * @example "Texas" - */ - region?: string; - /** - * If known, the ISO 3166-2 code for the first-level region associated with - * the IP address of the incoming request - * - * @example "TX" - */ - regionCode?: string; - /** - * Metro code (DMA) of the incoming request - * - * @example "635" - */ - metroCode?: string; -} -/** Data about the incoming request's TLS certificate */ -declare interface IncomingRequestCfPropertiesTLSClientAuth { - /** Always `"1"`, indicating that the certificate was presented */ - certPresented: "1"; - /** - * Result of certificate verification. - * - * @example "FAILED:self signed certificate" - */ - certVerified: Exclude; - /** The presented certificate's revokation status. - * - * - A value of `"1"` indicates the certificate has been revoked - * - A value of `"0"` indicates the certificate has not been revoked - */ - certRevoked: "1" | "0"; - /** - * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) - * - * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certIssuerDN: string; - /** - * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) - * - * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certSubjectDN: string; - /** - * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted) - * - * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certIssuerDNRFC2253: string; - /** - * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted) - * - * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certSubjectDNRFC2253: string; - /** The certificate issuer's distinguished name (legacy policies) */ - certIssuerDNLegacy: string; - /** The certificate subject's distinguished name (legacy policies) */ - certSubjectDNLegacy: string; - /** - * The certificate's serial number - * - * @example "00936EACBE07F201DF" - */ - certSerial: string; - /** - * The certificate issuer's serial number - * - * @example "2489002934BDFEA34" - */ - certIssuerSerial: string; - /** - * The certificate's Subject Key Identifier - * - * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4" - */ - certSKI: string; - /** - * The certificate issuer's Subject Key Identifier - * - * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4" - */ - certIssuerSKI: string; - /** - * The certificate's SHA-1 fingerprint - * - * @example "6b9109f323999e52259cda7373ff0b4d26bd232e" - */ - certFingerprintSHA1: string; - /** - * The certificate's SHA-256 fingerprint - * - * @example "acf77cf37b4156a2708e34c4eb755f9b5dbbe5ebb55adfec8f11493438d19e6ad3f157f81fa3b98278453d5652b0c1fd1d71e5695ae4d709803a4d3f39de9dea" - */ - certFingerprintSHA256: string; - /** - * The effective starting date of the certificate - * - * @example "Dec 22 19:39:00 2018 GMT" - */ - certNotBefore: string; - /** - * The effective expiration date of the certificate - * - * @example "Dec 22 19:39:00 2018 GMT" - */ - certNotAfter: string; -} -/** Placeholder values for TLS Client Authorization */ -declare interface IncomingRequestCfPropertiesTLSClientAuthPlaceholder { - certPresented: "0"; - certVerified: "NONE"; - certRevoked: "0"; - certIssuerDN: ""; - certSubjectDN: ""; - certIssuerDNRFC2253: ""; - certSubjectDNRFC2253: ""; - certIssuerDNLegacy: ""; - certSubjectDNLegacy: ""; - certSerial: ""; - certIssuerSerial: ""; - certSKI: ""; - certIssuerSKI: ""; - certFingerprintSHA1: ""; - certFingerprintSHA256: ""; - certNotBefore: ""; - certNotAfter: ""; -} -/** Possible outcomes of TLS verification */ -declare type CertVerificationStatus = - /** Authentication succeeded */ - | "SUCCESS" - /** No certificate was presented */ - | "NONE" - /** Failed because the certificate was self-signed */ - | "FAILED:self signed certificate" - /** Failed because the certificate failed a trust chain check */ - | "FAILED:unable to verify the first certificate" - /** Failed because the certificate not yet valid */ - | "FAILED:certificate is not yet valid" - /** Failed because the certificate is expired */ - | "FAILED:certificate has expired" - /** Failed for another unspecified reason */ - | "FAILED"; -/** - * An upstream endpoint's response to a TCP `keepalive` message from Cloudflare. - */ -declare type IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus = - | 0 /** Unknown */ - | 1 /** no keepalives (not found) */ - | 2 /** no connection re-use, opening keepalive connection failed */ - | 3 /** no connection re-use, keepalive accepted and saved */ - | 4 /** connection re-use, refused by the origin server (`TCP FIN`) */ - | 5; /** connection re-use, accepted by the origin server */ -/** ISO 3166-1 Alpha-2 codes */ -declare type Iso3166Alpha2Code = - | "AD" - | "AE" - | "AF" - | "AG" - | "AI" - | "AL" - | "AM" - | "AO" - | "AQ" - | "AR" - | "AS" - | "AT" - | "AU" - | "AW" - | "AX" - | "AZ" - | "BA" - | "BB" - | "BD" - | "BE" - | "BF" - | "BG" - | "BH" - | "BI" - | "BJ" - | "BL" - | "BM" - | "BN" - | "BO" - | "BQ" - | "BR" - | "BS" - | "BT" - | "BV" - | "BW" - | "BY" - | "BZ" - | "CA" - | "CC" - | "CD" - | "CF" - | "CG" - | "CH" - | "CI" - | "CK" - | "CL" - | "CM" - | "CN" - | "CO" - | "CR" - | "CU" - | "CV" - | "CW" - | "CX" - | "CY" - | "CZ" - | "DE" - | "DJ" - | "DK" - | "DM" - | "DO" - | "DZ" - | "EC" - | "EE" - | "EG" - | "EH" - | "ER" - | "ES" - | "ET" - | "FI" - | "FJ" - | "FK" - | "FM" - | "FO" - | "FR" - | "GA" - | "GB" - | "GD" - | "GE" - | "GF" - | "GG" - | "GH" - | "GI" - | "GL" - | "GM" - | "GN" - | "GP" - | "GQ" - | "GR" - | "GS" - | "GT" - | "GU" - | "GW" - | "GY" - | "HK" - | "HM" - | "HN" - | "HR" - | "HT" - | "HU" - | "ID" - | "IE" - | "IL" - | "IM" - | "IN" - | "IO" - | "IQ" - | "IR" - | "IS" - | "IT" - | "JE" - | "JM" - | "JO" - | "JP" - | "KE" - | "KG" - | "KH" - | "KI" - | "KM" - | "KN" - | "KP" - | "KR" - | "KW" - | "KY" - | "KZ" - | "LA" - | "LB" - | "LC" - | "LI" - | "LK" - | "LR" - | "LS" - | "LT" - | "LU" - | "LV" - | "LY" - | "MA" - | "MC" - | "MD" - | "ME" - | "MF" - | "MG" - | "MH" - | "MK" - | "ML" - | "MM" - | "MN" - | "MO" - | "MP" - | "MQ" - | "MR" - | "MS" - | "MT" - | "MU" - | "MV" - | "MW" - | "MX" - | "MY" - | "MZ" - | "NA" - | "NC" - | "NE" - | "NF" - | "NG" - | "NI" - | "NL" - | "NO" - | "NP" - | "NR" - | "NU" - | "NZ" - | "OM" - | "PA" - | "PE" - | "PF" - | "PG" - | "PH" - | "PK" - | "PL" - | "PM" - | "PN" - | "PR" - | "PS" - | "PT" - | "PW" - | "PY" - | "QA" - | "RE" - | "RO" - | "RS" - | "RU" - | "RW" - | "SA" - | "SB" - | "SC" - | "SD" - | "SE" - | "SG" - | "SH" - | "SI" - | "SJ" - | "SK" - | "SL" - | "SM" - | "SN" - | "SO" - | "SR" - | "SS" - | "ST" - | "SV" - | "SX" - | "SY" - | "SZ" - | "TC" - | "TD" - | "TF" - | "TG" - | "TH" - | "TJ" - | "TK" - | "TL" - | "TM" - | "TN" - | "TO" - | "TR" - | "TT" - | "TV" - | "TW" - | "TZ" - | "UA" - | "UG" - | "UM" - | "US" - | "UY" - | "UZ" - | "VA" - | "VC" - | "VE" - | "VG" - | "VI" - | "VN" - | "VU" - | "WF" - | "WS" - | "YE" - | "YT" - | "ZA" - | "ZM" - | "ZW"; -/** The 2-letter continent codes Cloudflare uses */ -declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA"; -declare type CfProperties = - | IncomingRequestCfProperties - | RequestInitCfProperties; -declare interface D1Result { - results?: T[]; - success: boolean; - error?: string; - meta: any; -} -declare abstract class D1Database { - prepare(query: string): D1PreparedStatement; - dump(): Promise; - batch(statements: D1PreparedStatement[]): Promise[]>; - exec(query: string): Promise>; -} -declare abstract class D1PreparedStatement { - bind(...values: any[]): D1PreparedStatement; - first(colName?: string): Promise; - run(): Promise>; - all(): Promise>; - raw(): Promise; -} -/** - * A email message that is sent to a consumer Worker. - */ -declare interface EmailMessage { - /** - * Envelope From attribute of the email message. - */ - readonly from: string; - /** - * Envelope To attribute of the email message. - */ - readonly to: string; - /** - * A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers). - */ - readonly headers: Headers; - /** - * Stream of the email message content. - */ - readonly raw: ReadableStream; - /** - * Size of the email message content. - */ - readonly rawSize: number; - /** - * Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason. - * @param reason The reject reason. - * @returns void - */ - setReject(reason: string): void; - /** - * Forward this email message to a verified destination address of the account. - * @param rcptTo Verified destination address. - * @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers). - * @returns A promise that resolves when the email message is forwarded. - */ - forward(rcptTo: string, headers?: Headers): Promise; -} -declare abstract class EmailEvent extends ExtendableEvent { - readonly message: EmailMessage; -} -declare type EmailExportedHandler = ( - message: EmailMessage, - env: Env, - ctx: ExecutionContext -) => void | Promise; -declare type Params

= Record; -declare type EventContext = { - request: Request; - functionPath: string; - waitUntil: (promise: Promise) => void; - passThroughOnException: () => void; - next: (input?: Request | string, init?: RequestInit) => Promise; - env: Env & { - ASSETS: { - fetch: typeof fetch; - }; - }; - params: Params

; - data: Data; -}; -declare type PagesFunction< - Env = unknown, - Params extends string = any, - Data extends Record = Record -> = (context: EventContext) => Response | Promise; -declare type EventPluginContext = { - request: Request; - functionPath: string; - waitUntil: (promise: Promise) => void; - passThroughOnException: () => void; - next: (input?: Request | string, init?: RequestInit) => Promise; - env: Env & { - ASSETS: { - fetch: typeof fetch; - }; - }; - params: Params

; - data: Data; - pluginArgs: PluginArgs; -}; -declare type PagesPluginFunction< - Env = unknown, - Params extends string = any, - Data extends Record = Record, - PluginArgs = unknown -> = ( - context: EventPluginContext -) => Response | Promise; -declare module "assets:*" { - export const onRequest: PagesFunction; -} -// https://developers.cloudflare.com/pub-sub/ -// PubSubMessage represents an incoming PubSub message. -// The message includes metadata about the broker, the client, and the payload -// itself. -declare interface PubSubMessage { - // Message ID - readonly mid: number; - // MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT - readonly broker: string; - // The MQTT topic the message was sent on. - readonly topic: string; - // The client ID of the client that published this message. - readonly clientId: string; - // The unique identifier (JWT ID) used by the client to authenticate, if token - // auth was used. - readonly jti?: string; - // A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker - // received the message from the client. - readonly receivedAt: number; - // An (optional) string with the MIME type of the payload, if set by the - // client. - readonly contentType: string; - // Set to 1 when the payload is a UTF-8 string - // https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063 - readonly payloadFormatIndicator: number; - // Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays. - // You can use payloadFormatIndicator to inspect this before decoding. - payload: string | Uint8Array; -} -// JsonWebKey extended by kid parameter -declare interface JsonWebKeyWithKid extends JsonWebKey { - // Key Identifier of the JWK - readonly kid: string; -} -/** - * A message that is sent to a consumer Worker. - */ -declare interface Message { - /** - * A unique, system-generated ID for the message. - */ - readonly id: string; - /** - * A timestamp when the message was sent. - */ - readonly timestamp: Date; - /** - * The body of the message. - */ - readonly body: Body; - /** - * Marks message to be retried. - */ - retry(): void; - /** - * Marks message acknowledged. - */ - ack(): void; -} -/** - * A batch of messages that are sent to a consumer Worker. - */ -declare interface MessageBatch { - /** - * The name of the Queue that belongs to this batch. - */ - readonly queue: string; - /** - * An array of messages in the batch. Ordering of messages is not guaranteed. - */ - readonly messages: readonly Message[]; - /** - * Marks every message to be retried in the next batch. - */ - retryAll(): void; - /** - * Marks every message acknowledged in the batch. - */ - ackAll(): void; -} -/** - * A wrapper class used to structure message batches. - */ -declare type MessageSendRequest = { - /** - * The body of the message. - */ - body: Body; -}; -/** - * A binding that allows a producer to send messages to a Queue. - */ -declare interface Queue { - /** - * Sends a message to the Queue. - * @param message The message can be any type supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types), as long as its size is less than 128 KB. - * @returns A promise that resolves when the message is confirmed to be written to disk. - */ - send(message: Body): Promise; - /** - * Sends a batch of messages to the Queue. - * @param messages Each item in the input must be supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types). A batch can contain up to 100 messages, though items are limited to 128 KB each, and the total size of the array cannot exceed 256 KB. - * @returns A promise that resolves when the messages are confirmed to be written to disk. - */ - sendBatch(messages: Iterable>): Promise; -} diff --git a/packages/denylist_bot/node_modules/@cloudflare/workers-types/2022-08-04/index.ts b/packages/denylist_bot/node_modules/@cloudflare/workers-types/2022-08-04/index.ts deleted file mode 100755 index 4ecfdb3fd..000000000 --- a/packages/denylist_bot/node_modules/@cloudflare/workers-types/2022-08-04/index.ts +++ /dev/null @@ -1,2985 +0,0 @@ -/*! ***************************************************************************** -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 -export declare class DOMException extends Error { - constructor(message?: string, name?: string); - readonly message: string; - readonly name: string; - readonly code: number; - readonly stack: any; - 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; -} -export type WorkerGlobalScopeEventMap = { - fetch: FetchEvent; - scheduled: ScheduledEvent; - unhandledrejection: PromiseRejectionEvent; - rejectionhandled: PromiseRejectionEvent; -}; -export declare abstract class WorkerGlobalScope extends EventTarget { - EventTarget: typeof EventTarget; -} -export interface Console { - "assert"(condition?: boolean, ...data: any[]): void; - clear(): void; - count(label?: string): void; - countReset(label?: string): void; - debug(...data: any[]): void; - dir(item?: any, options?: any): void; - dirxml(...data: any[]): void; - error(...data: any[]): void; - group(...data: any[]): void; - groupCollapsed(...data: any[]): void; - groupEnd(): void; - info(...data: any[]): void; - log(...data: any[]): void; - table(tabularData?: any, properties?: string[]): void; - time(label?: string): void; - timeEnd(label?: string): void; - timeLog(label?: string, ...data: any[]): void; - timeStamp(label?: string): void; - trace(...data: any[]): void; - warn(...data: any[]): void; -} -export declare const console: Console; -export type BufferSource = ArrayBufferView | ArrayBuffer; -export 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; - type Imports = Record; - type ExportValue = Function | Global | Memory | Table; - type Exports = Record; - 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; - function validate(bytes: BufferSource): boolean; -} -/** This ServiceWorker API interface represents the global execution context of a service worker. */ -export 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( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args - ): number; - clearTimeout(timeoutId: number | null): void; - setInterval(callback: (...args: any[]) => void, msDelay?: number): number; - setInterval( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args - ): number; - clearInterval(timeoutId: number | null): void; - queueMicrotask(task: Function): void; - structuredClone(value: T, options?: StructuredSerializeOptions): T; - fetch( - input: RequestInfo, - init?: RequestInit - ): Promise; - self: ServiceWorkerGlobalScope; - crypto: Crypto; - caches: CacheStorage; - scheduler: Scheduler; - Event: typeof Event; - ExtendableEvent: typeof ExtendableEvent; - PromiseRejectionEvent: typeof PromiseRejectionEvent; - FetchEvent: typeof FetchEvent; - TraceEvent: typeof TraceEvent; - 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; - 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; - 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; -} -export declare function addEventListener< - Type extends keyof WorkerGlobalScopeEventMap ->( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetAddEventListenerOptions | boolean -): void; -export declare function removeEventListener< - Type extends keyof WorkerGlobalScopeEventMap ->( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetEventListenerOptions | boolean -): void; -/** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */ -export declare function dispatchEvent( - event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap] -): boolean; -export declare function btoa(data: string): string; -export declare function atob(data: string): string; -export declare function setTimeout( - callback: (...args: any[]) => void, - msDelay?: number -): number; -export declare function setTimeout( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args -): number; -export declare function clearTimeout(timeoutId: number | null): void; -export declare function setInterval( - callback: (...args: any[]) => void, - msDelay?: number -): number; -export declare function setInterval( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args -): number; -export declare function clearInterval(timeoutId: number | null): void; -export declare function queueMicrotask(task: Function): void; -export declare function structuredClone( - value: T, - options?: StructuredSerializeOptions -): T; -export declare function fetch( - input: RequestInfo, - init?: RequestInit -): Promise; -export declare const self: ServiceWorkerGlobalScope; -export declare const crypto: Crypto; -export declare const caches: CacheStorage; -export declare const scheduler: Scheduler; -export declare const navigator: Navigator; -export interface TestController {} -export interface ExecutionContext { - waitUntil(promise: Promise): void; - passThroughOnException(): void; -} -export type ExportedHandlerFetchHandler< - Env = unknown, - CfHostMetadata = unknown -> = ( - request: Request>, - env: Env, - ctx: ExecutionContext -) => Response | Promise; -export type ExportedHandlerTraceHandler = ( - traces: TraceItem[], - env: Env, - ctx: ExecutionContext -) => void | Promise; -export type ExportedHandlerScheduledHandler = ( - controller: ScheduledController, - env: Env, - ctx: ExecutionContext -) => void | Promise; -export type ExportedHandlerQueueHandler = ( - batch: MessageBatch, - env: Env, - ctx: ExecutionContext -) => void | Promise; -export type ExportedHandlerTestHandler = ( - controller: TestController, - env: Env, - ctx: ExecutionContext -) => void | Promise; -export interface ExportedHandler< - Env = unknown, - QueueMessage = unknown, - CfHostMetadata = unknown -> { - fetch?: ExportedHandlerFetchHandler; - trace?: ExportedHandlerTraceHandler; - scheduled?: ExportedHandlerScheduledHandler; - test?: ExportedHandlerTestHandler; - queue?: ExportedHandlerQueueHandler; -} -export interface StructuredSerializeOptions { - transfer?: any[]; -} -export declare abstract class PromiseRejectionEvent extends Event { - readonly promise: Promise; - readonly reason: any; -} -export declare abstract class Navigator { - readonly userAgent: string; -} -export interface DurableObject { - fetch(request: Request): Response | Promise; - alarm?(): void | Promise; -} -export interface DurableObjectStub extends Fetcher { - readonly id: DurableObjectId; - readonly name?: string; -} -export interface DurableObjectId { - toString(): string; - equals(other: DurableObjectId): boolean; - readonly name?: string; -} -export interface DurableObjectNamespace { - newUniqueId( - options?: DurableObjectNamespaceNewUniqueIdOptions - ): DurableObjectId; - idFromName(name: string): DurableObjectId; - idFromString(id: string): DurableObjectId; - get( - id: DurableObjectId, - options?: DurableObjectNamespaceGetDurableObjectOptions - ): DurableObjectStub; - jurisdiction(jurisdiction: string): DurableObjectNamespace; -} -export interface DurableObjectNamespaceNewUniqueIdOptions { - jurisdiction?: string; -} -export interface DurableObjectNamespaceGetDurableObjectOptions { - locationHint?: string; -} -export interface DurableObjectState { - waitUntil(promise: Promise): void; - readonly id: DurableObjectId; - readonly storage: DurableObjectStorage; - blockConcurrencyWhile(callback: () => Promise): Promise; -} -export interface DurableObjectTransaction { - get( - key: string, - options?: DurableObjectGetOptions - ): Promise; - get( - keys: string[], - options?: DurableObjectGetOptions - ): Promise>; - list( - options?: DurableObjectListOptions - ): Promise>; - put( - key: string, - value: T, - options?: DurableObjectPutOptions - ): Promise; - put( - entries: Record, - options?: DurableObjectPutOptions - ): Promise; - delete(key: string, options?: DurableObjectPutOptions): Promise; - delete(keys: string[], options?: DurableObjectPutOptions): Promise; - rollback(): void; - getAlarm(options?: DurableObjectGetAlarmOptions): Promise; - setAlarm( - scheduledTime: number | Date, - options?: DurableObjectSetAlarmOptions - ): Promise; - deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise; -} -export interface DurableObjectStorage { - get( - key: string, - options?: DurableObjectGetOptions - ): Promise; - get( - keys: string[], - options?: DurableObjectGetOptions - ): Promise>; - list( - options?: DurableObjectListOptions - ): Promise>; - put( - key: string, - value: T, - options?: DurableObjectPutOptions - ): Promise; - put( - entries: Record, - options?: DurableObjectPutOptions - ): Promise; - delete(key: string, options?: DurableObjectPutOptions): Promise; - delete(keys: string[], options?: DurableObjectPutOptions): Promise; - deleteAll(options?: DurableObjectPutOptions): Promise; - transaction( - closure: (txn: DurableObjectTransaction) => Promise - ): Promise; - getAlarm(options?: DurableObjectGetAlarmOptions): Promise; - setAlarm( - scheduledTime: number | Date, - options?: DurableObjectSetAlarmOptions - ): Promise; - deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise; - sync(): Promise; -} -export interface DurableObjectListOptions { - start?: string; - startAfter?: string; - end?: string; - prefix?: string; - reverse?: boolean; - limit?: number; - allowConcurrency?: boolean; - noCache?: boolean; -} -export interface DurableObjectGetOptions { - allowConcurrency?: boolean; - noCache?: boolean; -} -export interface DurableObjectGetAlarmOptions { - allowConcurrency?: boolean; -} -export interface DurableObjectPutOptions { - allowConcurrency?: boolean; - allowUnconfirmed?: boolean; - noCache?: boolean; -} -export interface DurableObjectSetAlarmOptions { - allowConcurrency?: boolean; - allowUnconfirmed?: boolean; -} -export interface AnalyticsEngineDataset { - writeDataPoint(event?: AnalyticsEngineDataPoint): void; -} -export interface AnalyticsEngineDataPoint { - indexes?: ((ArrayBuffer | string) | null)[]; - doubles?: number[]; - blobs?: ((ArrayBuffer | string) | null)[]; -} -export declare class Event { - constructor(type: string, init?: EventInit); - get type(): string; - get eventPhase(): number; - get composed(): boolean; - get bubbles(): boolean; - get cancelable(): boolean; - get defaultPrevented(): boolean; - get returnValue(): boolean; - get currentTarget(): EventTarget | undefined; - get srcElement(): EventTarget | undefined; - get timeStamp(): number; - get isTrusted(): boolean; - get cancelBubble(): boolean; - set cancelBubble(value: boolean); - stopImmediatePropagation(): void; - preventDefault(): void; - stopPropagation(): void; - composedPath(): EventTarget[]; - static readonly NONE: number; - static readonly CAPTURING_PHASE: number; - static readonly AT_TARGET: number; - static readonly BUBBLING_PHASE: number; -} -export interface EventInit { - bubbles?: boolean; - cancelable?: boolean; - composed?: boolean; -} -export type EventListener = ( - event: EventType -) => void; -export interface EventListenerObject { - handleEvent(event: EventType): void; -} -export type EventListenerOrEventListenerObject< - EventType extends Event = Event -> = EventListener | EventListenerObject; -export declare class EventTarget< - EventMap extends Record = Record -> { - constructor(); - addEventListener( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetAddEventListenerOptions | boolean - ): void; - removeEventListener( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetEventListenerOptions | boolean - ): void; - dispatchEvent(event: EventMap[keyof EventMap]): boolean; -} -export interface EventTargetEventListenerOptions { - capture?: boolean; -} -export interface EventTargetAddEventListenerOptions { - capture?: boolean; - passive?: boolean; - once?: boolean; - signal?: AbortSignal; -} -export interface EventTargetHandlerObject { - handleEvent: (event: Event) => any | undefined; -} -export declare class AbortController { - constructor(); - get signal(): AbortSignal; - abort(reason?: any): void; -} -export declare abstract class AbortSignal extends EventTarget { - static abort(reason?: any): AbortSignal; - static timeout(delay: number): AbortSignal; - get aborted(): boolean; - get reason(): any; - throwIfAborted(): void; -} -export interface Scheduler { - wait(delay: number, maybeOptions?: SchedulerWaitOptions): Promise; -} -export interface SchedulerWaitOptions { - signal?: AbortSignal; -} -export declare abstract class ExtendableEvent extends Event { - waitUntil(promise: Promise): void; -} -export declare class Blob { - constructor( - bits?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[], - options?: BlobOptions - ); - get size(): number; - get type(): string; - slice(start?: number, end?: number, type?: string): Blob; - arrayBuffer(): Promise; - text(): Promise; - stream(): ReadableStream; -} -export interface BlobOptions { - type?: string; -} -export declare class File extends Blob { - constructor( - bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined, - name: string, - options?: FileOptions - ); - get name(): string; - get lastModified(): number; -} -export interface FileOptions { - type?: string; - lastModified?: number; -} -export declare abstract class CacheStorage { - open(cacheName: string): Promise; - readonly default: Cache; -} -export declare abstract class Cache { - delete(request: RequestInfo, options?: CacheQueryOptions): Promise; - match( - request: RequestInfo, - options?: CacheQueryOptions - ): Promise; - put(request: RequestInfo, response: Response): Promise; -} -export interface CacheQueryOptions { - ignoreMethod?: boolean; -} -export declare abstract class Crypto { - get subtle(): SubtleCrypto; - getRandomValues< - T extends - | Int8Array - | Uint8Array - | Int16Array - | Uint16Array - | Int32Array - | Uint32Array - | BigInt64Array - | BigUint64Array - >(buffer: T): T; - randomUUID(): string; - DigestStream: typeof DigestStream; -} -export declare abstract class SubtleCrypto { - encrypt( - algorithm: string | SubtleCryptoEncryptAlgorithm, - key: CryptoKey, - plainText: ArrayBuffer | ArrayBufferView - ): Promise; - decrypt( - algorithm: string | SubtleCryptoEncryptAlgorithm, - key: CryptoKey, - cipherText: ArrayBuffer | ArrayBufferView - ): Promise; - sign( - algorithm: string | SubtleCryptoSignAlgorithm, - key: CryptoKey, - data: ArrayBuffer | ArrayBufferView - ): Promise; - verify( - algorithm: string | SubtleCryptoSignAlgorithm, - key: CryptoKey, - signature: ArrayBuffer | ArrayBufferView, - data: ArrayBuffer | ArrayBufferView - ): Promise; - digest( - algorithm: string | SubtleCryptoHashAlgorithm, - data: ArrayBuffer | ArrayBufferView - ): Promise; - generateKey( - algorithm: string | SubtleCryptoGenerateKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - deriveKey( - algorithm: string | SubtleCryptoDeriveKeyAlgorithm, - baseKey: CryptoKey, - derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - deriveBits( - algorithm: string | SubtleCryptoDeriveKeyAlgorithm, - baseKey: CryptoKey, - length: number | null - ): Promise; - importKey( - format: string, - keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey, - algorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - exportKey(format: string, key: CryptoKey): Promise; - wrapKey( - format: string, - key: CryptoKey, - wrappingKey: CryptoKey, - wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm - ): Promise; - unwrapKey( - format: string, - wrappedKey: ArrayBuffer | ArrayBufferView, - unwrappingKey: CryptoKey, - unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm, - unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - timingSafeEqual( - a: ArrayBuffer | ArrayBufferView, - b: ArrayBuffer | ArrayBufferView - ): boolean; -} -export declare abstract class CryptoKey { - readonly type: string; - readonly extractable: boolean; - readonly algorithm: - | CryptoKeyKeyAlgorithm - | CryptoKeyAesKeyAlgorithm - | CryptoKeyHmacKeyAlgorithm - | CryptoKeyRsaKeyAlgorithm - | CryptoKeyEllipticKeyAlgorithm - | CryptoKeyArbitraryKeyAlgorithm; - readonly usages: string[]; -} -export interface CryptoKeyPair { - publicKey: CryptoKey; - privateKey: CryptoKey; -} -export 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; -} -export interface RsaOtherPrimesInfo { - r?: string; - d?: string; - t?: string; -} -export interface SubtleCryptoDeriveKeyAlgorithm { - name: string; - salt?: ArrayBuffer; - iterations?: number; - hash?: string | SubtleCryptoHashAlgorithm; - $public?: CryptoKey; - info?: ArrayBuffer; -} -export interface SubtleCryptoEncryptAlgorithm { - name: string; - iv?: ArrayBuffer; - additionalData?: ArrayBuffer; - tagLength?: number; - counter?: ArrayBuffer; - length?: number; - label?: ArrayBuffer; -} -export interface SubtleCryptoGenerateKeyAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - modulusLength?: number; - publicExponent?: ArrayBuffer; - length?: number; - namedCurve?: string; -} -export interface SubtleCryptoHashAlgorithm { - name: string; -} -export interface SubtleCryptoImportKeyAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - length?: number; - namedCurve?: string; - compressed?: boolean; -} -export interface SubtleCryptoSignAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - dataLength?: number; - saltLength?: number; -} -export interface CryptoKeyKeyAlgorithm { - name: string; -} -export interface CryptoKeyAesKeyAlgorithm { - name: string; - length: number; -} -export interface CryptoKeyHmacKeyAlgorithm { - name: string; - hash: CryptoKeyKeyAlgorithm; - length: number; -} -export interface CryptoKeyRsaKeyAlgorithm { - name: string; - modulusLength: number; - publicExponent: ArrayBuffer; - hash?: CryptoKeyKeyAlgorithm; -} -export interface CryptoKeyEllipticKeyAlgorithm { - name: string; - namedCurve: string; -} -export interface CryptoKeyArbitraryKeyAlgorithm { - name: string; - hash?: CryptoKeyKeyAlgorithm; - namedCurve?: string; - length?: number; -} -export declare class DigestStream extends WritableStream< - ArrayBuffer | ArrayBufferView -> { - constructor(algorithm: string | SubtleCryptoHashAlgorithm); - get digest(): Promise; -} -export declare class TextDecoder { - constructor(decoder?: string, options?: TextDecoderConstructorOptions); - decode( - input?: ArrayBuffer | ArrayBufferView, - options?: TextDecoderDecodeOptions - ): string; - get encoding(): string; - get fatal(): boolean; - get ignoreBOM(): boolean; -} -export declare class TextEncoder { - constructor(); - encode(input?: string): Uint8Array; - encodeInto(input: string, buffer: Uint8Array): TextEncoderEncodeIntoResult; - get encoding(): string; -} -export interface TextDecoderConstructorOptions { - fatal: boolean; - ignoreBOM: boolean; -} -export interface TextDecoderDecodeOptions { - stream: boolean; -} -export interface TextEncoderEncodeIntoResult { - read: number; - written: number; -} -export declare class FormData { - constructor(); - append(name: string, value: string): void; - append(name: string, value: Blob, filename?: string): void; - delete(name: string): void; - get(name: string): (File | string) | null; - getAll(name: string): (File | string)[]; - has(name: string): boolean; - set(name: string, value: string): void; - set(name: string, value: Blob, filename?: string): void; - entries(): IterableIterator<[key: string, value: File | string]>; - keys(): IterableIterator; - values(): IterableIterator; - forEach( - callback: ( - this: This, - value: File | string, - key: string, - parent: FormData - ) => void, - thisArg?: This - ): void; - [Symbol.iterator](): IterableIterator<[key: string, value: File | string]>; -} -export interface ContentOptions { - html?: boolean; -} -export declare class HTMLRewriter { - constructor(); - on( - selector: string, - handlers: HTMLRewriterElementContentHandlers - ): HTMLRewriter; - onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter; - transform(response: Response): Response; -} -export interface HTMLRewriterElementContentHandlers { - element?(element: Element): void | Promise; - comments?(comment: Comment): void | Promise; - text?(element: Text): void | Promise; -} -export interface HTMLRewriterDocumentContentHandlers { - doctype?(doctype: Doctype): void | Promise; - comments?(comment: Comment): void | Promise; - text?(text: Text): void | Promise; - end?(end: DocumentEnd): void | Promise; -} -export interface Doctype { - readonly name: string | null; - readonly publicId: string | null; - readonly systemId: string | null; -} -export interface Element { - tagName: string; - readonly attributes: IterableIterator; - 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, options?: ContentOptions): Element; - after(content: string, options?: ContentOptions): Element; - prepend(content: string, options?: ContentOptions): Element; - append(content: string, options?: ContentOptions): Element; - replace(content: string, options?: ContentOptions): Element; - remove(): Element; - removeAndKeepContent(): Element; - setInnerContent(content: string, options?: ContentOptions): Element; - onEndTag(handler: (tag: EndTag) => void | Promise): void; -} -export interface EndTag { - name: string; - before(content: string, options?: ContentOptions): EndTag; - after(content: string, options?: ContentOptions): EndTag; - remove(): EndTag; -} -export 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; -} -export interface Text { - readonly text: string; - readonly lastInTextNode: boolean; - readonly removed: boolean; - before(content: string, options?: ContentOptions): Text; - after(content: string, options?: ContentOptions): Text; - replace(content: string, options?: ContentOptions): Text; - remove(): Text; -} -export interface DocumentEnd { - append(content: string, options?: ContentOptions): DocumentEnd; -} -export declare abstract class FetchEvent extends ExtendableEvent { - readonly request: Request; - respondWith(promise: Response | Promise): void; - passThroughOnException(): void; -} -export type HeadersInit = - | Headers - | Iterable> - | Record; -export declare class Headers { - constructor(init?: HeadersInit); - get(name: string): string | null; - getAll(name: string): string[]; - has(name: string): boolean; - set(name: string, value: string): void; - append(name: string, value: string): void; - delete(name: string): void; - forEach( - callback: (this: This, value: string, key: string, parent: Headers) => void, - thisArg?: This - ): void; - entries(): IterableIterator<[key: string, value: string]>; - keys(): IterableIterator; - values(): IterableIterator; - [Symbol.iterator](): IterableIterator<[key: string, value: string]>; -} -export type BodyInit = - | ReadableStream - | string - | ArrayBuffer - | ArrayBufferView - | Blob - | URLSearchParams - | FormData; -export declare abstract class Body { - get body(): ReadableStream | null; - get bodyUsed(): boolean; - arrayBuffer(): Promise; - text(): Promise; - json(): Promise; - formData(): Promise; - blob(): Promise; -} -export declare class Response extends Body { - constructor(body?: BodyInit | null, init?: ResponseInit); - static redirect(url: string, status?: number): Response; - static json(any: any, maybeInit?: ResponseInit | Response): Response; - clone(): Response; - get status(): number; - get statusText(): string; - get headers(): Headers; - get ok(): boolean; - get redirected(): boolean; - get url(): string; - get webSocket(): WebSocket | null; - get cf(): any | undefined; -} -export interface ResponseInit { - status?: number; - statusText?: string; - headers?: HeadersInit; - cf?: any; - webSocket?: WebSocket | null; - encodeBody?: "automatic" | "manual"; -} -export type RequestInfo< - CfHostMetadata = unknown, - Cf = CfProperties -> = Request | string | URL; -export declare class Request< - CfHostMetadata = unknown, - Cf = CfProperties -> extends Body { - constructor(input: RequestInfo, init?: RequestInit); - clone(): Request; - get method(): string; - get url(): string; - get headers(): Headers; - get redirect(): string; - get fetcher(): Fetcher | null; - get signal(): AbortSignal; - get cf(): Cf | undefined; - get integrity(): string; - get keepalive(): boolean; -} -export interface RequestInit { - /** 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 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; -} -export declare abstract class Fetcher { - fetch(input: RequestInfo, init?: RequestInit): Promise; -} -export interface FetcherPutOptions { - expiration?: number; - expirationTtl?: number; -} -export interface KVNamespaceListKey { - name: Key; - expiration?: number; - metadata?: Metadata; -} -export type KVNamespaceListResult = - | { - list_complete: false; - keys: KVNamespaceListKey[]; - cursor: string; - } - | { - list_complete: true; - keys: KVNamespaceListKey[]; - }; -export interface KVNamespace { - get( - key: Key, - options?: Partial> - ): Promise; - get(key: Key, type: "text"): Promise; - get( - key: Key, - type: "json" - ): Promise; - get(key: Key, type: "arrayBuffer"): Promise; - get(key: Key, type: "stream"): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"text"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"json"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"arrayBuffer"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"stream"> - ): Promise; - list( - options?: KVNamespaceListOptions - ): Promise>; - put( - key: Key, - value: string | ArrayBuffer | ArrayBufferView | ReadableStream, - options?: KVNamespacePutOptions - ): Promise; - getWithMetadata( - key: Key, - options?: Partial> - ): Promise>; - getWithMetadata( - key: Key, - type: "text" - ): Promise>; - getWithMetadata( - key: Key, - type: "json" - ): Promise>; - getWithMetadata( - key: Key, - type: "arrayBuffer" - ): Promise>; - getWithMetadata( - key: Key, - type: "stream" - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"text"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"json"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"arrayBuffer"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"stream"> - ): Promise>; - delete(key: Key): Promise; -} -export interface KVNamespaceListOptions { - limit?: number; - prefix?: string | null; - cursor?: string | null; -} -export interface KVNamespaceGetOptions { - type: Type; - cacheTtl?: number; -} -export interface KVNamespacePutOptions { - expiration?: number; - expirationTtl?: number; - metadata?: any | null; -} -export interface KVNamespaceGetWithMetadataResult { - value: Value | null; - metadata: Metadata | null; -} -export interface R2Error extends Error { - readonly name: string; - readonly code: number; - readonly message: string; - readonly action: string; - readonly stack: any; -} -export interface R2ListOptions { - limit?: number; - prefix?: string; - cursor?: string; - delimiter?: string; - startAfter?: string; - include?: ("httpMetadata" | "customMetadata")[]; -} -export declare abstract class R2Bucket { - head(key: string): Promise; - get( - key: string, - options: R2GetOptions & { - onlyIf: R2Conditional | Headers; - } - ): Promise; - get(key: string, options?: R2GetOptions): Promise; - put( - key: string, - value: - | ReadableStream - | ArrayBuffer - | ArrayBufferView - | string - | null - | Blob, - options?: R2PutOptions - ): Promise; - put( - key: string, - value: - | ReadableStream - | ArrayBuffer - | ArrayBufferView - | string - | null - | Blob, - options?: R2PutOptions & { - onlyIf: R2Conditional | Headers; - } - ): Promise; - createMultipartUpload( - key: string, - options?: R2MultipartOptions - ): Promise; - resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload; - delete(keys: string | string[]): Promise; - list(options?: R2ListOptions): Promise; -} -export interface R2MultipartUpload { - readonly key: string; - readonly uploadId: string; - uploadPart( - partNumber: number, - value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob - ): Promise; - abort(): Promise; - complete(uploadedParts: R2UploadedPart[]): Promise; -} -export interface R2UploadedPart { - partNumber: number; - etag: string; -} -export 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; - readonly range?: R2Range; - writeHttpMetadata(headers: Headers): void; -} -export interface R2ObjectBody extends R2Object { - get body(): ReadableStream; - get bodyUsed(): boolean; - arrayBuffer(): Promise; - text(): Promise; - json(): Promise; - blob(): Promise; -} -export type R2Range = - | { - offset: number; - length?: number; - } - | { - offset?: number; - length: number; - } - | { - suffix: number; - }; -export interface R2Conditional { - etagMatches?: string; - etagDoesNotMatch?: string; - uploadedBefore?: Date; - uploadedAfter?: Date; - secondsGranularity?: boolean; -} -export interface R2GetOptions { - onlyIf?: R2Conditional | Headers; - range?: R2Range | Headers; -} -export interface R2PutOptions { - onlyIf?: R2Conditional | Headers; - httpMetadata?: R2HTTPMetadata | Headers; - customMetadata?: Record; - md5?: ArrayBuffer | string; - sha1?: ArrayBuffer | string; - sha256?: ArrayBuffer | string; - sha384?: ArrayBuffer | string; - sha512?: ArrayBuffer | string; -} -export interface R2MultipartOptions { - httpMetadata?: R2HTTPMetadata | Headers; - customMetadata?: Record; -} -export interface R2Checksums { - readonly md5?: ArrayBuffer; - readonly sha1?: ArrayBuffer; - readonly sha256?: ArrayBuffer; - readonly sha384?: ArrayBuffer; - readonly sha512?: ArrayBuffer; - toJSON(): R2StringChecksums; -} -export interface R2StringChecksums { - md5?: string; - sha1?: string; - sha256?: string; - sha384?: string; - sha512?: string; -} -export interface R2HTTPMetadata { - contentType?: string; - contentLanguage?: string; - contentDisposition?: string; - contentEncoding?: string; - cacheControl?: string; - cacheExpiry?: Date; -} -export interface R2Objects { - objects: R2Object[]; - truncated: boolean; - cursor?: string; - delimitedPrefixes: string[]; -} -export declare abstract class ScheduledEvent extends ExtendableEvent { - readonly scheduledTime: number; - readonly cron: string; - noRetry(): void; -} -export interface ScheduledController { - readonly scheduledTime: number; - readonly cron: string; - noRetry(): void; -} -export interface QueuingStrategy { - highWaterMark?: number | bigint; - size?: (chunk: T) => number | bigint; -} -export interface UnderlyingSink { - type?: string; - start?: (controller: WritableStreamDefaultController) => void | Promise; - write?: ( - chunk: W, - controller: WritableStreamDefaultController - ) => void | Promise; - abort?: (reason: any) => void | Promise; - close?: () => void | Promise; -} -export interface UnderlyingByteSource { - type: "bytes"; - autoAllocateChunkSize?: number; - start?: (controller: ReadableByteStreamController) => void | Promise; - pull?: (controller: ReadableByteStreamController) => void | Promise; - cancel?: (reason: any) => void | Promise; -} -export interface UnderlyingSource { - type?: "" | undefined; - start?: ( - controller: ReadableStreamDefaultController - ) => void | Promise; - pull?: ( - controller: ReadableStreamDefaultController - ) => void | Promise; - cancel?: (reason: any) => void | Promise; -} -export interface Transformer { - readableType?: string; - writableType?: string; - start?: ( - controller: TransformStreamDefaultController - ) => void | Promise; - transform?: ( - chunk: I, - controller: TransformStreamDefaultController - ) => void | Promise; - flush?: ( - controller: TransformStreamDefaultController - ) => void | Promise; -} -export interface StreamPipeOptions { - /** - * 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; - preventAbort?: boolean; - preventCancel?: boolean; - signal?: AbortSignal; -} -export type ReadableStreamReadResult = - | { - done: false; - value: R; - } - | { - done: true; - value?: undefined; - }; -/** This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object. */ -export interface ReadableStream { - get locked(): boolean; - cancel(reason?: any): Promise; - getReader(): ReadableStreamDefaultReader; - getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader; - pipeThrough( - transform: ReadableWritablePair, - options?: StreamPipeOptions - ): ReadableStream; - pipeTo( - destination: WritableStream, - options?: StreamPipeOptions - ): Promise; - tee(): [ReadableStream, ReadableStream]; - values(options?: ReadableStreamValuesOptions): AsyncIterableIterator; - [Symbol.asyncIterator]( - options?: ReadableStreamValuesOptions - ): AsyncIterableIterator; -} -export declare const ReadableStream: { - prototype: ReadableStream; - new ( - underlyingSource: UnderlyingByteSource, - strategy?: QueuingStrategy - ): ReadableStream; - new ( - underlyingSource?: UnderlyingSource, - strategy?: QueuingStrategy - ): ReadableStream; -}; -export declare class ReadableStreamDefaultReader { - constructor(stream: ReadableStream); - get closed(): Promise; - cancel(reason?: any): Promise; - read(): Promise>; - releaseLock(): void; -} -export declare class ReadableStreamBYOBReader { - constructor(stream: ReadableStream); - get closed(): Promise; - cancel(reason?: any): Promise; - read( - view: T - ): Promise>; - releaseLock(): void; - readAtLeast( - minElements: number, - view: T - ): Promise>; -} -export interface ReadableStreamGetReaderOptions { - mode: "byob"; -} -export interface ReadableStreamBYOBRequest { - readonly view: Uint8Array | null; - respond(bytesWritten: number): void; - respondWithNewView(view: ArrayBuffer | ArrayBufferView): void; - readonly atLeast: number | null; -} -export interface ReadableStreamDefaultController { - readonly desiredSize: number | null; - close(): void; - enqueue(chunk?: R): void; - error(reason: any): void; -} -export interface ReadableByteStreamController { - readonly byobRequest: ReadableStreamBYOBRequest | null; - readonly desiredSize: number | null; - close(): void; - enqueue(chunk: ArrayBuffer | ArrayBufferView): void; - error(reason: any): void; -} -/** This Streams API interface represents a controller allowing control of a WritableStream's state. When constructing a WritableStream, the underlying sink is given a corresponding WritableStreamDefaultController instance to manipulate. */ -export interface WritableStreamDefaultController { - readonly signal: AbortSignal; - error(reason?: any): void; -} -export interface TransformStreamDefaultController { - get desiredSize(): number | null; - enqueue(chunk?: O): void; - error(reason: any): void; - terminate(): void; -} -export interface ReadableWritablePair { - /** - * 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; - readable: ReadableStream; -} -export declare class WritableStream { - constructor( - underlyingSink?: UnderlyingSink, - queuingStrategy?: QueuingStrategy - ); - get locked(): boolean; - abort(reason?: any): Promise; - close(): Promise; - getWriter(): WritableStreamDefaultWriter; -} -export declare class WritableStreamDefaultWriter { - constructor(stream: WritableStream); - get closed(): Promise; - get ready(): Promise; - get desiredSize(): number | null; - abort(reason?: any): Promise; - close(): Promise; - write(chunk?: W): Promise; - releaseLock(): void; -} -export declare class TransformStream { - constructor( - transformer?: Transformer, - writableStrategy?: QueuingStrategy, - readableStrategy?: QueuingStrategy - ); - get readable(): ReadableStream; - get writable(): WritableStream; -} -export declare class FixedLengthStream extends IdentityTransformStream { - constructor(expectedLength: number | bigint); -} -export declare class IdentityTransformStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(); -} -export interface ReadableStreamValuesOptions { - preventCancel?: boolean; -} -export declare class CompressionStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(format: "gzip" | "deflate" | "deflate-raw"); -} -export declare class DecompressionStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(format: "gzip" | "deflate" | "deflate-raw"); -} -export declare class TextEncoderStream extends TransformStream< - string, - Uint8Array -> { - constructor(); -} -export declare class TextDecoderStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - string -> { - constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit); -} -export interface TextDecoderStreamTextDecoderStreamInit { - fatal?: boolean; -} -export declare class ByteLengthQueuingStrategy - implements QueuingStrategy -{ - constructor(init: QueuingStrategyInit); - get highWaterMark(): number; - get size(): (chunk?: any) => number; -} -export declare class CountQueuingStrategy implements QueuingStrategy { - constructor(init: QueuingStrategyInit); - get highWaterMark(): number; - get size(): (chunk?: any) => number; -} -export 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; -} -export declare abstract class TraceEvent extends ExtendableEvent { - readonly traces: TraceItem[]; -} -export interface TraceItem { - readonly event: - | ( - | TraceItemFetchEventInfo - | TraceItemScheduledEventInfo - | TraceItemAlarmEventInfo - | TraceItemQueueEventInfo - | TraceItemEmailEventInfo - | TraceItemCustomEventInfo - ) - | null; - readonly eventTimestamp: number | null; - readonly logs: TraceLog[]; - readonly exceptions: TraceException[]; - readonly scriptName: string | null; - readonly dispatchNamespace?: string; - readonly scriptTags?: string[]; - readonly outcome: string; -} -export interface TraceItemAlarmEventInfo { - readonly scheduledTime: Date; -} -export interface TraceItemCustomEventInfo {} -export interface TraceItemScheduledEventInfo { - readonly scheduledTime: number; - readonly cron: string; -} -export interface TraceItemQueueEventInfo { - readonly queue: string; - readonly batchSize: number; -} -export interface TraceItemEmailEventInfo { - readonly mailFrom: string; - readonly rcptTo: string; - readonly rawSize: number; -} -export interface TraceItemFetchEventInfo { - readonly response?: TraceItemFetchEventInfoResponse; - readonly request: TraceItemFetchEventInfoRequest; -} -export interface TraceItemFetchEventInfoRequest { - readonly cf?: any; - readonly headers: Record; - readonly method: string; - readonly url: string; - getUnredacted(): TraceItemFetchEventInfoRequest; -} -export interface TraceItemFetchEventInfoResponse { - readonly status: number; -} -export interface TraceLog { - readonly timestamp: number; - readonly level: string; - readonly message: any; -} -export interface TraceException { - readonly timestamp: number; - readonly message: string; - readonly name: string; -} -export interface TraceMetrics { - readonly cpuTime: number; - readonly wallTime: number; -} -export interface UnsafeTraceMetrics { - fromTrace(item: TraceItem): TraceMetrics; -} -export declare class URL { - constructor(url: string | URL, base?: string | URL); - get href(): string; - set href(value: string); - get origin(): string; - get protocol(): string; - set protocol(value: string); - get username(): string; - set username(value: string); - get password(): string; - set password(value: string); - get host(): string; - set host(value: string); - get hostname(): string; - set hostname(value: string); - get port(): string; - set port(value: string); - get pathname(): string; - set pathname(value: string); - get search(): string; - set search(value: string); - get searchParams(): URLSearchParams; - get hash(): string; - set hash(value: string); - toString(): string; - toJSON(): string; -} -export declare class URLSearchParams { - constructor( - init?: - | URLSearchParams - | string - | Record - | [key: string, value: string][] - ); - get size(): number; - append(name: string, value: string): void; - delete(name: string): void; - get(name: string): string | null; - getAll(name: string): string[]; - has(name: string): boolean; - set(name: string, value: string): void; - sort(): void; - entries(): IterableIterator<[key: string, value: string]>; - keys(): IterableIterator; - values(): IterableIterator; - forEach( - callback: ( - this: This, - value: string, - key: string, - parent: URLSearchParams - ) => void, - thisArg?: This - ): void; - toString(): string; - [Symbol.iterator](): IterableIterator<[key: string, value: string]>; -} -export declare class URLPattern { - constructor(input?: string | URLPatternURLPatternInit, baseURL?: string); - get protocol(): string; - get username(): string; - get password(): string; - get hostname(): string; - get port(): string; - get pathname(): string; - get search(): string; - get hash(): string; - test(input?: string | URLPatternURLPatternInit, baseURL?: string): boolean; - exec( - input?: string | URLPatternURLPatternInit, - baseURL?: string - ): URLPatternURLPatternResult | null; -} -export interface URLPatternURLPatternInit { - protocol?: string; - username?: string; - password?: string; - hostname?: string; - port?: string; - pathname?: string; - search?: string; - hash?: string; - baseURL?: string; -} -export interface URLPatternURLPatternComponentResult { - input: string; - groups: Record; -} -export interface URLPatternURLPatternResult { - inputs: (string | URLPatternURLPatternInit)[]; - protocol: URLPatternURLPatternComponentResult; - username: URLPatternURLPatternComponentResult; - password: URLPatternURLPatternComponentResult; - hostname: URLPatternURLPatternComponentResult; - port: URLPatternURLPatternComponentResult; - pathname: URLPatternURLPatternComponentResult; - search: URLPatternURLPatternComponentResult; - hash: URLPatternURLPatternComponentResult; -} -export declare class CloseEvent extends Event { - constructor(type: string, initializer: CloseEventInit); - /** Returns the WebSocket connection close code provided by the server. */ - readonly code: number; - /** Returns the WebSocket connection close reason provided by the server. */ - readonly reason: string; - /** Returns true if the connection closed cleanly; false otherwise. */ - readonly wasClean: boolean; -} -export interface CloseEventInit { - code?: number; - reason?: string; - wasClean?: boolean; -} -export declare class MessageEvent extends Event { - constructor(type: string, initializer: MessageEventInit); - readonly data: ArrayBuffer | string; -} -export interface MessageEventInit { - data: ArrayBuffer | string; -} -/** Events providing information related to errors in scripts or in files. */ -export interface ErrorEvent extends Event { - readonly filename: string; - readonly message: string; - readonly lineno: number; - readonly colno: number; - readonly error: any; -} -export type WebSocketEventMap = { - close: CloseEvent; - message: MessageEvent; - open: Event; - error: ErrorEvent; -}; -export declare class WebSocket extends EventTarget { - constructor(url: string, protocols?: string[] | string); - accept(): void; - send(message: (ArrayBuffer | ArrayBufferView) | string): void; - close(code?: number, reason?: string): void; - static readonly READY_STATE_CONNECTING: number; - static readonly READY_STATE_OPEN: number; - static readonly READY_STATE_CLOSING: number; - static readonly READY_STATE_CLOSED: number; - get readyState(): number; - get url(): string | null; - get protocol(): string | null; - get extensions(): string | null; -} -export declare const WebSocketPair: { - new (): { - 0: WebSocket; - 1: WebSocket; - }; -}; -export interface BasicImageTransformations { - /** - * Maximum width in image pixels. The value must be an integer. - */ - width?: number; - /** - * Maximum height in image pixels. The value must be an integer. - */ - height?: number; - /** - * Resizing mode as a string. It affects interpretation of width and height - * options: - * - scale-down: Similar to contain, but the image is never enlarged. If - * the image is larger than given width or height, it will be resized. - * Otherwise its original size will be kept. - * - contain: Resizes to maximum size that fits within the given width and - * height. If only a single dimension is given (e.g. only width), the - * image will be shrunk or enlarged to exactly match that dimension. - * Aspect ratio is always preserved. - * - cover: Resizes (shrinks or enlarges) to fill the entire area of width - * and height. If the image has an aspect ratio different from the ratio - * of width and height, it will be cropped to fit. - * - crop: The image will be shrunk and cropped to fit within the area - * specified by width and height. The image will not be enlarged. For images - * smaller than the given dimensions it's the same as scale-down. For - * images larger than the given dimensions, it's the same as cover. - * See also trim. - * - pad: Resizes to the maximum size that fits within the given width and - * height, and then fills the remaining area with a background color - * (white by default). Use of this mode is not recommended, as the same - * effect can be more efficiently achieved with the contain mode and the - * CSS object-fit: contain property. - */ - fit?: "scale-down" | "contain" | "cover" | "crop" | "pad"; - /** - * When cropping with fit: "cover", this defines the side or point that should - * be left uncropped. The value is either a string - * "left", "right", "top", "bottom", "auto", or "center" (the default), - * or an object {x, y} containing focal point coordinates in the original - * image expressed as fractions ranging from 0.0 (top or left) to 1.0 - * (bottom or right), 0.5 being the center. {fit: "cover", gravity: "top"} will - * crop bottom or left and right sides as necessary, but won’t crop anything - * from the top. {fit: "cover", gravity: {x:0.5, y:0.2}} will crop each side to - * preserve as much as possible around a point at 20% of the height of the - * source image. - */ - gravity?: - | "left" - | "right" - | "top" - | "bottom" - | "center" - | "auto" - | BasicImageTransformationsGravityCoordinates; - /** - * Background color to add underneath the image. Applies only to images with - * transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…), - * hsl(…), etc.) - */ - background?: string; - /** - * Number of degrees (90, 180, 270) to rotate the image by. width and height - * options refer to axes after rotation. - */ - rotate?: 0 | 90 | 180 | 270 | 360; -} -export interface BasicImageTransformationsGravityCoordinates { - x: number; - y: number; -} -/** - * In addition to the properties you can set in the RequestInit dict - * that you pass as an argument to the Request constructor, you can - * set certain properties of a `cf` object to control how Cloudflare - * features are applied to that new Request. - * - * Note: Currently, these properties cannot be tested in the - * playground. - */ -export interface RequestInitCfProperties extends Record { - cacheEverything?: boolean; - /** - * A request's cache key is what determines if two requests are - * "the same" for caching purposes. If a request has the same cache key - * as some previous request, then we can serve the same cached response for - * both. (e.g. 'some-key') - * - * Only available for Enterprise customers. - */ - cacheKey?: string; - /** - * This allows you to append additional Cache-Tag response headers - * to the origin response without modifications to the origin server. - * This will allow for greater control over the Purge by Cache Tag feature - * utilizing changes only in the Workers process. - * - * Only available for Enterprise customers. - */ - cacheTags?: string[]; - /** - * Force response to be cached for a given number of seconds. (e.g. 300) - */ - cacheTtl?: number; - /** - * Force response to be cached for a given number of seconds based on the Origin status code. - * (e.g. { '200-299': 86400, '404': 1, '500-599': 0 }) - */ - cacheTtlByStatus?: Record; - scrapeShield?: boolean; - apps?: boolean; - image?: RequestInitCfPropertiesImage; - minify?: RequestInitCfPropertiesImageMinify; - mirage?: boolean; - polish?: "lossy" | "lossless" | "off"; - /** - * Redirects the request to an alternate origin server. You can use this, - * for example, to implement load balancing across several origins. - * (e.g.us-east.example.com) - * - * Note - For security reasons, the hostname set in resolveOverride must - * be proxied on the same Cloudflare zone of the incoming request. - * Otherwise, the setting is ignored. CNAME hosts are allowed, so to - * resolve to a host under a different domain or a DNS only domain first - * declare a CNAME record within your own zone’s DNS mapping to the - * external hostname, set proxy on Cloudflare, then set resolveOverride - * to point to that CNAME record. - */ - resolveOverride?: string; -} -export interface RequestInitCfPropertiesImageDraw - extends BasicImageTransformations { - /** - * Absolute URL of the image file to use for the drawing. It can be any of - * the supported file formats. For drawing of watermarks or non-rectangular - * overlays we recommend using PNG or WebP images. - */ - url: string; - /** - * Floating-point number between 0 (transparent) and 1 (opaque). - * For example, opacity: 0.5 makes overlay semitransparent. - */ - opacity?: number; - /** - * - If set to true, the overlay image will be tiled to cover the entire - * area. This is useful for stock-photo-like watermarks. - * - If set to "x", the overlay image will be tiled horizontally only - * (form a line). - * - If set to "y", the overlay image will be tiled vertically only - * (form a line). - */ - repeat?: true | "x" | "y"; - /** - * Position of the overlay image relative to a given edge. Each property is - * an offset in pixels. 0 aligns exactly to the edge. For example, left: 10 - * positions left side of the overlay 10 pixels from the left edge of the - * image it's drawn over. bottom: 0 aligns bottom of the overlay with bottom - * of the background image. - * - * Setting both left & right, or both top & bottom is an error. - * - * If no position is specified, the image will be centered. - */ - top?: number; - left?: number; - bottom?: number; - right?: number; -} -export interface RequestInitCfPropertiesImage - extends BasicImageTransformations { - /** - * Device Pixel Ratio. Default 1. Multiplier for width/height that makes it - * easier to specify higher-DPI sizes in . - */ - dpr?: number; - /** - * An object with four properties {left, top, right, bottom} that specify - * a number of pixels to cut off on each side. Allows removal of borders - * or cutting out a specific fragment of an image. Trimming is performed - * before resizing or rotation. Takes dpr into account. - */ - trim?: { - left?: number; - top?: number; - right?: number; - bottom?: number; - }; - /** - * Quality setting from 1-100 (useful values are in 60-90 range). Lower values - * make images look worse, but load faster. The default is 85. It applies only - * to JPEG and WebP images. It doesn’t have any effect on PNG. - */ - quality?: number; - /** - * Output format to generate. It can be: - * - avif: generate images in AVIF format. - * - webp: generate images in Google WebP format. Set quality to 100 to get - * the WebP-lossless format. - * - json: instead of generating an image, outputs information about the - * image, in JSON format. The JSON object will contain image size - * (before and after resizing), source image’s MIME type, file size, etc. - * - jpeg: generate images in JPEG format. - * - png: generate images in PNG format. - */ - format?: "avif" | "webp" | "json" | "jpeg" | "png"; - /** - * Whether to preserve animation frames from input files. Default is true. - * Setting it to false reduces animations to still images. This setting is - * recommended when enlarging images or processing arbitrary user content, - * because large GIF animations can weigh tens or even hundreds of megabytes. - * It is also useful to set anim:false when using format:"json" to get the - * response quicker without the number of frames. - */ - anim?: boolean; - /** - * What EXIF data should be preserved in the output image. Note that EXIF - * rotation and embedded color profiles are always applied ("baked in" into - * the image), and aren't affected by this option. Note that if the Polish - * feature is enabled, all metadata may have been removed already and this - * option may have no effect. - * - keep: Preserve most of EXIF metadata, including GPS location if there's - * any. - * - copyright: Only keep the copyright tag, and discard everything else. - * This is the default behavior for JPEG files. - * - none: Discard all invisible EXIF metadata. Currently WebP and PNG - * output formats always discard metadata. - */ - metadata?: "keep" | "copyright" | "none"; - /** - * Strength of sharpening filter to apply to the image. Floating-point - * number between 0 (no sharpening, default) and 10 (maximum). 1.0 is a - * recommended value for downscaled images. - */ - sharpen?: number; - /** - * Radius of a blur filter (approximate gaussian). Maximum supported radius - * is 250. - */ - blur?: number; - /** - * Overlays are drawn in the order they appear in the array (last array - * entry is the topmost layer). - */ - draw?: RequestInitCfPropertiesImageDraw[]; - /** - * Fetching image from authenticated origin. Setting this property will - * pass authentication headers (Authorization, Cookie, etc.) through to - * the origin. - */ - "origin-auth"?: "share-publicly"; - /** - * Adds a border around the image. The border is added after resizing. Border - * width takes dpr into account, and can be specified either using a single - * width property, or individually for each side. - */ - border?: - | { - color: string; - width: number; - } - | { - color: string; - top: number; - right: number; - bottom: number; - left: number; - }; - /** - * Increase brightness by a factor. A value of 1.0 equals no change, a value - * of 0.5 equals half brightness, and a value of 2.0 equals twice as bright. - * 0 is ignored. - */ - brightness?: number; - /** - * Increase contrast by a factor. A value of 1.0 equals no change, a value of - * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is - * ignored. - */ - contrast?: number; - /** - * Increase exposure by a factor. A value of 1.0 equals no change, a value of - * 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored. - */ - gamma?: number; - /** - * Slightly reduces latency on a cache miss by selecting a - * quickest-to-compress file format, at a cost of increased file size and - * lower image quality. It will usually override the format option and choose - * JPEG over WebP or AVIF. We do not recommend using this option, except in - * unusual circumstances like resizing uncacheable dynamically-generated - * images. - */ - compression?: "fast"; -} -export interface RequestInitCfPropertiesImageMinify { - javascript?: boolean; - css?: boolean; - html?: boolean; -} -/** - * Request metadata provided by Cloudflare's edge. - */ -export type IncomingRequestCfProperties = - IncomingRequestCfPropertiesBase & - IncomingRequestCfPropertiesBotManagementEnterprise & - IncomingRequestCfPropertiesCloudflareForSaaSEnterprise & - IncomingRequestCfPropertiesGeographicInformation & - IncomingRequestCfPropertiesCloudflareAccessOrApiShield; -export interface IncomingRequestCfPropertiesBase - extends Record { - /** - * [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request. - * - * @example 395747 - */ - asn: number; - /** - * The organization which owns the ASN of the incoming request. - * - * @example "Google Cloud" - */ - asOrganization: string; - /** - * The original value of the `Accept-Encoding` header if Cloudflare modified it. - * - * @example "gzip, deflate, br" - */ - clientAcceptEncoding?: string; - /** - * The number of milliseconds it took for the request to reach your worker. - * - * @example 22 - */ - clientTcpRtt?: number; - /** - * The three-letter [IATA](https://en.wikipedia.org/wiki/IATA_airport_code) - * airport code of the data center that the request hit. - * - * @example "DFW" - */ - colo: string; - /** - * Represents the upstream's response to a - * [TCP `keepalive` message](https://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html) - * from cloudflare. - * - * For workers with no upstream, this will always be `1`. - * - * @example 3 - */ - edgeRequestKeepAliveStatus: IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus; - /** - * The HTTP Protocol the request used. - * - * @example "HTTP/2" - */ - httpProtocol: string; - /** - * The browser-requested prioritization information in the request object. - * - * If no information was set, defaults to the empty string `""` - * - * @example "weight=192;exclusive=0;group=3;group-weight=127" - * @default "" - */ - requestPriority: string; - /** - * The TLS version of the connection to Cloudflare. - * In requests served over plaintext (without TLS), this property is the empty string `""`. - * - * @example "TLSv1.3" - */ - tlsVersion: string; - /** - * The cipher for the connection to Cloudflare. - * In requests served over plaintext (without TLS), this property is the empty string `""`. - * - * @example "AEAD-AES128-GCM-SHA256" - */ - tlsCipher: string; - /** - * Metadata containing the [`HELLO`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2) and [`FINISHED`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9) messages from this request's TLS handshake. - * - * If the incoming request was served over plaintext (without TLS) this field is undefined. - */ - tlsExportedAuthenticator?: IncomingRequestCfPropertiesExportedAuthenticatorMetadata; -} -export interface IncomingRequestCfPropertiesBotManagementBase { - /** - * Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot, - * represented as an integer percentage between `1` (almost certainly human) - * and `99` (almost certainly a bot). - * - * @example 54 - */ - score: number; - /** - * A boolean value that is true if the request comes from a good bot, like Google or Bing. - * Most customers choose to allow this traffic. For more details, see [Traffic from known bots](https://developers.cloudflare.com/firewall/known-issues-and-faq/#how-does-firewall-rules-handle-traffic-from-known-bots). - */ - verifiedBot: boolean; - /** - * A boolean value that is true if the request originates from a - * Cloudflare-verified proxy service. - */ - corporateProxy: boolean; - /** - * A boolean value that's true if the request matches [file extensions](https://developers.cloudflare.com/bots/reference/static-resources/) for many types of static resources. - */ - staticResource: boolean; - /** - * List of IDs that correlate to the Bot Management heuristic detections made on a request (you can have multiple heuristic detections on the same request). - */ - detectionIds: number[]; -} -export interface IncomingRequestCfPropertiesBotManagement { - /** - * Results of Cloudflare's Bot Management analysis - */ - botManagement: IncomingRequestCfPropertiesBotManagementBase; - /** - * Duplicate of `botManagement.score`. - * - * @deprecated - */ - clientTrustScore: number; -} -export interface IncomingRequestCfPropertiesBotManagementEnterprise - extends IncomingRequestCfPropertiesBotManagement { - /** - * Results of Cloudflare's Bot Management analysis - */ - botManagement: IncomingRequestCfPropertiesBotManagementBase & { - /** - * A [JA3 Fingerprint](https://developers.cloudflare.com/bots/concepts/ja3-fingerprint/) to help profile specific SSL/TLS clients - * across different destination IPs, Ports, and X509 certificates. - */ - ja3Hash: string; - }; -} -export interface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise< - HostMetadata -> { - /** - * Custom metadata set per-host in [Cloudflare for SaaS](https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/). - * - * This field is only present if you have Cloudflare for SaaS enabled on your account - * and you have followed the [required steps to enable it]((https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/domain-support/custom-metadata/)). - */ - hostMetadata: HostMetadata; -} -export interface IncomingRequestCfPropertiesCloudflareAccessOrApiShield { - /** - * Information about the client certificate presented to Cloudflare. - * - * This is populated when the incoming request is served over TLS using - * either Cloudflare Access or API Shield (mTLS) - * and the presented SSL certificate has a valid - * [Certificate Serial Number](https://ldapwiki.com/wiki/Certificate%20Serial%20Number) - * (i.e., not `null` or `""`). - * - * Otherwise, a set of placeholder values are used. - * - * The property `certPresented` will be set to `"1"` when - * the object is populated (i.e. the above conditions were met). - */ - tlsClientAuth: - | IncomingRequestCfPropertiesTLSClientAuth - | IncomingRequestCfPropertiesTLSClientAuthPlaceholder; -} -/** - * Metadata about the request's TLS handshake - */ -export interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata { - /** - * The client's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal - * - * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d" - */ - clientHandshake: string; - /** - * The server's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal - * - * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d" - */ - serverHandshake: string; - /** - * The client's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal - * - * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b" - */ - clientFinished: string; - /** - * The server's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal - * - * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b" - */ - serverFinished: string; -} -/** - * Geographic data about the request's origin. - */ -export interface IncomingRequestCfPropertiesGeographicInformation { - /** - * The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from. - * - * If your worker is [configured to accept TOR connections](https://support.cloudflare.com/hc/en-us/articles/203306930-Understanding-Cloudflare-Tor-support-and-Onion-Routing), this may also be `"T1"`, indicating a request that originated over TOR. - * - * If Cloudflare is unable to determine where the request originated this property is omitted. - * - * The country code `"T1"` is used for requests originating on TOR. - * - * @example "GB" - */ - country?: Iso3166Alpha2Code | "T1"; - /** - * If present, this property indicates that the request originated in the EU - * - * @example "1" - */ - isEUCountry?: "1"; - /** - * A two-letter code indicating the continent the request originated from. - * - * @example "AN" - */ - continent?: ContinentCode; - /** - * The city the request originated from - * - * @example "Austin" - */ - city?: string; - /** - * Postal code of the incoming request - * - * @example "78701" - */ - postalCode?: string; - /** - * Latitude of the incoming request - * - * @example "30.27130" - */ - latitude?: string; - /** - * Longitude of the incoming request - * - * @example "-97.74260" - */ - longitude?: string; - /** - * Timezone of the incoming request - * - * @example "America/Chicago" - */ - timezone?: string; - /** - * If known, the ISO 3166-2 name for the first level region associated with - * the IP address of the incoming request - * - * @example "Texas" - */ - region?: string; - /** - * If known, the ISO 3166-2 code for the first-level region associated with - * the IP address of the incoming request - * - * @example "TX" - */ - regionCode?: string; - /** - * Metro code (DMA) of the incoming request - * - * @example "635" - */ - metroCode?: string; -} -/** Data about the incoming request's TLS certificate */ -export interface IncomingRequestCfPropertiesTLSClientAuth { - /** Always `"1"`, indicating that the certificate was presented */ - certPresented: "1"; - /** - * Result of certificate verification. - * - * @example "FAILED:self signed certificate" - */ - certVerified: Exclude; - /** The presented certificate's revokation status. - * - * - A value of `"1"` indicates the certificate has been revoked - * - A value of `"0"` indicates the certificate has not been revoked - */ - certRevoked: "1" | "0"; - /** - * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) - * - * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certIssuerDN: string; - /** - * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) - * - * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certSubjectDN: string; - /** - * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted) - * - * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certIssuerDNRFC2253: string; - /** - * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted) - * - * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certSubjectDNRFC2253: string; - /** The certificate issuer's distinguished name (legacy policies) */ - certIssuerDNLegacy: string; - /** The certificate subject's distinguished name (legacy policies) */ - certSubjectDNLegacy: string; - /** - * The certificate's serial number - * - * @example "00936EACBE07F201DF" - */ - certSerial: string; - /** - * The certificate issuer's serial number - * - * @example "2489002934BDFEA34" - */ - certIssuerSerial: string; - /** - * The certificate's Subject Key Identifier - * - * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4" - */ - certSKI: string; - /** - * The certificate issuer's Subject Key Identifier - * - * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4" - */ - certIssuerSKI: string; - /** - * The certificate's SHA-1 fingerprint - * - * @example "6b9109f323999e52259cda7373ff0b4d26bd232e" - */ - certFingerprintSHA1: string; - /** - * The certificate's SHA-256 fingerprint - * - * @example "acf77cf37b4156a2708e34c4eb755f9b5dbbe5ebb55adfec8f11493438d19e6ad3f157f81fa3b98278453d5652b0c1fd1d71e5695ae4d709803a4d3f39de9dea" - */ - certFingerprintSHA256: string; - /** - * The effective starting date of the certificate - * - * @example "Dec 22 19:39:00 2018 GMT" - */ - certNotBefore: string; - /** - * The effective expiration date of the certificate - * - * @example "Dec 22 19:39:00 2018 GMT" - */ - certNotAfter: string; -} -/** Placeholder values for TLS Client Authorization */ -export interface IncomingRequestCfPropertiesTLSClientAuthPlaceholder { - certPresented: "0"; - certVerified: "NONE"; - certRevoked: "0"; - certIssuerDN: ""; - certSubjectDN: ""; - certIssuerDNRFC2253: ""; - certSubjectDNRFC2253: ""; - certIssuerDNLegacy: ""; - certSubjectDNLegacy: ""; - certSerial: ""; - certIssuerSerial: ""; - certSKI: ""; - certIssuerSKI: ""; - certFingerprintSHA1: ""; - certFingerprintSHA256: ""; - certNotBefore: ""; - certNotAfter: ""; -} -/** Possible outcomes of TLS verification */ -export type CertVerificationStatus = - /** Authentication succeeded */ - | "SUCCESS" - /** No certificate was presented */ - | "NONE" - /** Failed because the certificate was self-signed */ - | "FAILED:self signed certificate" - /** Failed because the certificate failed a trust chain check */ - | "FAILED:unable to verify the first certificate" - /** Failed because the certificate not yet valid */ - | "FAILED:certificate is not yet valid" - /** Failed because the certificate is expired */ - | "FAILED:certificate has expired" - /** Failed for another unspecified reason */ - | "FAILED"; -/** - * An upstream endpoint's response to a TCP `keepalive` message from Cloudflare. - */ -export type IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus = - | 0 /** Unknown */ - | 1 /** no keepalives (not found) */ - | 2 /** no connection re-use, opening keepalive connection failed */ - | 3 /** no connection re-use, keepalive accepted and saved */ - | 4 /** connection re-use, refused by the origin server (`TCP FIN`) */ - | 5; /** connection re-use, accepted by the origin server */ -/** ISO 3166-1 Alpha-2 codes */ -export type Iso3166Alpha2Code = - | "AD" - | "AE" - | "AF" - | "AG" - | "AI" - | "AL" - | "AM" - | "AO" - | "AQ" - | "AR" - | "AS" - | "AT" - | "AU" - | "AW" - | "AX" - | "AZ" - | "BA" - | "BB" - | "BD" - | "BE" - | "BF" - | "BG" - | "BH" - | "BI" - | "BJ" - | "BL" - | "BM" - | "BN" - | "BO" - | "BQ" - | "BR" - | "BS" - | "BT" - | "BV" - | "BW" - | "BY" - | "BZ" - | "CA" - | "CC" - | "CD" - | "CF" - | "CG" - | "CH" - | "CI" - | "CK" - | "CL" - | "CM" - | "CN" - | "CO" - | "CR" - | "CU" - | "CV" - | "CW" - | "CX" - | "CY" - | "CZ" - | "DE" - | "DJ" - | "DK" - | "DM" - | "DO" - | "DZ" - | "EC" - | "EE" - | "EG" - | "EH" - | "ER" - | "ES" - | "ET" - | "FI" - | "FJ" - | "FK" - | "FM" - | "FO" - | "FR" - | "GA" - | "GB" - | "GD" - | "GE" - | "GF" - | "GG" - | "GH" - | "GI" - | "GL" - | "GM" - | "GN" - | "GP" - | "GQ" - | "GR" - | "GS" - | "GT" - | "GU" - | "GW" - | "GY" - | "HK" - | "HM" - | "HN" - | "HR" - | "HT" - | "HU" - | "ID" - | "IE" - | "IL" - | "IM" - | "IN" - | "IO" - | "IQ" - | "IR" - | "IS" - | "IT" - | "JE" - | "JM" - | "JO" - | "JP" - | "KE" - | "KG" - | "KH" - | "KI" - | "KM" - | "KN" - | "KP" - | "KR" - | "KW" - | "KY" - | "KZ" - | "LA" - | "LB" - | "LC" - | "LI" - | "LK" - | "LR" - | "LS" - | "LT" - | "LU" - | "LV" - | "LY" - | "MA" - | "MC" - | "MD" - | "ME" - | "MF" - | "MG" - | "MH" - | "MK" - | "ML" - | "MM" - | "MN" - | "MO" - | "MP" - | "MQ" - | "MR" - | "MS" - | "MT" - | "MU" - | "MV" - | "MW" - | "MX" - | "MY" - | "MZ" - | "NA" - | "NC" - | "NE" - | "NF" - | "NG" - | "NI" - | "NL" - | "NO" - | "NP" - | "NR" - | "NU" - | "NZ" - | "OM" - | "PA" - | "PE" - | "PF" - | "PG" - | "PH" - | "PK" - | "PL" - | "PM" - | "PN" - | "PR" - | "PS" - | "PT" - | "PW" - | "PY" - | "QA" - | "RE" - | "RO" - | "RS" - | "RU" - | "RW" - | "SA" - | "SB" - | "SC" - | "SD" - | "SE" - | "SG" - | "SH" - | "SI" - | "SJ" - | "SK" - | "SL" - | "SM" - | "SN" - | "SO" - | "SR" - | "SS" - | "ST" - | "SV" - | "SX" - | "SY" - | "SZ" - | "TC" - | "TD" - | "TF" - | "TG" - | "TH" - | "TJ" - | "TK" - | "TL" - | "TM" - | "TN" - | "TO" - | "TR" - | "TT" - | "TV" - | "TW" - | "TZ" - | "UA" - | "UG" - | "UM" - | "US" - | "UY" - | "UZ" - | "VA" - | "VC" - | "VE" - | "VG" - | "VI" - | "VN" - | "VU" - | "WF" - | "WS" - | "YE" - | "YT" - | "ZA" - | "ZM" - | "ZW"; -/** The 2-letter continent codes Cloudflare uses */ -export type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA"; -export type CfProperties = - | IncomingRequestCfProperties - | RequestInitCfProperties; -export interface D1Result { - results?: T[]; - success: boolean; - error?: string; - meta: any; -} -export declare abstract class D1Database { - prepare(query: string): D1PreparedStatement; - dump(): Promise; - batch(statements: D1PreparedStatement[]): Promise[]>; - exec(query: string): Promise>; -} -export declare abstract class D1PreparedStatement { - bind(...values: any[]): D1PreparedStatement; - first(colName?: string): Promise; - run(): Promise>; - all(): Promise>; - raw(): Promise; -} -/** - * A email message that is sent to a consumer Worker. - */ -export interface EmailMessage { - /** - * Envelope From attribute of the email message. - */ - readonly from: string; - /** - * Envelope To attribute of the email message. - */ - readonly to: string; - /** - * A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers). - */ - readonly headers: Headers; - /** - * Stream of the email message content. - */ - readonly raw: ReadableStream; - /** - * Size of the email message content. - */ - readonly rawSize: number; - /** - * Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason. - * @param reason The reject reason. - * @returns void - */ - setReject(reason: string): void; - /** - * Forward this email message to a verified destination address of the account. - * @param rcptTo Verified destination address. - * @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers). - * @returns A promise that resolves when the email message is forwarded. - */ - forward(rcptTo: string, headers?: Headers): Promise; -} -export declare abstract class EmailEvent extends ExtendableEvent { - readonly message: EmailMessage; -} -export type EmailExportedHandler = ( - message: EmailMessage, - env: Env, - ctx: ExecutionContext -) => void | Promise; -export type Params

= Record; -export type EventContext = { - request: Request; - functionPath: string; - waitUntil: (promise: Promise) => void; - passThroughOnException: () => void; - next: (input?: Request | string, init?: RequestInit) => Promise; - env: Env & { - ASSETS: { - fetch: typeof fetch; - }; - }; - params: Params

; - data: Data; -}; -export type PagesFunction< - Env = unknown, - Params extends string = any, - Data extends Record = Record -> = (context: EventContext) => Response | Promise; -export type EventPluginContext = { - request: Request; - functionPath: string; - waitUntil: (promise: Promise) => void; - passThroughOnException: () => void; - next: (input?: Request | string, init?: RequestInit) => Promise; - env: Env & { - ASSETS: { - fetch: typeof fetch; - }; - }; - params: Params

; - data: Data; - pluginArgs: PluginArgs; -}; -export type PagesPluginFunction< - Env = unknown, - Params extends string = any, - Data extends Record = Record, - PluginArgs = unknown -> = ( - context: EventPluginContext -) => Response | Promise; -// https://developers.cloudflare.com/pub-sub/ -// PubSubMessage represents an incoming PubSub message. -// The message includes metadata about the broker, the client, and the payload -// itself. -export interface PubSubMessage { - // Message ID - readonly mid: number; - // MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT - readonly broker: string; - // The MQTT topic the message was sent on. - readonly topic: string; - // The client ID of the client that published this message. - readonly clientId: string; - // The unique identifier (JWT ID) used by the client to authenticate, if token - // auth was used. - readonly jti?: string; - // A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker - // received the message from the client. - readonly receivedAt: number; - // An (optional) string with the MIME type of the payload, if set by the - // client. - readonly contentType: string; - // Set to 1 when the payload is a UTF-8 string - // https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063 - readonly payloadFormatIndicator: number; - // Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays. - // You can use payloadFormatIndicator to inspect this before decoding. - payload: string | Uint8Array; -} -// JsonWebKey extended by kid parameter -export interface JsonWebKeyWithKid extends JsonWebKey { - // Key Identifier of the JWK - readonly kid: string; -} -/** - * A message that is sent to a consumer Worker. - */ -export interface Message { - /** - * A unique, system-generated ID for the message. - */ - readonly id: string; - /** - * A timestamp when the message was sent. - */ - readonly timestamp: Date; - /** - * The body of the message. - */ - readonly body: Body; - /** - * Marks message to be retried. - */ - retry(): void; - /** - * Marks message acknowledged. - */ - ack(): void; -} -/** - * A batch of messages that are sent to a consumer Worker. - */ -export interface MessageBatch { - /** - * The name of the Queue that belongs to this batch. - */ - readonly queue: string; - /** - * An array of messages in the batch. Ordering of messages is not guaranteed. - */ - readonly messages: readonly Message[]; - /** - * Marks every message to be retried in the next batch. - */ - retryAll(): void; - /** - * Marks every message acknowledged in the batch. - */ - ackAll(): void; -} -/** - * A wrapper class used to structure message batches. - */ -export type MessageSendRequest = { - /** - * The body of the message. - */ - body: Body; -}; -/** - * A binding that allows a producer to send messages to a Queue. - */ -export interface Queue { - /** - * Sends a message to the Queue. - * @param message The message can be any type supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types), as long as its size is less than 128 KB. - * @returns A promise that resolves when the message is confirmed to be written to disk. - */ - send(message: Body): Promise; - /** - * Sends a batch of messages to the Queue. - * @param messages Each item in the input must be supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types). A batch can contain up to 100 messages, though items are limited to 128 KB each, and the total size of the array cannot exceed 256 KB. - * @returns A promise that resolves when the messages are confirmed to be written to disk. - */ - sendBatch(messages: Iterable>): Promise; -} diff --git a/packages/denylist_bot/node_modules/@cloudflare/workers-types/2022-10-31/index.d.ts b/packages/denylist_bot/node_modules/@cloudflare/workers-types/2022-10-31/index.d.ts deleted file mode 100755 index 78ca2e412..000000000 --- a/packages/denylist_bot/node_modules/@cloudflare/workers-types/2022-10-31/index.d.ts +++ /dev/null @@ -1,2980 +0,0 @@ -/*! ***************************************************************************** -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 class DOMException extends Error { - constructor(message?: string, name?: string); - readonly message: string; - readonly name: string; - readonly code: number; - readonly stack: any; - 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; -} -declare type WorkerGlobalScopeEventMap = { - fetch: FetchEvent; - scheduled: ScheduledEvent; - unhandledrejection: PromiseRejectionEvent; - rejectionhandled: PromiseRejectionEvent; -}; -declare abstract class WorkerGlobalScope extends EventTarget { - EventTarget: typeof EventTarget; -} -declare interface Console { - "assert"(condition?: boolean, ...data: any[]): void; - clear(): void; - count(label?: string): void; - countReset(label?: string): void; - debug(...data: any[]): void; - dir(item?: any, options?: any): void; - dirxml(...data: any[]): void; - error(...data: any[]): void; - group(...data: any[]): void; - groupCollapsed(...data: any[]): void; - groupEnd(): void; - info(...data: any[]): void; - log(...data: any[]): void; - table(tabularData?: any, properties?: string[]): void; - time(label?: string): void; - timeEnd(label?: string): void; - timeLog(label?: string, ...data: any[]): void; - timeStamp(label?: string): void; - trace(...data: any[]): void; - warn(...data: any[]): void; -} -declare const console: Console; -declare type BufferSource = ArrayBufferView | ArrayBuffer; -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; - type Imports = Record; - type ExportValue = Function | Global | Memory | Table; - type Exports = Record; - 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; - function validate(bytes: BufferSource): boolean; -} -/** This ServiceWorker API interface represents the global execution context of a service worker. */ -declare 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( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args - ): number; - clearTimeout(timeoutId: number | null): void; - setInterval(callback: (...args: any[]) => void, msDelay?: number): number; - setInterval( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args - ): number; - clearInterval(timeoutId: number | null): void; - queueMicrotask(task: Function): void; - structuredClone(value: T, options?: StructuredSerializeOptions): T; - fetch( - input: RequestInfo, - init?: RequestInit - ): Promise; - self: ServiceWorkerGlobalScope; - crypto: Crypto; - caches: CacheStorage; - scheduler: Scheduler; - Event: typeof Event; - ExtendableEvent: typeof ExtendableEvent; - PromiseRejectionEvent: typeof PromiseRejectionEvent; - FetchEvent: typeof FetchEvent; - TraceEvent: typeof TraceEvent; - 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; - 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; - 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: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetAddEventListenerOptions | boolean -): void; -declare function removeEventListener< - Type extends keyof WorkerGlobalScopeEventMap ->( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetEventListenerOptions | boolean -): void; -/** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */ -declare function dispatchEvent( - event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap] -): boolean; -declare function btoa(data: string): string; -declare function atob(data: string): string; -declare function setTimeout( - callback: (...args: any[]) => void, - msDelay?: number -): number; -declare function setTimeout( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args -): number; -declare function clearTimeout(timeoutId: number | null): void; -declare function setInterval( - callback: (...args: any[]) => void, - msDelay?: number -): number; -declare function setInterval( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args -): number; -declare function clearInterval(timeoutId: number | null): void; -declare function queueMicrotask(task: Function): void; -declare function structuredClone( - value: T, - options?: StructuredSerializeOptions -): T; -declare function fetch( - input: RequestInfo, - init?: RequestInit -): Promise; -declare const self: ServiceWorkerGlobalScope; -declare const crypto: Crypto; -declare const caches: CacheStorage; -declare const scheduler: Scheduler; -declare const navigator: Navigator; -declare interface TestController {} -declare interface ExecutionContext { - waitUntil(promise: Promise): void; - passThroughOnException(): void; -} -declare type ExportedHandlerFetchHandler< - Env = unknown, - CfHostMetadata = unknown -> = ( - request: Request>, - env: Env, - ctx: ExecutionContext -) => Response | Promise; -declare type ExportedHandlerTraceHandler = ( - traces: TraceItem[], - env: Env, - ctx: ExecutionContext -) => void | Promise; -declare type ExportedHandlerScheduledHandler = ( - controller: ScheduledController, - env: Env, - ctx: ExecutionContext -) => void | Promise; -declare type ExportedHandlerQueueHandler = ( - batch: MessageBatch, - env: Env, - ctx: ExecutionContext -) => void | Promise; -declare type ExportedHandlerTestHandler = ( - controller: TestController, - env: Env, - ctx: ExecutionContext -) => void | Promise; -declare interface ExportedHandler< - Env = unknown, - QueueMessage = unknown, - CfHostMetadata = unknown -> { - fetch?: ExportedHandlerFetchHandler; - trace?: ExportedHandlerTraceHandler; - scheduled?: ExportedHandlerScheduledHandler; - test?: ExportedHandlerTestHandler; - queue?: ExportedHandlerQueueHandler; -} -declare interface StructuredSerializeOptions { - transfer?: any[]; -} -declare abstract class PromiseRejectionEvent extends Event { - readonly promise: Promise; - readonly reason: any; -} -declare abstract class Navigator { - readonly userAgent: string; -} -declare interface DurableObject { - fetch(request: Request): Response | Promise; - alarm?(): void | Promise; -} -declare interface DurableObjectStub extends Fetcher { - readonly id: DurableObjectId; - readonly name?: string; -} -declare interface DurableObjectId { - toString(): string; - equals(other: DurableObjectId): boolean; - readonly name?: string; -} -declare interface DurableObjectNamespace { - newUniqueId( - options?: DurableObjectNamespaceNewUniqueIdOptions - ): DurableObjectId; - idFromName(name: string): DurableObjectId; - idFromString(id: string): DurableObjectId; - get( - id: DurableObjectId, - options?: DurableObjectNamespaceGetDurableObjectOptions - ): DurableObjectStub; - jurisdiction(jurisdiction: string): DurableObjectNamespace; -} -declare interface DurableObjectNamespaceNewUniqueIdOptions { - jurisdiction?: string; -} -declare interface DurableObjectNamespaceGetDurableObjectOptions { - locationHint?: string; -} -declare interface DurableObjectState { - waitUntil(promise: Promise): void; - readonly id: DurableObjectId; - readonly storage: DurableObjectStorage; - blockConcurrencyWhile(callback: () => Promise): Promise; -} -declare interface DurableObjectTransaction { - get( - key: string, - options?: DurableObjectGetOptions - ): Promise; - get( - keys: string[], - options?: DurableObjectGetOptions - ): Promise>; - list( - options?: DurableObjectListOptions - ): Promise>; - put( - key: string, - value: T, - options?: DurableObjectPutOptions - ): Promise; - put( - entries: Record, - options?: DurableObjectPutOptions - ): Promise; - delete(key: string, options?: DurableObjectPutOptions): Promise; - delete(keys: string[], options?: DurableObjectPutOptions): Promise; - rollback(): void; - getAlarm(options?: DurableObjectGetAlarmOptions): Promise; - setAlarm( - scheduledTime: number | Date, - options?: DurableObjectSetAlarmOptions - ): Promise; - deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise; -} -declare interface DurableObjectStorage { - get( - key: string, - options?: DurableObjectGetOptions - ): Promise; - get( - keys: string[], - options?: DurableObjectGetOptions - ): Promise>; - list( - options?: DurableObjectListOptions - ): Promise>; - put( - key: string, - value: T, - options?: DurableObjectPutOptions - ): Promise; - put( - entries: Record, - options?: DurableObjectPutOptions - ): Promise; - delete(key: string, options?: DurableObjectPutOptions): Promise; - delete(keys: string[], options?: DurableObjectPutOptions): Promise; - deleteAll(options?: DurableObjectPutOptions): Promise; - transaction( - closure: (txn: DurableObjectTransaction) => Promise - ): Promise; - getAlarm(options?: DurableObjectGetAlarmOptions): Promise; - setAlarm( - scheduledTime: number | Date, - options?: DurableObjectSetAlarmOptions - ): Promise; - deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise; - sync(): Promise; -} -declare interface DurableObjectListOptions { - start?: string; - startAfter?: string; - end?: string; - prefix?: string; - reverse?: boolean; - limit?: number; - allowConcurrency?: boolean; - noCache?: boolean; -} -declare interface DurableObjectGetOptions { - allowConcurrency?: boolean; - noCache?: boolean; -} -declare interface DurableObjectGetAlarmOptions { - allowConcurrency?: boolean; -} -declare interface DurableObjectPutOptions { - allowConcurrency?: boolean; - allowUnconfirmed?: boolean; - noCache?: boolean; -} -declare interface DurableObjectSetAlarmOptions { - allowConcurrency?: boolean; - allowUnconfirmed?: boolean; -} -declare interface AnalyticsEngineDataset { - writeDataPoint(event?: AnalyticsEngineDataPoint): void; -} -declare interface AnalyticsEngineDataPoint { - indexes?: ((ArrayBuffer | string) | null)[]; - doubles?: number[]; - blobs?: ((ArrayBuffer | string) | null)[]; -} -declare class Event { - constructor(type: string, init?: EventInit); - get type(): string; - get eventPhase(): number; - get composed(): boolean; - get bubbles(): boolean; - get cancelable(): boolean; - get defaultPrevented(): boolean; - get returnValue(): boolean; - get currentTarget(): EventTarget | undefined; - get srcElement(): EventTarget | undefined; - get timeStamp(): number; - get isTrusted(): boolean; - get cancelBubble(): boolean; - set cancelBubble(value: boolean); - stopImmediatePropagation(): void; - preventDefault(): void; - stopPropagation(): void; - composedPath(): EventTarget[]; - static readonly NONE: number; - static readonly CAPTURING_PHASE: number; - static readonly AT_TARGET: number; - static readonly BUBBLING_PHASE: number; -} -declare interface EventInit { - bubbles?: boolean; - cancelable?: boolean; - composed?: boolean; -} -declare type EventListener = ( - event: EventType -) => void; -declare interface EventListenerObject { - handleEvent(event: EventType): void; -} -declare type EventListenerOrEventListenerObject< - EventType extends Event = Event -> = EventListener | EventListenerObject; -declare class EventTarget< - EventMap extends Record = Record -> { - constructor(); - addEventListener( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetAddEventListenerOptions | boolean - ): void; - removeEventListener( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetEventListenerOptions | boolean - ): void; - dispatchEvent(event: EventMap[keyof EventMap]): boolean; -} -declare interface EventTargetEventListenerOptions { - capture?: boolean; -} -declare interface EventTargetAddEventListenerOptions { - capture?: boolean; - passive?: boolean; - once?: boolean; - signal?: AbortSignal; -} -declare interface EventTargetHandlerObject { - handleEvent: (event: Event) => any | undefined; -} -declare class AbortController { - constructor(); - get signal(): AbortSignal; - abort(reason?: any): void; -} -declare abstract class AbortSignal extends EventTarget { - static abort(reason?: any): AbortSignal; - static timeout(delay: number): AbortSignal; - get aborted(): boolean; - get reason(): any; - throwIfAborted(): void; -} -declare interface Scheduler { - wait(delay: number, maybeOptions?: SchedulerWaitOptions): Promise; -} -declare interface SchedulerWaitOptions { - signal?: AbortSignal; -} -declare abstract class ExtendableEvent extends Event { - waitUntil(promise: Promise): void; -} -declare class Blob { - constructor( - bits?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[], - options?: BlobOptions - ); - get size(): number; - get type(): string; - slice(start?: number, end?: number, type?: string): Blob; - arrayBuffer(): Promise; - text(): Promise; - stream(): ReadableStream; -} -declare interface BlobOptions { - type?: string; -} -declare class File extends Blob { - constructor( - bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined, - name: string, - options?: FileOptions - ); - get name(): string; - get lastModified(): number; -} -declare interface FileOptions { - type?: string; - lastModified?: number; -} -declare abstract class CacheStorage { - open(cacheName: string): Promise; - readonly default: Cache; -} -declare abstract class Cache { - delete(request: RequestInfo, options?: CacheQueryOptions): Promise; - match( - request: RequestInfo, - options?: CacheQueryOptions - ): Promise; - put(request: RequestInfo, response: Response): Promise; -} -declare interface CacheQueryOptions { - ignoreMethod?: boolean; -} -declare abstract class Crypto { - get subtle(): SubtleCrypto; - getRandomValues< - T extends - | Int8Array - | Uint8Array - | Int16Array - | Uint16Array - | Int32Array - | Uint32Array - | BigInt64Array - | BigUint64Array - >(buffer: T): T; - randomUUID(): string; - DigestStream: typeof DigestStream; -} -declare abstract class SubtleCrypto { - encrypt( - algorithm: string | SubtleCryptoEncryptAlgorithm, - key: CryptoKey, - plainText: ArrayBuffer | ArrayBufferView - ): Promise; - decrypt( - algorithm: string | SubtleCryptoEncryptAlgorithm, - key: CryptoKey, - cipherText: ArrayBuffer | ArrayBufferView - ): Promise; - sign( - algorithm: string | SubtleCryptoSignAlgorithm, - key: CryptoKey, - data: ArrayBuffer | ArrayBufferView - ): Promise; - verify( - algorithm: string | SubtleCryptoSignAlgorithm, - key: CryptoKey, - signature: ArrayBuffer | ArrayBufferView, - data: ArrayBuffer | ArrayBufferView - ): Promise; - digest( - algorithm: string | SubtleCryptoHashAlgorithm, - data: ArrayBuffer | ArrayBufferView - ): Promise; - generateKey( - algorithm: string | SubtleCryptoGenerateKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - deriveKey( - algorithm: string | SubtleCryptoDeriveKeyAlgorithm, - baseKey: CryptoKey, - derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - deriveBits( - algorithm: string | SubtleCryptoDeriveKeyAlgorithm, - baseKey: CryptoKey, - length: number | null - ): Promise; - importKey( - format: string, - keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey, - algorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - exportKey(format: string, key: CryptoKey): Promise; - wrapKey( - format: string, - key: CryptoKey, - wrappingKey: CryptoKey, - wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm - ): Promise; - unwrapKey( - format: string, - wrappedKey: ArrayBuffer | ArrayBufferView, - unwrappingKey: CryptoKey, - unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm, - unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - timingSafeEqual( - a: ArrayBuffer | ArrayBufferView, - b: ArrayBuffer | ArrayBufferView - ): boolean; -} -declare abstract class CryptoKey { - readonly type: string; - readonly extractable: boolean; - readonly algorithm: - | CryptoKeyKeyAlgorithm - | CryptoKeyAesKeyAlgorithm - | CryptoKeyHmacKeyAlgorithm - | CryptoKeyRsaKeyAlgorithm - | CryptoKeyEllipticKeyAlgorithm - | CryptoKeyArbitraryKeyAlgorithm; - readonly usages: string[]; -} -declare interface CryptoKeyPair { - publicKey: CryptoKey; - privateKey: CryptoKey; -} -declare 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; -} -declare interface RsaOtherPrimesInfo { - r?: string; - d?: string; - t?: string; -} -declare interface SubtleCryptoDeriveKeyAlgorithm { - name: string; - salt?: ArrayBuffer; - iterations?: number; - hash?: string | SubtleCryptoHashAlgorithm; - $public?: CryptoKey; - info?: ArrayBuffer; -} -declare interface SubtleCryptoEncryptAlgorithm { - name: string; - iv?: ArrayBuffer; - additionalData?: ArrayBuffer; - tagLength?: number; - counter?: ArrayBuffer; - length?: number; - label?: ArrayBuffer; -} -declare interface SubtleCryptoGenerateKeyAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - modulusLength?: number; - publicExponent?: ArrayBuffer; - length?: number; - namedCurve?: string; -} -declare interface SubtleCryptoHashAlgorithm { - name: string; -} -declare interface SubtleCryptoImportKeyAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - length?: number; - namedCurve?: string; - compressed?: boolean; -} -declare interface SubtleCryptoSignAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - dataLength?: number; - saltLength?: number; -} -declare interface CryptoKeyKeyAlgorithm { - name: string; -} -declare interface CryptoKeyAesKeyAlgorithm { - name: string; - length: number; -} -declare interface CryptoKeyHmacKeyAlgorithm { - name: string; - hash: CryptoKeyKeyAlgorithm; - length: number; -} -declare interface CryptoKeyRsaKeyAlgorithm { - name: string; - modulusLength: number; - publicExponent: ArrayBuffer; - hash?: CryptoKeyKeyAlgorithm; -} -declare interface CryptoKeyEllipticKeyAlgorithm { - name: string; - namedCurve: string; -} -declare interface CryptoKeyArbitraryKeyAlgorithm { - name: string; - hash?: CryptoKeyKeyAlgorithm; - namedCurve?: string; - length?: number; -} -declare class DigestStream extends WritableStream< - ArrayBuffer | ArrayBufferView -> { - constructor(algorithm: string | SubtleCryptoHashAlgorithm); - get digest(): Promise; -} -declare class TextDecoder { - constructor(decoder?: string, options?: TextDecoderConstructorOptions); - decode( - input?: ArrayBuffer | ArrayBufferView, - options?: TextDecoderDecodeOptions - ): string; - get encoding(): string; - get fatal(): boolean; - get ignoreBOM(): boolean; -} -declare class TextEncoder { - constructor(); - encode(input?: string): Uint8Array; - encodeInto(input: string, buffer: Uint8Array): TextEncoderEncodeIntoResult; - get encoding(): string; -} -declare interface TextDecoderConstructorOptions { - fatal: boolean; - ignoreBOM: boolean; -} -declare interface TextDecoderDecodeOptions { - stream: boolean; -} -declare interface TextEncoderEncodeIntoResult { - read: number; - written: number; -} -declare class FormData { - constructor(); - append(name: string, value: string): void; - append(name: string, value: Blob, filename?: string): void; - delete(name: string): void; - get(name: string): (File | string) | null; - getAll(name: string): (File | string)[]; - has(name: string): boolean; - set(name: string, value: string): void; - set(name: string, value: Blob, filename?: string): void; - entries(): IterableIterator<[key: string, value: File | string]>; - keys(): IterableIterator; - values(): IterableIterator; - forEach( - callback: ( - this: This, - value: File | string, - key: string, - parent: FormData - ) => void, - thisArg?: This - ): void; - [Symbol.iterator](): IterableIterator<[key: string, value: File | string]>; -} -declare interface ContentOptions { - html?: boolean; -} -declare class HTMLRewriter { - constructor(); - on( - selector: string, - handlers: HTMLRewriterElementContentHandlers - ): HTMLRewriter; - onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter; - transform(response: Response): Response; -} -declare interface HTMLRewriterElementContentHandlers { - element?(element: Element): void | Promise; - comments?(comment: Comment): void | Promise; - text?(element: Text): void | Promise; -} -declare interface HTMLRewriterDocumentContentHandlers { - doctype?(doctype: Doctype): void | Promise; - comments?(comment: Comment): void | Promise; - text?(text: Text): void | Promise; - end?(end: DocumentEnd): void | Promise; -} -declare interface Doctype { - readonly name: string | null; - readonly publicId: string | null; - readonly systemId: string | null; -} -declare interface Element { - tagName: string; - readonly attributes: IterableIterator; - 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, options?: ContentOptions): Element; - after(content: string, options?: ContentOptions): Element; - prepend(content: string, options?: ContentOptions): Element; - append(content: string, options?: ContentOptions): Element; - replace(content: string, options?: ContentOptions): Element; - remove(): Element; - removeAndKeepContent(): Element; - setInnerContent(content: string, options?: ContentOptions): Element; - onEndTag(handler: (tag: EndTag) => void | Promise): void; -} -declare interface EndTag { - name: string; - before(content: string, options?: ContentOptions): EndTag; - after(content: string, options?: ContentOptions): EndTag; - remove(): EndTag; -} -declare 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; -} -declare interface Text { - readonly text: string; - readonly lastInTextNode: boolean; - readonly removed: boolean; - before(content: string, options?: ContentOptions): Text; - after(content: string, options?: ContentOptions): Text; - replace(content: string, options?: ContentOptions): Text; - remove(): Text; -} -declare interface DocumentEnd { - append(content: string, options?: ContentOptions): DocumentEnd; -} -declare abstract class FetchEvent extends ExtendableEvent { - readonly request: Request; - respondWith(promise: Response | Promise): void; - passThroughOnException(): void; -} -declare type HeadersInit = - | Headers - | Iterable> - | Record; -declare class Headers { - constructor(init?: HeadersInit); - get(name: string): string | null; - getAll(name: string): string[]; - has(name: string): boolean; - set(name: string, value: string): void; - append(name: string, value: string): void; - delete(name: string): void; - forEach( - callback: (this: This, value: string, key: string, parent: Headers) => void, - thisArg?: This - ): void; - entries(): IterableIterator<[key: string, value: string]>; - keys(): IterableIterator; - values(): IterableIterator; - [Symbol.iterator](): IterableIterator<[key: string, value: string]>; -} -declare type BodyInit = - | ReadableStream - | string - | ArrayBuffer - | ArrayBufferView - | Blob - | URLSearchParams - | FormData; -declare abstract class Body { - get body(): ReadableStream | null; - get bodyUsed(): boolean; - arrayBuffer(): Promise; - text(): Promise; - json(): Promise; - formData(): Promise; - blob(): Promise; -} -declare class Response extends Body { - constructor(body?: BodyInit | null, init?: ResponseInit); - static redirect(url: string, status?: number): Response; - static json(any: any, maybeInit?: ResponseInit | Response): Response; - clone(): Response; - get status(): number; - get statusText(): string; - get headers(): Headers; - get ok(): boolean; - get redirected(): boolean; - get url(): string; - get webSocket(): WebSocket | null; - get cf(): any | undefined; -} -declare interface ResponseInit { - status?: number; - statusText?: string; - headers?: HeadersInit; - cf?: any; - webSocket?: WebSocket | null; - encodeBody?: "automatic" | "manual"; -} -declare type RequestInfo< - CfHostMetadata = unknown, - Cf = CfProperties -> = Request | string | URL; -declare class Request< - CfHostMetadata = unknown, - Cf = CfProperties -> extends Body { - constructor(input: RequestInfo, init?: RequestInit); - clone(): Request; - get method(): string; - get url(): string; - get headers(): Headers; - get redirect(): string; - get fetcher(): Fetcher | null; - get signal(): AbortSignal; - get cf(): Cf | undefined; - get integrity(): string; - get keepalive(): boolean; -} -declare interface RequestInit { - /** 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 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; -} -declare abstract class Fetcher { - fetch(input: RequestInfo, init?: RequestInit): Promise; -} -declare interface FetcherPutOptions { - expiration?: number; - expirationTtl?: number; -} -declare interface KVNamespaceListKey { - name: Key; - expiration?: number; - metadata?: Metadata; -} -declare type KVNamespaceListResult = - | { - list_complete: false; - keys: KVNamespaceListKey[]; - cursor: string; - } - | { - list_complete: true; - keys: KVNamespaceListKey[]; - }; -declare interface KVNamespace { - get( - key: Key, - options?: Partial> - ): Promise; - get(key: Key, type: "text"): Promise; - get( - key: Key, - type: "json" - ): Promise; - get(key: Key, type: "arrayBuffer"): Promise; - get(key: Key, type: "stream"): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"text"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"json"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"arrayBuffer"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"stream"> - ): Promise; - list( - options?: KVNamespaceListOptions - ): Promise>; - put( - key: Key, - value: string | ArrayBuffer | ArrayBufferView | ReadableStream, - options?: KVNamespacePutOptions - ): Promise; - getWithMetadata( - key: Key, - options?: Partial> - ): Promise>; - getWithMetadata( - key: Key, - type: "text" - ): Promise>; - getWithMetadata( - key: Key, - type: "json" - ): Promise>; - getWithMetadata( - key: Key, - type: "arrayBuffer" - ): Promise>; - getWithMetadata( - key: Key, - type: "stream" - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"text"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"json"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"arrayBuffer"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"stream"> - ): Promise>; - delete(key: Key): Promise; -} -declare interface KVNamespaceListOptions { - limit?: number; - prefix?: string | null; - cursor?: string | null; -} -declare interface KVNamespaceGetOptions { - type: Type; - cacheTtl?: number; -} -declare interface KVNamespacePutOptions { - expiration?: number; - expirationTtl?: number; - metadata?: any | null; -} -declare interface KVNamespaceGetWithMetadataResult { - value: Value | null; - metadata: Metadata | null; -} -declare interface R2Error extends Error { - readonly name: string; - readonly code: number; - readonly message: string; - readonly action: string; - readonly stack: any; -} -declare interface R2ListOptions { - limit?: number; - prefix?: string; - cursor?: string; - delimiter?: string; - startAfter?: string; - include?: ("httpMetadata" | "customMetadata")[]; -} -declare abstract class R2Bucket { - head(key: string): Promise; - get( - key: string, - options: R2GetOptions & { - onlyIf: R2Conditional | Headers; - } - ): Promise; - get(key: string, options?: R2GetOptions): Promise; - put( - key: string, - value: - | ReadableStream - | ArrayBuffer - | ArrayBufferView - | string - | null - | Blob, - options?: R2PutOptions - ): Promise; - put( - key: string, - value: - | ReadableStream - | ArrayBuffer - | ArrayBufferView - | string - | null - | Blob, - options?: R2PutOptions & { - onlyIf: R2Conditional | Headers; - } - ): Promise; - createMultipartUpload( - key: string, - options?: R2MultipartOptions - ): Promise; - resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload; - delete(keys: string | string[]): Promise; - list(options?: R2ListOptions): Promise; -} -declare interface R2MultipartUpload { - readonly key: string; - readonly uploadId: string; - uploadPart( - partNumber: number, - value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob - ): Promise; - abort(): Promise; - complete(uploadedParts: R2UploadedPart[]): Promise; -} -declare 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; - readonly range?: R2Range; - writeHttpMetadata(headers: Headers): void; -} -declare interface R2ObjectBody extends R2Object { - get body(): ReadableStream; - get bodyUsed(): boolean; - arrayBuffer(): Promise; - text(): Promise; - json(): Promise; - blob(): Promise; -} -declare type R2Range = - | { - offset: number; - length?: number; - } - | { - offset?: number; - length: number; - } - | { - suffix: number; - }; -declare interface R2Conditional { - etagMatches?: string; - etagDoesNotMatch?: string; - uploadedBefore?: Date; - uploadedAfter?: Date; - secondsGranularity?: boolean; -} -declare interface R2GetOptions { - onlyIf?: R2Conditional | Headers; - range?: R2Range | Headers; -} -declare interface R2PutOptions { - onlyIf?: R2Conditional | Headers; - httpMetadata?: R2HTTPMetadata | Headers; - customMetadata?: Record; - md5?: ArrayBuffer | string; - sha1?: ArrayBuffer | string; - sha256?: ArrayBuffer | string; - sha384?: ArrayBuffer | string; - sha512?: ArrayBuffer | string; -} -declare interface R2MultipartOptions { - httpMetadata?: R2HTTPMetadata | Headers; - customMetadata?: Record; -} -declare interface R2Checksums { - readonly md5?: ArrayBuffer; - readonly sha1?: ArrayBuffer; - readonly sha256?: ArrayBuffer; - readonly sha384?: ArrayBuffer; - readonly sha512?: ArrayBuffer; - toJSON(): R2StringChecksums; -} -declare interface R2StringChecksums { - md5?: string; - sha1?: string; - sha256?: string; - sha384?: string; - sha512?: string; -} -declare interface R2HTTPMetadata { - contentType?: string; - contentLanguage?: string; - contentDisposition?: string; - contentEncoding?: string; - cacheControl?: string; - cacheExpiry?: Date; -} -declare interface R2Objects { - objects: R2Object[]; - truncated: boolean; - cursor?: string; - delimitedPrefixes: string[]; -} -declare abstract class ScheduledEvent extends ExtendableEvent { - readonly scheduledTime: number; - readonly cron: string; - noRetry(): void; -} -declare interface ScheduledController { - readonly scheduledTime: number; - readonly cron: string; - noRetry(): void; -} -declare interface QueuingStrategy { - highWaterMark?: number | bigint; - size?: (chunk: T) => number | bigint; -} -declare interface UnderlyingSink { - type?: string; - start?: (controller: WritableStreamDefaultController) => void | Promise; - write?: ( - chunk: W, - controller: WritableStreamDefaultController - ) => void | Promise; - abort?: (reason: any) => void | Promise; - close?: () => void | Promise; -} -declare interface UnderlyingByteSource { - type: "bytes"; - autoAllocateChunkSize?: number; - start?: (controller: ReadableByteStreamController) => void | Promise; - pull?: (controller: ReadableByteStreamController) => void | Promise; - cancel?: (reason: any) => void | Promise; -} -declare interface UnderlyingSource { - type?: "" | undefined; - start?: ( - controller: ReadableStreamDefaultController - ) => void | Promise; - pull?: ( - controller: ReadableStreamDefaultController - ) => void | Promise; - cancel?: (reason: any) => void | Promise; -} -declare interface Transformer { - readableType?: string; - writableType?: string; - start?: ( - controller: TransformStreamDefaultController - ) => void | Promise; - transform?: ( - chunk: I, - controller: TransformStreamDefaultController - ) => void | Promise; - flush?: ( - controller: TransformStreamDefaultController - ) => void | Promise; -} -declare interface StreamPipeOptions { - /** - * 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; - preventAbort?: boolean; - preventCancel?: boolean; - signal?: AbortSignal; -} -declare type ReadableStreamReadResult = - | { - done: false; - value: R; - } - | { - done: true; - value?: undefined; - }; -/** This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object. */ -declare interface ReadableStream { - get locked(): boolean; - cancel(reason?: any): Promise; - getReader(): ReadableStreamDefaultReader; - getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader; - pipeThrough( - transform: ReadableWritablePair, - options?: StreamPipeOptions - ): ReadableStream; - pipeTo( - destination: WritableStream, - options?: StreamPipeOptions - ): Promise; - tee(): [ReadableStream, ReadableStream]; - values(options?: ReadableStreamValuesOptions): AsyncIterableIterator; - [Symbol.asyncIterator]( - options?: ReadableStreamValuesOptions - ): AsyncIterableIterator; -} -declare const ReadableStream: { - prototype: ReadableStream; - new ( - underlyingSource: UnderlyingByteSource, - strategy?: QueuingStrategy - ): ReadableStream; - new ( - underlyingSource?: UnderlyingSource, - strategy?: QueuingStrategy - ): ReadableStream; -}; -declare class ReadableStreamDefaultReader { - constructor(stream: ReadableStream); - get closed(): Promise; - cancel(reason?: any): Promise; - read(): Promise>; - releaseLock(): void; -} -declare class ReadableStreamBYOBReader { - constructor(stream: ReadableStream); - get closed(): Promise; - cancel(reason?: any): Promise; - read( - view: T - ): Promise>; - releaseLock(): void; - readAtLeast( - minElements: number, - view: T - ): Promise>; -} -declare interface ReadableStreamGetReaderOptions { - mode: "byob"; -} -declare interface ReadableStreamBYOBRequest { - readonly view: Uint8Array | null; - respond(bytesWritten: number): void; - respondWithNewView(view: ArrayBuffer | ArrayBufferView): void; - readonly atLeast: number | null; -} -declare interface ReadableStreamDefaultController { - readonly desiredSize: number | null; - close(): void; - enqueue(chunk?: R): void; - error(reason: any): void; -} -declare interface ReadableByteStreamController { - readonly byobRequest: ReadableStreamBYOBRequest | null; - readonly desiredSize: number | null; - close(): void; - enqueue(chunk: ArrayBuffer | ArrayBufferView): void; - error(reason: any): void; -} -/** This Streams API interface represents a controller allowing control of a WritableStream's state. When constructing a WritableStream, the underlying sink is given a corresponding WritableStreamDefaultController instance to manipulate. */ -declare interface WritableStreamDefaultController { - readonly signal: AbortSignal; - error(reason?: any): void; -} -declare interface TransformStreamDefaultController { - get desiredSize(): number | null; - enqueue(chunk?: O): void; - error(reason: any): void; - terminate(): void; -} -declare interface ReadableWritablePair { - /** - * 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; - readable: ReadableStream; -} -declare class WritableStream { - constructor( - underlyingSink?: UnderlyingSink, - queuingStrategy?: QueuingStrategy - ); - get locked(): boolean; - abort(reason?: any): Promise; - close(): Promise; - getWriter(): WritableStreamDefaultWriter; -} -declare class WritableStreamDefaultWriter { - constructor(stream: WritableStream); - get closed(): Promise; - get ready(): Promise; - get desiredSize(): number | null; - abort(reason?: any): Promise; - close(): Promise; - write(chunk?: W): Promise; - releaseLock(): void; -} -declare class TransformStream { - constructor( - transformer?: Transformer, - writableStrategy?: QueuingStrategy, - readableStrategy?: QueuingStrategy - ); - get readable(): ReadableStream; - get writable(): WritableStream; -} -declare class FixedLengthStream extends IdentityTransformStream { - constructor(expectedLength: number | bigint); -} -declare class IdentityTransformStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(); -} -declare interface ReadableStreamValuesOptions { - preventCancel?: boolean; -} -declare class CompressionStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(format: "gzip" | "deflate" | "deflate-raw"); -} -declare class DecompressionStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(format: "gzip" | "deflate" | "deflate-raw"); -} -declare class TextEncoderStream extends TransformStream { - constructor(); -} -declare class TextDecoderStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - string -> { - constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit); -} -declare interface TextDecoderStreamTextDecoderStreamInit { - fatal?: boolean; -} -declare class ByteLengthQueuingStrategy - implements QueuingStrategy -{ - constructor(init: QueuingStrategyInit); - get highWaterMark(): number; - get size(): (chunk?: any) => number; -} -declare class CountQueuingStrategy implements QueuingStrategy { - constructor(init: QueuingStrategyInit); - get highWaterMark(): number; - get size(): (chunk?: any) => number; -} -declare 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; -} -declare abstract class TraceEvent extends ExtendableEvent { - readonly traces: TraceItem[]; -} -declare interface TraceItem { - readonly event: - | ( - | TraceItemFetchEventInfo - | TraceItemScheduledEventInfo - | TraceItemAlarmEventInfo - | TraceItemQueueEventInfo - | TraceItemEmailEventInfo - | TraceItemCustomEventInfo - ) - | null; - readonly eventTimestamp: number | null; - readonly logs: TraceLog[]; - readonly exceptions: TraceException[]; - readonly scriptName: string | null; - readonly dispatchNamespace?: string; - readonly scriptTags?: string[]; - readonly outcome: string; -} -declare interface TraceItemAlarmEventInfo { - readonly scheduledTime: Date; -} -declare interface TraceItemCustomEventInfo {} -declare interface TraceItemScheduledEventInfo { - readonly scheduledTime: number; - readonly cron: string; -} -declare interface TraceItemQueueEventInfo { - readonly queue: string; - readonly batchSize: number; -} -declare interface TraceItemEmailEventInfo { - readonly mailFrom: string; - readonly rcptTo: string; - readonly rawSize: number; -} -declare interface TraceItemFetchEventInfo { - readonly response?: TraceItemFetchEventInfoResponse; - readonly request: TraceItemFetchEventInfoRequest; -} -declare interface TraceItemFetchEventInfoRequest { - readonly cf?: any; - readonly headers: Record; - readonly method: string; - readonly url: string; - getUnredacted(): TraceItemFetchEventInfoRequest; -} -declare interface TraceItemFetchEventInfoResponse { - readonly status: number; -} -declare interface TraceLog { - readonly timestamp: number; - readonly level: string; - readonly message: any; -} -declare interface TraceException { - readonly timestamp: number; - readonly message: string; - readonly name: string; -} -declare interface TraceMetrics { - readonly cpuTime: number; - readonly wallTime: number; -} -declare interface UnsafeTraceMetrics { - fromTrace(item: TraceItem): TraceMetrics; -} -declare class URL { - constructor(url: string | URL, base?: string | URL); - get origin(): string; - get href(): string; - set href(value: string); - get protocol(): string; - set protocol(value: string); - get username(): string; - set username(value: string); - get password(): string; - set password(value: string); - get host(): string; - set host(value: string); - get hostname(): string; - set hostname(value: string); - get port(): string; - set port(value: string); - get pathname(): string; - set pathname(value: string); - get search(): string; - set search(value: string); - get hash(): string; - set hash(value: string); - get searchParams(): URLSearchParams; - toJSON(): string; - toString(): string; - static canParse(url: string, base?: string): boolean; -} -declare class URLSearchParams { - constructor( - init?: Iterable> | Record | string - ); - get size(): number; - append(name: string, value: string): void; - delete(name: string): void; - get(name: string): string | null; - getAll(name: string): string[]; - has(name: string): boolean; - set(name: string, value: string): void; - sort(): void; - entries(): IterableIterator<[key: string, value: string]>; - keys(): IterableIterator; - values(): IterableIterator; - forEach( - callback: ( - this: This, - value: string, - key: string, - parent: URLSearchParams - ) => void, - thisArg?: This - ): void; - toString(): string; - [Symbol.iterator](): IterableIterator<[key: string, value: string]>; -} -declare class URLPattern { - constructor(input?: string | URLPatternURLPatternInit, baseURL?: string); - get protocol(): string; - get username(): string; - get password(): string; - get hostname(): string; - get port(): string; - get pathname(): string; - get search(): string; - get hash(): string; - test(input?: string | URLPatternURLPatternInit, baseURL?: string): boolean; - exec( - input?: string | URLPatternURLPatternInit, - baseURL?: string - ): URLPatternURLPatternResult | null; -} -declare interface URLPatternURLPatternInit { - protocol?: string; - username?: string; - password?: string; - hostname?: string; - port?: string; - pathname?: string; - search?: string; - hash?: string; - baseURL?: string; -} -declare interface URLPatternURLPatternComponentResult { - input: string; - groups: Record; -} -declare interface URLPatternURLPatternResult { - inputs: (string | URLPatternURLPatternInit)[]; - protocol: URLPatternURLPatternComponentResult; - username: URLPatternURLPatternComponentResult; - password: URLPatternURLPatternComponentResult; - hostname: URLPatternURLPatternComponentResult; - port: URLPatternURLPatternComponentResult; - pathname: URLPatternURLPatternComponentResult; - search: URLPatternURLPatternComponentResult; - hash: URLPatternURLPatternComponentResult; -} -declare class CloseEvent extends Event { - constructor(type: string, initializer: CloseEventInit); - /** Returns the WebSocket connection close code provided by the server. */ - readonly code: number; - /** Returns the WebSocket connection close reason provided by the server. */ - readonly reason: string; - /** Returns true if the connection closed cleanly; false otherwise. */ - readonly wasClean: boolean; -} -declare interface CloseEventInit { - code?: number; - reason?: string; - wasClean?: boolean; -} -declare class MessageEvent extends Event { - constructor(type: string, initializer: MessageEventInit); - readonly data: ArrayBuffer | string; -} -declare interface MessageEventInit { - data: ArrayBuffer | string; -} -/** Events providing information related to errors in scripts or in files. */ -declare interface ErrorEvent extends Event { - readonly filename: string; - readonly message: string; - readonly lineno: number; - readonly colno: number; - readonly error: any; -} -declare type WebSocketEventMap = { - close: CloseEvent; - message: MessageEvent; - open: Event; - error: ErrorEvent; -}; -declare class WebSocket extends EventTarget { - constructor(url: string, protocols?: string[] | string); - accept(): void; - send(message: (ArrayBuffer | ArrayBufferView) | string): void; - close(code?: number, reason?: string): void; - static readonly READY_STATE_CONNECTING: number; - static readonly READY_STATE_OPEN: number; - static readonly READY_STATE_CLOSING: number; - static readonly READY_STATE_CLOSED: number; - get readyState(): number; - get url(): string | null; - get protocol(): string | null; - get extensions(): string | null; -} -declare const WebSocketPair: { - new (): { - 0: WebSocket; - 1: WebSocket; - }; -}; -declare interface BasicImageTransformations { - /** - * Maximum width in image pixels. The value must be an integer. - */ - width?: number; - /** - * Maximum height in image pixels. The value must be an integer. - */ - height?: number; - /** - * Resizing mode as a string. It affects interpretation of width and height - * options: - * - scale-down: Similar to contain, but the image is never enlarged. If - * the image is larger than given width or height, it will be resized. - * Otherwise its original size will be kept. - * - contain: Resizes to maximum size that fits within the given width and - * height. If only a single dimension is given (e.g. only width), the - * image will be shrunk or enlarged to exactly match that dimension. - * Aspect ratio is always preserved. - * - cover: Resizes (shrinks or enlarges) to fill the entire area of width - * and height. If the image has an aspect ratio different from the ratio - * of width and height, it will be cropped to fit. - * - crop: The image will be shrunk and cropped to fit within the area - * specified by width and height. The image will not be enlarged. For images - * smaller than the given dimensions it's the same as scale-down. For - * images larger than the given dimensions, it's the same as cover. - * See also trim. - * - pad: Resizes to the maximum size that fits within the given width and - * height, and then fills the remaining area with a background color - * (white by default). Use of this mode is not recommended, as the same - * effect can be more efficiently achieved with the contain mode and the - * CSS object-fit: contain property. - */ - fit?: "scale-down" | "contain" | "cover" | "crop" | "pad"; - /** - * When cropping with fit: "cover", this defines the side or point that should - * be left uncropped. The value is either a string - * "left", "right", "top", "bottom", "auto", or "center" (the default), - * or an object {x, y} containing focal point coordinates in the original - * image expressed as fractions ranging from 0.0 (top or left) to 1.0 - * (bottom or right), 0.5 being the center. {fit: "cover", gravity: "top"} will - * crop bottom or left and right sides as necessary, but won’t crop anything - * from the top. {fit: "cover", gravity: {x:0.5, y:0.2}} will crop each side to - * preserve as much as possible around a point at 20% of the height of the - * source image. - */ - gravity?: - | "left" - | "right" - | "top" - | "bottom" - | "center" - | "auto" - | BasicImageTransformationsGravityCoordinates; - /** - * Background color to add underneath the image. Applies only to images with - * transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…), - * hsl(…), etc.) - */ - background?: string; - /** - * Number of degrees (90, 180, 270) to rotate the image by. width and height - * options refer to axes after rotation. - */ - rotate?: 0 | 90 | 180 | 270 | 360; -} -declare interface BasicImageTransformationsGravityCoordinates { - x: number; - y: number; -} -/** - * In addition to the properties you can set in the RequestInit dict - * that you pass as an argument to the Request constructor, you can - * set certain properties of a `cf` object to control how Cloudflare - * features are applied to that new Request. - * - * Note: Currently, these properties cannot be tested in the - * playground. - */ -declare interface RequestInitCfProperties extends Record { - cacheEverything?: boolean; - /** - * A request's cache key is what determines if two requests are - * "the same" for caching purposes. If a request has the same cache key - * as some previous request, then we can serve the same cached response for - * both. (e.g. 'some-key') - * - * Only available for Enterprise customers. - */ - cacheKey?: string; - /** - * This allows you to append additional Cache-Tag response headers - * to the origin response without modifications to the origin server. - * This will allow for greater control over the Purge by Cache Tag feature - * utilizing changes only in the Workers process. - * - * Only available for Enterprise customers. - */ - cacheTags?: string[]; - /** - * Force response to be cached for a given number of seconds. (e.g. 300) - */ - cacheTtl?: number; - /** - * Force response to be cached for a given number of seconds based on the Origin status code. - * (e.g. { '200-299': 86400, '404': 1, '500-599': 0 }) - */ - cacheTtlByStatus?: Record; - scrapeShield?: boolean; - apps?: boolean; - image?: RequestInitCfPropertiesImage; - minify?: RequestInitCfPropertiesImageMinify; - mirage?: boolean; - polish?: "lossy" | "lossless" | "off"; - /** - * Redirects the request to an alternate origin server. You can use this, - * for example, to implement load balancing across several origins. - * (e.g.us-east.example.com) - * - * Note - For security reasons, the hostname set in resolveOverride must - * be proxied on the same Cloudflare zone of the incoming request. - * Otherwise, the setting is ignored. CNAME hosts are allowed, so to - * resolve to a host under a different domain or a DNS only domain first - * declare a CNAME record within your own zone’s DNS mapping to the - * external hostname, set proxy on Cloudflare, then set resolveOverride - * to point to that CNAME record. - */ - resolveOverride?: string; -} -declare interface RequestInitCfPropertiesImageDraw - extends BasicImageTransformations { - /** - * Absolute URL of the image file to use for the drawing. It can be any of - * the supported file formats. For drawing of watermarks or non-rectangular - * overlays we recommend using PNG or WebP images. - */ - url: string; - /** - * Floating-point number between 0 (transparent) and 1 (opaque). - * For example, opacity: 0.5 makes overlay semitransparent. - */ - opacity?: number; - /** - * - If set to true, the overlay image will be tiled to cover the entire - * area. This is useful for stock-photo-like watermarks. - * - If set to "x", the overlay image will be tiled horizontally only - * (form a line). - * - If set to "y", the overlay image will be tiled vertically only - * (form a line). - */ - repeat?: true | "x" | "y"; - /** - * Position of the overlay image relative to a given edge. Each property is - * an offset in pixels. 0 aligns exactly to the edge. For example, left: 10 - * positions left side of the overlay 10 pixels from the left edge of the - * image it's drawn over. bottom: 0 aligns bottom of the overlay with bottom - * of the background image. - * - * Setting both left & right, or both top & bottom is an error. - * - * If no position is specified, the image will be centered. - */ - top?: number; - left?: number; - bottom?: number; - right?: number; -} -declare interface RequestInitCfPropertiesImage - extends BasicImageTransformations { - /** - * Device Pixel Ratio. Default 1. Multiplier for width/height that makes it - * easier to specify higher-DPI sizes in . - */ - dpr?: number; - /** - * An object with four properties {left, top, right, bottom} that specify - * a number of pixels to cut off on each side. Allows removal of borders - * or cutting out a specific fragment of an image. Trimming is performed - * before resizing or rotation. Takes dpr into account. - */ - trim?: { - left?: number; - top?: number; - right?: number; - bottom?: number; - }; - /** - * Quality setting from 1-100 (useful values are in 60-90 range). Lower values - * make images look worse, but load faster. The default is 85. It applies only - * to JPEG and WebP images. It doesn’t have any effect on PNG. - */ - quality?: number; - /** - * Output format to generate. It can be: - * - avif: generate images in AVIF format. - * - webp: generate images in Google WebP format. Set quality to 100 to get - * the WebP-lossless format. - * - json: instead of generating an image, outputs information about the - * image, in JSON format. The JSON object will contain image size - * (before and after resizing), source image’s MIME type, file size, etc. - * - jpeg: generate images in JPEG format. - * - png: generate images in PNG format. - */ - format?: "avif" | "webp" | "json" | "jpeg" | "png"; - /** - * Whether to preserve animation frames from input files. Default is true. - * Setting it to false reduces animations to still images. This setting is - * recommended when enlarging images or processing arbitrary user content, - * because large GIF animations can weigh tens or even hundreds of megabytes. - * It is also useful to set anim:false when using format:"json" to get the - * response quicker without the number of frames. - */ - anim?: boolean; - /** - * What EXIF data should be preserved in the output image. Note that EXIF - * rotation and embedded color profiles are always applied ("baked in" into - * the image), and aren't affected by this option. Note that if the Polish - * feature is enabled, all metadata may have been removed already and this - * option may have no effect. - * - keep: Preserve most of EXIF metadata, including GPS location if there's - * any. - * - copyright: Only keep the copyright tag, and discard everything else. - * This is the default behavior for JPEG files. - * - none: Discard all invisible EXIF metadata. Currently WebP and PNG - * output formats always discard metadata. - */ - metadata?: "keep" | "copyright" | "none"; - /** - * Strength of sharpening filter to apply to the image. Floating-point - * number between 0 (no sharpening, default) and 10 (maximum). 1.0 is a - * recommended value for downscaled images. - */ - sharpen?: number; - /** - * Radius of a blur filter (approximate gaussian). Maximum supported radius - * is 250. - */ - blur?: number; - /** - * Overlays are drawn in the order they appear in the array (last array - * entry is the topmost layer). - */ - draw?: RequestInitCfPropertiesImageDraw[]; - /** - * Fetching image from authenticated origin. Setting this property will - * pass authentication headers (Authorization, Cookie, etc.) through to - * the origin. - */ - "origin-auth"?: "share-publicly"; - /** - * Adds a border around the image. The border is added after resizing. Border - * width takes dpr into account, and can be specified either using a single - * width property, or individually for each side. - */ - border?: - | { - color: string; - width: number; - } - | { - color: string; - top: number; - right: number; - bottom: number; - left: number; - }; - /** - * Increase brightness by a factor. A value of 1.0 equals no change, a value - * of 0.5 equals half brightness, and a value of 2.0 equals twice as bright. - * 0 is ignored. - */ - brightness?: number; - /** - * Increase contrast by a factor. A value of 1.0 equals no change, a value of - * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is - * ignored. - */ - contrast?: number; - /** - * Increase exposure by a factor. A value of 1.0 equals no change, a value of - * 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored. - */ - gamma?: number; - /** - * Slightly reduces latency on a cache miss by selecting a - * quickest-to-compress file format, at a cost of increased file size and - * lower image quality. It will usually override the format option and choose - * JPEG over WebP or AVIF. We do not recommend using this option, except in - * unusual circumstances like resizing uncacheable dynamically-generated - * images. - */ - compression?: "fast"; -} -declare interface RequestInitCfPropertiesImageMinify { - javascript?: boolean; - css?: boolean; - html?: boolean; -} -/** - * Request metadata provided by Cloudflare's edge. - */ -declare type IncomingRequestCfProperties = - IncomingRequestCfPropertiesBase & - IncomingRequestCfPropertiesBotManagementEnterprise & - IncomingRequestCfPropertiesCloudflareForSaaSEnterprise & - IncomingRequestCfPropertiesGeographicInformation & - IncomingRequestCfPropertiesCloudflareAccessOrApiShield; -declare interface IncomingRequestCfPropertiesBase - extends Record { - /** - * [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request. - * - * @example 395747 - */ - asn: number; - /** - * The organization which owns the ASN of the incoming request. - * - * @example "Google Cloud" - */ - asOrganization: string; - /** - * The original value of the `Accept-Encoding` header if Cloudflare modified it. - * - * @example "gzip, deflate, br" - */ - clientAcceptEncoding?: string; - /** - * The number of milliseconds it took for the request to reach your worker. - * - * @example 22 - */ - clientTcpRtt?: number; - /** - * The three-letter [IATA](https://en.wikipedia.org/wiki/IATA_airport_code) - * airport code of the data center that the request hit. - * - * @example "DFW" - */ - colo: string; - /** - * Represents the upstream's response to a - * [TCP `keepalive` message](https://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html) - * from cloudflare. - * - * For workers with no upstream, this will always be `1`. - * - * @example 3 - */ - edgeRequestKeepAliveStatus: IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus; - /** - * The HTTP Protocol the request used. - * - * @example "HTTP/2" - */ - httpProtocol: string; - /** - * The browser-requested prioritization information in the request object. - * - * If no information was set, defaults to the empty string `""` - * - * @example "weight=192;exclusive=0;group=3;group-weight=127" - * @default "" - */ - requestPriority: string; - /** - * The TLS version of the connection to Cloudflare. - * In requests served over plaintext (without TLS), this property is the empty string `""`. - * - * @example "TLSv1.3" - */ - tlsVersion: string; - /** - * The cipher for the connection to Cloudflare. - * In requests served over plaintext (without TLS), this property is the empty string `""`. - * - * @example "AEAD-AES128-GCM-SHA256" - */ - tlsCipher: string; - /** - * Metadata containing the [`HELLO`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2) and [`FINISHED`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9) messages from this request's TLS handshake. - * - * If the incoming request was served over plaintext (without TLS) this field is undefined. - */ - tlsExportedAuthenticator?: IncomingRequestCfPropertiesExportedAuthenticatorMetadata; -} -declare interface IncomingRequestCfPropertiesBotManagementBase { - /** - * Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot, - * represented as an integer percentage between `1` (almost certainly human) - * and `99` (almost certainly a bot). - * - * @example 54 - */ - score: number; - /** - * A boolean value that is true if the request comes from a good bot, like Google or Bing. - * Most customers choose to allow this traffic. For more details, see [Traffic from known bots](https://developers.cloudflare.com/firewall/known-issues-and-faq/#how-does-firewall-rules-handle-traffic-from-known-bots). - */ - verifiedBot: boolean; - /** - * A boolean value that is true if the request originates from a - * Cloudflare-verified proxy service. - */ - corporateProxy: boolean; - /** - * A boolean value that's true if the request matches [file extensions](https://developers.cloudflare.com/bots/reference/static-resources/) for many types of static resources. - */ - staticResource: boolean; - /** - * List of IDs that correlate to the Bot Management heuristic detections made on a request (you can have multiple heuristic detections on the same request). - */ - detectionIds: number[]; -} -declare interface IncomingRequestCfPropertiesBotManagement { - /** - * Results of Cloudflare's Bot Management analysis - */ - botManagement: IncomingRequestCfPropertiesBotManagementBase; - /** - * Duplicate of `botManagement.score`. - * - * @deprecated - */ - clientTrustScore: number; -} -declare interface IncomingRequestCfPropertiesBotManagementEnterprise - extends IncomingRequestCfPropertiesBotManagement { - /** - * Results of Cloudflare's Bot Management analysis - */ - botManagement: IncomingRequestCfPropertiesBotManagementBase & { - /** - * A [JA3 Fingerprint](https://developers.cloudflare.com/bots/concepts/ja3-fingerprint/) to help profile specific SSL/TLS clients - * across different destination IPs, Ports, and X509 certificates. - */ - ja3Hash: string; - }; -} -declare interface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise< - HostMetadata -> { - /** - * Custom metadata set per-host in [Cloudflare for SaaS](https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/). - * - * This field is only present if you have Cloudflare for SaaS enabled on your account - * and you have followed the [required steps to enable it]((https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/domain-support/custom-metadata/)). - */ - hostMetadata: HostMetadata; -} -declare interface IncomingRequestCfPropertiesCloudflareAccessOrApiShield { - /** - * Information about the client certificate presented to Cloudflare. - * - * This is populated when the incoming request is served over TLS using - * either Cloudflare Access or API Shield (mTLS) - * and the presented SSL certificate has a valid - * [Certificate Serial Number](https://ldapwiki.com/wiki/Certificate%20Serial%20Number) - * (i.e., not `null` or `""`). - * - * Otherwise, a set of placeholder values are used. - * - * The property `certPresented` will be set to `"1"` when - * the object is populated (i.e. the above conditions were met). - */ - tlsClientAuth: - | IncomingRequestCfPropertiesTLSClientAuth - | IncomingRequestCfPropertiesTLSClientAuthPlaceholder; -} -/** - * Metadata about the request's TLS handshake - */ -declare interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata { - /** - * The client's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal - * - * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d" - */ - clientHandshake: string; - /** - * The server's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal - * - * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d" - */ - serverHandshake: string; - /** - * The client's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal - * - * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b" - */ - clientFinished: string; - /** - * The server's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal - * - * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b" - */ - serverFinished: string; -} -/** - * Geographic data about the request's origin. - */ -declare interface IncomingRequestCfPropertiesGeographicInformation { - /** - * The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from. - * - * If your worker is [configured to accept TOR connections](https://support.cloudflare.com/hc/en-us/articles/203306930-Understanding-Cloudflare-Tor-support-and-Onion-Routing), this may also be `"T1"`, indicating a request that originated over TOR. - * - * If Cloudflare is unable to determine where the request originated this property is omitted. - * - * The country code `"T1"` is used for requests originating on TOR. - * - * @example "GB" - */ - country?: Iso3166Alpha2Code | "T1"; - /** - * If present, this property indicates that the request originated in the EU - * - * @example "1" - */ - isEUCountry?: "1"; - /** - * A two-letter code indicating the continent the request originated from. - * - * @example "AN" - */ - continent?: ContinentCode; - /** - * The city the request originated from - * - * @example "Austin" - */ - city?: string; - /** - * Postal code of the incoming request - * - * @example "78701" - */ - postalCode?: string; - /** - * Latitude of the incoming request - * - * @example "30.27130" - */ - latitude?: string; - /** - * Longitude of the incoming request - * - * @example "-97.74260" - */ - longitude?: string; - /** - * Timezone of the incoming request - * - * @example "America/Chicago" - */ - timezone?: string; - /** - * If known, the ISO 3166-2 name for the first level region associated with - * the IP address of the incoming request - * - * @example "Texas" - */ - region?: string; - /** - * If known, the ISO 3166-2 code for the first-level region associated with - * the IP address of the incoming request - * - * @example "TX" - */ - regionCode?: string; - /** - * Metro code (DMA) of the incoming request - * - * @example "635" - */ - metroCode?: string; -} -/** Data about the incoming request's TLS certificate */ -declare interface IncomingRequestCfPropertiesTLSClientAuth { - /** Always `"1"`, indicating that the certificate was presented */ - certPresented: "1"; - /** - * Result of certificate verification. - * - * @example "FAILED:self signed certificate" - */ - certVerified: Exclude; - /** The presented certificate's revokation status. - * - * - A value of `"1"` indicates the certificate has been revoked - * - A value of `"0"` indicates the certificate has not been revoked - */ - certRevoked: "1" | "0"; - /** - * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) - * - * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certIssuerDN: string; - /** - * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) - * - * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certSubjectDN: string; - /** - * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted) - * - * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certIssuerDNRFC2253: string; - /** - * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted) - * - * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certSubjectDNRFC2253: string; - /** The certificate issuer's distinguished name (legacy policies) */ - certIssuerDNLegacy: string; - /** The certificate subject's distinguished name (legacy policies) */ - certSubjectDNLegacy: string; - /** - * The certificate's serial number - * - * @example "00936EACBE07F201DF" - */ - certSerial: string; - /** - * The certificate issuer's serial number - * - * @example "2489002934BDFEA34" - */ - certIssuerSerial: string; - /** - * The certificate's Subject Key Identifier - * - * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4" - */ - certSKI: string; - /** - * The certificate issuer's Subject Key Identifier - * - * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4" - */ - certIssuerSKI: string; - /** - * The certificate's SHA-1 fingerprint - * - * @example "6b9109f323999e52259cda7373ff0b4d26bd232e" - */ - certFingerprintSHA1: string; - /** - * The certificate's SHA-256 fingerprint - * - * @example "acf77cf37b4156a2708e34c4eb755f9b5dbbe5ebb55adfec8f11493438d19e6ad3f157f81fa3b98278453d5652b0c1fd1d71e5695ae4d709803a4d3f39de9dea" - */ - certFingerprintSHA256: string; - /** - * The effective starting date of the certificate - * - * @example "Dec 22 19:39:00 2018 GMT" - */ - certNotBefore: string; - /** - * The effective expiration date of the certificate - * - * @example "Dec 22 19:39:00 2018 GMT" - */ - certNotAfter: string; -} -/** Placeholder values for TLS Client Authorization */ -declare interface IncomingRequestCfPropertiesTLSClientAuthPlaceholder { - certPresented: "0"; - certVerified: "NONE"; - certRevoked: "0"; - certIssuerDN: ""; - certSubjectDN: ""; - certIssuerDNRFC2253: ""; - certSubjectDNRFC2253: ""; - certIssuerDNLegacy: ""; - certSubjectDNLegacy: ""; - certSerial: ""; - certIssuerSerial: ""; - certSKI: ""; - certIssuerSKI: ""; - certFingerprintSHA1: ""; - certFingerprintSHA256: ""; - certNotBefore: ""; - certNotAfter: ""; -} -/** Possible outcomes of TLS verification */ -declare type CertVerificationStatus = - /** Authentication succeeded */ - | "SUCCESS" - /** No certificate was presented */ - | "NONE" - /** Failed because the certificate was self-signed */ - | "FAILED:self signed certificate" - /** Failed because the certificate failed a trust chain check */ - | "FAILED:unable to verify the first certificate" - /** Failed because the certificate not yet valid */ - | "FAILED:certificate is not yet valid" - /** Failed because the certificate is expired */ - | "FAILED:certificate has expired" - /** Failed for another unspecified reason */ - | "FAILED"; -/** - * An upstream endpoint's response to a TCP `keepalive` message from Cloudflare. - */ -declare type IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus = - | 0 /** Unknown */ - | 1 /** no keepalives (not found) */ - | 2 /** no connection re-use, opening keepalive connection failed */ - | 3 /** no connection re-use, keepalive accepted and saved */ - | 4 /** connection re-use, refused by the origin server (`TCP FIN`) */ - | 5; /** connection re-use, accepted by the origin server */ -/** ISO 3166-1 Alpha-2 codes */ -declare type Iso3166Alpha2Code = - | "AD" - | "AE" - | "AF" - | "AG" - | "AI" - | "AL" - | "AM" - | "AO" - | "AQ" - | "AR" - | "AS" - | "AT" - | "AU" - | "AW" - | "AX" - | "AZ" - | "BA" - | "BB" - | "BD" - | "BE" - | "BF" - | "BG" - | "BH" - | "BI" - | "BJ" - | "BL" - | "BM" - | "BN" - | "BO" - | "BQ" - | "BR" - | "BS" - | "BT" - | "BV" - | "BW" - | "BY" - | "BZ" - | "CA" - | "CC" - | "CD" - | "CF" - | "CG" - | "CH" - | "CI" - | "CK" - | "CL" - | "CM" - | "CN" - | "CO" - | "CR" - | "CU" - | "CV" - | "CW" - | "CX" - | "CY" - | "CZ" - | "DE" - | "DJ" - | "DK" - | "DM" - | "DO" - | "DZ" - | "EC" - | "EE" - | "EG" - | "EH" - | "ER" - | "ES" - | "ET" - | "FI" - | "FJ" - | "FK" - | "FM" - | "FO" - | "FR" - | "GA" - | "GB" - | "GD" - | "GE" - | "GF" - | "GG" - | "GH" - | "GI" - | "GL" - | "GM" - | "GN" - | "GP" - | "GQ" - | "GR" - | "GS" - | "GT" - | "GU" - | "GW" - | "GY" - | "HK" - | "HM" - | "HN" - | "HR" - | "HT" - | "HU" - | "ID" - | "IE" - | "IL" - | "IM" - | "IN" - | "IO" - | "IQ" - | "IR" - | "IS" - | "IT" - | "JE" - | "JM" - | "JO" - | "JP" - | "KE" - | "KG" - | "KH" - | "KI" - | "KM" - | "KN" - | "KP" - | "KR" - | "KW" - | "KY" - | "KZ" - | "LA" - | "LB" - | "LC" - | "LI" - | "LK" - | "LR" - | "LS" - | "LT" - | "LU" - | "LV" - | "LY" - | "MA" - | "MC" - | "MD" - | "ME" - | "MF" - | "MG" - | "MH" - | "MK" - | "ML" - | "MM" - | "MN" - | "MO" - | "MP" - | "MQ" - | "MR" - | "MS" - | "MT" - | "MU" - | "MV" - | "MW" - | "MX" - | "MY" - | "MZ" - | "NA" - | "NC" - | "NE" - | "NF" - | "NG" - | "NI" - | "NL" - | "NO" - | "NP" - | "NR" - | "NU" - | "NZ" - | "OM" - | "PA" - | "PE" - | "PF" - | "PG" - | "PH" - | "PK" - | "PL" - | "PM" - | "PN" - | "PR" - | "PS" - | "PT" - | "PW" - | "PY" - | "QA" - | "RE" - | "RO" - | "RS" - | "RU" - | "RW" - | "SA" - | "SB" - | "SC" - | "SD" - | "SE" - | "SG" - | "SH" - | "SI" - | "SJ" - | "SK" - | "SL" - | "SM" - | "SN" - | "SO" - | "SR" - | "SS" - | "ST" - | "SV" - | "SX" - | "SY" - | "SZ" - | "TC" - | "TD" - | "TF" - | "TG" - | "TH" - | "TJ" - | "TK" - | "TL" - | "TM" - | "TN" - | "TO" - | "TR" - | "TT" - | "TV" - | "TW" - | "TZ" - | "UA" - | "UG" - | "UM" - | "US" - | "UY" - | "UZ" - | "VA" - | "VC" - | "VE" - | "VG" - | "VI" - | "VN" - | "VU" - | "WF" - | "WS" - | "YE" - | "YT" - | "ZA" - | "ZM" - | "ZW"; -/** The 2-letter continent codes Cloudflare uses */ -declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA"; -declare type CfProperties = - | IncomingRequestCfProperties - | RequestInitCfProperties; -declare interface D1Result { - results?: T[]; - success: boolean; - error?: string; - meta: any; -} -declare abstract class D1Database { - prepare(query: string): D1PreparedStatement; - dump(): Promise; - batch(statements: D1PreparedStatement[]): Promise[]>; - exec(query: string): Promise>; -} -declare abstract class D1PreparedStatement { - bind(...values: any[]): D1PreparedStatement; - first(colName?: string): Promise; - run(): Promise>; - all(): Promise>; - raw(): Promise; -} -/** - * A email message that is sent to a consumer Worker. - */ -declare interface EmailMessage { - /** - * Envelope From attribute of the email message. - */ - readonly from: string; - /** - * Envelope To attribute of the email message. - */ - readonly to: string; - /** - * A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers). - */ - readonly headers: Headers; - /** - * Stream of the email message content. - */ - readonly raw: ReadableStream; - /** - * Size of the email message content. - */ - readonly rawSize: number; - /** - * Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason. - * @param reason The reject reason. - * @returns void - */ - setReject(reason: string): void; - /** - * Forward this email message to a verified destination address of the account. - * @param rcptTo Verified destination address. - * @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers). - * @returns A promise that resolves when the email message is forwarded. - */ - forward(rcptTo: string, headers?: Headers): Promise; -} -declare abstract class EmailEvent extends ExtendableEvent { - readonly message: EmailMessage; -} -declare type EmailExportedHandler = ( - message: EmailMessage, - env: Env, - ctx: ExecutionContext -) => void | Promise; -declare type Params

= Record; -declare type EventContext = { - request: Request; - functionPath: string; - waitUntil: (promise: Promise) => void; - passThroughOnException: () => void; - next: (input?: Request | string, init?: RequestInit) => Promise; - env: Env & { - ASSETS: { - fetch: typeof fetch; - }; - }; - params: Params

; - data: Data; -}; -declare type PagesFunction< - Env = unknown, - Params extends string = any, - Data extends Record = Record -> = (context: EventContext) => Response | Promise; -declare type EventPluginContext = { - request: Request; - functionPath: string; - waitUntil: (promise: Promise) => void; - passThroughOnException: () => void; - next: (input?: Request | string, init?: RequestInit) => Promise; - env: Env & { - ASSETS: { - fetch: typeof fetch; - }; - }; - params: Params

; - data: Data; - pluginArgs: PluginArgs; -}; -declare type PagesPluginFunction< - Env = unknown, - Params extends string = any, - Data extends Record = Record, - PluginArgs = unknown -> = ( - context: EventPluginContext -) => Response | Promise; -declare module "assets:*" { - export const onRequest: PagesFunction; -} -// https://developers.cloudflare.com/pub-sub/ -// PubSubMessage represents an incoming PubSub message. -// The message includes metadata about the broker, the client, and the payload -// itself. -declare interface PubSubMessage { - // Message ID - readonly mid: number; - // MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT - readonly broker: string; - // The MQTT topic the message was sent on. - readonly topic: string; - // The client ID of the client that published this message. - readonly clientId: string; - // The unique identifier (JWT ID) used by the client to authenticate, if token - // auth was used. - readonly jti?: string; - // A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker - // received the message from the client. - readonly receivedAt: number; - // An (optional) string with the MIME type of the payload, if set by the - // client. - readonly contentType: string; - // Set to 1 when the payload is a UTF-8 string - // https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063 - readonly payloadFormatIndicator: number; - // Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays. - // You can use payloadFormatIndicator to inspect this before decoding. - payload: string | Uint8Array; -} -// JsonWebKey extended by kid parameter -declare interface JsonWebKeyWithKid extends JsonWebKey { - // Key Identifier of the JWK - readonly kid: string; -} -/** - * A message that is sent to a consumer Worker. - */ -declare interface Message { - /** - * A unique, system-generated ID for the message. - */ - readonly id: string; - /** - * A timestamp when the message was sent. - */ - readonly timestamp: Date; - /** - * The body of the message. - */ - readonly body: Body; - /** - * Marks message to be retried. - */ - retry(): void; - /** - * Marks message acknowledged. - */ - ack(): void; -} -/** - * A batch of messages that are sent to a consumer Worker. - */ -declare interface MessageBatch { - /** - * The name of the Queue that belongs to this batch. - */ - readonly queue: string; - /** - * An array of messages in the batch. Ordering of messages is not guaranteed. - */ - readonly messages: readonly Message[]; - /** - * Marks every message to be retried in the next batch. - */ - retryAll(): void; - /** - * Marks every message acknowledged in the batch. - */ - ackAll(): void; -} -/** - * A wrapper class used to structure message batches. - */ -declare type MessageSendRequest = { - /** - * The body of the message. - */ - body: Body; -}; -/** - * A binding that allows a producer to send messages to a Queue. - */ -declare interface Queue { - /** - * Sends a message to the Queue. - * @param message The message can be any type supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types), as long as its size is less than 128 KB. - * @returns A promise that resolves when the message is confirmed to be written to disk. - */ - send(message: Body): Promise; - /** - * Sends a batch of messages to the Queue. - * @param messages Each item in the input must be supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types). A batch can contain up to 100 messages, though items are limited to 128 KB each, and the total size of the array cannot exceed 256 KB. - * @returns A promise that resolves when the messages are confirmed to be written to disk. - */ - sendBatch(messages: Iterable>): Promise; -} diff --git a/packages/denylist_bot/node_modules/@cloudflare/workers-types/2022-10-31/index.ts b/packages/denylist_bot/node_modules/@cloudflare/workers-types/2022-10-31/index.ts deleted file mode 100755 index 16953fedd..000000000 --- a/packages/denylist_bot/node_modules/@cloudflare/workers-types/2022-10-31/index.ts +++ /dev/null @@ -1,2982 +0,0 @@ -/*! ***************************************************************************** -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 -export declare class DOMException extends Error { - constructor(message?: string, name?: string); - readonly message: string; - readonly name: string; - readonly code: number; - readonly stack: any; - 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; -} -export type WorkerGlobalScopeEventMap = { - fetch: FetchEvent; - scheduled: ScheduledEvent; - unhandledrejection: PromiseRejectionEvent; - rejectionhandled: PromiseRejectionEvent; -}; -export declare abstract class WorkerGlobalScope extends EventTarget { - EventTarget: typeof EventTarget; -} -export interface Console { - "assert"(condition?: boolean, ...data: any[]): void; - clear(): void; - count(label?: string): void; - countReset(label?: string): void; - debug(...data: any[]): void; - dir(item?: any, options?: any): void; - dirxml(...data: any[]): void; - error(...data: any[]): void; - group(...data: any[]): void; - groupCollapsed(...data: any[]): void; - groupEnd(): void; - info(...data: any[]): void; - log(...data: any[]): void; - table(tabularData?: any, properties?: string[]): void; - time(label?: string): void; - timeEnd(label?: string): void; - timeLog(label?: string, ...data: any[]): void; - timeStamp(label?: string): void; - trace(...data: any[]): void; - warn(...data: any[]): void; -} -export declare const console: Console; -export type BufferSource = ArrayBufferView | ArrayBuffer; -export 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; - type Imports = Record; - type ExportValue = Function | Global | Memory | Table; - type Exports = Record; - 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; - function validate(bytes: BufferSource): boolean; -} -/** This ServiceWorker API interface represents the global execution context of a service worker. */ -export 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( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args - ): number; - clearTimeout(timeoutId: number | null): void; - setInterval(callback: (...args: any[]) => void, msDelay?: number): number; - setInterval( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args - ): number; - clearInterval(timeoutId: number | null): void; - queueMicrotask(task: Function): void; - structuredClone(value: T, options?: StructuredSerializeOptions): T; - fetch( - input: RequestInfo, - init?: RequestInit - ): Promise; - self: ServiceWorkerGlobalScope; - crypto: Crypto; - caches: CacheStorage; - scheduler: Scheduler; - Event: typeof Event; - ExtendableEvent: typeof ExtendableEvent; - PromiseRejectionEvent: typeof PromiseRejectionEvent; - FetchEvent: typeof FetchEvent; - TraceEvent: typeof TraceEvent; - 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; - 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; - 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; -} -export declare function addEventListener< - Type extends keyof WorkerGlobalScopeEventMap ->( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetAddEventListenerOptions | boolean -): void; -export declare function removeEventListener< - Type extends keyof WorkerGlobalScopeEventMap ->( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetEventListenerOptions | boolean -): void; -/** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */ -export declare function dispatchEvent( - event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap] -): boolean; -export declare function btoa(data: string): string; -export declare function atob(data: string): string; -export declare function setTimeout( - callback: (...args: any[]) => void, - msDelay?: number -): number; -export declare function setTimeout( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args -): number; -export declare function clearTimeout(timeoutId: number | null): void; -export declare function setInterval( - callback: (...args: any[]) => void, - msDelay?: number -): number; -export declare function setInterval( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args -): number; -export declare function clearInterval(timeoutId: number | null): void; -export declare function queueMicrotask(task: Function): void; -export declare function structuredClone( - value: T, - options?: StructuredSerializeOptions -): T; -export declare function fetch( - input: RequestInfo, - init?: RequestInit -): Promise; -export declare const self: ServiceWorkerGlobalScope; -export declare const crypto: Crypto; -export declare const caches: CacheStorage; -export declare const scheduler: Scheduler; -export declare const navigator: Navigator; -export interface TestController {} -export interface ExecutionContext { - waitUntil(promise: Promise): void; - passThroughOnException(): void; -} -export type ExportedHandlerFetchHandler< - Env = unknown, - CfHostMetadata = unknown -> = ( - request: Request>, - env: Env, - ctx: ExecutionContext -) => Response | Promise; -export type ExportedHandlerTraceHandler = ( - traces: TraceItem[], - env: Env, - ctx: ExecutionContext -) => void | Promise; -export type ExportedHandlerScheduledHandler = ( - controller: ScheduledController, - env: Env, - ctx: ExecutionContext -) => void | Promise; -export type ExportedHandlerQueueHandler = ( - batch: MessageBatch, - env: Env, - ctx: ExecutionContext -) => void | Promise; -export type ExportedHandlerTestHandler = ( - controller: TestController, - env: Env, - ctx: ExecutionContext -) => void | Promise; -export interface ExportedHandler< - Env = unknown, - QueueMessage = unknown, - CfHostMetadata = unknown -> { - fetch?: ExportedHandlerFetchHandler; - trace?: ExportedHandlerTraceHandler; - scheduled?: ExportedHandlerScheduledHandler; - test?: ExportedHandlerTestHandler; - queue?: ExportedHandlerQueueHandler; -} -export interface StructuredSerializeOptions { - transfer?: any[]; -} -export declare abstract class PromiseRejectionEvent extends Event { - readonly promise: Promise; - readonly reason: any; -} -export declare abstract class Navigator { - readonly userAgent: string; -} -export interface DurableObject { - fetch(request: Request): Response | Promise; - alarm?(): void | Promise; -} -export interface DurableObjectStub extends Fetcher { - readonly id: DurableObjectId; - readonly name?: string; -} -export interface DurableObjectId { - toString(): string; - equals(other: DurableObjectId): boolean; - readonly name?: string; -} -export interface DurableObjectNamespace { - newUniqueId( - options?: DurableObjectNamespaceNewUniqueIdOptions - ): DurableObjectId; - idFromName(name: string): DurableObjectId; - idFromString(id: string): DurableObjectId; - get( - id: DurableObjectId, - options?: DurableObjectNamespaceGetDurableObjectOptions - ): DurableObjectStub; - jurisdiction(jurisdiction: string): DurableObjectNamespace; -} -export interface DurableObjectNamespaceNewUniqueIdOptions { - jurisdiction?: string; -} -export interface DurableObjectNamespaceGetDurableObjectOptions { - locationHint?: string; -} -export interface DurableObjectState { - waitUntil(promise: Promise): void; - readonly id: DurableObjectId; - readonly storage: DurableObjectStorage; - blockConcurrencyWhile(callback: () => Promise): Promise; -} -export interface DurableObjectTransaction { - get( - key: string, - options?: DurableObjectGetOptions - ): Promise; - get( - keys: string[], - options?: DurableObjectGetOptions - ): Promise>; - list( - options?: DurableObjectListOptions - ): Promise>; - put( - key: string, - value: T, - options?: DurableObjectPutOptions - ): Promise; - put( - entries: Record, - options?: DurableObjectPutOptions - ): Promise; - delete(key: string, options?: DurableObjectPutOptions): Promise; - delete(keys: string[], options?: DurableObjectPutOptions): Promise; - rollback(): void; - getAlarm(options?: DurableObjectGetAlarmOptions): Promise; - setAlarm( - scheduledTime: number | Date, - options?: DurableObjectSetAlarmOptions - ): Promise; - deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise; -} -export interface DurableObjectStorage { - get( - key: string, - options?: DurableObjectGetOptions - ): Promise; - get( - keys: string[], - options?: DurableObjectGetOptions - ): Promise>; - list( - options?: DurableObjectListOptions - ): Promise>; - put( - key: string, - value: T, - options?: DurableObjectPutOptions - ): Promise; - put( - entries: Record, - options?: DurableObjectPutOptions - ): Promise; - delete(key: string, options?: DurableObjectPutOptions): Promise; - delete(keys: string[], options?: DurableObjectPutOptions): Promise; - deleteAll(options?: DurableObjectPutOptions): Promise; - transaction( - closure: (txn: DurableObjectTransaction) => Promise - ): Promise; - getAlarm(options?: DurableObjectGetAlarmOptions): Promise; - setAlarm( - scheduledTime: number | Date, - options?: DurableObjectSetAlarmOptions - ): Promise; - deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise; - sync(): Promise; -} -export interface DurableObjectListOptions { - start?: string; - startAfter?: string; - end?: string; - prefix?: string; - reverse?: boolean; - limit?: number; - allowConcurrency?: boolean; - noCache?: boolean; -} -export interface DurableObjectGetOptions { - allowConcurrency?: boolean; - noCache?: boolean; -} -export interface DurableObjectGetAlarmOptions { - allowConcurrency?: boolean; -} -export interface DurableObjectPutOptions { - allowConcurrency?: boolean; - allowUnconfirmed?: boolean; - noCache?: boolean; -} -export interface DurableObjectSetAlarmOptions { - allowConcurrency?: boolean; - allowUnconfirmed?: boolean; -} -export interface AnalyticsEngineDataset { - writeDataPoint(event?: AnalyticsEngineDataPoint): void; -} -export interface AnalyticsEngineDataPoint { - indexes?: ((ArrayBuffer | string) | null)[]; - doubles?: number[]; - blobs?: ((ArrayBuffer | string) | null)[]; -} -export declare class Event { - constructor(type: string, init?: EventInit); - get type(): string; - get eventPhase(): number; - get composed(): boolean; - get bubbles(): boolean; - get cancelable(): boolean; - get defaultPrevented(): boolean; - get returnValue(): boolean; - get currentTarget(): EventTarget | undefined; - get srcElement(): EventTarget | undefined; - get timeStamp(): number; - get isTrusted(): boolean; - get cancelBubble(): boolean; - set cancelBubble(value: boolean); - stopImmediatePropagation(): void; - preventDefault(): void; - stopPropagation(): void; - composedPath(): EventTarget[]; - static readonly NONE: number; - static readonly CAPTURING_PHASE: number; - static readonly AT_TARGET: number; - static readonly BUBBLING_PHASE: number; -} -export interface EventInit { - bubbles?: boolean; - cancelable?: boolean; - composed?: boolean; -} -export type EventListener = ( - event: EventType -) => void; -export interface EventListenerObject { - handleEvent(event: EventType): void; -} -export type EventListenerOrEventListenerObject< - EventType extends Event = Event -> = EventListener | EventListenerObject; -export declare class EventTarget< - EventMap extends Record = Record -> { - constructor(); - addEventListener( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetAddEventListenerOptions | boolean - ): void; - removeEventListener( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetEventListenerOptions | boolean - ): void; - dispatchEvent(event: EventMap[keyof EventMap]): boolean; -} -export interface EventTargetEventListenerOptions { - capture?: boolean; -} -export interface EventTargetAddEventListenerOptions { - capture?: boolean; - passive?: boolean; - once?: boolean; - signal?: AbortSignal; -} -export interface EventTargetHandlerObject { - handleEvent: (event: Event) => any | undefined; -} -export declare class AbortController { - constructor(); - get signal(): AbortSignal; - abort(reason?: any): void; -} -export declare abstract class AbortSignal extends EventTarget { - static abort(reason?: any): AbortSignal; - static timeout(delay: number): AbortSignal; - get aborted(): boolean; - get reason(): any; - throwIfAborted(): void; -} -export interface Scheduler { - wait(delay: number, maybeOptions?: SchedulerWaitOptions): Promise; -} -export interface SchedulerWaitOptions { - signal?: AbortSignal; -} -export declare abstract class ExtendableEvent extends Event { - waitUntil(promise: Promise): void; -} -export declare class Blob { - constructor( - bits?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[], - options?: BlobOptions - ); - get size(): number; - get type(): string; - slice(start?: number, end?: number, type?: string): Blob; - arrayBuffer(): Promise; - text(): Promise; - stream(): ReadableStream; -} -export interface BlobOptions { - type?: string; -} -export declare class File extends Blob { - constructor( - bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined, - name: string, - options?: FileOptions - ); - get name(): string; - get lastModified(): number; -} -export interface FileOptions { - type?: string; - lastModified?: number; -} -export declare abstract class CacheStorage { - open(cacheName: string): Promise; - readonly default: Cache; -} -export declare abstract class Cache { - delete(request: RequestInfo, options?: CacheQueryOptions): Promise; - match( - request: RequestInfo, - options?: CacheQueryOptions - ): Promise; - put(request: RequestInfo, response: Response): Promise; -} -export interface CacheQueryOptions { - ignoreMethod?: boolean; -} -export declare abstract class Crypto { - get subtle(): SubtleCrypto; - getRandomValues< - T extends - | Int8Array - | Uint8Array - | Int16Array - | Uint16Array - | Int32Array - | Uint32Array - | BigInt64Array - | BigUint64Array - >(buffer: T): T; - randomUUID(): string; - DigestStream: typeof DigestStream; -} -export declare abstract class SubtleCrypto { - encrypt( - algorithm: string | SubtleCryptoEncryptAlgorithm, - key: CryptoKey, - plainText: ArrayBuffer | ArrayBufferView - ): Promise; - decrypt( - algorithm: string | SubtleCryptoEncryptAlgorithm, - key: CryptoKey, - cipherText: ArrayBuffer | ArrayBufferView - ): Promise; - sign( - algorithm: string | SubtleCryptoSignAlgorithm, - key: CryptoKey, - data: ArrayBuffer | ArrayBufferView - ): Promise; - verify( - algorithm: string | SubtleCryptoSignAlgorithm, - key: CryptoKey, - signature: ArrayBuffer | ArrayBufferView, - data: ArrayBuffer | ArrayBufferView - ): Promise; - digest( - algorithm: string | SubtleCryptoHashAlgorithm, - data: ArrayBuffer | ArrayBufferView - ): Promise; - generateKey( - algorithm: string | SubtleCryptoGenerateKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - deriveKey( - algorithm: string | SubtleCryptoDeriveKeyAlgorithm, - baseKey: CryptoKey, - derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - deriveBits( - algorithm: string | SubtleCryptoDeriveKeyAlgorithm, - baseKey: CryptoKey, - length: number | null - ): Promise; - importKey( - format: string, - keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey, - algorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - exportKey(format: string, key: CryptoKey): Promise; - wrapKey( - format: string, - key: CryptoKey, - wrappingKey: CryptoKey, - wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm - ): Promise; - unwrapKey( - format: string, - wrappedKey: ArrayBuffer | ArrayBufferView, - unwrappingKey: CryptoKey, - unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm, - unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - timingSafeEqual( - a: ArrayBuffer | ArrayBufferView, - b: ArrayBuffer | ArrayBufferView - ): boolean; -} -export declare abstract class CryptoKey { - readonly type: string; - readonly extractable: boolean; - readonly algorithm: - | CryptoKeyKeyAlgorithm - | CryptoKeyAesKeyAlgorithm - | CryptoKeyHmacKeyAlgorithm - | CryptoKeyRsaKeyAlgorithm - | CryptoKeyEllipticKeyAlgorithm - | CryptoKeyArbitraryKeyAlgorithm; - readonly usages: string[]; -} -export interface CryptoKeyPair { - publicKey: CryptoKey; - privateKey: CryptoKey; -} -export 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; -} -export interface RsaOtherPrimesInfo { - r?: string; - d?: string; - t?: string; -} -export interface SubtleCryptoDeriveKeyAlgorithm { - name: string; - salt?: ArrayBuffer; - iterations?: number; - hash?: string | SubtleCryptoHashAlgorithm; - $public?: CryptoKey; - info?: ArrayBuffer; -} -export interface SubtleCryptoEncryptAlgorithm { - name: string; - iv?: ArrayBuffer; - additionalData?: ArrayBuffer; - tagLength?: number; - counter?: ArrayBuffer; - length?: number; - label?: ArrayBuffer; -} -export interface SubtleCryptoGenerateKeyAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - modulusLength?: number; - publicExponent?: ArrayBuffer; - length?: number; - namedCurve?: string; -} -export interface SubtleCryptoHashAlgorithm { - name: string; -} -export interface SubtleCryptoImportKeyAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - length?: number; - namedCurve?: string; - compressed?: boolean; -} -export interface SubtleCryptoSignAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - dataLength?: number; - saltLength?: number; -} -export interface CryptoKeyKeyAlgorithm { - name: string; -} -export interface CryptoKeyAesKeyAlgorithm { - name: string; - length: number; -} -export interface CryptoKeyHmacKeyAlgorithm { - name: string; - hash: CryptoKeyKeyAlgorithm; - length: number; -} -export interface CryptoKeyRsaKeyAlgorithm { - name: string; - modulusLength: number; - publicExponent: ArrayBuffer; - hash?: CryptoKeyKeyAlgorithm; -} -export interface CryptoKeyEllipticKeyAlgorithm { - name: string; - namedCurve: string; -} -export interface CryptoKeyArbitraryKeyAlgorithm { - name: string; - hash?: CryptoKeyKeyAlgorithm; - namedCurve?: string; - length?: number; -} -export declare class DigestStream extends WritableStream< - ArrayBuffer | ArrayBufferView -> { - constructor(algorithm: string | SubtleCryptoHashAlgorithm); - get digest(): Promise; -} -export declare class TextDecoder { - constructor(decoder?: string, options?: TextDecoderConstructorOptions); - decode( - input?: ArrayBuffer | ArrayBufferView, - options?: TextDecoderDecodeOptions - ): string; - get encoding(): string; - get fatal(): boolean; - get ignoreBOM(): boolean; -} -export declare class TextEncoder { - constructor(); - encode(input?: string): Uint8Array; - encodeInto(input: string, buffer: Uint8Array): TextEncoderEncodeIntoResult; - get encoding(): string; -} -export interface TextDecoderConstructorOptions { - fatal: boolean; - ignoreBOM: boolean; -} -export interface TextDecoderDecodeOptions { - stream: boolean; -} -export interface TextEncoderEncodeIntoResult { - read: number; - written: number; -} -export declare class FormData { - constructor(); - append(name: string, value: string): void; - append(name: string, value: Blob, filename?: string): void; - delete(name: string): void; - get(name: string): (File | string) | null; - getAll(name: string): (File | string)[]; - has(name: string): boolean; - set(name: string, value: string): void; - set(name: string, value: Blob, filename?: string): void; - entries(): IterableIterator<[key: string, value: File | string]>; - keys(): IterableIterator; - values(): IterableIterator; - forEach( - callback: ( - this: This, - value: File | string, - key: string, - parent: FormData - ) => void, - thisArg?: This - ): void; - [Symbol.iterator](): IterableIterator<[key: string, value: File | string]>; -} -export interface ContentOptions { - html?: boolean; -} -export declare class HTMLRewriter { - constructor(); - on( - selector: string, - handlers: HTMLRewriterElementContentHandlers - ): HTMLRewriter; - onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter; - transform(response: Response): Response; -} -export interface HTMLRewriterElementContentHandlers { - element?(element: Element): void | Promise; - comments?(comment: Comment): void | Promise; - text?(element: Text): void | Promise; -} -export interface HTMLRewriterDocumentContentHandlers { - doctype?(doctype: Doctype): void | Promise; - comments?(comment: Comment): void | Promise; - text?(text: Text): void | Promise; - end?(end: DocumentEnd): void | Promise; -} -export interface Doctype { - readonly name: string | null; - readonly publicId: string | null; - readonly systemId: string | null; -} -export interface Element { - tagName: string; - readonly attributes: IterableIterator; - 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, options?: ContentOptions): Element; - after(content: string, options?: ContentOptions): Element; - prepend(content: string, options?: ContentOptions): Element; - append(content: string, options?: ContentOptions): Element; - replace(content: string, options?: ContentOptions): Element; - remove(): Element; - removeAndKeepContent(): Element; - setInnerContent(content: string, options?: ContentOptions): Element; - onEndTag(handler: (tag: EndTag) => void | Promise): void; -} -export interface EndTag { - name: string; - before(content: string, options?: ContentOptions): EndTag; - after(content: string, options?: ContentOptions): EndTag; - remove(): EndTag; -} -export 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; -} -export interface Text { - readonly text: string; - readonly lastInTextNode: boolean; - readonly removed: boolean; - before(content: string, options?: ContentOptions): Text; - after(content: string, options?: ContentOptions): Text; - replace(content: string, options?: ContentOptions): Text; - remove(): Text; -} -export interface DocumentEnd { - append(content: string, options?: ContentOptions): DocumentEnd; -} -export declare abstract class FetchEvent extends ExtendableEvent { - readonly request: Request; - respondWith(promise: Response | Promise): void; - passThroughOnException(): void; -} -export type HeadersInit = - | Headers - | Iterable> - | Record; -export declare class Headers { - constructor(init?: HeadersInit); - get(name: string): string | null; - getAll(name: string): string[]; - has(name: string): boolean; - set(name: string, value: string): void; - append(name: string, value: string): void; - delete(name: string): void; - forEach( - callback: (this: This, value: string, key: string, parent: Headers) => void, - thisArg?: This - ): void; - entries(): IterableIterator<[key: string, value: string]>; - keys(): IterableIterator; - values(): IterableIterator; - [Symbol.iterator](): IterableIterator<[key: string, value: string]>; -} -export type BodyInit = - | ReadableStream - | string - | ArrayBuffer - | ArrayBufferView - | Blob - | URLSearchParams - | FormData; -export declare abstract class Body { - get body(): ReadableStream | null; - get bodyUsed(): boolean; - arrayBuffer(): Promise; - text(): Promise; - json(): Promise; - formData(): Promise; - blob(): Promise; -} -export declare class Response extends Body { - constructor(body?: BodyInit | null, init?: ResponseInit); - static redirect(url: string, status?: number): Response; - static json(any: any, maybeInit?: ResponseInit | Response): Response; - clone(): Response; - get status(): number; - get statusText(): string; - get headers(): Headers; - get ok(): boolean; - get redirected(): boolean; - get url(): string; - get webSocket(): WebSocket | null; - get cf(): any | undefined; -} -export interface ResponseInit { - status?: number; - statusText?: string; - headers?: HeadersInit; - cf?: any; - webSocket?: WebSocket | null; - encodeBody?: "automatic" | "manual"; -} -export type RequestInfo< - CfHostMetadata = unknown, - Cf = CfProperties -> = Request | string | URL; -export declare class Request< - CfHostMetadata = unknown, - Cf = CfProperties -> extends Body { - constructor(input: RequestInfo, init?: RequestInit); - clone(): Request; - get method(): string; - get url(): string; - get headers(): Headers; - get redirect(): string; - get fetcher(): Fetcher | null; - get signal(): AbortSignal; - get cf(): Cf | undefined; - get integrity(): string; - get keepalive(): boolean; -} -export interface RequestInit { - /** 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 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; -} -export declare abstract class Fetcher { - fetch(input: RequestInfo, init?: RequestInit): Promise; -} -export interface FetcherPutOptions { - expiration?: number; - expirationTtl?: number; -} -export interface KVNamespaceListKey { - name: Key; - expiration?: number; - metadata?: Metadata; -} -export type KVNamespaceListResult = - | { - list_complete: false; - keys: KVNamespaceListKey[]; - cursor: string; - } - | { - list_complete: true; - keys: KVNamespaceListKey[]; - }; -export interface KVNamespace { - get( - key: Key, - options?: Partial> - ): Promise; - get(key: Key, type: "text"): Promise; - get( - key: Key, - type: "json" - ): Promise; - get(key: Key, type: "arrayBuffer"): Promise; - get(key: Key, type: "stream"): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"text"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"json"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"arrayBuffer"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"stream"> - ): Promise; - list( - options?: KVNamespaceListOptions - ): Promise>; - put( - key: Key, - value: string | ArrayBuffer | ArrayBufferView | ReadableStream, - options?: KVNamespacePutOptions - ): Promise; - getWithMetadata( - key: Key, - options?: Partial> - ): Promise>; - getWithMetadata( - key: Key, - type: "text" - ): Promise>; - getWithMetadata( - key: Key, - type: "json" - ): Promise>; - getWithMetadata( - key: Key, - type: "arrayBuffer" - ): Promise>; - getWithMetadata( - key: Key, - type: "stream" - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"text"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"json"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"arrayBuffer"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"stream"> - ): Promise>; - delete(key: Key): Promise; -} -export interface KVNamespaceListOptions { - limit?: number; - prefix?: string | null; - cursor?: string | null; -} -export interface KVNamespaceGetOptions { - type: Type; - cacheTtl?: number; -} -export interface KVNamespacePutOptions { - expiration?: number; - expirationTtl?: number; - metadata?: any | null; -} -export interface KVNamespaceGetWithMetadataResult { - value: Value | null; - metadata: Metadata | null; -} -export interface R2Error extends Error { - readonly name: string; - readonly code: number; - readonly message: string; - readonly action: string; - readonly stack: any; -} -export interface R2ListOptions { - limit?: number; - prefix?: string; - cursor?: string; - delimiter?: string; - startAfter?: string; - include?: ("httpMetadata" | "customMetadata")[]; -} -export declare abstract class R2Bucket { - head(key: string): Promise; - get( - key: string, - options: R2GetOptions & { - onlyIf: R2Conditional | Headers; - } - ): Promise; - get(key: string, options?: R2GetOptions): Promise; - put( - key: string, - value: - | ReadableStream - | ArrayBuffer - | ArrayBufferView - | string - | null - | Blob, - options?: R2PutOptions - ): Promise; - put( - key: string, - value: - | ReadableStream - | ArrayBuffer - | ArrayBufferView - | string - | null - | Blob, - options?: R2PutOptions & { - onlyIf: R2Conditional | Headers; - } - ): Promise; - createMultipartUpload( - key: string, - options?: R2MultipartOptions - ): Promise; - resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload; - delete(keys: string | string[]): Promise; - list(options?: R2ListOptions): Promise; -} -export interface R2MultipartUpload { - readonly key: string; - readonly uploadId: string; - uploadPart( - partNumber: number, - value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob - ): Promise; - abort(): Promise; - complete(uploadedParts: R2UploadedPart[]): Promise; -} -export interface R2UploadedPart { - partNumber: number; - etag: string; -} -export 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; - readonly range?: R2Range; - writeHttpMetadata(headers: Headers): void; -} -export interface R2ObjectBody extends R2Object { - get body(): ReadableStream; - get bodyUsed(): boolean; - arrayBuffer(): Promise; - text(): Promise; - json(): Promise; - blob(): Promise; -} -export type R2Range = - | { - offset: number; - length?: number; - } - | { - offset?: number; - length: number; - } - | { - suffix: number; - }; -export interface R2Conditional { - etagMatches?: string; - etagDoesNotMatch?: string; - uploadedBefore?: Date; - uploadedAfter?: Date; - secondsGranularity?: boolean; -} -export interface R2GetOptions { - onlyIf?: R2Conditional | Headers; - range?: R2Range | Headers; -} -export interface R2PutOptions { - onlyIf?: R2Conditional | Headers; - httpMetadata?: R2HTTPMetadata | Headers; - customMetadata?: Record; - md5?: ArrayBuffer | string; - sha1?: ArrayBuffer | string; - sha256?: ArrayBuffer | string; - sha384?: ArrayBuffer | string; - sha512?: ArrayBuffer | string; -} -export interface R2MultipartOptions { - httpMetadata?: R2HTTPMetadata | Headers; - customMetadata?: Record; -} -export interface R2Checksums { - readonly md5?: ArrayBuffer; - readonly sha1?: ArrayBuffer; - readonly sha256?: ArrayBuffer; - readonly sha384?: ArrayBuffer; - readonly sha512?: ArrayBuffer; - toJSON(): R2StringChecksums; -} -export interface R2StringChecksums { - md5?: string; - sha1?: string; - sha256?: string; - sha384?: string; - sha512?: string; -} -export interface R2HTTPMetadata { - contentType?: string; - contentLanguage?: string; - contentDisposition?: string; - contentEncoding?: string; - cacheControl?: string; - cacheExpiry?: Date; -} -export interface R2Objects { - objects: R2Object[]; - truncated: boolean; - cursor?: string; - delimitedPrefixes: string[]; -} -export declare abstract class ScheduledEvent extends ExtendableEvent { - readonly scheduledTime: number; - readonly cron: string; - noRetry(): void; -} -export interface ScheduledController { - readonly scheduledTime: number; - readonly cron: string; - noRetry(): void; -} -export interface QueuingStrategy { - highWaterMark?: number | bigint; - size?: (chunk: T) => number | bigint; -} -export interface UnderlyingSink { - type?: string; - start?: (controller: WritableStreamDefaultController) => void | Promise; - write?: ( - chunk: W, - controller: WritableStreamDefaultController - ) => void | Promise; - abort?: (reason: any) => void | Promise; - close?: () => void | Promise; -} -export interface UnderlyingByteSource { - type: "bytes"; - autoAllocateChunkSize?: number; - start?: (controller: ReadableByteStreamController) => void | Promise; - pull?: (controller: ReadableByteStreamController) => void | Promise; - cancel?: (reason: any) => void | Promise; -} -export interface UnderlyingSource { - type?: "" | undefined; - start?: ( - controller: ReadableStreamDefaultController - ) => void | Promise; - pull?: ( - controller: ReadableStreamDefaultController - ) => void | Promise; - cancel?: (reason: any) => void | Promise; -} -export interface Transformer { - readableType?: string; - writableType?: string; - start?: ( - controller: TransformStreamDefaultController - ) => void | Promise; - transform?: ( - chunk: I, - controller: TransformStreamDefaultController - ) => void | Promise; - flush?: ( - controller: TransformStreamDefaultController - ) => void | Promise; -} -export interface StreamPipeOptions { - /** - * 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; - preventAbort?: boolean; - preventCancel?: boolean; - signal?: AbortSignal; -} -export type ReadableStreamReadResult = - | { - done: false; - value: R; - } - | { - done: true; - value?: undefined; - }; -/** This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object. */ -export interface ReadableStream { - get locked(): boolean; - cancel(reason?: any): Promise; - getReader(): ReadableStreamDefaultReader; - getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader; - pipeThrough( - transform: ReadableWritablePair, - options?: StreamPipeOptions - ): ReadableStream; - pipeTo( - destination: WritableStream, - options?: StreamPipeOptions - ): Promise; - tee(): [ReadableStream, ReadableStream]; - values(options?: ReadableStreamValuesOptions): AsyncIterableIterator; - [Symbol.asyncIterator]( - options?: ReadableStreamValuesOptions - ): AsyncIterableIterator; -} -export declare const ReadableStream: { - prototype: ReadableStream; - new ( - underlyingSource: UnderlyingByteSource, - strategy?: QueuingStrategy - ): ReadableStream; - new ( - underlyingSource?: UnderlyingSource, - strategy?: QueuingStrategy - ): ReadableStream; -}; -export declare class ReadableStreamDefaultReader { - constructor(stream: ReadableStream); - get closed(): Promise; - cancel(reason?: any): Promise; - read(): Promise>; - releaseLock(): void; -} -export declare class ReadableStreamBYOBReader { - constructor(stream: ReadableStream); - get closed(): Promise; - cancel(reason?: any): Promise; - read( - view: T - ): Promise>; - releaseLock(): void; - readAtLeast( - minElements: number, - view: T - ): Promise>; -} -export interface ReadableStreamGetReaderOptions { - mode: "byob"; -} -export interface ReadableStreamBYOBRequest { - readonly view: Uint8Array | null; - respond(bytesWritten: number): void; - respondWithNewView(view: ArrayBuffer | ArrayBufferView): void; - readonly atLeast: number | null; -} -export interface ReadableStreamDefaultController { - readonly desiredSize: number | null; - close(): void; - enqueue(chunk?: R): void; - error(reason: any): void; -} -export interface ReadableByteStreamController { - readonly byobRequest: ReadableStreamBYOBRequest | null; - readonly desiredSize: number | null; - close(): void; - enqueue(chunk: ArrayBuffer | ArrayBufferView): void; - error(reason: any): void; -} -/** This Streams API interface represents a controller allowing control of a WritableStream's state. When constructing a WritableStream, the underlying sink is given a corresponding WritableStreamDefaultController instance to manipulate. */ -export interface WritableStreamDefaultController { - readonly signal: AbortSignal; - error(reason?: any): void; -} -export interface TransformStreamDefaultController { - get desiredSize(): number | null; - enqueue(chunk?: O): void; - error(reason: any): void; - terminate(): void; -} -export interface ReadableWritablePair { - /** - * 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; - readable: ReadableStream; -} -export declare class WritableStream { - constructor( - underlyingSink?: UnderlyingSink, - queuingStrategy?: QueuingStrategy - ); - get locked(): boolean; - abort(reason?: any): Promise; - close(): Promise; - getWriter(): WritableStreamDefaultWriter; -} -export declare class WritableStreamDefaultWriter { - constructor(stream: WritableStream); - get closed(): Promise; - get ready(): Promise; - get desiredSize(): number | null; - abort(reason?: any): Promise; - close(): Promise; - write(chunk?: W): Promise; - releaseLock(): void; -} -export declare class TransformStream { - constructor( - transformer?: Transformer, - writableStrategy?: QueuingStrategy, - readableStrategy?: QueuingStrategy - ); - get readable(): ReadableStream; - get writable(): WritableStream; -} -export declare class FixedLengthStream extends IdentityTransformStream { - constructor(expectedLength: number | bigint); -} -export declare class IdentityTransformStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(); -} -export interface ReadableStreamValuesOptions { - preventCancel?: boolean; -} -export declare class CompressionStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(format: "gzip" | "deflate" | "deflate-raw"); -} -export declare class DecompressionStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(format: "gzip" | "deflate" | "deflate-raw"); -} -export declare class TextEncoderStream extends TransformStream< - string, - Uint8Array -> { - constructor(); -} -export declare class TextDecoderStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - string -> { - constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit); -} -export interface TextDecoderStreamTextDecoderStreamInit { - fatal?: boolean; -} -export declare class ByteLengthQueuingStrategy - implements QueuingStrategy -{ - constructor(init: QueuingStrategyInit); - get highWaterMark(): number; - get size(): (chunk?: any) => number; -} -export declare class CountQueuingStrategy implements QueuingStrategy { - constructor(init: QueuingStrategyInit); - get highWaterMark(): number; - get size(): (chunk?: any) => number; -} -export 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; -} -export declare abstract class TraceEvent extends ExtendableEvent { - readonly traces: TraceItem[]; -} -export interface TraceItem { - readonly event: - | ( - | TraceItemFetchEventInfo - | TraceItemScheduledEventInfo - | TraceItemAlarmEventInfo - | TraceItemQueueEventInfo - | TraceItemEmailEventInfo - | TraceItemCustomEventInfo - ) - | null; - readonly eventTimestamp: number | null; - readonly logs: TraceLog[]; - readonly exceptions: TraceException[]; - readonly scriptName: string | null; - readonly dispatchNamespace?: string; - readonly scriptTags?: string[]; - readonly outcome: string; -} -export interface TraceItemAlarmEventInfo { - readonly scheduledTime: Date; -} -export interface TraceItemCustomEventInfo {} -export interface TraceItemScheduledEventInfo { - readonly scheduledTime: number; - readonly cron: string; -} -export interface TraceItemQueueEventInfo { - readonly queue: string; - readonly batchSize: number; -} -export interface TraceItemEmailEventInfo { - readonly mailFrom: string; - readonly rcptTo: string; - readonly rawSize: number; -} -export interface TraceItemFetchEventInfo { - readonly response?: TraceItemFetchEventInfoResponse; - readonly request: TraceItemFetchEventInfoRequest; -} -export interface TraceItemFetchEventInfoRequest { - readonly cf?: any; - readonly headers: Record; - readonly method: string; - readonly url: string; - getUnredacted(): TraceItemFetchEventInfoRequest; -} -export interface TraceItemFetchEventInfoResponse { - readonly status: number; -} -export interface TraceLog { - readonly timestamp: number; - readonly level: string; - readonly message: any; -} -export interface TraceException { - readonly timestamp: number; - readonly message: string; - readonly name: string; -} -export interface TraceMetrics { - readonly cpuTime: number; - readonly wallTime: number; -} -export interface UnsafeTraceMetrics { - fromTrace(item: TraceItem): TraceMetrics; -} -export declare class URL { - constructor(url: string | URL, base?: string | URL); - get origin(): string; - get href(): string; - set href(value: string); - get protocol(): string; - set protocol(value: string); - get username(): string; - set username(value: string); - get password(): string; - set password(value: string); - get host(): string; - set host(value: string); - get hostname(): string; - set hostname(value: string); - get port(): string; - set port(value: string); - get pathname(): string; - set pathname(value: string); - get search(): string; - set search(value: string); - get hash(): string; - set hash(value: string); - get searchParams(): URLSearchParams; - toJSON(): string; - toString(): string; - static canParse(url: string, base?: string): boolean; -} -export declare class URLSearchParams { - constructor( - init?: Iterable> | Record | string - ); - get size(): number; - append(name: string, value: string): void; - delete(name: string): void; - get(name: string): string | null; - getAll(name: string): string[]; - has(name: string): boolean; - set(name: string, value: string): void; - sort(): void; - entries(): IterableIterator<[key: string, value: string]>; - keys(): IterableIterator; - values(): IterableIterator; - forEach( - callback: ( - this: This, - value: string, - key: string, - parent: URLSearchParams - ) => void, - thisArg?: This - ): void; - toString(): string; - [Symbol.iterator](): IterableIterator<[key: string, value: string]>; -} -export declare class URLPattern { - constructor(input?: string | URLPatternURLPatternInit, baseURL?: string); - get protocol(): string; - get username(): string; - get password(): string; - get hostname(): string; - get port(): string; - get pathname(): string; - get search(): string; - get hash(): string; - test(input?: string | URLPatternURLPatternInit, baseURL?: string): boolean; - exec( - input?: string | URLPatternURLPatternInit, - baseURL?: string - ): URLPatternURLPatternResult | null; -} -export interface URLPatternURLPatternInit { - protocol?: string; - username?: string; - password?: string; - hostname?: string; - port?: string; - pathname?: string; - search?: string; - hash?: string; - baseURL?: string; -} -export interface URLPatternURLPatternComponentResult { - input: string; - groups: Record; -} -export interface URLPatternURLPatternResult { - inputs: (string | URLPatternURLPatternInit)[]; - protocol: URLPatternURLPatternComponentResult; - username: URLPatternURLPatternComponentResult; - password: URLPatternURLPatternComponentResult; - hostname: URLPatternURLPatternComponentResult; - port: URLPatternURLPatternComponentResult; - pathname: URLPatternURLPatternComponentResult; - search: URLPatternURLPatternComponentResult; - hash: URLPatternURLPatternComponentResult; -} -export declare class CloseEvent extends Event { - constructor(type: string, initializer: CloseEventInit); - /** Returns the WebSocket connection close code provided by the server. */ - readonly code: number; - /** Returns the WebSocket connection close reason provided by the server. */ - readonly reason: string; - /** Returns true if the connection closed cleanly; false otherwise. */ - readonly wasClean: boolean; -} -export interface CloseEventInit { - code?: number; - reason?: string; - wasClean?: boolean; -} -export declare class MessageEvent extends Event { - constructor(type: string, initializer: MessageEventInit); - readonly data: ArrayBuffer | string; -} -export interface MessageEventInit { - data: ArrayBuffer | string; -} -/** Events providing information related to errors in scripts or in files. */ -export interface ErrorEvent extends Event { - readonly filename: string; - readonly message: string; - readonly lineno: number; - readonly colno: number; - readonly error: any; -} -export type WebSocketEventMap = { - close: CloseEvent; - message: MessageEvent; - open: Event; - error: ErrorEvent; -}; -export declare class WebSocket extends EventTarget { - constructor(url: string, protocols?: string[] | string); - accept(): void; - send(message: (ArrayBuffer | ArrayBufferView) | string): void; - close(code?: number, reason?: string): void; - static readonly READY_STATE_CONNECTING: number; - static readonly READY_STATE_OPEN: number; - static readonly READY_STATE_CLOSING: number; - static readonly READY_STATE_CLOSED: number; - get readyState(): number; - get url(): string | null; - get protocol(): string | null; - get extensions(): string | null; -} -export declare const WebSocketPair: { - new (): { - 0: WebSocket; - 1: WebSocket; - }; -}; -export interface BasicImageTransformations { - /** - * Maximum width in image pixels. The value must be an integer. - */ - width?: number; - /** - * Maximum height in image pixels. The value must be an integer. - */ - height?: number; - /** - * Resizing mode as a string. It affects interpretation of width and height - * options: - * - scale-down: Similar to contain, but the image is never enlarged. If - * the image is larger than given width or height, it will be resized. - * Otherwise its original size will be kept. - * - contain: Resizes to maximum size that fits within the given width and - * height. If only a single dimension is given (e.g. only width), the - * image will be shrunk or enlarged to exactly match that dimension. - * Aspect ratio is always preserved. - * - cover: Resizes (shrinks or enlarges) to fill the entire area of width - * and height. If the image has an aspect ratio different from the ratio - * of width and height, it will be cropped to fit. - * - crop: The image will be shrunk and cropped to fit within the area - * specified by width and height. The image will not be enlarged. For images - * smaller than the given dimensions it's the same as scale-down. For - * images larger than the given dimensions, it's the same as cover. - * See also trim. - * - pad: Resizes to the maximum size that fits within the given width and - * height, and then fills the remaining area with a background color - * (white by default). Use of this mode is not recommended, as the same - * effect can be more efficiently achieved with the contain mode and the - * CSS object-fit: contain property. - */ - fit?: "scale-down" | "contain" | "cover" | "crop" | "pad"; - /** - * When cropping with fit: "cover", this defines the side or point that should - * be left uncropped. The value is either a string - * "left", "right", "top", "bottom", "auto", or "center" (the default), - * or an object {x, y} containing focal point coordinates in the original - * image expressed as fractions ranging from 0.0 (top or left) to 1.0 - * (bottom or right), 0.5 being the center. {fit: "cover", gravity: "top"} will - * crop bottom or left and right sides as necessary, but won’t crop anything - * from the top. {fit: "cover", gravity: {x:0.5, y:0.2}} will crop each side to - * preserve as much as possible around a point at 20% of the height of the - * source image. - */ - gravity?: - | "left" - | "right" - | "top" - | "bottom" - | "center" - | "auto" - | BasicImageTransformationsGravityCoordinates; - /** - * Background color to add underneath the image. Applies only to images with - * transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…), - * hsl(…), etc.) - */ - background?: string; - /** - * Number of degrees (90, 180, 270) to rotate the image by. width and height - * options refer to axes after rotation. - */ - rotate?: 0 | 90 | 180 | 270 | 360; -} -export interface BasicImageTransformationsGravityCoordinates { - x: number; - y: number; -} -/** - * In addition to the properties you can set in the RequestInit dict - * that you pass as an argument to the Request constructor, you can - * set certain properties of a `cf` object to control how Cloudflare - * features are applied to that new Request. - * - * Note: Currently, these properties cannot be tested in the - * playground. - */ -export interface RequestInitCfProperties extends Record { - cacheEverything?: boolean; - /** - * A request's cache key is what determines if two requests are - * "the same" for caching purposes. If a request has the same cache key - * as some previous request, then we can serve the same cached response for - * both. (e.g. 'some-key') - * - * Only available for Enterprise customers. - */ - cacheKey?: string; - /** - * This allows you to append additional Cache-Tag response headers - * to the origin response without modifications to the origin server. - * This will allow for greater control over the Purge by Cache Tag feature - * utilizing changes only in the Workers process. - * - * Only available for Enterprise customers. - */ - cacheTags?: string[]; - /** - * Force response to be cached for a given number of seconds. (e.g. 300) - */ - cacheTtl?: number; - /** - * Force response to be cached for a given number of seconds based on the Origin status code. - * (e.g. { '200-299': 86400, '404': 1, '500-599': 0 }) - */ - cacheTtlByStatus?: Record; - scrapeShield?: boolean; - apps?: boolean; - image?: RequestInitCfPropertiesImage; - minify?: RequestInitCfPropertiesImageMinify; - mirage?: boolean; - polish?: "lossy" | "lossless" | "off"; - /** - * Redirects the request to an alternate origin server. You can use this, - * for example, to implement load balancing across several origins. - * (e.g.us-east.example.com) - * - * Note - For security reasons, the hostname set in resolveOverride must - * be proxied on the same Cloudflare zone of the incoming request. - * Otherwise, the setting is ignored. CNAME hosts are allowed, so to - * resolve to a host under a different domain or a DNS only domain first - * declare a CNAME record within your own zone’s DNS mapping to the - * external hostname, set proxy on Cloudflare, then set resolveOverride - * to point to that CNAME record. - */ - resolveOverride?: string; -} -export interface RequestInitCfPropertiesImageDraw - extends BasicImageTransformations { - /** - * Absolute URL of the image file to use for the drawing. It can be any of - * the supported file formats. For drawing of watermarks or non-rectangular - * overlays we recommend using PNG or WebP images. - */ - url: string; - /** - * Floating-point number between 0 (transparent) and 1 (opaque). - * For example, opacity: 0.5 makes overlay semitransparent. - */ - opacity?: number; - /** - * - If set to true, the overlay image will be tiled to cover the entire - * area. This is useful for stock-photo-like watermarks. - * - If set to "x", the overlay image will be tiled horizontally only - * (form a line). - * - If set to "y", the overlay image will be tiled vertically only - * (form a line). - */ - repeat?: true | "x" | "y"; - /** - * Position of the overlay image relative to a given edge. Each property is - * an offset in pixels. 0 aligns exactly to the edge. For example, left: 10 - * positions left side of the overlay 10 pixels from the left edge of the - * image it's drawn over. bottom: 0 aligns bottom of the overlay with bottom - * of the background image. - * - * Setting both left & right, or both top & bottom is an error. - * - * If no position is specified, the image will be centered. - */ - top?: number; - left?: number; - bottom?: number; - right?: number; -} -export interface RequestInitCfPropertiesImage - extends BasicImageTransformations { - /** - * Device Pixel Ratio. Default 1. Multiplier for width/height that makes it - * easier to specify higher-DPI sizes in . - */ - dpr?: number; - /** - * An object with four properties {left, top, right, bottom} that specify - * a number of pixels to cut off on each side. Allows removal of borders - * or cutting out a specific fragment of an image. Trimming is performed - * before resizing or rotation. Takes dpr into account. - */ - trim?: { - left?: number; - top?: number; - right?: number; - bottom?: number; - }; - /** - * Quality setting from 1-100 (useful values are in 60-90 range). Lower values - * make images look worse, but load faster. The default is 85. It applies only - * to JPEG and WebP images. It doesn’t have any effect on PNG. - */ - quality?: number; - /** - * Output format to generate. It can be: - * - avif: generate images in AVIF format. - * - webp: generate images in Google WebP format. Set quality to 100 to get - * the WebP-lossless format. - * - json: instead of generating an image, outputs information about the - * image, in JSON format. The JSON object will contain image size - * (before and after resizing), source image’s MIME type, file size, etc. - * - jpeg: generate images in JPEG format. - * - png: generate images in PNG format. - */ - format?: "avif" | "webp" | "json" | "jpeg" | "png"; - /** - * Whether to preserve animation frames from input files. Default is true. - * Setting it to false reduces animations to still images. This setting is - * recommended when enlarging images or processing arbitrary user content, - * because large GIF animations can weigh tens or even hundreds of megabytes. - * It is also useful to set anim:false when using format:"json" to get the - * response quicker without the number of frames. - */ - anim?: boolean; - /** - * What EXIF data should be preserved in the output image. Note that EXIF - * rotation and embedded color profiles are always applied ("baked in" into - * the image), and aren't affected by this option. Note that if the Polish - * feature is enabled, all metadata may have been removed already and this - * option may have no effect. - * - keep: Preserve most of EXIF metadata, including GPS location if there's - * any. - * - copyright: Only keep the copyright tag, and discard everything else. - * This is the default behavior for JPEG files. - * - none: Discard all invisible EXIF metadata. Currently WebP and PNG - * output formats always discard metadata. - */ - metadata?: "keep" | "copyright" | "none"; - /** - * Strength of sharpening filter to apply to the image. Floating-point - * number between 0 (no sharpening, default) and 10 (maximum). 1.0 is a - * recommended value for downscaled images. - */ - sharpen?: number; - /** - * Radius of a blur filter (approximate gaussian). Maximum supported radius - * is 250. - */ - blur?: number; - /** - * Overlays are drawn in the order they appear in the array (last array - * entry is the topmost layer). - */ - draw?: RequestInitCfPropertiesImageDraw[]; - /** - * Fetching image from authenticated origin. Setting this property will - * pass authentication headers (Authorization, Cookie, etc.) through to - * the origin. - */ - "origin-auth"?: "share-publicly"; - /** - * Adds a border around the image. The border is added after resizing. Border - * width takes dpr into account, and can be specified either using a single - * width property, or individually for each side. - */ - border?: - | { - color: string; - width: number; - } - | { - color: string; - top: number; - right: number; - bottom: number; - left: number; - }; - /** - * Increase brightness by a factor. A value of 1.0 equals no change, a value - * of 0.5 equals half brightness, and a value of 2.0 equals twice as bright. - * 0 is ignored. - */ - brightness?: number; - /** - * Increase contrast by a factor. A value of 1.0 equals no change, a value of - * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is - * ignored. - */ - contrast?: number; - /** - * Increase exposure by a factor. A value of 1.0 equals no change, a value of - * 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored. - */ - gamma?: number; - /** - * Slightly reduces latency on a cache miss by selecting a - * quickest-to-compress file format, at a cost of increased file size and - * lower image quality. It will usually override the format option and choose - * JPEG over WebP or AVIF. We do not recommend using this option, except in - * unusual circumstances like resizing uncacheable dynamically-generated - * images. - */ - compression?: "fast"; -} -export interface RequestInitCfPropertiesImageMinify { - javascript?: boolean; - css?: boolean; - html?: boolean; -} -/** - * Request metadata provided by Cloudflare's edge. - */ -export type IncomingRequestCfProperties = - IncomingRequestCfPropertiesBase & - IncomingRequestCfPropertiesBotManagementEnterprise & - IncomingRequestCfPropertiesCloudflareForSaaSEnterprise & - IncomingRequestCfPropertiesGeographicInformation & - IncomingRequestCfPropertiesCloudflareAccessOrApiShield; -export interface IncomingRequestCfPropertiesBase - extends Record { - /** - * [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request. - * - * @example 395747 - */ - asn: number; - /** - * The organization which owns the ASN of the incoming request. - * - * @example "Google Cloud" - */ - asOrganization: string; - /** - * The original value of the `Accept-Encoding` header if Cloudflare modified it. - * - * @example "gzip, deflate, br" - */ - clientAcceptEncoding?: string; - /** - * The number of milliseconds it took for the request to reach your worker. - * - * @example 22 - */ - clientTcpRtt?: number; - /** - * The three-letter [IATA](https://en.wikipedia.org/wiki/IATA_airport_code) - * airport code of the data center that the request hit. - * - * @example "DFW" - */ - colo: string; - /** - * Represents the upstream's response to a - * [TCP `keepalive` message](https://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html) - * from cloudflare. - * - * For workers with no upstream, this will always be `1`. - * - * @example 3 - */ - edgeRequestKeepAliveStatus: IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus; - /** - * The HTTP Protocol the request used. - * - * @example "HTTP/2" - */ - httpProtocol: string; - /** - * The browser-requested prioritization information in the request object. - * - * If no information was set, defaults to the empty string `""` - * - * @example "weight=192;exclusive=0;group=3;group-weight=127" - * @default "" - */ - requestPriority: string; - /** - * The TLS version of the connection to Cloudflare. - * In requests served over plaintext (without TLS), this property is the empty string `""`. - * - * @example "TLSv1.3" - */ - tlsVersion: string; - /** - * The cipher for the connection to Cloudflare. - * In requests served over plaintext (without TLS), this property is the empty string `""`. - * - * @example "AEAD-AES128-GCM-SHA256" - */ - tlsCipher: string; - /** - * Metadata containing the [`HELLO`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2) and [`FINISHED`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9) messages from this request's TLS handshake. - * - * If the incoming request was served over plaintext (without TLS) this field is undefined. - */ - tlsExportedAuthenticator?: IncomingRequestCfPropertiesExportedAuthenticatorMetadata; -} -export interface IncomingRequestCfPropertiesBotManagementBase { - /** - * Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot, - * represented as an integer percentage between `1` (almost certainly human) - * and `99` (almost certainly a bot). - * - * @example 54 - */ - score: number; - /** - * A boolean value that is true if the request comes from a good bot, like Google or Bing. - * Most customers choose to allow this traffic. For more details, see [Traffic from known bots](https://developers.cloudflare.com/firewall/known-issues-and-faq/#how-does-firewall-rules-handle-traffic-from-known-bots). - */ - verifiedBot: boolean; - /** - * A boolean value that is true if the request originates from a - * Cloudflare-verified proxy service. - */ - corporateProxy: boolean; - /** - * A boolean value that's true if the request matches [file extensions](https://developers.cloudflare.com/bots/reference/static-resources/) for many types of static resources. - */ - staticResource: boolean; - /** - * List of IDs that correlate to the Bot Management heuristic detections made on a request (you can have multiple heuristic detections on the same request). - */ - detectionIds: number[]; -} -export interface IncomingRequestCfPropertiesBotManagement { - /** - * Results of Cloudflare's Bot Management analysis - */ - botManagement: IncomingRequestCfPropertiesBotManagementBase; - /** - * Duplicate of `botManagement.score`. - * - * @deprecated - */ - clientTrustScore: number; -} -export interface IncomingRequestCfPropertiesBotManagementEnterprise - extends IncomingRequestCfPropertiesBotManagement { - /** - * Results of Cloudflare's Bot Management analysis - */ - botManagement: IncomingRequestCfPropertiesBotManagementBase & { - /** - * A [JA3 Fingerprint](https://developers.cloudflare.com/bots/concepts/ja3-fingerprint/) to help profile specific SSL/TLS clients - * across different destination IPs, Ports, and X509 certificates. - */ - ja3Hash: string; - }; -} -export interface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise< - HostMetadata -> { - /** - * Custom metadata set per-host in [Cloudflare for SaaS](https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/). - * - * This field is only present if you have Cloudflare for SaaS enabled on your account - * and you have followed the [required steps to enable it]((https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/domain-support/custom-metadata/)). - */ - hostMetadata: HostMetadata; -} -export interface IncomingRequestCfPropertiesCloudflareAccessOrApiShield { - /** - * Information about the client certificate presented to Cloudflare. - * - * This is populated when the incoming request is served over TLS using - * either Cloudflare Access or API Shield (mTLS) - * and the presented SSL certificate has a valid - * [Certificate Serial Number](https://ldapwiki.com/wiki/Certificate%20Serial%20Number) - * (i.e., not `null` or `""`). - * - * Otherwise, a set of placeholder values are used. - * - * The property `certPresented` will be set to `"1"` when - * the object is populated (i.e. the above conditions were met). - */ - tlsClientAuth: - | IncomingRequestCfPropertiesTLSClientAuth - | IncomingRequestCfPropertiesTLSClientAuthPlaceholder; -} -/** - * Metadata about the request's TLS handshake - */ -export interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata { - /** - * The client's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal - * - * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d" - */ - clientHandshake: string; - /** - * The server's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal - * - * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d" - */ - serverHandshake: string; - /** - * The client's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal - * - * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b" - */ - clientFinished: string; - /** - * The server's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal - * - * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b" - */ - serverFinished: string; -} -/** - * Geographic data about the request's origin. - */ -export interface IncomingRequestCfPropertiesGeographicInformation { - /** - * The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from. - * - * If your worker is [configured to accept TOR connections](https://support.cloudflare.com/hc/en-us/articles/203306930-Understanding-Cloudflare-Tor-support-and-Onion-Routing), this may also be `"T1"`, indicating a request that originated over TOR. - * - * If Cloudflare is unable to determine where the request originated this property is omitted. - * - * The country code `"T1"` is used for requests originating on TOR. - * - * @example "GB" - */ - country?: Iso3166Alpha2Code | "T1"; - /** - * If present, this property indicates that the request originated in the EU - * - * @example "1" - */ - isEUCountry?: "1"; - /** - * A two-letter code indicating the continent the request originated from. - * - * @example "AN" - */ - continent?: ContinentCode; - /** - * The city the request originated from - * - * @example "Austin" - */ - city?: string; - /** - * Postal code of the incoming request - * - * @example "78701" - */ - postalCode?: string; - /** - * Latitude of the incoming request - * - * @example "30.27130" - */ - latitude?: string; - /** - * Longitude of the incoming request - * - * @example "-97.74260" - */ - longitude?: string; - /** - * Timezone of the incoming request - * - * @example "America/Chicago" - */ - timezone?: string; - /** - * If known, the ISO 3166-2 name for the first level region associated with - * the IP address of the incoming request - * - * @example "Texas" - */ - region?: string; - /** - * If known, the ISO 3166-2 code for the first-level region associated with - * the IP address of the incoming request - * - * @example "TX" - */ - regionCode?: string; - /** - * Metro code (DMA) of the incoming request - * - * @example "635" - */ - metroCode?: string; -} -/** Data about the incoming request's TLS certificate */ -export interface IncomingRequestCfPropertiesTLSClientAuth { - /** Always `"1"`, indicating that the certificate was presented */ - certPresented: "1"; - /** - * Result of certificate verification. - * - * @example "FAILED:self signed certificate" - */ - certVerified: Exclude; - /** The presented certificate's revokation status. - * - * - A value of `"1"` indicates the certificate has been revoked - * - A value of `"0"` indicates the certificate has not been revoked - */ - certRevoked: "1" | "0"; - /** - * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) - * - * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certIssuerDN: string; - /** - * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) - * - * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certSubjectDN: string; - /** - * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted) - * - * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certIssuerDNRFC2253: string; - /** - * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted) - * - * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certSubjectDNRFC2253: string; - /** The certificate issuer's distinguished name (legacy policies) */ - certIssuerDNLegacy: string; - /** The certificate subject's distinguished name (legacy policies) */ - certSubjectDNLegacy: string; - /** - * The certificate's serial number - * - * @example "00936EACBE07F201DF" - */ - certSerial: string; - /** - * The certificate issuer's serial number - * - * @example "2489002934BDFEA34" - */ - certIssuerSerial: string; - /** - * The certificate's Subject Key Identifier - * - * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4" - */ - certSKI: string; - /** - * The certificate issuer's Subject Key Identifier - * - * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4" - */ - certIssuerSKI: string; - /** - * The certificate's SHA-1 fingerprint - * - * @example "6b9109f323999e52259cda7373ff0b4d26bd232e" - */ - certFingerprintSHA1: string; - /** - * The certificate's SHA-256 fingerprint - * - * @example "acf77cf37b4156a2708e34c4eb755f9b5dbbe5ebb55adfec8f11493438d19e6ad3f157f81fa3b98278453d5652b0c1fd1d71e5695ae4d709803a4d3f39de9dea" - */ - certFingerprintSHA256: string; - /** - * The effective starting date of the certificate - * - * @example "Dec 22 19:39:00 2018 GMT" - */ - certNotBefore: string; - /** - * The effective expiration date of the certificate - * - * @example "Dec 22 19:39:00 2018 GMT" - */ - certNotAfter: string; -} -/** Placeholder values for TLS Client Authorization */ -export interface IncomingRequestCfPropertiesTLSClientAuthPlaceholder { - certPresented: "0"; - certVerified: "NONE"; - certRevoked: "0"; - certIssuerDN: ""; - certSubjectDN: ""; - certIssuerDNRFC2253: ""; - certSubjectDNRFC2253: ""; - certIssuerDNLegacy: ""; - certSubjectDNLegacy: ""; - certSerial: ""; - certIssuerSerial: ""; - certSKI: ""; - certIssuerSKI: ""; - certFingerprintSHA1: ""; - certFingerprintSHA256: ""; - certNotBefore: ""; - certNotAfter: ""; -} -/** Possible outcomes of TLS verification */ -export type CertVerificationStatus = - /** Authentication succeeded */ - | "SUCCESS" - /** No certificate was presented */ - | "NONE" - /** Failed because the certificate was self-signed */ - | "FAILED:self signed certificate" - /** Failed because the certificate failed a trust chain check */ - | "FAILED:unable to verify the first certificate" - /** Failed because the certificate not yet valid */ - | "FAILED:certificate is not yet valid" - /** Failed because the certificate is expired */ - | "FAILED:certificate has expired" - /** Failed for another unspecified reason */ - | "FAILED"; -/** - * An upstream endpoint's response to a TCP `keepalive` message from Cloudflare. - */ -export type IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus = - | 0 /** Unknown */ - | 1 /** no keepalives (not found) */ - | 2 /** no connection re-use, opening keepalive connection failed */ - | 3 /** no connection re-use, keepalive accepted and saved */ - | 4 /** connection re-use, refused by the origin server (`TCP FIN`) */ - | 5; /** connection re-use, accepted by the origin server */ -/** ISO 3166-1 Alpha-2 codes */ -export type Iso3166Alpha2Code = - | "AD" - | "AE" - | "AF" - | "AG" - | "AI" - | "AL" - | "AM" - | "AO" - | "AQ" - | "AR" - | "AS" - | "AT" - | "AU" - | "AW" - | "AX" - | "AZ" - | "BA" - | "BB" - | "BD" - | "BE" - | "BF" - | "BG" - | "BH" - | "BI" - | "BJ" - | "BL" - | "BM" - | "BN" - | "BO" - | "BQ" - | "BR" - | "BS" - | "BT" - | "BV" - | "BW" - | "BY" - | "BZ" - | "CA" - | "CC" - | "CD" - | "CF" - | "CG" - | "CH" - | "CI" - | "CK" - | "CL" - | "CM" - | "CN" - | "CO" - | "CR" - | "CU" - | "CV" - | "CW" - | "CX" - | "CY" - | "CZ" - | "DE" - | "DJ" - | "DK" - | "DM" - | "DO" - | "DZ" - | "EC" - | "EE" - | "EG" - | "EH" - | "ER" - | "ES" - | "ET" - | "FI" - | "FJ" - | "FK" - | "FM" - | "FO" - | "FR" - | "GA" - | "GB" - | "GD" - | "GE" - | "GF" - | "GG" - | "GH" - | "GI" - | "GL" - | "GM" - | "GN" - | "GP" - | "GQ" - | "GR" - | "GS" - | "GT" - | "GU" - | "GW" - | "GY" - | "HK" - | "HM" - | "HN" - | "HR" - | "HT" - | "HU" - | "ID" - | "IE" - | "IL" - | "IM" - | "IN" - | "IO" - | "IQ" - | "IR" - | "IS" - | "IT" - | "JE" - | "JM" - | "JO" - | "JP" - | "KE" - | "KG" - | "KH" - | "KI" - | "KM" - | "KN" - | "KP" - | "KR" - | "KW" - | "KY" - | "KZ" - | "LA" - | "LB" - | "LC" - | "LI" - | "LK" - | "LR" - | "LS" - | "LT" - | "LU" - | "LV" - | "LY" - | "MA" - | "MC" - | "MD" - | "ME" - | "MF" - | "MG" - | "MH" - | "MK" - | "ML" - | "MM" - | "MN" - | "MO" - | "MP" - | "MQ" - | "MR" - | "MS" - | "MT" - | "MU" - | "MV" - | "MW" - | "MX" - | "MY" - | "MZ" - | "NA" - | "NC" - | "NE" - | "NF" - | "NG" - | "NI" - | "NL" - | "NO" - | "NP" - | "NR" - | "NU" - | "NZ" - | "OM" - | "PA" - | "PE" - | "PF" - | "PG" - | "PH" - | "PK" - | "PL" - | "PM" - | "PN" - | "PR" - | "PS" - | "PT" - | "PW" - | "PY" - | "QA" - | "RE" - | "RO" - | "RS" - | "RU" - | "RW" - | "SA" - | "SB" - | "SC" - | "SD" - | "SE" - | "SG" - | "SH" - | "SI" - | "SJ" - | "SK" - | "SL" - | "SM" - | "SN" - | "SO" - | "SR" - | "SS" - | "ST" - | "SV" - | "SX" - | "SY" - | "SZ" - | "TC" - | "TD" - | "TF" - | "TG" - | "TH" - | "TJ" - | "TK" - | "TL" - | "TM" - | "TN" - | "TO" - | "TR" - | "TT" - | "TV" - | "TW" - | "TZ" - | "UA" - | "UG" - | "UM" - | "US" - | "UY" - | "UZ" - | "VA" - | "VC" - | "VE" - | "VG" - | "VI" - | "VN" - | "VU" - | "WF" - | "WS" - | "YE" - | "YT" - | "ZA" - | "ZM" - | "ZW"; -/** The 2-letter continent codes Cloudflare uses */ -export type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA"; -export type CfProperties = - | IncomingRequestCfProperties - | RequestInitCfProperties; -export interface D1Result { - results?: T[]; - success: boolean; - error?: string; - meta: any; -} -export declare abstract class D1Database { - prepare(query: string): D1PreparedStatement; - dump(): Promise; - batch(statements: D1PreparedStatement[]): Promise[]>; - exec(query: string): Promise>; -} -export declare abstract class D1PreparedStatement { - bind(...values: any[]): D1PreparedStatement; - first(colName?: string): Promise; - run(): Promise>; - all(): Promise>; - raw(): Promise; -} -/** - * A email message that is sent to a consumer Worker. - */ -export interface EmailMessage { - /** - * Envelope From attribute of the email message. - */ - readonly from: string; - /** - * Envelope To attribute of the email message. - */ - readonly to: string; - /** - * A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers). - */ - readonly headers: Headers; - /** - * Stream of the email message content. - */ - readonly raw: ReadableStream; - /** - * Size of the email message content. - */ - readonly rawSize: number; - /** - * Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason. - * @param reason The reject reason. - * @returns void - */ - setReject(reason: string): void; - /** - * Forward this email message to a verified destination address of the account. - * @param rcptTo Verified destination address. - * @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers). - * @returns A promise that resolves when the email message is forwarded. - */ - forward(rcptTo: string, headers?: Headers): Promise; -} -export declare abstract class EmailEvent extends ExtendableEvent { - readonly message: EmailMessage; -} -export type EmailExportedHandler = ( - message: EmailMessage, - env: Env, - ctx: ExecutionContext -) => void | Promise; -export type Params

= Record; -export type EventContext = { - request: Request; - functionPath: string; - waitUntil: (promise: Promise) => void; - passThroughOnException: () => void; - next: (input?: Request | string, init?: RequestInit) => Promise; - env: Env & { - ASSETS: { - fetch: typeof fetch; - }; - }; - params: Params

; - data: Data; -}; -export type PagesFunction< - Env = unknown, - Params extends string = any, - Data extends Record = Record -> = (context: EventContext) => Response | Promise; -export type EventPluginContext = { - request: Request; - functionPath: string; - waitUntil: (promise: Promise) => void; - passThroughOnException: () => void; - next: (input?: Request | string, init?: RequestInit) => Promise; - env: Env & { - ASSETS: { - fetch: typeof fetch; - }; - }; - params: Params

; - data: Data; - pluginArgs: PluginArgs; -}; -export type PagesPluginFunction< - Env = unknown, - Params extends string = any, - Data extends Record = Record, - PluginArgs = unknown -> = ( - context: EventPluginContext -) => Response | Promise; -// https://developers.cloudflare.com/pub-sub/ -// PubSubMessage represents an incoming PubSub message. -// The message includes metadata about the broker, the client, and the payload -// itself. -export interface PubSubMessage { - // Message ID - readonly mid: number; - // MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT - readonly broker: string; - // The MQTT topic the message was sent on. - readonly topic: string; - // The client ID of the client that published this message. - readonly clientId: string; - // The unique identifier (JWT ID) used by the client to authenticate, if token - // auth was used. - readonly jti?: string; - // A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker - // received the message from the client. - readonly receivedAt: number; - // An (optional) string with the MIME type of the payload, if set by the - // client. - readonly contentType: string; - // Set to 1 when the payload is a UTF-8 string - // https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063 - readonly payloadFormatIndicator: number; - // Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays. - // You can use payloadFormatIndicator to inspect this before decoding. - payload: string | Uint8Array; -} -// JsonWebKey extended by kid parameter -export interface JsonWebKeyWithKid extends JsonWebKey { - // Key Identifier of the JWK - readonly kid: string; -} -/** - * A message that is sent to a consumer Worker. - */ -export interface Message { - /** - * A unique, system-generated ID for the message. - */ - readonly id: string; - /** - * A timestamp when the message was sent. - */ - readonly timestamp: Date; - /** - * The body of the message. - */ - readonly body: Body; - /** - * Marks message to be retried. - */ - retry(): void; - /** - * Marks message acknowledged. - */ - ack(): void; -} -/** - * A batch of messages that are sent to a consumer Worker. - */ -export interface MessageBatch { - /** - * The name of the Queue that belongs to this batch. - */ - readonly queue: string; - /** - * An array of messages in the batch. Ordering of messages is not guaranteed. - */ - readonly messages: readonly Message[]; - /** - * Marks every message to be retried in the next batch. - */ - retryAll(): void; - /** - * Marks every message acknowledged in the batch. - */ - ackAll(): void; -} -/** - * A wrapper class used to structure message batches. - */ -export type MessageSendRequest = { - /** - * The body of the message. - */ - body: Body; -}; -/** - * A binding that allows a producer to send messages to a Queue. - */ -export interface Queue { - /** - * Sends a message to the Queue. - * @param message The message can be any type supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types), as long as its size is less than 128 KB. - * @returns A promise that resolves when the message is confirmed to be written to disk. - */ - send(message: Body): Promise; - /** - * Sends a batch of messages to the Queue. - * @param messages Each item in the input must be supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types). A batch can contain up to 100 messages, though items are limited to 128 KB each, and the total size of the array cannot exceed 256 KB. - * @returns A promise that resolves when the messages are confirmed to be written to disk. - */ - sendBatch(messages: Iterable>): Promise; -} diff --git a/packages/denylist_bot/node_modules/@cloudflare/workers-types/2022-11-30/index.d.ts b/packages/denylist_bot/node_modules/@cloudflare/workers-types/2022-11-30/index.d.ts deleted file mode 100755 index d44eb860c..000000000 --- a/packages/denylist_bot/node_modules/@cloudflare/workers-types/2022-11-30/index.d.ts +++ /dev/null @@ -1,2983 +0,0 @@ -/*! ***************************************************************************** -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 class DOMException extends Error { - constructor(message?: string, name?: string); - readonly message: string; - readonly name: string; - readonly code: number; - readonly stack: any; - 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; -} -declare type WorkerGlobalScopeEventMap = { - fetch: FetchEvent; - scheduled: ScheduledEvent; - unhandledrejection: PromiseRejectionEvent; - rejectionhandled: PromiseRejectionEvent; -}; -declare abstract class WorkerGlobalScope extends EventTarget { - EventTarget: typeof EventTarget; -} -declare interface Console { - "assert"(condition?: boolean, ...data: any[]): void; - clear(): void; - count(label?: string): void; - countReset(label?: string): void; - debug(...data: any[]): void; - dir(item?: any, options?: any): void; - dirxml(...data: any[]): void; - error(...data: any[]): void; - group(...data: any[]): void; - groupCollapsed(...data: any[]): void; - groupEnd(): void; - info(...data: any[]): void; - log(...data: any[]): void; - table(tabularData?: any, properties?: string[]): void; - time(label?: string): void; - timeEnd(label?: string): void; - timeLog(label?: string, ...data: any[]): void; - timeStamp(label?: string): void; - trace(...data: any[]): void; - warn(...data: any[]): void; -} -declare const console: Console; -declare type BufferSource = ArrayBufferView | ArrayBuffer; -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; - type Imports = Record; - type ExportValue = Function | Global | Memory | Table; - type Exports = Record; - 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; - function validate(bytes: BufferSource): boolean; -} -/** This ServiceWorker API interface represents the global execution context of a service worker. */ -declare 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( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args - ): number; - clearTimeout(timeoutId: number | null): void; - setInterval(callback: (...args: any[]) => void, msDelay?: number): number; - setInterval( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args - ): number; - clearInterval(timeoutId: number | null): void; - queueMicrotask(task: Function): void; - structuredClone(value: T, options?: StructuredSerializeOptions): T; - fetch( - input: RequestInfo, - init?: RequestInit - ): Promise; - self: ServiceWorkerGlobalScope; - crypto: Crypto; - caches: CacheStorage; - scheduler: Scheduler; - Event: typeof Event; - ExtendableEvent: typeof ExtendableEvent; - PromiseRejectionEvent: typeof PromiseRejectionEvent; - FetchEvent: typeof FetchEvent; - TraceEvent: typeof TraceEvent; - 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; - ReadableStreamBYOBRequest: typeof ReadableStreamBYOBRequest; - ReadableStreamDefaultController: typeof ReadableStreamDefaultController; - ReadableByteStreamController: typeof ReadableByteStreamController; - WritableStreamDefaultController: typeof WritableStreamDefaultController; - 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; - 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: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetAddEventListenerOptions | boolean -): void; -declare function removeEventListener< - Type extends keyof WorkerGlobalScopeEventMap ->( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetEventListenerOptions | boolean -): void; -/** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */ -declare function dispatchEvent( - event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap] -): boolean; -declare function btoa(data: string): string; -declare function atob(data: string): string; -declare function setTimeout( - callback: (...args: any[]) => void, - msDelay?: number -): number; -declare function setTimeout( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args -): number; -declare function clearTimeout(timeoutId: number | null): void; -declare function setInterval( - callback: (...args: any[]) => void, - msDelay?: number -): number; -declare function setInterval( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args -): number; -declare function clearInterval(timeoutId: number | null): void; -declare function queueMicrotask(task: Function): void; -declare function structuredClone( - value: T, - options?: StructuredSerializeOptions -): T; -declare function fetch( - input: RequestInfo, - init?: RequestInit -): Promise; -declare const self: ServiceWorkerGlobalScope; -declare const crypto: Crypto; -declare const caches: CacheStorage; -declare const scheduler: Scheduler; -declare const navigator: Navigator; -declare interface TestController {} -declare interface ExecutionContext { - waitUntil(promise: Promise): void; - passThroughOnException(): void; -} -declare type ExportedHandlerFetchHandler< - Env = unknown, - CfHostMetadata = unknown -> = ( - request: Request>, - env: Env, - ctx: ExecutionContext -) => Response | Promise; -declare type ExportedHandlerTraceHandler = ( - traces: TraceItem[], - env: Env, - ctx: ExecutionContext -) => void | Promise; -declare type ExportedHandlerScheduledHandler = ( - controller: ScheduledController, - env: Env, - ctx: ExecutionContext -) => void | Promise; -declare type ExportedHandlerQueueHandler = ( - batch: MessageBatch, - env: Env, - ctx: ExecutionContext -) => void | Promise; -declare type ExportedHandlerTestHandler = ( - controller: TestController, - env: Env, - ctx: ExecutionContext -) => void | Promise; -declare interface ExportedHandler< - Env = unknown, - QueueMessage = unknown, - CfHostMetadata = unknown -> { - fetch?: ExportedHandlerFetchHandler; - trace?: ExportedHandlerTraceHandler; - scheduled?: ExportedHandlerScheduledHandler; - test?: ExportedHandlerTestHandler; - queue?: ExportedHandlerQueueHandler; -} -declare interface StructuredSerializeOptions { - transfer?: any[]; -} -declare abstract class PromiseRejectionEvent extends Event { - readonly promise: Promise; - readonly reason: any; -} -declare abstract class Navigator { - readonly userAgent: string; -} -declare interface DurableObject { - fetch(request: Request): Response | Promise; - alarm?(): void | Promise; -} -declare interface DurableObjectStub extends Fetcher { - readonly id: DurableObjectId; - readonly name?: string; -} -declare interface DurableObjectId { - toString(): string; - equals(other: DurableObjectId): boolean; - readonly name?: string; -} -declare interface DurableObjectNamespace { - newUniqueId( - options?: DurableObjectNamespaceNewUniqueIdOptions - ): DurableObjectId; - idFromName(name: string): DurableObjectId; - idFromString(id: string): DurableObjectId; - get( - id: DurableObjectId, - options?: DurableObjectNamespaceGetDurableObjectOptions - ): DurableObjectStub; - jurisdiction(jurisdiction: string): DurableObjectNamespace; -} -declare interface DurableObjectNamespaceNewUniqueIdOptions { - jurisdiction?: string; -} -declare interface DurableObjectNamespaceGetDurableObjectOptions { - locationHint?: string; -} -declare interface DurableObjectState { - waitUntil(promise: Promise): void; - readonly id: DurableObjectId; - readonly storage: DurableObjectStorage; - blockConcurrencyWhile(callback: () => Promise): Promise; -} -declare interface DurableObjectTransaction { - get( - key: string, - options?: DurableObjectGetOptions - ): Promise; - get( - keys: string[], - options?: DurableObjectGetOptions - ): Promise>; - list( - options?: DurableObjectListOptions - ): Promise>; - put( - key: string, - value: T, - options?: DurableObjectPutOptions - ): Promise; - put( - entries: Record, - options?: DurableObjectPutOptions - ): Promise; - delete(key: string, options?: DurableObjectPutOptions): Promise; - delete(keys: string[], options?: DurableObjectPutOptions): Promise; - rollback(): void; - getAlarm(options?: DurableObjectGetAlarmOptions): Promise; - setAlarm( - scheduledTime: number | Date, - options?: DurableObjectSetAlarmOptions - ): Promise; - deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise; -} -declare interface DurableObjectStorage { - get( - key: string, - options?: DurableObjectGetOptions - ): Promise; - get( - keys: string[], - options?: DurableObjectGetOptions - ): Promise>; - list( - options?: DurableObjectListOptions - ): Promise>; - put( - key: string, - value: T, - options?: DurableObjectPutOptions - ): Promise; - put( - entries: Record, - options?: DurableObjectPutOptions - ): Promise; - delete(key: string, options?: DurableObjectPutOptions): Promise; - delete(keys: string[], options?: DurableObjectPutOptions): Promise; - deleteAll(options?: DurableObjectPutOptions): Promise; - transaction( - closure: (txn: DurableObjectTransaction) => Promise - ): Promise; - getAlarm(options?: DurableObjectGetAlarmOptions): Promise; - setAlarm( - scheduledTime: number | Date, - options?: DurableObjectSetAlarmOptions - ): Promise; - deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise; - sync(): Promise; -} -declare interface DurableObjectListOptions { - start?: string; - startAfter?: string; - end?: string; - prefix?: string; - reverse?: boolean; - limit?: number; - allowConcurrency?: boolean; - noCache?: boolean; -} -declare interface DurableObjectGetOptions { - allowConcurrency?: boolean; - noCache?: boolean; -} -declare interface DurableObjectGetAlarmOptions { - allowConcurrency?: boolean; -} -declare interface DurableObjectPutOptions { - allowConcurrency?: boolean; - allowUnconfirmed?: boolean; - noCache?: boolean; -} -declare interface DurableObjectSetAlarmOptions { - allowConcurrency?: boolean; - allowUnconfirmed?: boolean; -} -declare interface AnalyticsEngineDataset { - writeDataPoint(event?: AnalyticsEngineDataPoint): void; -} -declare interface AnalyticsEngineDataPoint { - indexes?: ((ArrayBuffer | string) | null)[]; - doubles?: number[]; - blobs?: ((ArrayBuffer | string) | null)[]; -} -declare class Event { - constructor(type: string, init?: EventInit); - get type(): string; - get eventPhase(): number; - get composed(): boolean; - get bubbles(): boolean; - get cancelable(): boolean; - get defaultPrevented(): boolean; - get returnValue(): boolean; - get currentTarget(): EventTarget | undefined; - get srcElement(): EventTarget | undefined; - get timeStamp(): number; - get isTrusted(): boolean; - get cancelBubble(): boolean; - set cancelBubble(value: boolean); - stopImmediatePropagation(): void; - preventDefault(): void; - stopPropagation(): void; - composedPath(): EventTarget[]; - static readonly NONE: number; - static readonly CAPTURING_PHASE: number; - static readonly AT_TARGET: number; - static readonly BUBBLING_PHASE: number; -} -declare interface EventInit { - bubbles?: boolean; - cancelable?: boolean; - composed?: boolean; -} -declare type EventListener = ( - event: EventType -) => void; -declare interface EventListenerObject { - handleEvent(event: EventType): void; -} -declare type EventListenerOrEventListenerObject< - EventType extends Event = Event -> = EventListener | EventListenerObject; -declare class EventTarget< - EventMap extends Record = Record -> { - constructor(); - addEventListener( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetAddEventListenerOptions | boolean - ): void; - removeEventListener( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetEventListenerOptions | boolean - ): void; - dispatchEvent(event: EventMap[keyof EventMap]): boolean; -} -declare interface EventTargetEventListenerOptions { - capture?: boolean; -} -declare interface EventTargetAddEventListenerOptions { - capture?: boolean; - passive?: boolean; - once?: boolean; - signal?: AbortSignal; -} -declare interface EventTargetHandlerObject { - handleEvent: (event: Event) => any | undefined; -} -declare class AbortController { - constructor(); - get signal(): AbortSignal; - abort(reason?: any): void; -} -declare abstract class AbortSignal extends EventTarget { - static abort(reason?: any): AbortSignal; - static timeout(delay: number): AbortSignal; - get aborted(): boolean; - get reason(): any; - throwIfAborted(): void; -} -declare interface Scheduler { - wait(delay: number, maybeOptions?: SchedulerWaitOptions): Promise; -} -declare interface SchedulerWaitOptions { - signal?: AbortSignal; -} -declare abstract class ExtendableEvent extends Event { - waitUntil(promise: Promise): void; -} -declare class Blob { - constructor( - bits?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[], - options?: BlobOptions - ); - get size(): number; - get type(): string; - slice(start?: number, end?: number, type?: string): Blob; - arrayBuffer(): Promise; - text(): Promise; - stream(): ReadableStream; -} -declare interface BlobOptions { - type?: string; -} -declare class File extends Blob { - constructor( - bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined, - name: string, - options?: FileOptions - ); - get name(): string; - get lastModified(): number; -} -declare interface FileOptions { - type?: string; - lastModified?: number; -} -declare abstract class CacheStorage { - open(cacheName: string): Promise; - readonly default: Cache; -} -declare abstract class Cache { - delete(request: RequestInfo, options?: CacheQueryOptions): Promise; - match( - request: RequestInfo, - options?: CacheQueryOptions - ): Promise; - put(request: RequestInfo, response: Response): Promise; -} -declare interface CacheQueryOptions { - ignoreMethod?: boolean; -} -declare abstract class Crypto { - get subtle(): SubtleCrypto; - getRandomValues< - T extends - | Int8Array - | Uint8Array - | Int16Array - | Uint16Array - | Int32Array - | Uint32Array - | BigInt64Array - | BigUint64Array - >(buffer: T): T; - randomUUID(): string; - DigestStream: typeof DigestStream; -} -declare abstract class SubtleCrypto { - encrypt( - algorithm: string | SubtleCryptoEncryptAlgorithm, - key: CryptoKey, - plainText: ArrayBuffer | ArrayBufferView - ): Promise; - decrypt( - algorithm: string | SubtleCryptoEncryptAlgorithm, - key: CryptoKey, - cipherText: ArrayBuffer | ArrayBufferView - ): Promise; - sign( - algorithm: string | SubtleCryptoSignAlgorithm, - key: CryptoKey, - data: ArrayBuffer | ArrayBufferView - ): Promise; - verify( - algorithm: string | SubtleCryptoSignAlgorithm, - key: CryptoKey, - signature: ArrayBuffer | ArrayBufferView, - data: ArrayBuffer | ArrayBufferView - ): Promise; - digest( - algorithm: string | SubtleCryptoHashAlgorithm, - data: ArrayBuffer | ArrayBufferView - ): Promise; - generateKey( - algorithm: string | SubtleCryptoGenerateKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - deriveKey( - algorithm: string | SubtleCryptoDeriveKeyAlgorithm, - baseKey: CryptoKey, - derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - deriveBits( - algorithm: string | SubtleCryptoDeriveKeyAlgorithm, - baseKey: CryptoKey, - length: number | null - ): Promise; - importKey( - format: string, - keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey, - algorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - exportKey(format: string, key: CryptoKey): Promise; - wrapKey( - format: string, - key: CryptoKey, - wrappingKey: CryptoKey, - wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm - ): Promise; - unwrapKey( - format: string, - wrappedKey: ArrayBuffer | ArrayBufferView, - unwrappingKey: CryptoKey, - unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm, - unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - timingSafeEqual( - a: ArrayBuffer | ArrayBufferView, - b: ArrayBuffer | ArrayBufferView - ): boolean; -} -declare abstract class CryptoKey { - readonly type: string; - readonly extractable: boolean; - readonly algorithm: - | CryptoKeyKeyAlgorithm - | CryptoKeyAesKeyAlgorithm - | CryptoKeyHmacKeyAlgorithm - | CryptoKeyRsaKeyAlgorithm - | CryptoKeyEllipticKeyAlgorithm - | CryptoKeyArbitraryKeyAlgorithm; - readonly usages: string[]; -} -declare interface CryptoKeyPair { - publicKey: CryptoKey; - privateKey: CryptoKey; -} -declare 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; -} -declare interface RsaOtherPrimesInfo { - r?: string; - d?: string; - t?: string; -} -declare interface SubtleCryptoDeriveKeyAlgorithm { - name: string; - salt?: ArrayBuffer; - iterations?: number; - hash?: string | SubtleCryptoHashAlgorithm; - $public?: CryptoKey; - info?: ArrayBuffer; -} -declare interface SubtleCryptoEncryptAlgorithm { - name: string; - iv?: ArrayBuffer; - additionalData?: ArrayBuffer; - tagLength?: number; - counter?: ArrayBuffer; - length?: number; - label?: ArrayBuffer; -} -declare interface SubtleCryptoGenerateKeyAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - modulusLength?: number; - publicExponent?: ArrayBuffer; - length?: number; - namedCurve?: string; -} -declare interface SubtleCryptoHashAlgorithm { - name: string; -} -declare interface SubtleCryptoImportKeyAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - length?: number; - namedCurve?: string; - compressed?: boolean; -} -declare interface SubtleCryptoSignAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - dataLength?: number; - saltLength?: number; -} -declare interface CryptoKeyKeyAlgorithm { - name: string; -} -declare interface CryptoKeyAesKeyAlgorithm { - name: string; - length: number; -} -declare interface CryptoKeyHmacKeyAlgorithm { - name: string; - hash: CryptoKeyKeyAlgorithm; - length: number; -} -declare interface CryptoKeyRsaKeyAlgorithm { - name: string; - modulusLength: number; - publicExponent: ArrayBuffer; - hash?: CryptoKeyKeyAlgorithm; -} -declare interface CryptoKeyEllipticKeyAlgorithm { - name: string; - namedCurve: string; -} -declare interface CryptoKeyArbitraryKeyAlgorithm { - name: string; - hash?: CryptoKeyKeyAlgorithm; - namedCurve?: string; - length?: number; -} -declare class DigestStream extends WritableStream< - ArrayBuffer | ArrayBufferView -> { - constructor(algorithm: string | SubtleCryptoHashAlgorithm); - get digest(): Promise; -} -declare class TextDecoder { - constructor(decoder?: string, options?: TextDecoderConstructorOptions); - decode( - input?: ArrayBuffer | ArrayBufferView, - options?: TextDecoderDecodeOptions - ): string; - get encoding(): string; - get fatal(): boolean; - get ignoreBOM(): boolean; -} -declare class TextEncoder { - constructor(); - encode(input?: string): Uint8Array; - encodeInto(input: string, buffer: Uint8Array): TextEncoderEncodeIntoResult; - get encoding(): string; -} -declare interface TextDecoderConstructorOptions { - fatal: boolean; - ignoreBOM: boolean; -} -declare interface TextDecoderDecodeOptions { - stream: boolean; -} -declare interface TextEncoderEncodeIntoResult { - read: number; - written: number; -} -declare class FormData { - constructor(); - append(name: string, value: string): void; - append(name: string, value: Blob, filename?: string): void; - delete(name: string): void; - get(name: string): (File | string) | null; - getAll(name: string): (File | string)[]; - has(name: string): boolean; - set(name: string, value: string): void; - set(name: string, value: Blob, filename?: string): void; - entries(): IterableIterator<[key: string, value: File | string]>; - keys(): IterableIterator; - values(): IterableIterator; - forEach( - callback: ( - this: This, - value: File | string, - key: string, - parent: FormData - ) => void, - thisArg?: This - ): void; - [Symbol.iterator](): IterableIterator<[key: string, value: File | string]>; -} -declare interface ContentOptions { - html?: boolean; -} -declare class HTMLRewriter { - constructor(); - on( - selector: string, - handlers: HTMLRewriterElementContentHandlers - ): HTMLRewriter; - onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter; - transform(response: Response): Response; -} -declare interface HTMLRewriterElementContentHandlers { - element?(element: Element): void | Promise; - comments?(comment: Comment): void | Promise; - text?(element: Text): void | Promise; -} -declare interface HTMLRewriterDocumentContentHandlers { - doctype?(doctype: Doctype): void | Promise; - comments?(comment: Comment): void | Promise; - text?(text: Text): void | Promise; - end?(end: DocumentEnd): void | Promise; -} -declare interface Doctype { - readonly name: string | null; - readonly publicId: string | null; - readonly systemId: string | null; -} -declare interface Element { - tagName: string; - readonly attributes: IterableIterator; - 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, options?: ContentOptions): Element; - after(content: string, options?: ContentOptions): Element; - prepend(content: string, options?: ContentOptions): Element; - append(content: string, options?: ContentOptions): Element; - replace(content: string, options?: ContentOptions): Element; - remove(): Element; - removeAndKeepContent(): Element; - setInnerContent(content: string, options?: ContentOptions): Element; - onEndTag(handler: (tag: EndTag) => void | Promise): void; -} -declare interface EndTag { - name: string; - before(content: string, options?: ContentOptions): EndTag; - after(content: string, options?: ContentOptions): EndTag; - remove(): EndTag; -} -declare 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; -} -declare interface Text { - readonly text: string; - readonly lastInTextNode: boolean; - readonly removed: boolean; - before(content: string, options?: ContentOptions): Text; - after(content: string, options?: ContentOptions): Text; - replace(content: string, options?: ContentOptions): Text; - remove(): Text; -} -declare interface DocumentEnd { - append(content: string, options?: ContentOptions): DocumentEnd; -} -declare abstract class FetchEvent extends ExtendableEvent { - readonly request: Request; - respondWith(promise: Response | Promise): void; - passThroughOnException(): void; -} -declare type HeadersInit = - | Headers - | Iterable> - | Record; -declare class Headers { - constructor(init?: HeadersInit); - get(name: string): string | null; - getAll(name: string): string[]; - has(name: string): boolean; - set(name: string, value: string): void; - append(name: string, value: string): void; - delete(name: string): void; - forEach( - callback: (this: This, value: string, key: string, parent: Headers) => void, - thisArg?: This - ): void; - entries(): IterableIterator<[key: string, value: string]>; - keys(): IterableIterator; - values(): IterableIterator; - [Symbol.iterator](): IterableIterator<[key: string, value: string]>; -} -declare type BodyInit = - | ReadableStream - | string - | ArrayBuffer - | ArrayBufferView - | Blob - | URLSearchParams - | FormData; -declare abstract class Body { - get body(): ReadableStream | null; - get bodyUsed(): boolean; - arrayBuffer(): Promise; - text(): Promise; - json(): Promise; - formData(): Promise; - blob(): Promise; -} -declare class Response extends Body { - constructor(body?: BodyInit | null, init?: ResponseInit); - static redirect(url: string, status?: number): Response; - static json(any: any, maybeInit?: ResponseInit | Response): Response; - clone(): Response; - get status(): number; - get statusText(): string; - get headers(): Headers; - get ok(): boolean; - get redirected(): boolean; - get url(): string; - get webSocket(): WebSocket | null; - get cf(): any | undefined; -} -declare interface ResponseInit { - status?: number; - statusText?: string; - headers?: HeadersInit; - cf?: any; - webSocket?: WebSocket | null; - encodeBody?: "automatic" | "manual"; -} -declare type RequestInfo< - CfHostMetadata = unknown, - Cf = CfProperties -> = Request | string | URL; -declare class Request< - CfHostMetadata = unknown, - Cf = CfProperties -> extends Body { - constructor(input: RequestInfo, init?: RequestInit); - clone(): Request; - get method(): string; - get url(): string; - get headers(): Headers; - get redirect(): string; - get fetcher(): Fetcher | null; - get signal(): AbortSignal; - get cf(): Cf | undefined; - get integrity(): string; - get keepalive(): boolean; -} -declare interface RequestInit { - /** 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 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; -} -declare abstract class Fetcher { - fetch(input: RequestInfo, init?: RequestInit): Promise; -} -declare interface FetcherPutOptions { - expiration?: number; - expirationTtl?: number; -} -declare interface KVNamespaceListKey { - name: Key; - expiration?: number; - metadata?: Metadata; -} -declare type KVNamespaceListResult = - | { - list_complete: false; - keys: KVNamespaceListKey[]; - cursor: string; - } - | { - list_complete: true; - keys: KVNamespaceListKey[]; - }; -declare interface KVNamespace { - get( - key: Key, - options?: Partial> - ): Promise; - get(key: Key, type: "text"): Promise; - get( - key: Key, - type: "json" - ): Promise; - get(key: Key, type: "arrayBuffer"): Promise; - get(key: Key, type: "stream"): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"text"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"json"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"arrayBuffer"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"stream"> - ): Promise; - list( - options?: KVNamespaceListOptions - ): Promise>; - put( - key: Key, - value: string | ArrayBuffer | ArrayBufferView | ReadableStream, - options?: KVNamespacePutOptions - ): Promise; - getWithMetadata( - key: Key, - options?: Partial> - ): Promise>; - getWithMetadata( - key: Key, - type: "text" - ): Promise>; - getWithMetadata( - key: Key, - type: "json" - ): Promise>; - getWithMetadata( - key: Key, - type: "arrayBuffer" - ): Promise>; - getWithMetadata( - key: Key, - type: "stream" - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"text"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"json"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"arrayBuffer"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"stream"> - ): Promise>; - delete(key: Key): Promise; -} -declare interface KVNamespaceListOptions { - limit?: number; - prefix?: string | null; - cursor?: string | null; -} -declare interface KVNamespaceGetOptions { - type: Type; - cacheTtl?: number; -} -declare interface KVNamespacePutOptions { - expiration?: number; - expirationTtl?: number; - metadata?: any | null; -} -declare interface KVNamespaceGetWithMetadataResult { - value: Value | null; - metadata: Metadata | null; -} -declare interface R2Error extends Error { - readonly name: string; - readonly code: number; - readonly message: string; - readonly action: string; - readonly stack: any; -} -declare interface R2ListOptions { - limit?: number; - prefix?: string; - cursor?: string; - delimiter?: string; - startAfter?: string; - include?: ("httpMetadata" | "customMetadata")[]; -} -declare abstract class R2Bucket { - head(key: string): Promise; - get( - key: string, - options: R2GetOptions & { - onlyIf: R2Conditional | Headers; - } - ): Promise; - get(key: string, options?: R2GetOptions): Promise; - put( - key: string, - value: - | ReadableStream - | ArrayBuffer - | ArrayBufferView - | string - | null - | Blob, - options?: R2PutOptions - ): Promise; - put( - key: string, - value: - | ReadableStream - | ArrayBuffer - | ArrayBufferView - | string - | null - | Blob, - options?: R2PutOptions & { - onlyIf: R2Conditional | Headers; - } - ): Promise; - createMultipartUpload( - key: string, - options?: R2MultipartOptions - ): Promise; - resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload; - delete(keys: string | string[]): Promise; - list(options?: R2ListOptions): Promise; -} -declare interface R2MultipartUpload { - readonly key: string; - readonly uploadId: string; - uploadPart( - partNumber: number, - value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob - ): Promise; - abort(): Promise; - complete(uploadedParts: R2UploadedPart[]): Promise; -} -declare 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; - readonly range?: R2Range; - writeHttpMetadata(headers: Headers): void; -} -declare interface R2ObjectBody extends R2Object { - get body(): ReadableStream; - get bodyUsed(): boolean; - arrayBuffer(): Promise; - text(): Promise; - json(): Promise; - blob(): Promise; -} -declare type R2Range = - | { - offset: number; - length?: number; - } - | { - offset?: number; - length: number; - } - | { - suffix: number; - }; -declare interface R2Conditional { - etagMatches?: string; - etagDoesNotMatch?: string; - uploadedBefore?: Date; - uploadedAfter?: Date; - secondsGranularity?: boolean; -} -declare interface R2GetOptions { - onlyIf?: R2Conditional | Headers; - range?: R2Range | Headers; -} -declare interface R2PutOptions { - onlyIf?: R2Conditional | Headers; - httpMetadata?: R2HTTPMetadata | Headers; - customMetadata?: Record; - md5?: ArrayBuffer | string; - sha1?: ArrayBuffer | string; - sha256?: ArrayBuffer | string; - sha384?: ArrayBuffer | string; - sha512?: ArrayBuffer | string; -} -declare interface R2MultipartOptions { - httpMetadata?: R2HTTPMetadata | Headers; - customMetadata?: Record; -} -declare interface R2Checksums { - readonly md5?: ArrayBuffer; - readonly sha1?: ArrayBuffer; - readonly sha256?: ArrayBuffer; - readonly sha384?: ArrayBuffer; - readonly sha512?: ArrayBuffer; - toJSON(): R2StringChecksums; -} -declare interface R2StringChecksums { - md5?: string; - sha1?: string; - sha256?: string; - sha384?: string; - sha512?: string; -} -declare interface R2HTTPMetadata { - contentType?: string; - contentLanguage?: string; - contentDisposition?: string; - contentEncoding?: string; - cacheControl?: string; - cacheExpiry?: Date; -} -declare interface R2Objects { - objects: R2Object[]; - truncated: boolean; - cursor?: string; - delimitedPrefixes: string[]; -} -declare abstract class ScheduledEvent extends ExtendableEvent { - readonly scheduledTime: number; - readonly cron: string; - noRetry(): void; -} -declare interface ScheduledController { - readonly scheduledTime: number; - readonly cron: string; - noRetry(): void; -} -declare interface QueuingStrategy { - highWaterMark?: number | bigint; - size?: (chunk: T) => number | bigint; -} -declare interface UnderlyingSink { - type?: string; - start?: (controller: WritableStreamDefaultController) => void | Promise; - write?: ( - chunk: W, - controller: WritableStreamDefaultController - ) => void | Promise; - abort?: (reason: any) => void | Promise; - close?: () => void | Promise; -} -declare interface UnderlyingByteSource { - type: "bytes"; - autoAllocateChunkSize?: number; - start?: (controller: ReadableByteStreamController) => void | Promise; - pull?: (controller: ReadableByteStreamController) => void | Promise; - cancel?: (reason: any) => void | Promise; -} -declare interface UnderlyingSource { - type?: "" | undefined; - start?: ( - controller: ReadableStreamDefaultController - ) => void | Promise; - pull?: ( - controller: ReadableStreamDefaultController - ) => void | Promise; - cancel?: (reason: any) => void | Promise; -} -declare interface Transformer { - readableType?: string; - writableType?: string; - start?: ( - controller: TransformStreamDefaultController - ) => void | Promise; - transform?: ( - chunk: I, - controller: TransformStreamDefaultController - ) => void | Promise; - flush?: ( - controller: TransformStreamDefaultController - ) => void | Promise; -} -declare interface StreamPipeOptions { - /** - * 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; - preventAbort?: boolean; - preventCancel?: boolean; - signal?: AbortSignal; -} -declare type ReadableStreamReadResult = - | { - done: false; - value: R; - } - | { - done: true; - value?: undefined; - }; -/** This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object. */ -declare interface ReadableStream { - get locked(): boolean; - cancel(reason?: any): Promise; - getReader(): ReadableStreamDefaultReader; - getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader; - pipeThrough( - transform: ReadableWritablePair, - options?: StreamPipeOptions - ): ReadableStream; - pipeTo( - destination: WritableStream, - options?: StreamPipeOptions - ): Promise; - tee(): [ReadableStream, ReadableStream]; - values(options?: ReadableStreamValuesOptions): AsyncIterableIterator; - [Symbol.asyncIterator]( - options?: ReadableStreamValuesOptions - ): AsyncIterableIterator; -} -declare const ReadableStream: { - prototype: ReadableStream; - new ( - underlyingSource: UnderlyingByteSource, - strategy?: QueuingStrategy - ): ReadableStream; - new ( - underlyingSource?: UnderlyingSource, - strategy?: QueuingStrategy - ): ReadableStream; -}; -declare class ReadableStreamDefaultReader { - constructor(stream: ReadableStream); - get closed(): Promise; - cancel(reason?: any): Promise; - read(): Promise>; - releaseLock(): void; -} -declare class ReadableStreamBYOBReader { - constructor(stream: ReadableStream); - get closed(): Promise; - cancel(reason?: any): Promise; - read( - view: T - ): Promise>; - releaseLock(): void; - readAtLeast( - minElements: number, - view: T - ): Promise>; -} -declare interface ReadableStreamGetReaderOptions { - mode: "byob"; -} -declare abstract class ReadableStreamBYOBRequest { - readonly view: Uint8Array | null; - respond(bytesWritten: number): void; - respondWithNewView(view: ArrayBuffer | ArrayBufferView): void; - readonly atLeast: number | null; -} -declare abstract class ReadableStreamDefaultController { - readonly desiredSize: number | null; - close(): void; - enqueue(chunk?: R): void; - error(reason: any): void; -} -declare abstract class ReadableByteStreamController { - readonly byobRequest: ReadableStreamBYOBRequest | null; - readonly desiredSize: number | null; - close(): void; - enqueue(chunk: ArrayBuffer | ArrayBufferView): void; - error(reason: any): void; -} -declare abstract class WritableStreamDefaultController { - readonly signal: AbortSignal; - error(reason?: any): void; -} -declare interface TransformStreamDefaultController { - get desiredSize(): number | null; - enqueue(chunk?: O): void; - error(reason: any): void; - terminate(): void; -} -declare interface ReadableWritablePair { - /** - * 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; - readable: ReadableStream; -} -declare class WritableStream { - constructor( - underlyingSink?: UnderlyingSink, - queuingStrategy?: QueuingStrategy - ); - get locked(): boolean; - abort(reason?: any): Promise; - close(): Promise; - getWriter(): WritableStreamDefaultWriter; -} -declare class WritableStreamDefaultWriter { - constructor(stream: WritableStream); - get closed(): Promise; - get ready(): Promise; - get desiredSize(): number | null; - abort(reason?: any): Promise; - close(): Promise; - write(chunk?: W): Promise; - releaseLock(): void; -} -declare class TransformStream { - constructor( - transformer?: Transformer, - writableStrategy?: QueuingStrategy, - readableStrategy?: QueuingStrategy - ); - get readable(): ReadableStream; - get writable(): WritableStream; -} -declare class FixedLengthStream extends IdentityTransformStream { - constructor(expectedLength: number | bigint); -} -declare class IdentityTransformStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(); -} -declare interface ReadableStreamValuesOptions { - preventCancel?: boolean; -} -declare class CompressionStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(format: "gzip" | "deflate" | "deflate-raw"); -} -declare class DecompressionStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(format: "gzip" | "deflate" | "deflate-raw"); -} -declare class TextEncoderStream extends TransformStream { - constructor(); -} -declare class TextDecoderStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - string -> { - constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit); -} -declare interface TextDecoderStreamTextDecoderStreamInit { - fatal?: boolean; -} -declare class ByteLengthQueuingStrategy - implements QueuingStrategy -{ - constructor(init: QueuingStrategyInit); - get highWaterMark(): number; - get size(): (chunk?: any) => number; -} -declare class CountQueuingStrategy implements QueuingStrategy { - constructor(init: QueuingStrategyInit); - get highWaterMark(): number; - get size(): (chunk?: any) => number; -} -declare 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; -} -declare abstract class TraceEvent extends ExtendableEvent { - readonly traces: TraceItem[]; -} -declare interface TraceItem { - readonly event: - | ( - | TraceItemFetchEventInfo - | TraceItemScheduledEventInfo - | TraceItemAlarmEventInfo - | TraceItemQueueEventInfo - | TraceItemEmailEventInfo - | TraceItemCustomEventInfo - ) - | null; - readonly eventTimestamp: number | null; - readonly logs: TraceLog[]; - readonly exceptions: TraceException[]; - readonly scriptName: string | null; - readonly dispatchNamespace?: string; - readonly scriptTags?: string[]; - readonly outcome: string; -} -declare interface TraceItemAlarmEventInfo { - readonly scheduledTime: Date; -} -declare interface TraceItemCustomEventInfo {} -declare interface TraceItemScheduledEventInfo { - readonly scheduledTime: number; - readonly cron: string; -} -declare interface TraceItemQueueEventInfo { - readonly queue: string; - readonly batchSize: number; -} -declare interface TraceItemEmailEventInfo { - readonly mailFrom: string; - readonly rcptTo: string; - readonly rawSize: number; -} -declare interface TraceItemFetchEventInfo { - readonly response?: TraceItemFetchEventInfoResponse; - readonly request: TraceItemFetchEventInfoRequest; -} -declare interface TraceItemFetchEventInfoRequest { - readonly cf?: any; - readonly headers: Record; - readonly method: string; - readonly url: string; - getUnredacted(): TraceItemFetchEventInfoRequest; -} -declare interface TraceItemFetchEventInfoResponse { - readonly status: number; -} -declare interface TraceLog { - readonly timestamp: number; - readonly level: string; - readonly message: any; -} -declare interface TraceException { - readonly timestamp: number; - readonly message: string; - readonly name: string; -} -declare interface TraceMetrics { - readonly cpuTime: number; - readonly wallTime: number; -} -declare interface UnsafeTraceMetrics { - fromTrace(item: TraceItem): TraceMetrics; -} -declare class URL { - constructor(url: string | URL, base?: string | URL); - get origin(): string; - get href(): string; - set href(value: string); - get protocol(): string; - set protocol(value: string); - get username(): string; - set username(value: string); - get password(): string; - set password(value: string); - get host(): string; - set host(value: string); - get hostname(): string; - set hostname(value: string); - get port(): string; - set port(value: string); - get pathname(): string; - set pathname(value: string); - get search(): string; - set search(value: string); - get hash(): string; - set hash(value: string); - get searchParams(): URLSearchParams; - toJSON(): string; - toString(): string; - static canParse(url: string, base?: string): boolean; -} -declare class URLSearchParams { - constructor( - init?: Iterable> | Record | string - ); - get size(): number; - append(name: string, value: string): void; - delete(name: string): void; - get(name: string): string | null; - getAll(name: string): string[]; - has(name: string): boolean; - set(name: string, value: string): void; - sort(): void; - entries(): IterableIterator<[key: string, value: string]>; - keys(): IterableIterator; - values(): IterableIterator; - forEach( - callback: ( - this: This, - value: string, - key: string, - parent: URLSearchParams - ) => void, - thisArg?: This - ): void; - toString(): string; - [Symbol.iterator](): IterableIterator<[key: string, value: string]>; -} -declare class URLPattern { - constructor(input?: string | URLPatternURLPatternInit, baseURL?: string); - get protocol(): string; - get username(): string; - get password(): string; - get hostname(): string; - get port(): string; - get pathname(): string; - get search(): string; - get hash(): string; - test(input?: string | URLPatternURLPatternInit, baseURL?: string): boolean; - exec( - input?: string | URLPatternURLPatternInit, - baseURL?: string - ): URLPatternURLPatternResult | null; -} -declare interface URLPatternURLPatternInit { - protocol?: string; - username?: string; - password?: string; - hostname?: string; - port?: string; - pathname?: string; - search?: string; - hash?: string; - baseURL?: string; -} -declare interface URLPatternURLPatternComponentResult { - input: string; - groups: Record; -} -declare interface URLPatternURLPatternResult { - inputs: (string | URLPatternURLPatternInit)[]; - protocol: URLPatternURLPatternComponentResult; - username: URLPatternURLPatternComponentResult; - password: URLPatternURLPatternComponentResult; - hostname: URLPatternURLPatternComponentResult; - port: URLPatternURLPatternComponentResult; - pathname: URLPatternURLPatternComponentResult; - search: URLPatternURLPatternComponentResult; - hash: URLPatternURLPatternComponentResult; -} -declare class CloseEvent extends Event { - constructor(type: string, initializer: CloseEventInit); - /** Returns the WebSocket connection close code provided by the server. */ - readonly code: number; - /** Returns the WebSocket connection close reason provided by the server. */ - readonly reason: string; - /** Returns true if the connection closed cleanly; false otherwise. */ - readonly wasClean: boolean; -} -declare interface CloseEventInit { - code?: number; - reason?: string; - wasClean?: boolean; -} -declare class MessageEvent extends Event { - constructor(type: string, initializer: MessageEventInit); - readonly data: ArrayBuffer | string; -} -declare interface MessageEventInit { - data: ArrayBuffer | string; -} -/** Events providing information related to errors in scripts or in files. */ -declare interface ErrorEvent extends Event { - readonly filename: string; - readonly message: string; - readonly lineno: number; - readonly colno: number; - readonly error: any; -} -declare type WebSocketEventMap = { - close: CloseEvent; - message: MessageEvent; - open: Event; - error: ErrorEvent; -}; -declare class WebSocket extends EventTarget { - constructor(url: string, protocols?: string[] | string); - accept(): void; - send(message: (ArrayBuffer | ArrayBufferView) | string): void; - close(code?: number, reason?: string): void; - static readonly READY_STATE_CONNECTING: number; - static readonly READY_STATE_OPEN: number; - static readonly READY_STATE_CLOSING: number; - static readonly READY_STATE_CLOSED: number; - get readyState(): number; - get url(): string | null; - get protocol(): string | null; - get extensions(): string | null; -} -declare const WebSocketPair: { - new (): { - 0: WebSocket; - 1: WebSocket; - }; -}; -declare interface BasicImageTransformations { - /** - * Maximum width in image pixels. The value must be an integer. - */ - width?: number; - /** - * Maximum height in image pixels. The value must be an integer. - */ - height?: number; - /** - * Resizing mode as a string. It affects interpretation of width and height - * options: - * - scale-down: Similar to contain, but the image is never enlarged. If - * the image is larger than given width or height, it will be resized. - * Otherwise its original size will be kept. - * - contain: Resizes to maximum size that fits within the given width and - * height. If only a single dimension is given (e.g. only width), the - * image will be shrunk or enlarged to exactly match that dimension. - * Aspect ratio is always preserved. - * - cover: Resizes (shrinks or enlarges) to fill the entire area of width - * and height. If the image has an aspect ratio different from the ratio - * of width and height, it will be cropped to fit. - * - crop: The image will be shrunk and cropped to fit within the area - * specified by width and height. The image will not be enlarged. For images - * smaller than the given dimensions it's the same as scale-down. For - * images larger than the given dimensions, it's the same as cover. - * See also trim. - * - pad: Resizes to the maximum size that fits within the given width and - * height, and then fills the remaining area with a background color - * (white by default). Use of this mode is not recommended, as the same - * effect can be more efficiently achieved with the contain mode and the - * CSS object-fit: contain property. - */ - fit?: "scale-down" | "contain" | "cover" | "crop" | "pad"; - /** - * When cropping with fit: "cover", this defines the side or point that should - * be left uncropped. The value is either a string - * "left", "right", "top", "bottom", "auto", or "center" (the default), - * or an object {x, y} containing focal point coordinates in the original - * image expressed as fractions ranging from 0.0 (top or left) to 1.0 - * (bottom or right), 0.5 being the center. {fit: "cover", gravity: "top"} will - * crop bottom or left and right sides as necessary, but won’t crop anything - * from the top. {fit: "cover", gravity: {x:0.5, y:0.2}} will crop each side to - * preserve as much as possible around a point at 20% of the height of the - * source image. - */ - gravity?: - | "left" - | "right" - | "top" - | "bottom" - | "center" - | "auto" - | BasicImageTransformationsGravityCoordinates; - /** - * Background color to add underneath the image. Applies only to images with - * transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…), - * hsl(…), etc.) - */ - background?: string; - /** - * Number of degrees (90, 180, 270) to rotate the image by. width and height - * options refer to axes after rotation. - */ - rotate?: 0 | 90 | 180 | 270 | 360; -} -declare interface BasicImageTransformationsGravityCoordinates { - x: number; - y: number; -} -/** - * In addition to the properties you can set in the RequestInit dict - * that you pass as an argument to the Request constructor, you can - * set certain properties of a `cf` object to control how Cloudflare - * features are applied to that new Request. - * - * Note: Currently, these properties cannot be tested in the - * playground. - */ -declare interface RequestInitCfProperties extends Record { - cacheEverything?: boolean; - /** - * A request's cache key is what determines if two requests are - * "the same" for caching purposes. If a request has the same cache key - * as some previous request, then we can serve the same cached response for - * both. (e.g. 'some-key') - * - * Only available for Enterprise customers. - */ - cacheKey?: string; - /** - * This allows you to append additional Cache-Tag response headers - * to the origin response without modifications to the origin server. - * This will allow for greater control over the Purge by Cache Tag feature - * utilizing changes only in the Workers process. - * - * Only available for Enterprise customers. - */ - cacheTags?: string[]; - /** - * Force response to be cached for a given number of seconds. (e.g. 300) - */ - cacheTtl?: number; - /** - * Force response to be cached for a given number of seconds based on the Origin status code. - * (e.g. { '200-299': 86400, '404': 1, '500-599': 0 }) - */ - cacheTtlByStatus?: Record; - scrapeShield?: boolean; - apps?: boolean; - image?: RequestInitCfPropertiesImage; - minify?: RequestInitCfPropertiesImageMinify; - mirage?: boolean; - polish?: "lossy" | "lossless" | "off"; - /** - * Redirects the request to an alternate origin server. You can use this, - * for example, to implement load balancing across several origins. - * (e.g.us-east.example.com) - * - * Note - For security reasons, the hostname set in resolveOverride must - * be proxied on the same Cloudflare zone of the incoming request. - * Otherwise, the setting is ignored. CNAME hosts are allowed, so to - * resolve to a host under a different domain or a DNS only domain first - * declare a CNAME record within your own zone’s DNS mapping to the - * external hostname, set proxy on Cloudflare, then set resolveOverride - * to point to that CNAME record. - */ - resolveOverride?: string; -} -declare interface RequestInitCfPropertiesImageDraw - extends BasicImageTransformations { - /** - * Absolute URL of the image file to use for the drawing. It can be any of - * the supported file formats. For drawing of watermarks or non-rectangular - * overlays we recommend using PNG or WebP images. - */ - url: string; - /** - * Floating-point number between 0 (transparent) and 1 (opaque). - * For example, opacity: 0.5 makes overlay semitransparent. - */ - opacity?: number; - /** - * - If set to true, the overlay image will be tiled to cover the entire - * area. This is useful for stock-photo-like watermarks. - * - If set to "x", the overlay image will be tiled horizontally only - * (form a line). - * - If set to "y", the overlay image will be tiled vertically only - * (form a line). - */ - repeat?: true | "x" | "y"; - /** - * Position of the overlay image relative to a given edge. Each property is - * an offset in pixels. 0 aligns exactly to the edge. For example, left: 10 - * positions left side of the overlay 10 pixels from the left edge of the - * image it's drawn over. bottom: 0 aligns bottom of the overlay with bottom - * of the background image. - * - * Setting both left & right, or both top & bottom is an error. - * - * If no position is specified, the image will be centered. - */ - top?: number; - left?: number; - bottom?: number; - right?: number; -} -declare interface RequestInitCfPropertiesImage - extends BasicImageTransformations { - /** - * Device Pixel Ratio. Default 1. Multiplier for width/height that makes it - * easier to specify higher-DPI sizes in . - */ - dpr?: number; - /** - * An object with four properties {left, top, right, bottom} that specify - * a number of pixels to cut off on each side. Allows removal of borders - * or cutting out a specific fragment of an image. Trimming is performed - * before resizing or rotation. Takes dpr into account. - */ - trim?: { - left?: number; - top?: number; - right?: number; - bottom?: number; - }; - /** - * Quality setting from 1-100 (useful values are in 60-90 range). Lower values - * make images look worse, but load faster. The default is 85. It applies only - * to JPEG and WebP images. It doesn’t have any effect on PNG. - */ - quality?: number; - /** - * Output format to generate. It can be: - * - avif: generate images in AVIF format. - * - webp: generate images in Google WebP format. Set quality to 100 to get - * the WebP-lossless format. - * - json: instead of generating an image, outputs information about the - * image, in JSON format. The JSON object will contain image size - * (before and after resizing), source image’s MIME type, file size, etc. - * - jpeg: generate images in JPEG format. - * - png: generate images in PNG format. - */ - format?: "avif" | "webp" | "json" | "jpeg" | "png"; - /** - * Whether to preserve animation frames from input files. Default is true. - * Setting it to false reduces animations to still images. This setting is - * recommended when enlarging images or processing arbitrary user content, - * because large GIF animations can weigh tens or even hundreds of megabytes. - * It is also useful to set anim:false when using format:"json" to get the - * response quicker without the number of frames. - */ - anim?: boolean; - /** - * What EXIF data should be preserved in the output image. Note that EXIF - * rotation and embedded color profiles are always applied ("baked in" into - * the image), and aren't affected by this option. Note that if the Polish - * feature is enabled, all metadata may have been removed already and this - * option may have no effect. - * - keep: Preserve most of EXIF metadata, including GPS location if there's - * any. - * - copyright: Only keep the copyright tag, and discard everything else. - * This is the default behavior for JPEG files. - * - none: Discard all invisible EXIF metadata. Currently WebP and PNG - * output formats always discard metadata. - */ - metadata?: "keep" | "copyright" | "none"; - /** - * Strength of sharpening filter to apply to the image. Floating-point - * number between 0 (no sharpening, default) and 10 (maximum). 1.0 is a - * recommended value for downscaled images. - */ - sharpen?: number; - /** - * Radius of a blur filter (approximate gaussian). Maximum supported radius - * is 250. - */ - blur?: number; - /** - * Overlays are drawn in the order they appear in the array (last array - * entry is the topmost layer). - */ - draw?: RequestInitCfPropertiesImageDraw[]; - /** - * Fetching image from authenticated origin. Setting this property will - * pass authentication headers (Authorization, Cookie, etc.) through to - * the origin. - */ - "origin-auth"?: "share-publicly"; - /** - * Adds a border around the image. The border is added after resizing. Border - * width takes dpr into account, and can be specified either using a single - * width property, or individually for each side. - */ - border?: - | { - color: string; - width: number; - } - | { - color: string; - top: number; - right: number; - bottom: number; - left: number; - }; - /** - * Increase brightness by a factor. A value of 1.0 equals no change, a value - * of 0.5 equals half brightness, and a value of 2.0 equals twice as bright. - * 0 is ignored. - */ - brightness?: number; - /** - * Increase contrast by a factor. A value of 1.0 equals no change, a value of - * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is - * ignored. - */ - contrast?: number; - /** - * Increase exposure by a factor. A value of 1.0 equals no change, a value of - * 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored. - */ - gamma?: number; - /** - * Slightly reduces latency on a cache miss by selecting a - * quickest-to-compress file format, at a cost of increased file size and - * lower image quality. It will usually override the format option and choose - * JPEG over WebP or AVIF. We do not recommend using this option, except in - * unusual circumstances like resizing uncacheable dynamically-generated - * images. - */ - compression?: "fast"; -} -declare interface RequestInitCfPropertiesImageMinify { - javascript?: boolean; - css?: boolean; - html?: boolean; -} -/** - * Request metadata provided by Cloudflare's edge. - */ -declare type IncomingRequestCfProperties = - IncomingRequestCfPropertiesBase & - IncomingRequestCfPropertiesBotManagementEnterprise & - IncomingRequestCfPropertiesCloudflareForSaaSEnterprise & - IncomingRequestCfPropertiesGeographicInformation & - IncomingRequestCfPropertiesCloudflareAccessOrApiShield; -declare interface IncomingRequestCfPropertiesBase - extends Record { - /** - * [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request. - * - * @example 395747 - */ - asn: number; - /** - * The organization which owns the ASN of the incoming request. - * - * @example "Google Cloud" - */ - asOrganization: string; - /** - * The original value of the `Accept-Encoding` header if Cloudflare modified it. - * - * @example "gzip, deflate, br" - */ - clientAcceptEncoding?: string; - /** - * The number of milliseconds it took for the request to reach your worker. - * - * @example 22 - */ - clientTcpRtt?: number; - /** - * The three-letter [IATA](https://en.wikipedia.org/wiki/IATA_airport_code) - * airport code of the data center that the request hit. - * - * @example "DFW" - */ - colo: string; - /** - * Represents the upstream's response to a - * [TCP `keepalive` message](https://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html) - * from cloudflare. - * - * For workers with no upstream, this will always be `1`. - * - * @example 3 - */ - edgeRequestKeepAliveStatus: IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus; - /** - * The HTTP Protocol the request used. - * - * @example "HTTP/2" - */ - httpProtocol: string; - /** - * The browser-requested prioritization information in the request object. - * - * If no information was set, defaults to the empty string `""` - * - * @example "weight=192;exclusive=0;group=3;group-weight=127" - * @default "" - */ - requestPriority: string; - /** - * The TLS version of the connection to Cloudflare. - * In requests served over plaintext (without TLS), this property is the empty string `""`. - * - * @example "TLSv1.3" - */ - tlsVersion: string; - /** - * The cipher for the connection to Cloudflare. - * In requests served over plaintext (without TLS), this property is the empty string `""`. - * - * @example "AEAD-AES128-GCM-SHA256" - */ - tlsCipher: string; - /** - * Metadata containing the [`HELLO`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2) and [`FINISHED`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9) messages from this request's TLS handshake. - * - * If the incoming request was served over plaintext (without TLS) this field is undefined. - */ - tlsExportedAuthenticator?: IncomingRequestCfPropertiesExportedAuthenticatorMetadata; -} -declare interface IncomingRequestCfPropertiesBotManagementBase { - /** - * Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot, - * represented as an integer percentage between `1` (almost certainly human) - * and `99` (almost certainly a bot). - * - * @example 54 - */ - score: number; - /** - * A boolean value that is true if the request comes from a good bot, like Google or Bing. - * Most customers choose to allow this traffic. For more details, see [Traffic from known bots](https://developers.cloudflare.com/firewall/known-issues-and-faq/#how-does-firewall-rules-handle-traffic-from-known-bots). - */ - verifiedBot: boolean; - /** - * A boolean value that is true if the request originates from a - * Cloudflare-verified proxy service. - */ - corporateProxy: boolean; - /** - * A boolean value that's true if the request matches [file extensions](https://developers.cloudflare.com/bots/reference/static-resources/) for many types of static resources. - */ - staticResource: boolean; - /** - * List of IDs that correlate to the Bot Management heuristic detections made on a request (you can have multiple heuristic detections on the same request). - */ - detectionIds: number[]; -} -declare interface IncomingRequestCfPropertiesBotManagement { - /** - * Results of Cloudflare's Bot Management analysis - */ - botManagement: IncomingRequestCfPropertiesBotManagementBase; - /** - * Duplicate of `botManagement.score`. - * - * @deprecated - */ - clientTrustScore: number; -} -declare interface IncomingRequestCfPropertiesBotManagementEnterprise - extends IncomingRequestCfPropertiesBotManagement { - /** - * Results of Cloudflare's Bot Management analysis - */ - botManagement: IncomingRequestCfPropertiesBotManagementBase & { - /** - * A [JA3 Fingerprint](https://developers.cloudflare.com/bots/concepts/ja3-fingerprint/) to help profile specific SSL/TLS clients - * across different destination IPs, Ports, and X509 certificates. - */ - ja3Hash: string; - }; -} -declare interface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise< - HostMetadata -> { - /** - * Custom metadata set per-host in [Cloudflare for SaaS](https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/). - * - * This field is only present if you have Cloudflare for SaaS enabled on your account - * and you have followed the [required steps to enable it]((https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/domain-support/custom-metadata/)). - */ - hostMetadata: HostMetadata; -} -declare interface IncomingRequestCfPropertiesCloudflareAccessOrApiShield { - /** - * Information about the client certificate presented to Cloudflare. - * - * This is populated when the incoming request is served over TLS using - * either Cloudflare Access or API Shield (mTLS) - * and the presented SSL certificate has a valid - * [Certificate Serial Number](https://ldapwiki.com/wiki/Certificate%20Serial%20Number) - * (i.e., not `null` or `""`). - * - * Otherwise, a set of placeholder values are used. - * - * The property `certPresented` will be set to `"1"` when - * the object is populated (i.e. the above conditions were met). - */ - tlsClientAuth: - | IncomingRequestCfPropertiesTLSClientAuth - | IncomingRequestCfPropertiesTLSClientAuthPlaceholder; -} -/** - * Metadata about the request's TLS handshake - */ -declare interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata { - /** - * The client's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal - * - * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d" - */ - clientHandshake: string; - /** - * The server's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal - * - * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d" - */ - serverHandshake: string; - /** - * The client's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal - * - * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b" - */ - clientFinished: string; - /** - * The server's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal - * - * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b" - */ - serverFinished: string; -} -/** - * Geographic data about the request's origin. - */ -declare interface IncomingRequestCfPropertiesGeographicInformation { - /** - * The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from. - * - * If your worker is [configured to accept TOR connections](https://support.cloudflare.com/hc/en-us/articles/203306930-Understanding-Cloudflare-Tor-support-and-Onion-Routing), this may also be `"T1"`, indicating a request that originated over TOR. - * - * If Cloudflare is unable to determine where the request originated this property is omitted. - * - * The country code `"T1"` is used for requests originating on TOR. - * - * @example "GB" - */ - country?: Iso3166Alpha2Code | "T1"; - /** - * If present, this property indicates that the request originated in the EU - * - * @example "1" - */ - isEUCountry?: "1"; - /** - * A two-letter code indicating the continent the request originated from. - * - * @example "AN" - */ - continent?: ContinentCode; - /** - * The city the request originated from - * - * @example "Austin" - */ - city?: string; - /** - * Postal code of the incoming request - * - * @example "78701" - */ - postalCode?: string; - /** - * Latitude of the incoming request - * - * @example "30.27130" - */ - latitude?: string; - /** - * Longitude of the incoming request - * - * @example "-97.74260" - */ - longitude?: string; - /** - * Timezone of the incoming request - * - * @example "America/Chicago" - */ - timezone?: string; - /** - * If known, the ISO 3166-2 name for the first level region associated with - * the IP address of the incoming request - * - * @example "Texas" - */ - region?: string; - /** - * If known, the ISO 3166-2 code for the first-level region associated with - * the IP address of the incoming request - * - * @example "TX" - */ - regionCode?: string; - /** - * Metro code (DMA) of the incoming request - * - * @example "635" - */ - metroCode?: string; -} -/** Data about the incoming request's TLS certificate */ -declare interface IncomingRequestCfPropertiesTLSClientAuth { - /** Always `"1"`, indicating that the certificate was presented */ - certPresented: "1"; - /** - * Result of certificate verification. - * - * @example "FAILED:self signed certificate" - */ - certVerified: Exclude; - /** The presented certificate's revokation status. - * - * - A value of `"1"` indicates the certificate has been revoked - * - A value of `"0"` indicates the certificate has not been revoked - */ - certRevoked: "1" | "0"; - /** - * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) - * - * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certIssuerDN: string; - /** - * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) - * - * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certSubjectDN: string; - /** - * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted) - * - * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certIssuerDNRFC2253: string; - /** - * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted) - * - * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certSubjectDNRFC2253: string; - /** The certificate issuer's distinguished name (legacy policies) */ - certIssuerDNLegacy: string; - /** The certificate subject's distinguished name (legacy policies) */ - certSubjectDNLegacy: string; - /** - * The certificate's serial number - * - * @example "00936EACBE07F201DF" - */ - certSerial: string; - /** - * The certificate issuer's serial number - * - * @example "2489002934BDFEA34" - */ - certIssuerSerial: string; - /** - * The certificate's Subject Key Identifier - * - * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4" - */ - certSKI: string; - /** - * The certificate issuer's Subject Key Identifier - * - * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4" - */ - certIssuerSKI: string; - /** - * The certificate's SHA-1 fingerprint - * - * @example "6b9109f323999e52259cda7373ff0b4d26bd232e" - */ - certFingerprintSHA1: string; - /** - * The certificate's SHA-256 fingerprint - * - * @example "acf77cf37b4156a2708e34c4eb755f9b5dbbe5ebb55adfec8f11493438d19e6ad3f157f81fa3b98278453d5652b0c1fd1d71e5695ae4d709803a4d3f39de9dea" - */ - certFingerprintSHA256: string; - /** - * The effective starting date of the certificate - * - * @example "Dec 22 19:39:00 2018 GMT" - */ - certNotBefore: string; - /** - * The effective expiration date of the certificate - * - * @example "Dec 22 19:39:00 2018 GMT" - */ - certNotAfter: string; -} -/** Placeholder values for TLS Client Authorization */ -declare interface IncomingRequestCfPropertiesTLSClientAuthPlaceholder { - certPresented: "0"; - certVerified: "NONE"; - certRevoked: "0"; - certIssuerDN: ""; - certSubjectDN: ""; - certIssuerDNRFC2253: ""; - certSubjectDNRFC2253: ""; - certIssuerDNLegacy: ""; - certSubjectDNLegacy: ""; - certSerial: ""; - certIssuerSerial: ""; - certSKI: ""; - certIssuerSKI: ""; - certFingerprintSHA1: ""; - certFingerprintSHA256: ""; - certNotBefore: ""; - certNotAfter: ""; -} -/** Possible outcomes of TLS verification */ -declare type CertVerificationStatus = - /** Authentication succeeded */ - | "SUCCESS" - /** No certificate was presented */ - | "NONE" - /** Failed because the certificate was self-signed */ - | "FAILED:self signed certificate" - /** Failed because the certificate failed a trust chain check */ - | "FAILED:unable to verify the first certificate" - /** Failed because the certificate not yet valid */ - | "FAILED:certificate is not yet valid" - /** Failed because the certificate is expired */ - | "FAILED:certificate has expired" - /** Failed for another unspecified reason */ - | "FAILED"; -/** - * An upstream endpoint's response to a TCP `keepalive` message from Cloudflare. - */ -declare type IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus = - | 0 /** Unknown */ - | 1 /** no keepalives (not found) */ - | 2 /** no connection re-use, opening keepalive connection failed */ - | 3 /** no connection re-use, keepalive accepted and saved */ - | 4 /** connection re-use, refused by the origin server (`TCP FIN`) */ - | 5; /** connection re-use, accepted by the origin server */ -/** ISO 3166-1 Alpha-2 codes */ -declare type Iso3166Alpha2Code = - | "AD" - | "AE" - | "AF" - | "AG" - | "AI" - | "AL" - | "AM" - | "AO" - | "AQ" - | "AR" - | "AS" - | "AT" - | "AU" - | "AW" - | "AX" - | "AZ" - | "BA" - | "BB" - | "BD" - | "BE" - | "BF" - | "BG" - | "BH" - | "BI" - | "BJ" - | "BL" - | "BM" - | "BN" - | "BO" - | "BQ" - | "BR" - | "BS" - | "BT" - | "BV" - | "BW" - | "BY" - | "BZ" - | "CA" - | "CC" - | "CD" - | "CF" - | "CG" - | "CH" - | "CI" - | "CK" - | "CL" - | "CM" - | "CN" - | "CO" - | "CR" - | "CU" - | "CV" - | "CW" - | "CX" - | "CY" - | "CZ" - | "DE" - | "DJ" - | "DK" - | "DM" - | "DO" - | "DZ" - | "EC" - | "EE" - | "EG" - | "EH" - | "ER" - | "ES" - | "ET" - | "FI" - | "FJ" - | "FK" - | "FM" - | "FO" - | "FR" - | "GA" - | "GB" - | "GD" - | "GE" - | "GF" - | "GG" - | "GH" - | "GI" - | "GL" - | "GM" - | "GN" - | "GP" - | "GQ" - | "GR" - | "GS" - | "GT" - | "GU" - | "GW" - | "GY" - | "HK" - | "HM" - | "HN" - | "HR" - | "HT" - | "HU" - | "ID" - | "IE" - | "IL" - | "IM" - | "IN" - | "IO" - | "IQ" - | "IR" - | "IS" - | "IT" - | "JE" - | "JM" - | "JO" - | "JP" - | "KE" - | "KG" - | "KH" - | "KI" - | "KM" - | "KN" - | "KP" - | "KR" - | "KW" - | "KY" - | "KZ" - | "LA" - | "LB" - | "LC" - | "LI" - | "LK" - | "LR" - | "LS" - | "LT" - | "LU" - | "LV" - | "LY" - | "MA" - | "MC" - | "MD" - | "ME" - | "MF" - | "MG" - | "MH" - | "MK" - | "ML" - | "MM" - | "MN" - | "MO" - | "MP" - | "MQ" - | "MR" - | "MS" - | "MT" - | "MU" - | "MV" - | "MW" - | "MX" - | "MY" - | "MZ" - | "NA" - | "NC" - | "NE" - | "NF" - | "NG" - | "NI" - | "NL" - | "NO" - | "NP" - | "NR" - | "NU" - | "NZ" - | "OM" - | "PA" - | "PE" - | "PF" - | "PG" - | "PH" - | "PK" - | "PL" - | "PM" - | "PN" - | "PR" - | "PS" - | "PT" - | "PW" - | "PY" - | "QA" - | "RE" - | "RO" - | "RS" - | "RU" - | "RW" - | "SA" - | "SB" - | "SC" - | "SD" - | "SE" - | "SG" - | "SH" - | "SI" - | "SJ" - | "SK" - | "SL" - | "SM" - | "SN" - | "SO" - | "SR" - | "SS" - | "ST" - | "SV" - | "SX" - | "SY" - | "SZ" - | "TC" - | "TD" - | "TF" - | "TG" - | "TH" - | "TJ" - | "TK" - | "TL" - | "TM" - | "TN" - | "TO" - | "TR" - | "TT" - | "TV" - | "TW" - | "TZ" - | "UA" - | "UG" - | "UM" - | "US" - | "UY" - | "UZ" - | "VA" - | "VC" - | "VE" - | "VG" - | "VI" - | "VN" - | "VU" - | "WF" - | "WS" - | "YE" - | "YT" - | "ZA" - | "ZM" - | "ZW"; -/** The 2-letter continent codes Cloudflare uses */ -declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA"; -declare type CfProperties = - | IncomingRequestCfProperties - | RequestInitCfProperties; -declare interface D1Result { - results?: T[]; - success: boolean; - error?: string; - meta: any; -} -declare abstract class D1Database { - prepare(query: string): D1PreparedStatement; - dump(): Promise; - batch(statements: D1PreparedStatement[]): Promise[]>; - exec(query: string): Promise>; -} -declare abstract class D1PreparedStatement { - bind(...values: any[]): D1PreparedStatement; - first(colName?: string): Promise; - run(): Promise>; - all(): Promise>; - raw(): Promise; -} -/** - * A email message that is sent to a consumer Worker. - */ -declare interface EmailMessage { - /** - * Envelope From attribute of the email message. - */ - readonly from: string; - /** - * Envelope To attribute of the email message. - */ - readonly to: string; - /** - * A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers). - */ - readonly headers: Headers; - /** - * Stream of the email message content. - */ - readonly raw: ReadableStream; - /** - * Size of the email message content. - */ - readonly rawSize: number; - /** - * Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason. - * @param reason The reject reason. - * @returns void - */ - setReject(reason: string): void; - /** - * Forward this email message to a verified destination address of the account. - * @param rcptTo Verified destination address. - * @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers). - * @returns A promise that resolves when the email message is forwarded. - */ - forward(rcptTo: string, headers?: Headers): Promise; -} -declare abstract class EmailEvent extends ExtendableEvent { - readonly message: EmailMessage; -} -declare type EmailExportedHandler = ( - message: EmailMessage, - env: Env, - ctx: ExecutionContext -) => void | Promise; -declare type Params

= Record; -declare type EventContext = { - request: Request; - functionPath: string; - waitUntil: (promise: Promise) => void; - passThroughOnException: () => void; - next: (input?: Request | string, init?: RequestInit) => Promise; - env: Env & { - ASSETS: { - fetch: typeof fetch; - }; - }; - params: Params

; - data: Data; -}; -declare type PagesFunction< - Env = unknown, - Params extends string = any, - Data extends Record = Record -> = (context: EventContext) => Response | Promise; -declare type EventPluginContext = { - request: Request; - functionPath: string; - waitUntil: (promise: Promise) => void; - passThroughOnException: () => void; - next: (input?: Request | string, init?: RequestInit) => Promise; - env: Env & { - ASSETS: { - fetch: typeof fetch; - }; - }; - params: Params

; - data: Data; - pluginArgs: PluginArgs; -}; -declare type PagesPluginFunction< - Env = unknown, - Params extends string = any, - Data extends Record = Record, - PluginArgs = unknown -> = ( - context: EventPluginContext -) => Response | Promise; -declare module "assets:*" { - export const onRequest: PagesFunction; -} -// https://developers.cloudflare.com/pub-sub/ -// PubSubMessage represents an incoming PubSub message. -// The message includes metadata about the broker, the client, and the payload -// itself. -declare interface PubSubMessage { - // Message ID - readonly mid: number; - // MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT - readonly broker: string; - // The MQTT topic the message was sent on. - readonly topic: string; - // The client ID of the client that published this message. - readonly clientId: string; - // The unique identifier (JWT ID) used by the client to authenticate, if token - // auth was used. - readonly jti?: string; - // A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker - // received the message from the client. - readonly receivedAt: number; - // An (optional) string with the MIME type of the payload, if set by the - // client. - readonly contentType: string; - // Set to 1 when the payload is a UTF-8 string - // https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063 - readonly payloadFormatIndicator: number; - // Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays. - // You can use payloadFormatIndicator to inspect this before decoding. - payload: string | Uint8Array; -} -// JsonWebKey extended by kid parameter -declare interface JsonWebKeyWithKid extends JsonWebKey { - // Key Identifier of the JWK - readonly kid: string; -} -/** - * A message that is sent to a consumer Worker. - */ -declare interface Message { - /** - * A unique, system-generated ID for the message. - */ - readonly id: string; - /** - * A timestamp when the message was sent. - */ - readonly timestamp: Date; - /** - * The body of the message. - */ - readonly body: Body; - /** - * Marks message to be retried. - */ - retry(): void; - /** - * Marks message acknowledged. - */ - ack(): void; -} -/** - * A batch of messages that are sent to a consumer Worker. - */ -declare interface MessageBatch { - /** - * The name of the Queue that belongs to this batch. - */ - readonly queue: string; - /** - * An array of messages in the batch. Ordering of messages is not guaranteed. - */ - readonly messages: readonly Message[]; - /** - * Marks every message to be retried in the next batch. - */ - retryAll(): void; - /** - * Marks every message acknowledged in the batch. - */ - ackAll(): void; -} -/** - * A wrapper class used to structure message batches. - */ -declare type MessageSendRequest = { - /** - * The body of the message. - */ - body: Body; -}; -/** - * A binding that allows a producer to send messages to a Queue. - */ -declare interface Queue { - /** - * Sends a message to the Queue. - * @param message The message can be any type supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types), as long as its size is less than 128 KB. - * @returns A promise that resolves when the message is confirmed to be written to disk. - */ - send(message: Body): Promise; - /** - * Sends a batch of messages to the Queue. - * @param messages Each item in the input must be supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types). A batch can contain up to 100 messages, though items are limited to 128 KB each, and the total size of the array cannot exceed 256 KB. - * @returns A promise that resolves when the messages are confirmed to be written to disk. - */ - sendBatch(messages: Iterable>): Promise; -} diff --git a/packages/denylist_bot/node_modules/@cloudflare/workers-types/2022-11-30/index.ts b/packages/denylist_bot/node_modules/@cloudflare/workers-types/2022-11-30/index.ts deleted file mode 100755 index ac645a389..000000000 --- a/packages/denylist_bot/node_modules/@cloudflare/workers-types/2022-11-30/index.ts +++ /dev/null @@ -1,2985 +0,0 @@ -/*! ***************************************************************************** -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 -export declare class DOMException extends Error { - constructor(message?: string, name?: string); - readonly message: string; - readonly name: string; - readonly code: number; - readonly stack: any; - 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; -} -export type WorkerGlobalScopeEventMap = { - fetch: FetchEvent; - scheduled: ScheduledEvent; - unhandledrejection: PromiseRejectionEvent; - rejectionhandled: PromiseRejectionEvent; -}; -export declare abstract class WorkerGlobalScope extends EventTarget { - EventTarget: typeof EventTarget; -} -export interface Console { - "assert"(condition?: boolean, ...data: any[]): void; - clear(): void; - count(label?: string): void; - countReset(label?: string): void; - debug(...data: any[]): void; - dir(item?: any, options?: any): void; - dirxml(...data: any[]): void; - error(...data: any[]): void; - group(...data: any[]): void; - groupCollapsed(...data: any[]): void; - groupEnd(): void; - info(...data: any[]): void; - log(...data: any[]): void; - table(tabularData?: any, properties?: string[]): void; - time(label?: string): void; - timeEnd(label?: string): void; - timeLog(label?: string, ...data: any[]): void; - timeStamp(label?: string): void; - trace(...data: any[]): void; - warn(...data: any[]): void; -} -export declare const console: Console; -export type BufferSource = ArrayBufferView | ArrayBuffer; -export 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; - type Imports = Record; - type ExportValue = Function | Global | Memory | Table; - type Exports = Record; - 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; - function validate(bytes: BufferSource): boolean; -} -/** This ServiceWorker API interface represents the global execution context of a service worker. */ -export 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( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args - ): number; - clearTimeout(timeoutId: number | null): void; - setInterval(callback: (...args: any[]) => void, msDelay?: number): number; - setInterval( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args - ): number; - clearInterval(timeoutId: number | null): void; - queueMicrotask(task: Function): void; - structuredClone(value: T, options?: StructuredSerializeOptions): T; - fetch( - input: RequestInfo, - init?: RequestInit - ): Promise; - self: ServiceWorkerGlobalScope; - crypto: Crypto; - caches: CacheStorage; - scheduler: Scheduler; - Event: typeof Event; - ExtendableEvent: typeof ExtendableEvent; - PromiseRejectionEvent: typeof PromiseRejectionEvent; - FetchEvent: typeof FetchEvent; - TraceEvent: typeof TraceEvent; - 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; - ReadableStreamBYOBRequest: typeof ReadableStreamBYOBRequest; - ReadableStreamDefaultController: typeof ReadableStreamDefaultController; - ReadableByteStreamController: typeof ReadableByteStreamController; - WritableStreamDefaultController: typeof WritableStreamDefaultController; - 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; - 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; -} -export declare function addEventListener< - Type extends keyof WorkerGlobalScopeEventMap ->( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetAddEventListenerOptions | boolean -): void; -export declare function removeEventListener< - Type extends keyof WorkerGlobalScopeEventMap ->( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetEventListenerOptions | boolean -): void; -/** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */ -export declare function dispatchEvent( - event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap] -): boolean; -export declare function btoa(data: string): string; -export declare function atob(data: string): string; -export declare function setTimeout( - callback: (...args: any[]) => void, - msDelay?: number -): number; -export declare function setTimeout( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args -): number; -export declare function clearTimeout(timeoutId: number | null): void; -export declare function setInterval( - callback: (...args: any[]) => void, - msDelay?: number -): number; -export declare function setInterval( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args -): number; -export declare function clearInterval(timeoutId: number | null): void; -export declare function queueMicrotask(task: Function): void; -export declare function structuredClone( - value: T, - options?: StructuredSerializeOptions -): T; -export declare function fetch( - input: RequestInfo, - init?: RequestInit -): Promise; -export declare const self: ServiceWorkerGlobalScope; -export declare const crypto: Crypto; -export declare const caches: CacheStorage; -export declare const scheduler: Scheduler; -export declare const navigator: Navigator; -export interface TestController {} -export interface ExecutionContext { - waitUntil(promise: Promise): void; - passThroughOnException(): void; -} -export type ExportedHandlerFetchHandler< - Env = unknown, - CfHostMetadata = unknown -> = ( - request: Request>, - env: Env, - ctx: ExecutionContext -) => Response | Promise; -export type ExportedHandlerTraceHandler = ( - traces: TraceItem[], - env: Env, - ctx: ExecutionContext -) => void | Promise; -export type ExportedHandlerScheduledHandler = ( - controller: ScheduledController, - env: Env, - ctx: ExecutionContext -) => void | Promise; -export type ExportedHandlerQueueHandler = ( - batch: MessageBatch, - env: Env, - ctx: ExecutionContext -) => void | Promise; -export type ExportedHandlerTestHandler = ( - controller: TestController, - env: Env, - ctx: ExecutionContext -) => void | Promise; -export interface ExportedHandler< - Env = unknown, - QueueMessage = unknown, - CfHostMetadata = unknown -> { - fetch?: ExportedHandlerFetchHandler; - trace?: ExportedHandlerTraceHandler; - scheduled?: ExportedHandlerScheduledHandler; - test?: ExportedHandlerTestHandler; - queue?: ExportedHandlerQueueHandler; -} -export interface StructuredSerializeOptions { - transfer?: any[]; -} -export declare abstract class PromiseRejectionEvent extends Event { - readonly promise: Promise; - readonly reason: any; -} -export declare abstract class Navigator { - readonly userAgent: string; -} -export interface DurableObject { - fetch(request: Request): Response | Promise; - alarm?(): void | Promise; -} -export interface DurableObjectStub extends Fetcher { - readonly id: DurableObjectId; - readonly name?: string; -} -export interface DurableObjectId { - toString(): string; - equals(other: DurableObjectId): boolean; - readonly name?: string; -} -export interface DurableObjectNamespace { - newUniqueId( - options?: DurableObjectNamespaceNewUniqueIdOptions - ): DurableObjectId; - idFromName(name: string): DurableObjectId; - idFromString(id: string): DurableObjectId; - get( - id: DurableObjectId, - options?: DurableObjectNamespaceGetDurableObjectOptions - ): DurableObjectStub; - jurisdiction(jurisdiction: string): DurableObjectNamespace; -} -export interface DurableObjectNamespaceNewUniqueIdOptions { - jurisdiction?: string; -} -export interface DurableObjectNamespaceGetDurableObjectOptions { - locationHint?: string; -} -export interface DurableObjectState { - waitUntil(promise: Promise): void; - readonly id: DurableObjectId; - readonly storage: DurableObjectStorage; - blockConcurrencyWhile(callback: () => Promise): Promise; -} -export interface DurableObjectTransaction { - get( - key: string, - options?: DurableObjectGetOptions - ): Promise; - get( - keys: string[], - options?: DurableObjectGetOptions - ): Promise>; - list( - options?: DurableObjectListOptions - ): Promise>; - put( - key: string, - value: T, - options?: DurableObjectPutOptions - ): Promise; - put( - entries: Record, - options?: DurableObjectPutOptions - ): Promise; - delete(key: string, options?: DurableObjectPutOptions): Promise; - delete(keys: string[], options?: DurableObjectPutOptions): Promise; - rollback(): void; - getAlarm(options?: DurableObjectGetAlarmOptions): Promise; - setAlarm( - scheduledTime: number | Date, - options?: DurableObjectSetAlarmOptions - ): Promise; - deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise; -} -export interface DurableObjectStorage { - get( - key: string, - options?: DurableObjectGetOptions - ): Promise; - get( - keys: string[], - options?: DurableObjectGetOptions - ): Promise>; - list( - options?: DurableObjectListOptions - ): Promise>; - put( - key: string, - value: T, - options?: DurableObjectPutOptions - ): Promise; - put( - entries: Record, - options?: DurableObjectPutOptions - ): Promise; - delete(key: string, options?: DurableObjectPutOptions): Promise; - delete(keys: string[], options?: DurableObjectPutOptions): Promise; - deleteAll(options?: DurableObjectPutOptions): Promise; - transaction( - closure: (txn: DurableObjectTransaction) => Promise - ): Promise; - getAlarm(options?: DurableObjectGetAlarmOptions): Promise; - setAlarm( - scheduledTime: number | Date, - options?: DurableObjectSetAlarmOptions - ): Promise; - deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise; - sync(): Promise; -} -export interface DurableObjectListOptions { - start?: string; - startAfter?: string; - end?: string; - prefix?: string; - reverse?: boolean; - limit?: number; - allowConcurrency?: boolean; - noCache?: boolean; -} -export interface DurableObjectGetOptions { - allowConcurrency?: boolean; - noCache?: boolean; -} -export interface DurableObjectGetAlarmOptions { - allowConcurrency?: boolean; -} -export interface DurableObjectPutOptions { - allowConcurrency?: boolean; - allowUnconfirmed?: boolean; - noCache?: boolean; -} -export interface DurableObjectSetAlarmOptions { - allowConcurrency?: boolean; - allowUnconfirmed?: boolean; -} -export interface AnalyticsEngineDataset { - writeDataPoint(event?: AnalyticsEngineDataPoint): void; -} -export interface AnalyticsEngineDataPoint { - indexes?: ((ArrayBuffer | string) | null)[]; - doubles?: number[]; - blobs?: ((ArrayBuffer | string) | null)[]; -} -export declare class Event { - constructor(type: string, init?: EventInit); - get type(): string; - get eventPhase(): number; - get composed(): boolean; - get bubbles(): boolean; - get cancelable(): boolean; - get defaultPrevented(): boolean; - get returnValue(): boolean; - get currentTarget(): EventTarget | undefined; - get srcElement(): EventTarget | undefined; - get timeStamp(): number; - get isTrusted(): boolean; - get cancelBubble(): boolean; - set cancelBubble(value: boolean); - stopImmediatePropagation(): void; - preventDefault(): void; - stopPropagation(): void; - composedPath(): EventTarget[]; - static readonly NONE: number; - static readonly CAPTURING_PHASE: number; - static readonly AT_TARGET: number; - static readonly BUBBLING_PHASE: number; -} -export interface EventInit { - bubbles?: boolean; - cancelable?: boolean; - composed?: boolean; -} -export type EventListener = ( - event: EventType -) => void; -export interface EventListenerObject { - handleEvent(event: EventType): void; -} -export type EventListenerOrEventListenerObject< - EventType extends Event = Event -> = EventListener | EventListenerObject; -export declare class EventTarget< - EventMap extends Record = Record -> { - constructor(); - addEventListener( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetAddEventListenerOptions | boolean - ): void; - removeEventListener( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetEventListenerOptions | boolean - ): void; - dispatchEvent(event: EventMap[keyof EventMap]): boolean; -} -export interface EventTargetEventListenerOptions { - capture?: boolean; -} -export interface EventTargetAddEventListenerOptions { - capture?: boolean; - passive?: boolean; - once?: boolean; - signal?: AbortSignal; -} -export interface EventTargetHandlerObject { - handleEvent: (event: Event) => any | undefined; -} -export declare class AbortController { - constructor(); - get signal(): AbortSignal; - abort(reason?: any): void; -} -export declare abstract class AbortSignal extends EventTarget { - static abort(reason?: any): AbortSignal; - static timeout(delay: number): AbortSignal; - get aborted(): boolean; - get reason(): any; - throwIfAborted(): void; -} -export interface Scheduler { - wait(delay: number, maybeOptions?: SchedulerWaitOptions): Promise; -} -export interface SchedulerWaitOptions { - signal?: AbortSignal; -} -export declare abstract class ExtendableEvent extends Event { - waitUntil(promise: Promise): void; -} -export declare class Blob { - constructor( - bits?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[], - options?: BlobOptions - ); - get size(): number; - get type(): string; - slice(start?: number, end?: number, type?: string): Blob; - arrayBuffer(): Promise; - text(): Promise; - stream(): ReadableStream; -} -export interface BlobOptions { - type?: string; -} -export declare class File extends Blob { - constructor( - bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined, - name: string, - options?: FileOptions - ); - get name(): string; - get lastModified(): number; -} -export interface FileOptions { - type?: string; - lastModified?: number; -} -export declare abstract class CacheStorage { - open(cacheName: string): Promise; - readonly default: Cache; -} -export declare abstract class Cache { - delete(request: RequestInfo, options?: CacheQueryOptions): Promise; - match( - request: RequestInfo, - options?: CacheQueryOptions - ): Promise; - put(request: RequestInfo, response: Response): Promise; -} -export interface CacheQueryOptions { - ignoreMethod?: boolean; -} -export declare abstract class Crypto { - get subtle(): SubtleCrypto; - getRandomValues< - T extends - | Int8Array - | Uint8Array - | Int16Array - | Uint16Array - | Int32Array - | Uint32Array - | BigInt64Array - | BigUint64Array - >(buffer: T): T; - randomUUID(): string; - DigestStream: typeof DigestStream; -} -export declare abstract class SubtleCrypto { - encrypt( - algorithm: string | SubtleCryptoEncryptAlgorithm, - key: CryptoKey, - plainText: ArrayBuffer | ArrayBufferView - ): Promise; - decrypt( - algorithm: string | SubtleCryptoEncryptAlgorithm, - key: CryptoKey, - cipherText: ArrayBuffer | ArrayBufferView - ): Promise; - sign( - algorithm: string | SubtleCryptoSignAlgorithm, - key: CryptoKey, - data: ArrayBuffer | ArrayBufferView - ): Promise; - verify( - algorithm: string | SubtleCryptoSignAlgorithm, - key: CryptoKey, - signature: ArrayBuffer | ArrayBufferView, - data: ArrayBuffer | ArrayBufferView - ): Promise; - digest( - algorithm: string | SubtleCryptoHashAlgorithm, - data: ArrayBuffer | ArrayBufferView - ): Promise; - generateKey( - algorithm: string | SubtleCryptoGenerateKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - deriveKey( - algorithm: string | SubtleCryptoDeriveKeyAlgorithm, - baseKey: CryptoKey, - derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - deriveBits( - algorithm: string | SubtleCryptoDeriveKeyAlgorithm, - baseKey: CryptoKey, - length: number | null - ): Promise; - importKey( - format: string, - keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey, - algorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - exportKey(format: string, key: CryptoKey): Promise; - wrapKey( - format: string, - key: CryptoKey, - wrappingKey: CryptoKey, - wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm - ): Promise; - unwrapKey( - format: string, - wrappedKey: ArrayBuffer | ArrayBufferView, - unwrappingKey: CryptoKey, - unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm, - unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - timingSafeEqual( - a: ArrayBuffer | ArrayBufferView, - b: ArrayBuffer | ArrayBufferView - ): boolean; -} -export declare abstract class CryptoKey { - readonly type: string; - readonly extractable: boolean; - readonly algorithm: - | CryptoKeyKeyAlgorithm - | CryptoKeyAesKeyAlgorithm - | CryptoKeyHmacKeyAlgorithm - | CryptoKeyRsaKeyAlgorithm - | CryptoKeyEllipticKeyAlgorithm - | CryptoKeyArbitraryKeyAlgorithm; - readonly usages: string[]; -} -export interface CryptoKeyPair { - publicKey: CryptoKey; - privateKey: CryptoKey; -} -export 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; -} -export interface RsaOtherPrimesInfo { - r?: string; - d?: string; - t?: string; -} -export interface SubtleCryptoDeriveKeyAlgorithm { - name: string; - salt?: ArrayBuffer; - iterations?: number; - hash?: string | SubtleCryptoHashAlgorithm; - $public?: CryptoKey; - info?: ArrayBuffer; -} -export interface SubtleCryptoEncryptAlgorithm { - name: string; - iv?: ArrayBuffer; - additionalData?: ArrayBuffer; - tagLength?: number; - counter?: ArrayBuffer; - length?: number; - label?: ArrayBuffer; -} -export interface SubtleCryptoGenerateKeyAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - modulusLength?: number; - publicExponent?: ArrayBuffer; - length?: number; - namedCurve?: string; -} -export interface SubtleCryptoHashAlgorithm { - name: string; -} -export interface SubtleCryptoImportKeyAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - length?: number; - namedCurve?: string; - compressed?: boolean; -} -export interface SubtleCryptoSignAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - dataLength?: number; - saltLength?: number; -} -export interface CryptoKeyKeyAlgorithm { - name: string; -} -export interface CryptoKeyAesKeyAlgorithm { - name: string; - length: number; -} -export interface CryptoKeyHmacKeyAlgorithm { - name: string; - hash: CryptoKeyKeyAlgorithm; - length: number; -} -export interface CryptoKeyRsaKeyAlgorithm { - name: string; - modulusLength: number; - publicExponent: ArrayBuffer; - hash?: CryptoKeyKeyAlgorithm; -} -export interface CryptoKeyEllipticKeyAlgorithm { - name: string; - namedCurve: string; -} -export interface CryptoKeyArbitraryKeyAlgorithm { - name: string; - hash?: CryptoKeyKeyAlgorithm; - namedCurve?: string; - length?: number; -} -export declare class DigestStream extends WritableStream< - ArrayBuffer | ArrayBufferView -> { - constructor(algorithm: string | SubtleCryptoHashAlgorithm); - get digest(): Promise; -} -export declare class TextDecoder { - constructor(decoder?: string, options?: TextDecoderConstructorOptions); - decode( - input?: ArrayBuffer | ArrayBufferView, - options?: TextDecoderDecodeOptions - ): string; - get encoding(): string; - get fatal(): boolean; - get ignoreBOM(): boolean; -} -export declare class TextEncoder { - constructor(); - encode(input?: string): Uint8Array; - encodeInto(input: string, buffer: Uint8Array): TextEncoderEncodeIntoResult; - get encoding(): string; -} -export interface TextDecoderConstructorOptions { - fatal: boolean; - ignoreBOM: boolean; -} -export interface TextDecoderDecodeOptions { - stream: boolean; -} -export interface TextEncoderEncodeIntoResult { - read: number; - written: number; -} -export declare class FormData { - constructor(); - append(name: string, value: string): void; - append(name: string, value: Blob, filename?: string): void; - delete(name: string): void; - get(name: string): (File | string) | null; - getAll(name: string): (File | string)[]; - has(name: string): boolean; - set(name: string, value: string): void; - set(name: string, value: Blob, filename?: string): void; - entries(): IterableIterator<[key: string, value: File | string]>; - keys(): IterableIterator; - values(): IterableIterator; - forEach( - callback: ( - this: This, - value: File | string, - key: string, - parent: FormData - ) => void, - thisArg?: This - ): void; - [Symbol.iterator](): IterableIterator<[key: string, value: File | string]>; -} -export interface ContentOptions { - html?: boolean; -} -export declare class HTMLRewriter { - constructor(); - on( - selector: string, - handlers: HTMLRewriterElementContentHandlers - ): HTMLRewriter; - onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter; - transform(response: Response): Response; -} -export interface HTMLRewriterElementContentHandlers { - element?(element: Element): void | Promise; - comments?(comment: Comment): void | Promise; - text?(element: Text): void | Promise; -} -export interface HTMLRewriterDocumentContentHandlers { - doctype?(doctype: Doctype): void | Promise; - comments?(comment: Comment): void | Promise; - text?(text: Text): void | Promise; - end?(end: DocumentEnd): void | Promise; -} -export interface Doctype { - readonly name: string | null; - readonly publicId: string | null; - readonly systemId: string | null; -} -export interface Element { - tagName: string; - readonly attributes: IterableIterator; - 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, options?: ContentOptions): Element; - after(content: string, options?: ContentOptions): Element; - prepend(content: string, options?: ContentOptions): Element; - append(content: string, options?: ContentOptions): Element; - replace(content: string, options?: ContentOptions): Element; - remove(): Element; - removeAndKeepContent(): Element; - setInnerContent(content: string, options?: ContentOptions): Element; - onEndTag(handler: (tag: EndTag) => void | Promise): void; -} -export interface EndTag { - name: string; - before(content: string, options?: ContentOptions): EndTag; - after(content: string, options?: ContentOptions): EndTag; - remove(): EndTag; -} -export 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; -} -export interface Text { - readonly text: string; - readonly lastInTextNode: boolean; - readonly removed: boolean; - before(content: string, options?: ContentOptions): Text; - after(content: string, options?: ContentOptions): Text; - replace(content: string, options?: ContentOptions): Text; - remove(): Text; -} -export interface DocumentEnd { - append(content: string, options?: ContentOptions): DocumentEnd; -} -export declare abstract class FetchEvent extends ExtendableEvent { - readonly request: Request; - respondWith(promise: Response | Promise): void; - passThroughOnException(): void; -} -export type HeadersInit = - | Headers - | Iterable> - | Record; -export declare class Headers { - constructor(init?: HeadersInit); - get(name: string): string | null; - getAll(name: string): string[]; - has(name: string): boolean; - set(name: string, value: string): void; - append(name: string, value: string): void; - delete(name: string): void; - forEach( - callback: (this: This, value: string, key: string, parent: Headers) => void, - thisArg?: This - ): void; - entries(): IterableIterator<[key: string, value: string]>; - keys(): IterableIterator; - values(): IterableIterator; - [Symbol.iterator](): IterableIterator<[key: string, value: string]>; -} -export type BodyInit = - | ReadableStream - | string - | ArrayBuffer - | ArrayBufferView - | Blob - | URLSearchParams - | FormData; -export declare abstract class Body { - get body(): ReadableStream | null; - get bodyUsed(): boolean; - arrayBuffer(): Promise; - text(): Promise; - json(): Promise; - formData(): Promise; - blob(): Promise; -} -export declare class Response extends Body { - constructor(body?: BodyInit | null, init?: ResponseInit); - static redirect(url: string, status?: number): Response; - static json(any: any, maybeInit?: ResponseInit | Response): Response; - clone(): Response; - get status(): number; - get statusText(): string; - get headers(): Headers; - get ok(): boolean; - get redirected(): boolean; - get url(): string; - get webSocket(): WebSocket | null; - get cf(): any | undefined; -} -export interface ResponseInit { - status?: number; - statusText?: string; - headers?: HeadersInit; - cf?: any; - webSocket?: WebSocket | null; - encodeBody?: "automatic" | "manual"; -} -export type RequestInfo< - CfHostMetadata = unknown, - Cf = CfProperties -> = Request | string | URL; -export declare class Request< - CfHostMetadata = unknown, - Cf = CfProperties -> extends Body { - constructor(input: RequestInfo, init?: RequestInit); - clone(): Request; - get method(): string; - get url(): string; - get headers(): Headers; - get redirect(): string; - get fetcher(): Fetcher | null; - get signal(): AbortSignal; - get cf(): Cf | undefined; - get integrity(): string; - get keepalive(): boolean; -} -export interface RequestInit { - /** 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 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; -} -export declare abstract class Fetcher { - fetch(input: RequestInfo, init?: RequestInit): Promise; -} -export interface FetcherPutOptions { - expiration?: number; - expirationTtl?: number; -} -export interface KVNamespaceListKey { - name: Key; - expiration?: number; - metadata?: Metadata; -} -export type KVNamespaceListResult = - | { - list_complete: false; - keys: KVNamespaceListKey[]; - cursor: string; - } - | { - list_complete: true; - keys: KVNamespaceListKey[]; - }; -export interface KVNamespace { - get( - key: Key, - options?: Partial> - ): Promise; - get(key: Key, type: "text"): Promise; - get( - key: Key, - type: "json" - ): Promise; - get(key: Key, type: "arrayBuffer"): Promise; - get(key: Key, type: "stream"): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"text"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"json"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"arrayBuffer"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"stream"> - ): Promise; - list( - options?: KVNamespaceListOptions - ): Promise>; - put( - key: Key, - value: string | ArrayBuffer | ArrayBufferView | ReadableStream, - options?: KVNamespacePutOptions - ): Promise; - getWithMetadata( - key: Key, - options?: Partial> - ): Promise>; - getWithMetadata( - key: Key, - type: "text" - ): Promise>; - getWithMetadata( - key: Key, - type: "json" - ): Promise>; - getWithMetadata( - key: Key, - type: "arrayBuffer" - ): Promise>; - getWithMetadata( - key: Key, - type: "stream" - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"text"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"json"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"arrayBuffer"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"stream"> - ): Promise>; - delete(key: Key): Promise; -} -export interface KVNamespaceListOptions { - limit?: number; - prefix?: string | null; - cursor?: string | null; -} -export interface KVNamespaceGetOptions { - type: Type; - cacheTtl?: number; -} -export interface KVNamespacePutOptions { - expiration?: number; - expirationTtl?: number; - metadata?: any | null; -} -export interface KVNamespaceGetWithMetadataResult { - value: Value | null; - metadata: Metadata | null; -} -export interface R2Error extends Error { - readonly name: string; - readonly code: number; - readonly message: string; - readonly action: string; - readonly stack: any; -} -export interface R2ListOptions { - limit?: number; - prefix?: string; - cursor?: string; - delimiter?: string; - startAfter?: string; - include?: ("httpMetadata" | "customMetadata")[]; -} -export declare abstract class R2Bucket { - head(key: string): Promise; - get( - key: string, - options: R2GetOptions & { - onlyIf: R2Conditional | Headers; - } - ): Promise; - get(key: string, options?: R2GetOptions): Promise; - put( - key: string, - value: - | ReadableStream - | ArrayBuffer - | ArrayBufferView - | string - | null - | Blob, - options?: R2PutOptions - ): Promise; - put( - key: string, - value: - | ReadableStream - | ArrayBuffer - | ArrayBufferView - | string - | null - | Blob, - options?: R2PutOptions & { - onlyIf: R2Conditional | Headers; - } - ): Promise; - createMultipartUpload( - key: string, - options?: R2MultipartOptions - ): Promise; - resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload; - delete(keys: string | string[]): Promise; - list(options?: R2ListOptions): Promise; -} -export interface R2MultipartUpload { - readonly key: string; - readonly uploadId: string; - uploadPart( - partNumber: number, - value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob - ): Promise; - abort(): Promise; - complete(uploadedParts: R2UploadedPart[]): Promise; -} -export interface R2UploadedPart { - partNumber: number; - etag: string; -} -export 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; - readonly range?: R2Range; - writeHttpMetadata(headers: Headers): void; -} -export interface R2ObjectBody extends R2Object { - get body(): ReadableStream; - get bodyUsed(): boolean; - arrayBuffer(): Promise; - text(): Promise; - json(): Promise; - blob(): Promise; -} -export type R2Range = - | { - offset: number; - length?: number; - } - | { - offset?: number; - length: number; - } - | { - suffix: number; - }; -export interface R2Conditional { - etagMatches?: string; - etagDoesNotMatch?: string; - uploadedBefore?: Date; - uploadedAfter?: Date; - secondsGranularity?: boolean; -} -export interface R2GetOptions { - onlyIf?: R2Conditional | Headers; - range?: R2Range | Headers; -} -export interface R2PutOptions { - onlyIf?: R2Conditional | Headers; - httpMetadata?: R2HTTPMetadata | Headers; - customMetadata?: Record; - md5?: ArrayBuffer | string; - sha1?: ArrayBuffer | string; - sha256?: ArrayBuffer | string; - sha384?: ArrayBuffer | string; - sha512?: ArrayBuffer | string; -} -export interface R2MultipartOptions { - httpMetadata?: R2HTTPMetadata | Headers; - customMetadata?: Record; -} -export interface R2Checksums { - readonly md5?: ArrayBuffer; - readonly sha1?: ArrayBuffer; - readonly sha256?: ArrayBuffer; - readonly sha384?: ArrayBuffer; - readonly sha512?: ArrayBuffer; - toJSON(): R2StringChecksums; -} -export interface R2StringChecksums { - md5?: string; - sha1?: string; - sha256?: string; - sha384?: string; - sha512?: string; -} -export interface R2HTTPMetadata { - contentType?: string; - contentLanguage?: string; - contentDisposition?: string; - contentEncoding?: string; - cacheControl?: string; - cacheExpiry?: Date; -} -export interface R2Objects { - objects: R2Object[]; - truncated: boolean; - cursor?: string; - delimitedPrefixes: string[]; -} -export declare abstract class ScheduledEvent extends ExtendableEvent { - readonly scheduledTime: number; - readonly cron: string; - noRetry(): void; -} -export interface ScheduledController { - readonly scheduledTime: number; - readonly cron: string; - noRetry(): void; -} -export interface QueuingStrategy { - highWaterMark?: number | bigint; - size?: (chunk: T) => number | bigint; -} -export interface UnderlyingSink { - type?: string; - start?: (controller: WritableStreamDefaultController) => void | Promise; - write?: ( - chunk: W, - controller: WritableStreamDefaultController - ) => void | Promise; - abort?: (reason: any) => void | Promise; - close?: () => void | Promise; -} -export interface UnderlyingByteSource { - type: "bytes"; - autoAllocateChunkSize?: number; - start?: (controller: ReadableByteStreamController) => void | Promise; - pull?: (controller: ReadableByteStreamController) => void | Promise; - cancel?: (reason: any) => void | Promise; -} -export interface UnderlyingSource { - type?: "" | undefined; - start?: ( - controller: ReadableStreamDefaultController - ) => void | Promise; - pull?: ( - controller: ReadableStreamDefaultController - ) => void | Promise; - cancel?: (reason: any) => void | Promise; -} -export interface Transformer { - readableType?: string; - writableType?: string; - start?: ( - controller: TransformStreamDefaultController - ) => void | Promise; - transform?: ( - chunk: I, - controller: TransformStreamDefaultController - ) => void | Promise; - flush?: ( - controller: TransformStreamDefaultController - ) => void | Promise; -} -export interface StreamPipeOptions { - /** - * 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; - preventAbort?: boolean; - preventCancel?: boolean; - signal?: AbortSignal; -} -export type ReadableStreamReadResult = - | { - done: false; - value: R; - } - | { - done: true; - value?: undefined; - }; -/** This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object. */ -export interface ReadableStream { - get locked(): boolean; - cancel(reason?: any): Promise; - getReader(): ReadableStreamDefaultReader; - getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader; - pipeThrough( - transform: ReadableWritablePair, - options?: StreamPipeOptions - ): ReadableStream; - pipeTo( - destination: WritableStream, - options?: StreamPipeOptions - ): Promise; - tee(): [ReadableStream, ReadableStream]; - values(options?: ReadableStreamValuesOptions): AsyncIterableIterator; - [Symbol.asyncIterator]( - options?: ReadableStreamValuesOptions - ): AsyncIterableIterator; -} -export declare const ReadableStream: { - prototype: ReadableStream; - new ( - underlyingSource: UnderlyingByteSource, - strategy?: QueuingStrategy - ): ReadableStream; - new ( - underlyingSource?: UnderlyingSource, - strategy?: QueuingStrategy - ): ReadableStream; -}; -export declare class ReadableStreamDefaultReader { - constructor(stream: ReadableStream); - get closed(): Promise; - cancel(reason?: any): Promise; - read(): Promise>; - releaseLock(): void; -} -export declare class ReadableStreamBYOBReader { - constructor(stream: ReadableStream); - get closed(): Promise; - cancel(reason?: any): Promise; - read( - view: T - ): Promise>; - releaseLock(): void; - readAtLeast( - minElements: number, - view: T - ): Promise>; -} -export interface ReadableStreamGetReaderOptions { - mode: "byob"; -} -export declare abstract class ReadableStreamBYOBRequest { - readonly view: Uint8Array | null; - respond(bytesWritten: number): void; - respondWithNewView(view: ArrayBuffer | ArrayBufferView): void; - readonly atLeast: number | null; -} -export declare abstract class ReadableStreamDefaultController { - readonly desiredSize: number | null; - close(): void; - enqueue(chunk?: R): void; - error(reason: any): void; -} -export declare abstract class ReadableByteStreamController { - readonly byobRequest: ReadableStreamBYOBRequest | null; - readonly desiredSize: number | null; - close(): void; - enqueue(chunk: ArrayBuffer | ArrayBufferView): void; - error(reason: any): void; -} -export declare abstract class WritableStreamDefaultController { - readonly signal: AbortSignal; - error(reason?: any): void; -} -export interface TransformStreamDefaultController { - get desiredSize(): number | null; - enqueue(chunk?: O): void; - error(reason: any): void; - terminate(): void; -} -export interface ReadableWritablePair { - /** - * 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; - readable: ReadableStream; -} -export declare class WritableStream { - constructor( - underlyingSink?: UnderlyingSink, - queuingStrategy?: QueuingStrategy - ); - get locked(): boolean; - abort(reason?: any): Promise; - close(): Promise; - getWriter(): WritableStreamDefaultWriter; -} -export declare class WritableStreamDefaultWriter { - constructor(stream: WritableStream); - get closed(): Promise; - get ready(): Promise; - get desiredSize(): number | null; - abort(reason?: any): Promise; - close(): Promise; - write(chunk?: W): Promise; - releaseLock(): void; -} -export declare class TransformStream { - constructor( - transformer?: Transformer, - writableStrategy?: QueuingStrategy, - readableStrategy?: QueuingStrategy - ); - get readable(): ReadableStream; - get writable(): WritableStream; -} -export declare class FixedLengthStream extends IdentityTransformStream { - constructor(expectedLength: number | bigint); -} -export declare class IdentityTransformStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(); -} -export interface ReadableStreamValuesOptions { - preventCancel?: boolean; -} -export declare class CompressionStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(format: "gzip" | "deflate" | "deflate-raw"); -} -export declare class DecompressionStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(format: "gzip" | "deflate" | "deflate-raw"); -} -export declare class TextEncoderStream extends TransformStream< - string, - Uint8Array -> { - constructor(); -} -export declare class TextDecoderStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - string -> { - constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit); -} -export interface TextDecoderStreamTextDecoderStreamInit { - fatal?: boolean; -} -export declare class ByteLengthQueuingStrategy - implements QueuingStrategy -{ - constructor(init: QueuingStrategyInit); - get highWaterMark(): number; - get size(): (chunk?: any) => number; -} -export declare class CountQueuingStrategy implements QueuingStrategy { - constructor(init: QueuingStrategyInit); - get highWaterMark(): number; - get size(): (chunk?: any) => number; -} -export 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; -} -export declare abstract class TraceEvent extends ExtendableEvent { - readonly traces: TraceItem[]; -} -export interface TraceItem { - readonly event: - | ( - | TraceItemFetchEventInfo - | TraceItemScheduledEventInfo - | TraceItemAlarmEventInfo - | TraceItemQueueEventInfo - | TraceItemEmailEventInfo - | TraceItemCustomEventInfo - ) - | null; - readonly eventTimestamp: number | null; - readonly logs: TraceLog[]; - readonly exceptions: TraceException[]; - readonly scriptName: string | null; - readonly dispatchNamespace?: string; - readonly scriptTags?: string[]; - readonly outcome: string; -} -export interface TraceItemAlarmEventInfo { - readonly scheduledTime: Date; -} -export interface TraceItemCustomEventInfo {} -export interface TraceItemScheduledEventInfo { - readonly scheduledTime: number; - readonly cron: string; -} -export interface TraceItemQueueEventInfo { - readonly queue: string; - readonly batchSize: number; -} -export interface TraceItemEmailEventInfo { - readonly mailFrom: string; - readonly rcptTo: string; - readonly rawSize: number; -} -export interface TraceItemFetchEventInfo { - readonly response?: TraceItemFetchEventInfoResponse; - readonly request: TraceItemFetchEventInfoRequest; -} -export interface TraceItemFetchEventInfoRequest { - readonly cf?: any; - readonly headers: Record; - readonly method: string; - readonly url: string; - getUnredacted(): TraceItemFetchEventInfoRequest; -} -export interface TraceItemFetchEventInfoResponse { - readonly status: number; -} -export interface TraceLog { - readonly timestamp: number; - readonly level: string; - readonly message: any; -} -export interface TraceException { - readonly timestamp: number; - readonly message: string; - readonly name: string; -} -export interface TraceMetrics { - readonly cpuTime: number; - readonly wallTime: number; -} -export interface UnsafeTraceMetrics { - fromTrace(item: TraceItem): TraceMetrics; -} -export declare class URL { - constructor(url: string | URL, base?: string | URL); - get origin(): string; - get href(): string; - set href(value: string); - get protocol(): string; - set protocol(value: string); - get username(): string; - set username(value: string); - get password(): string; - set password(value: string); - get host(): string; - set host(value: string); - get hostname(): string; - set hostname(value: string); - get port(): string; - set port(value: string); - get pathname(): string; - set pathname(value: string); - get search(): string; - set search(value: string); - get hash(): string; - set hash(value: string); - get searchParams(): URLSearchParams; - toJSON(): string; - toString(): string; - static canParse(url: string, base?: string): boolean; -} -export declare class URLSearchParams { - constructor( - init?: Iterable> | Record | string - ); - get size(): number; - append(name: string, value: string): void; - delete(name: string): void; - get(name: string): string | null; - getAll(name: string): string[]; - has(name: string): boolean; - set(name: string, value: string): void; - sort(): void; - entries(): IterableIterator<[key: string, value: string]>; - keys(): IterableIterator; - values(): IterableIterator; - forEach( - callback: ( - this: This, - value: string, - key: string, - parent: URLSearchParams - ) => void, - thisArg?: This - ): void; - toString(): string; - [Symbol.iterator](): IterableIterator<[key: string, value: string]>; -} -export declare class URLPattern { - constructor(input?: string | URLPatternURLPatternInit, baseURL?: string); - get protocol(): string; - get username(): string; - get password(): string; - get hostname(): string; - get port(): string; - get pathname(): string; - get search(): string; - get hash(): string; - test(input?: string | URLPatternURLPatternInit, baseURL?: string): boolean; - exec( - input?: string | URLPatternURLPatternInit, - baseURL?: string - ): URLPatternURLPatternResult | null; -} -export interface URLPatternURLPatternInit { - protocol?: string; - username?: string; - password?: string; - hostname?: string; - port?: string; - pathname?: string; - search?: string; - hash?: string; - baseURL?: string; -} -export interface URLPatternURLPatternComponentResult { - input: string; - groups: Record; -} -export interface URLPatternURLPatternResult { - inputs: (string | URLPatternURLPatternInit)[]; - protocol: URLPatternURLPatternComponentResult; - username: URLPatternURLPatternComponentResult; - password: URLPatternURLPatternComponentResult; - hostname: URLPatternURLPatternComponentResult; - port: URLPatternURLPatternComponentResult; - pathname: URLPatternURLPatternComponentResult; - search: URLPatternURLPatternComponentResult; - hash: URLPatternURLPatternComponentResult; -} -export declare class CloseEvent extends Event { - constructor(type: string, initializer: CloseEventInit); - /** Returns the WebSocket connection close code provided by the server. */ - readonly code: number; - /** Returns the WebSocket connection close reason provided by the server. */ - readonly reason: string; - /** Returns true if the connection closed cleanly; false otherwise. */ - readonly wasClean: boolean; -} -export interface CloseEventInit { - code?: number; - reason?: string; - wasClean?: boolean; -} -export declare class MessageEvent extends Event { - constructor(type: string, initializer: MessageEventInit); - readonly data: ArrayBuffer | string; -} -export interface MessageEventInit { - data: ArrayBuffer | string; -} -/** Events providing information related to errors in scripts or in files. */ -export interface ErrorEvent extends Event { - readonly filename: string; - readonly message: string; - readonly lineno: number; - readonly colno: number; - readonly error: any; -} -export type WebSocketEventMap = { - close: CloseEvent; - message: MessageEvent; - open: Event; - error: ErrorEvent; -}; -export declare class WebSocket extends EventTarget { - constructor(url: string, protocols?: string[] | string); - accept(): void; - send(message: (ArrayBuffer | ArrayBufferView) | string): void; - close(code?: number, reason?: string): void; - static readonly READY_STATE_CONNECTING: number; - static readonly READY_STATE_OPEN: number; - static readonly READY_STATE_CLOSING: number; - static readonly READY_STATE_CLOSED: number; - get readyState(): number; - get url(): string | null; - get protocol(): string | null; - get extensions(): string | null; -} -export declare const WebSocketPair: { - new (): { - 0: WebSocket; - 1: WebSocket; - }; -}; -export interface BasicImageTransformations { - /** - * Maximum width in image pixels. The value must be an integer. - */ - width?: number; - /** - * Maximum height in image pixels. The value must be an integer. - */ - height?: number; - /** - * Resizing mode as a string. It affects interpretation of width and height - * options: - * - scale-down: Similar to contain, but the image is never enlarged. If - * the image is larger than given width or height, it will be resized. - * Otherwise its original size will be kept. - * - contain: Resizes to maximum size that fits within the given width and - * height. If only a single dimension is given (e.g. only width), the - * image will be shrunk or enlarged to exactly match that dimension. - * Aspect ratio is always preserved. - * - cover: Resizes (shrinks or enlarges) to fill the entire area of width - * and height. If the image has an aspect ratio different from the ratio - * of width and height, it will be cropped to fit. - * - crop: The image will be shrunk and cropped to fit within the area - * specified by width and height. The image will not be enlarged. For images - * smaller than the given dimensions it's the same as scale-down. For - * images larger than the given dimensions, it's the same as cover. - * See also trim. - * - pad: Resizes to the maximum size that fits within the given width and - * height, and then fills the remaining area with a background color - * (white by default). Use of this mode is not recommended, as the same - * effect can be more efficiently achieved with the contain mode and the - * CSS object-fit: contain property. - */ - fit?: "scale-down" | "contain" | "cover" | "crop" | "pad"; - /** - * When cropping with fit: "cover", this defines the side or point that should - * be left uncropped. The value is either a string - * "left", "right", "top", "bottom", "auto", or "center" (the default), - * or an object {x, y} containing focal point coordinates in the original - * image expressed as fractions ranging from 0.0 (top or left) to 1.0 - * (bottom or right), 0.5 being the center. {fit: "cover", gravity: "top"} will - * crop bottom or left and right sides as necessary, but won’t crop anything - * from the top. {fit: "cover", gravity: {x:0.5, y:0.2}} will crop each side to - * preserve as much as possible around a point at 20% of the height of the - * source image. - */ - gravity?: - | "left" - | "right" - | "top" - | "bottom" - | "center" - | "auto" - | BasicImageTransformationsGravityCoordinates; - /** - * Background color to add underneath the image. Applies only to images with - * transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…), - * hsl(…), etc.) - */ - background?: string; - /** - * Number of degrees (90, 180, 270) to rotate the image by. width and height - * options refer to axes after rotation. - */ - rotate?: 0 | 90 | 180 | 270 | 360; -} -export interface BasicImageTransformationsGravityCoordinates { - x: number; - y: number; -} -/** - * In addition to the properties you can set in the RequestInit dict - * that you pass as an argument to the Request constructor, you can - * set certain properties of a `cf` object to control how Cloudflare - * features are applied to that new Request. - * - * Note: Currently, these properties cannot be tested in the - * playground. - */ -export interface RequestInitCfProperties extends Record { - cacheEverything?: boolean; - /** - * A request's cache key is what determines if two requests are - * "the same" for caching purposes. If a request has the same cache key - * as some previous request, then we can serve the same cached response for - * both. (e.g. 'some-key') - * - * Only available for Enterprise customers. - */ - cacheKey?: string; - /** - * This allows you to append additional Cache-Tag response headers - * to the origin response without modifications to the origin server. - * This will allow for greater control over the Purge by Cache Tag feature - * utilizing changes only in the Workers process. - * - * Only available for Enterprise customers. - */ - cacheTags?: string[]; - /** - * Force response to be cached for a given number of seconds. (e.g. 300) - */ - cacheTtl?: number; - /** - * Force response to be cached for a given number of seconds based on the Origin status code. - * (e.g. { '200-299': 86400, '404': 1, '500-599': 0 }) - */ - cacheTtlByStatus?: Record; - scrapeShield?: boolean; - apps?: boolean; - image?: RequestInitCfPropertiesImage; - minify?: RequestInitCfPropertiesImageMinify; - mirage?: boolean; - polish?: "lossy" | "lossless" | "off"; - /** - * Redirects the request to an alternate origin server. You can use this, - * for example, to implement load balancing across several origins. - * (e.g.us-east.example.com) - * - * Note - For security reasons, the hostname set in resolveOverride must - * be proxied on the same Cloudflare zone of the incoming request. - * Otherwise, the setting is ignored. CNAME hosts are allowed, so to - * resolve to a host under a different domain or a DNS only domain first - * declare a CNAME record within your own zone’s DNS mapping to the - * external hostname, set proxy on Cloudflare, then set resolveOverride - * to point to that CNAME record. - */ - resolveOverride?: string; -} -export interface RequestInitCfPropertiesImageDraw - extends BasicImageTransformations { - /** - * Absolute URL of the image file to use for the drawing. It can be any of - * the supported file formats. For drawing of watermarks or non-rectangular - * overlays we recommend using PNG or WebP images. - */ - url: string; - /** - * Floating-point number between 0 (transparent) and 1 (opaque). - * For example, opacity: 0.5 makes overlay semitransparent. - */ - opacity?: number; - /** - * - If set to true, the overlay image will be tiled to cover the entire - * area. This is useful for stock-photo-like watermarks. - * - If set to "x", the overlay image will be tiled horizontally only - * (form a line). - * - If set to "y", the overlay image will be tiled vertically only - * (form a line). - */ - repeat?: true | "x" | "y"; - /** - * Position of the overlay image relative to a given edge. Each property is - * an offset in pixels. 0 aligns exactly to the edge. For example, left: 10 - * positions left side of the overlay 10 pixels from the left edge of the - * image it's drawn over. bottom: 0 aligns bottom of the overlay with bottom - * of the background image. - * - * Setting both left & right, or both top & bottom is an error. - * - * If no position is specified, the image will be centered. - */ - top?: number; - left?: number; - bottom?: number; - right?: number; -} -export interface RequestInitCfPropertiesImage - extends BasicImageTransformations { - /** - * Device Pixel Ratio. Default 1. Multiplier for width/height that makes it - * easier to specify higher-DPI sizes in . - */ - dpr?: number; - /** - * An object with four properties {left, top, right, bottom} that specify - * a number of pixels to cut off on each side. Allows removal of borders - * or cutting out a specific fragment of an image. Trimming is performed - * before resizing or rotation. Takes dpr into account. - */ - trim?: { - left?: number; - top?: number; - right?: number; - bottom?: number; - }; - /** - * Quality setting from 1-100 (useful values are in 60-90 range). Lower values - * make images look worse, but load faster. The default is 85. It applies only - * to JPEG and WebP images. It doesn’t have any effect on PNG. - */ - quality?: number; - /** - * Output format to generate. It can be: - * - avif: generate images in AVIF format. - * - webp: generate images in Google WebP format. Set quality to 100 to get - * the WebP-lossless format. - * - json: instead of generating an image, outputs information about the - * image, in JSON format. The JSON object will contain image size - * (before and after resizing), source image’s MIME type, file size, etc. - * - jpeg: generate images in JPEG format. - * - png: generate images in PNG format. - */ - format?: "avif" | "webp" | "json" | "jpeg" | "png"; - /** - * Whether to preserve animation frames from input files. Default is true. - * Setting it to false reduces animations to still images. This setting is - * recommended when enlarging images or processing arbitrary user content, - * because large GIF animations can weigh tens or even hundreds of megabytes. - * It is also useful to set anim:false when using format:"json" to get the - * response quicker without the number of frames. - */ - anim?: boolean; - /** - * What EXIF data should be preserved in the output image. Note that EXIF - * rotation and embedded color profiles are always applied ("baked in" into - * the image), and aren't affected by this option. Note that if the Polish - * feature is enabled, all metadata may have been removed already and this - * option may have no effect. - * - keep: Preserve most of EXIF metadata, including GPS location if there's - * any. - * - copyright: Only keep the copyright tag, and discard everything else. - * This is the default behavior for JPEG files. - * - none: Discard all invisible EXIF metadata. Currently WebP and PNG - * output formats always discard metadata. - */ - metadata?: "keep" | "copyright" | "none"; - /** - * Strength of sharpening filter to apply to the image. Floating-point - * number between 0 (no sharpening, default) and 10 (maximum). 1.0 is a - * recommended value for downscaled images. - */ - sharpen?: number; - /** - * Radius of a blur filter (approximate gaussian). Maximum supported radius - * is 250. - */ - blur?: number; - /** - * Overlays are drawn in the order they appear in the array (last array - * entry is the topmost layer). - */ - draw?: RequestInitCfPropertiesImageDraw[]; - /** - * Fetching image from authenticated origin. Setting this property will - * pass authentication headers (Authorization, Cookie, etc.) through to - * the origin. - */ - "origin-auth"?: "share-publicly"; - /** - * Adds a border around the image. The border is added after resizing. Border - * width takes dpr into account, and can be specified either using a single - * width property, or individually for each side. - */ - border?: - | { - color: string; - width: number; - } - | { - color: string; - top: number; - right: number; - bottom: number; - left: number; - }; - /** - * Increase brightness by a factor. A value of 1.0 equals no change, a value - * of 0.5 equals half brightness, and a value of 2.0 equals twice as bright. - * 0 is ignored. - */ - brightness?: number; - /** - * Increase contrast by a factor. A value of 1.0 equals no change, a value of - * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is - * ignored. - */ - contrast?: number; - /** - * Increase exposure by a factor. A value of 1.0 equals no change, a value of - * 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored. - */ - gamma?: number; - /** - * Slightly reduces latency on a cache miss by selecting a - * quickest-to-compress file format, at a cost of increased file size and - * lower image quality. It will usually override the format option and choose - * JPEG over WebP or AVIF. We do not recommend using this option, except in - * unusual circumstances like resizing uncacheable dynamically-generated - * images. - */ - compression?: "fast"; -} -export interface RequestInitCfPropertiesImageMinify { - javascript?: boolean; - css?: boolean; - html?: boolean; -} -/** - * Request metadata provided by Cloudflare's edge. - */ -export type IncomingRequestCfProperties = - IncomingRequestCfPropertiesBase & - IncomingRequestCfPropertiesBotManagementEnterprise & - IncomingRequestCfPropertiesCloudflareForSaaSEnterprise & - IncomingRequestCfPropertiesGeographicInformation & - IncomingRequestCfPropertiesCloudflareAccessOrApiShield; -export interface IncomingRequestCfPropertiesBase - extends Record { - /** - * [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request. - * - * @example 395747 - */ - asn: number; - /** - * The organization which owns the ASN of the incoming request. - * - * @example "Google Cloud" - */ - asOrganization: string; - /** - * The original value of the `Accept-Encoding` header if Cloudflare modified it. - * - * @example "gzip, deflate, br" - */ - clientAcceptEncoding?: string; - /** - * The number of milliseconds it took for the request to reach your worker. - * - * @example 22 - */ - clientTcpRtt?: number; - /** - * The three-letter [IATA](https://en.wikipedia.org/wiki/IATA_airport_code) - * airport code of the data center that the request hit. - * - * @example "DFW" - */ - colo: string; - /** - * Represents the upstream's response to a - * [TCP `keepalive` message](https://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html) - * from cloudflare. - * - * For workers with no upstream, this will always be `1`. - * - * @example 3 - */ - edgeRequestKeepAliveStatus: IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus; - /** - * The HTTP Protocol the request used. - * - * @example "HTTP/2" - */ - httpProtocol: string; - /** - * The browser-requested prioritization information in the request object. - * - * If no information was set, defaults to the empty string `""` - * - * @example "weight=192;exclusive=0;group=3;group-weight=127" - * @default "" - */ - requestPriority: string; - /** - * The TLS version of the connection to Cloudflare. - * In requests served over plaintext (without TLS), this property is the empty string `""`. - * - * @example "TLSv1.3" - */ - tlsVersion: string; - /** - * The cipher for the connection to Cloudflare. - * In requests served over plaintext (without TLS), this property is the empty string `""`. - * - * @example "AEAD-AES128-GCM-SHA256" - */ - tlsCipher: string; - /** - * Metadata containing the [`HELLO`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2) and [`FINISHED`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9) messages from this request's TLS handshake. - * - * If the incoming request was served over plaintext (without TLS) this field is undefined. - */ - tlsExportedAuthenticator?: IncomingRequestCfPropertiesExportedAuthenticatorMetadata; -} -export interface IncomingRequestCfPropertiesBotManagementBase { - /** - * Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot, - * represented as an integer percentage between `1` (almost certainly human) - * and `99` (almost certainly a bot). - * - * @example 54 - */ - score: number; - /** - * A boolean value that is true if the request comes from a good bot, like Google or Bing. - * Most customers choose to allow this traffic. For more details, see [Traffic from known bots](https://developers.cloudflare.com/firewall/known-issues-and-faq/#how-does-firewall-rules-handle-traffic-from-known-bots). - */ - verifiedBot: boolean; - /** - * A boolean value that is true if the request originates from a - * Cloudflare-verified proxy service. - */ - corporateProxy: boolean; - /** - * A boolean value that's true if the request matches [file extensions](https://developers.cloudflare.com/bots/reference/static-resources/) for many types of static resources. - */ - staticResource: boolean; - /** - * List of IDs that correlate to the Bot Management heuristic detections made on a request (you can have multiple heuristic detections on the same request). - */ - detectionIds: number[]; -} -export interface IncomingRequestCfPropertiesBotManagement { - /** - * Results of Cloudflare's Bot Management analysis - */ - botManagement: IncomingRequestCfPropertiesBotManagementBase; - /** - * Duplicate of `botManagement.score`. - * - * @deprecated - */ - clientTrustScore: number; -} -export interface IncomingRequestCfPropertiesBotManagementEnterprise - extends IncomingRequestCfPropertiesBotManagement { - /** - * Results of Cloudflare's Bot Management analysis - */ - botManagement: IncomingRequestCfPropertiesBotManagementBase & { - /** - * A [JA3 Fingerprint](https://developers.cloudflare.com/bots/concepts/ja3-fingerprint/) to help profile specific SSL/TLS clients - * across different destination IPs, Ports, and X509 certificates. - */ - ja3Hash: string; - }; -} -export interface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise< - HostMetadata -> { - /** - * Custom metadata set per-host in [Cloudflare for SaaS](https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/). - * - * This field is only present if you have Cloudflare for SaaS enabled on your account - * and you have followed the [required steps to enable it]((https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/domain-support/custom-metadata/)). - */ - hostMetadata: HostMetadata; -} -export interface IncomingRequestCfPropertiesCloudflareAccessOrApiShield { - /** - * Information about the client certificate presented to Cloudflare. - * - * This is populated when the incoming request is served over TLS using - * either Cloudflare Access or API Shield (mTLS) - * and the presented SSL certificate has a valid - * [Certificate Serial Number](https://ldapwiki.com/wiki/Certificate%20Serial%20Number) - * (i.e., not `null` or `""`). - * - * Otherwise, a set of placeholder values are used. - * - * The property `certPresented` will be set to `"1"` when - * the object is populated (i.e. the above conditions were met). - */ - tlsClientAuth: - | IncomingRequestCfPropertiesTLSClientAuth - | IncomingRequestCfPropertiesTLSClientAuthPlaceholder; -} -/** - * Metadata about the request's TLS handshake - */ -export interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata { - /** - * The client's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal - * - * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d" - */ - clientHandshake: string; - /** - * The server's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal - * - * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d" - */ - serverHandshake: string; - /** - * The client's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal - * - * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b" - */ - clientFinished: string; - /** - * The server's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal - * - * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b" - */ - serverFinished: string; -} -/** - * Geographic data about the request's origin. - */ -export interface IncomingRequestCfPropertiesGeographicInformation { - /** - * The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from. - * - * If your worker is [configured to accept TOR connections](https://support.cloudflare.com/hc/en-us/articles/203306930-Understanding-Cloudflare-Tor-support-and-Onion-Routing), this may also be `"T1"`, indicating a request that originated over TOR. - * - * If Cloudflare is unable to determine where the request originated this property is omitted. - * - * The country code `"T1"` is used for requests originating on TOR. - * - * @example "GB" - */ - country?: Iso3166Alpha2Code | "T1"; - /** - * If present, this property indicates that the request originated in the EU - * - * @example "1" - */ - isEUCountry?: "1"; - /** - * A two-letter code indicating the continent the request originated from. - * - * @example "AN" - */ - continent?: ContinentCode; - /** - * The city the request originated from - * - * @example "Austin" - */ - city?: string; - /** - * Postal code of the incoming request - * - * @example "78701" - */ - postalCode?: string; - /** - * Latitude of the incoming request - * - * @example "30.27130" - */ - latitude?: string; - /** - * Longitude of the incoming request - * - * @example "-97.74260" - */ - longitude?: string; - /** - * Timezone of the incoming request - * - * @example "America/Chicago" - */ - timezone?: string; - /** - * If known, the ISO 3166-2 name for the first level region associated with - * the IP address of the incoming request - * - * @example "Texas" - */ - region?: string; - /** - * If known, the ISO 3166-2 code for the first-level region associated with - * the IP address of the incoming request - * - * @example "TX" - */ - regionCode?: string; - /** - * Metro code (DMA) of the incoming request - * - * @example "635" - */ - metroCode?: string; -} -/** Data about the incoming request's TLS certificate */ -export interface IncomingRequestCfPropertiesTLSClientAuth { - /** Always `"1"`, indicating that the certificate was presented */ - certPresented: "1"; - /** - * Result of certificate verification. - * - * @example "FAILED:self signed certificate" - */ - certVerified: Exclude; - /** The presented certificate's revokation status. - * - * - A value of `"1"` indicates the certificate has been revoked - * - A value of `"0"` indicates the certificate has not been revoked - */ - certRevoked: "1" | "0"; - /** - * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) - * - * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certIssuerDN: string; - /** - * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) - * - * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certSubjectDN: string; - /** - * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted) - * - * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certIssuerDNRFC2253: string; - /** - * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted) - * - * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certSubjectDNRFC2253: string; - /** The certificate issuer's distinguished name (legacy policies) */ - certIssuerDNLegacy: string; - /** The certificate subject's distinguished name (legacy policies) */ - certSubjectDNLegacy: string; - /** - * The certificate's serial number - * - * @example "00936EACBE07F201DF" - */ - certSerial: string; - /** - * The certificate issuer's serial number - * - * @example "2489002934BDFEA34" - */ - certIssuerSerial: string; - /** - * The certificate's Subject Key Identifier - * - * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4" - */ - certSKI: string; - /** - * The certificate issuer's Subject Key Identifier - * - * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4" - */ - certIssuerSKI: string; - /** - * The certificate's SHA-1 fingerprint - * - * @example "6b9109f323999e52259cda7373ff0b4d26bd232e" - */ - certFingerprintSHA1: string; - /** - * The certificate's SHA-256 fingerprint - * - * @example "acf77cf37b4156a2708e34c4eb755f9b5dbbe5ebb55adfec8f11493438d19e6ad3f157f81fa3b98278453d5652b0c1fd1d71e5695ae4d709803a4d3f39de9dea" - */ - certFingerprintSHA256: string; - /** - * The effective starting date of the certificate - * - * @example "Dec 22 19:39:00 2018 GMT" - */ - certNotBefore: string; - /** - * The effective expiration date of the certificate - * - * @example "Dec 22 19:39:00 2018 GMT" - */ - certNotAfter: string; -} -/** Placeholder values for TLS Client Authorization */ -export interface IncomingRequestCfPropertiesTLSClientAuthPlaceholder { - certPresented: "0"; - certVerified: "NONE"; - certRevoked: "0"; - certIssuerDN: ""; - certSubjectDN: ""; - certIssuerDNRFC2253: ""; - certSubjectDNRFC2253: ""; - certIssuerDNLegacy: ""; - certSubjectDNLegacy: ""; - certSerial: ""; - certIssuerSerial: ""; - certSKI: ""; - certIssuerSKI: ""; - certFingerprintSHA1: ""; - certFingerprintSHA256: ""; - certNotBefore: ""; - certNotAfter: ""; -} -/** Possible outcomes of TLS verification */ -export type CertVerificationStatus = - /** Authentication succeeded */ - | "SUCCESS" - /** No certificate was presented */ - | "NONE" - /** Failed because the certificate was self-signed */ - | "FAILED:self signed certificate" - /** Failed because the certificate failed a trust chain check */ - | "FAILED:unable to verify the first certificate" - /** Failed because the certificate not yet valid */ - | "FAILED:certificate is not yet valid" - /** Failed because the certificate is expired */ - | "FAILED:certificate has expired" - /** Failed for another unspecified reason */ - | "FAILED"; -/** - * An upstream endpoint's response to a TCP `keepalive` message from Cloudflare. - */ -export type IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus = - | 0 /** Unknown */ - | 1 /** no keepalives (not found) */ - | 2 /** no connection re-use, opening keepalive connection failed */ - | 3 /** no connection re-use, keepalive accepted and saved */ - | 4 /** connection re-use, refused by the origin server (`TCP FIN`) */ - | 5; /** connection re-use, accepted by the origin server */ -/** ISO 3166-1 Alpha-2 codes */ -export type Iso3166Alpha2Code = - | "AD" - | "AE" - | "AF" - | "AG" - | "AI" - | "AL" - | "AM" - | "AO" - | "AQ" - | "AR" - | "AS" - | "AT" - | "AU" - | "AW" - | "AX" - | "AZ" - | "BA" - | "BB" - | "BD" - | "BE" - | "BF" - | "BG" - | "BH" - | "BI" - | "BJ" - | "BL" - | "BM" - | "BN" - | "BO" - | "BQ" - | "BR" - | "BS" - | "BT" - | "BV" - | "BW" - | "BY" - | "BZ" - | "CA" - | "CC" - | "CD" - | "CF" - | "CG" - | "CH" - | "CI" - | "CK" - | "CL" - | "CM" - | "CN" - | "CO" - | "CR" - | "CU" - | "CV" - | "CW" - | "CX" - | "CY" - | "CZ" - | "DE" - | "DJ" - | "DK" - | "DM" - | "DO" - | "DZ" - | "EC" - | "EE" - | "EG" - | "EH" - | "ER" - | "ES" - | "ET" - | "FI" - | "FJ" - | "FK" - | "FM" - | "FO" - | "FR" - | "GA" - | "GB" - | "GD" - | "GE" - | "GF" - | "GG" - | "GH" - | "GI" - | "GL" - | "GM" - | "GN" - | "GP" - | "GQ" - | "GR" - | "GS" - | "GT" - | "GU" - | "GW" - | "GY" - | "HK" - | "HM" - | "HN" - | "HR" - | "HT" - | "HU" - | "ID" - | "IE" - | "IL" - | "IM" - | "IN" - | "IO" - | "IQ" - | "IR" - | "IS" - | "IT" - | "JE" - | "JM" - | "JO" - | "JP" - | "KE" - | "KG" - | "KH" - | "KI" - | "KM" - | "KN" - | "KP" - | "KR" - | "KW" - | "KY" - | "KZ" - | "LA" - | "LB" - | "LC" - | "LI" - | "LK" - | "LR" - | "LS" - | "LT" - | "LU" - | "LV" - | "LY" - | "MA" - | "MC" - | "MD" - | "ME" - | "MF" - | "MG" - | "MH" - | "MK" - | "ML" - | "MM" - | "MN" - | "MO" - | "MP" - | "MQ" - | "MR" - | "MS" - | "MT" - | "MU" - | "MV" - | "MW" - | "MX" - | "MY" - | "MZ" - | "NA" - | "NC" - | "NE" - | "NF" - | "NG" - | "NI" - | "NL" - | "NO" - | "NP" - | "NR" - | "NU" - | "NZ" - | "OM" - | "PA" - | "PE" - | "PF" - | "PG" - | "PH" - | "PK" - | "PL" - | "PM" - | "PN" - | "PR" - | "PS" - | "PT" - | "PW" - | "PY" - | "QA" - | "RE" - | "RO" - | "RS" - | "RU" - | "RW" - | "SA" - | "SB" - | "SC" - | "SD" - | "SE" - | "SG" - | "SH" - | "SI" - | "SJ" - | "SK" - | "SL" - | "SM" - | "SN" - | "SO" - | "SR" - | "SS" - | "ST" - | "SV" - | "SX" - | "SY" - | "SZ" - | "TC" - | "TD" - | "TF" - | "TG" - | "TH" - | "TJ" - | "TK" - | "TL" - | "TM" - | "TN" - | "TO" - | "TR" - | "TT" - | "TV" - | "TW" - | "TZ" - | "UA" - | "UG" - | "UM" - | "US" - | "UY" - | "UZ" - | "VA" - | "VC" - | "VE" - | "VG" - | "VI" - | "VN" - | "VU" - | "WF" - | "WS" - | "YE" - | "YT" - | "ZA" - | "ZM" - | "ZW"; -/** The 2-letter continent codes Cloudflare uses */ -export type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA"; -export type CfProperties = - | IncomingRequestCfProperties - | RequestInitCfProperties; -export interface D1Result { - results?: T[]; - success: boolean; - error?: string; - meta: any; -} -export declare abstract class D1Database { - prepare(query: string): D1PreparedStatement; - dump(): Promise; - batch(statements: D1PreparedStatement[]): Promise[]>; - exec(query: string): Promise>; -} -export declare abstract class D1PreparedStatement { - bind(...values: any[]): D1PreparedStatement; - first(colName?: string): Promise; - run(): Promise>; - all(): Promise>; - raw(): Promise; -} -/** - * A email message that is sent to a consumer Worker. - */ -export interface EmailMessage { - /** - * Envelope From attribute of the email message. - */ - readonly from: string; - /** - * Envelope To attribute of the email message. - */ - readonly to: string; - /** - * A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers). - */ - readonly headers: Headers; - /** - * Stream of the email message content. - */ - readonly raw: ReadableStream; - /** - * Size of the email message content. - */ - readonly rawSize: number; - /** - * Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason. - * @param reason The reject reason. - * @returns void - */ - setReject(reason: string): void; - /** - * Forward this email message to a verified destination address of the account. - * @param rcptTo Verified destination address. - * @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers). - * @returns A promise that resolves when the email message is forwarded. - */ - forward(rcptTo: string, headers?: Headers): Promise; -} -export declare abstract class EmailEvent extends ExtendableEvent { - readonly message: EmailMessage; -} -export type EmailExportedHandler = ( - message: EmailMessage, - env: Env, - ctx: ExecutionContext -) => void | Promise; -export type Params

= Record; -export type EventContext = { - request: Request; - functionPath: string; - waitUntil: (promise: Promise) => void; - passThroughOnException: () => void; - next: (input?: Request | string, init?: RequestInit) => Promise; - env: Env & { - ASSETS: { - fetch: typeof fetch; - }; - }; - params: Params

; - data: Data; -}; -export type PagesFunction< - Env = unknown, - Params extends string = any, - Data extends Record = Record -> = (context: EventContext) => Response | Promise; -export type EventPluginContext = { - request: Request; - functionPath: string; - waitUntil: (promise: Promise) => void; - passThroughOnException: () => void; - next: (input?: Request | string, init?: RequestInit) => Promise; - env: Env & { - ASSETS: { - fetch: typeof fetch; - }; - }; - params: Params

; - data: Data; - pluginArgs: PluginArgs; -}; -export type PagesPluginFunction< - Env = unknown, - Params extends string = any, - Data extends Record = Record, - PluginArgs = unknown -> = ( - context: EventPluginContext -) => Response | Promise; -// https://developers.cloudflare.com/pub-sub/ -// PubSubMessage represents an incoming PubSub message. -// The message includes metadata about the broker, the client, and the payload -// itself. -export interface PubSubMessage { - // Message ID - readonly mid: number; - // MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT - readonly broker: string; - // The MQTT topic the message was sent on. - readonly topic: string; - // The client ID of the client that published this message. - readonly clientId: string; - // The unique identifier (JWT ID) used by the client to authenticate, if token - // auth was used. - readonly jti?: string; - // A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker - // received the message from the client. - readonly receivedAt: number; - // An (optional) string with the MIME type of the payload, if set by the - // client. - readonly contentType: string; - // Set to 1 when the payload is a UTF-8 string - // https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063 - readonly payloadFormatIndicator: number; - // Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays. - // You can use payloadFormatIndicator to inspect this before decoding. - payload: string | Uint8Array; -} -// JsonWebKey extended by kid parameter -export interface JsonWebKeyWithKid extends JsonWebKey { - // Key Identifier of the JWK - readonly kid: string; -} -/** - * A message that is sent to a consumer Worker. - */ -export interface Message { - /** - * A unique, system-generated ID for the message. - */ - readonly id: string; - /** - * A timestamp when the message was sent. - */ - readonly timestamp: Date; - /** - * The body of the message. - */ - readonly body: Body; - /** - * Marks message to be retried. - */ - retry(): void; - /** - * Marks message acknowledged. - */ - ack(): void; -} -/** - * A batch of messages that are sent to a consumer Worker. - */ -export interface MessageBatch { - /** - * The name of the Queue that belongs to this batch. - */ - readonly queue: string; - /** - * An array of messages in the batch. Ordering of messages is not guaranteed. - */ - readonly messages: readonly Message[]; - /** - * Marks every message to be retried in the next batch. - */ - retryAll(): void; - /** - * Marks every message acknowledged in the batch. - */ - ackAll(): void; -} -/** - * A wrapper class used to structure message batches. - */ -export type MessageSendRequest = { - /** - * The body of the message. - */ - body: Body; -}; -/** - * A binding that allows a producer to send messages to a Queue. - */ -export interface Queue { - /** - * Sends a message to the Queue. - * @param message The message can be any type supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types), as long as its size is less than 128 KB. - * @returns A promise that resolves when the message is confirmed to be written to disk. - */ - send(message: Body): Promise; - /** - * Sends a batch of messages to the Queue. - * @param messages Each item in the input must be supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types). A batch can contain up to 100 messages, though items are limited to 128 KB each, and the total size of the array cannot exceed 256 KB. - * @returns A promise that resolves when the messages are confirmed to be written to disk. - */ - sendBatch(messages: Iterable>): Promise; -} diff --git a/packages/denylist_bot/node_modules/@cloudflare/workers-types/README.md b/packages/denylist_bot/node_modules/@cloudflare/workers-types/README.md deleted file mode 100644 index 903f313b5..000000000 --- a/packages/denylist_bot/node_modules/@cloudflare/workers-types/README.md +++ /dev/null @@ -1,123 +0,0 @@ -# Cloudflare Workers Types - -> :warning: If you're upgrading from version 2, make sure to remove `webworker` from the `lib` array in your -> `tsconfig.json`. These types are now included in `@cloudflare/workers-types`. - -## Install - -```bash -npm install -D @cloudflare/workers-types --- Or -yarn add -D @cloudflare/workers-types -``` - -## Usage - -The following is a minimal `tsconfig.json` for use alongside this package: - -**`tsconfig.json`** - -```json -{ - "compilerOptions": { - "target": "esnext", - "module": "esnext", - "lib": ["esnext"], - "types": ["@cloudflare/workers-types"] - } -} -``` - -### Compatibility dates - -![Entrypoints for compatibility dates](./entrypoints.svg) - -The Cloudflare Workers runtime manages backwards compatibility through the use of [Compatibility Dates](https://developers.cloudflare.com/workers/platform/compatibility-dates/). Using different compatibility dates affects the runtime types available to your Worker, and so it's important you specify the correct entrypoint to the `workers-types` package to match your compatibility date (which is usually set in your `wrangler.toml` configuration file). `workers-types` currently exposes the following entrypoints to choose from: - -- `@cloudflare/workers-types` - - The default entrypoint exposes the runtime types for a compatibility date before `2021-11-03`. - -- `@cloudflare/workers-types/2021-11-03` - - This entrypoint exposes the runtime types for a compatibility date between `2021-11-03` and `2022-01-31`. - -- `@cloudflare/workers-types/2022-01-31` - - This entrypoint exposes the runtime types for a compatibility date between `2022-01-31` and `2022-03-21`. - -- `@cloudflare/workers-types/2022-03-21` - - This entrypoint exposes the runtime types for a compatibility date between `2022-03-21` and `2022-08-04`. - -- `@cloudflare/workers-types/2022-08-04` - - This entrypoint exposes the runtime types for a compatibility date between `2022-08-04` and `2022-10-31`. - -- `@cloudflare/workers-types/2022-10-31` - - This entrypoint exposes the runtime types for a compatibility date between `2022-10-31` and `2022-11-30`. - -- `@cloudflare/workers-types/2022-11-30` - - This entrypoint exposes the runtime types for a compatibility date after `2022-11-30`. - -- `@cloudflare/workers-types/experimental` - - This entrypoint exposes the runtime types for the latest compatibility date. The types exposed by this entrypoint will change over time to always reflect the latest version of the Workers runtime. - -To use one of these entrypoints, you need to specify them in your `tsconfig.json`. For example, this is a sample `tsconfig.json` for using the `2022-08-04` entrypoint. - -```json -{ - "compilerOptions": { - "target": "esnext", - "module": "esnext", - "lib": ["esnext"], - "types": ["@cloudflare/workers-types/2022-08-04"] - } -} -``` - -### Importable Types - -It's not always possible (or desirable) to modify the `tsconfig.json` settings for a project to include all the Cloudflare Workers types. For use cases like that, this package provides importable versions of it's types, which are usable with no additional `tsconfig.json` setup. For example: - -```ts -import type { Request as WorkerRequest, ExecutionContext } from "@cloudflare/workers-types/experimental" - -export default { - fetch(request: WorkerRequest, env: unknown, ctx: ExecutionContext) { - return new Response("OK") - } -} -``` - - -### Using bindings - -It's recommended that you create a type file for any bindings your Worker uses. Create a file named -`worker-configuration.d.ts` in your src directory. - -If you're using Module Workers, it should look like this: -```typescript -// worker-configuration.d.ts -interface Env { - MY_ENV_VAR: string; - MY_SECRET: string; - myKVNamespace: KVNamespace; -} -``` -For Service Workers, it should augment the global scope: -```typescript -// worker-configuration.d.ts -declare global { - const MY_ENV_VAR: string; - const MY_SECRET: string; - const myKVNamespace: KVNamespace; -} -export {} -``` - -Wrangler can also generate this for you automatically from your `wrangler.toml` configuration file, using the `wrangler types` command. - diff --git a/packages/denylist_bot/node_modules/@cloudflare/workers-types/entrypoints.svg b/packages/denylist_bot/node_modules/@cloudflare/workers-types/entrypoints.svg deleted file mode 100644 index 057a15244..000000000 --- a/packages/denylist_bot/node_modules/@cloudflare/workers-types/entrypoints.svg +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - @cloudflare/workers-types - - - - @cloudflare/workers-types/2021-11-03 - - - - @cloudflare/workers-types/2022-01-31 - - - - @cloudflare/workers-types/2022-03-21 - - - - @cloudflare/workers-types/2022-08-04 - - - - @cloudflare/workers-types/2022-10-31 - - - - @cloudflare/workers-types/2022-11-30 - - - - @cloudflare/workers-types/experimental - - - - - - - - - - - types Entrypoint - compatibility_date - 2021-11-03 - 2022-01-31 - 2022-03-21 - 2022-08-04 - 2022-10-31 - 2022-11-30 - diff --git a/packages/denylist_bot/node_modules/@cloudflare/workers-types/experimental/index.d.ts b/packages/denylist_bot/node_modules/@cloudflare/workers-types/experimental/index.d.ts deleted file mode 100755 index d0ad2ad77..000000000 --- a/packages/denylist_bot/node_modules/@cloudflare/workers-types/experimental/index.d.ts +++ /dev/null @@ -1,2984 +0,0 @@ -/*! ***************************************************************************** -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 class DOMException extends Error { - constructor(message?: string, name?: string); - readonly message: string; - readonly name: string; - readonly code: number; - readonly stack: any; - 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; -} -declare type WorkerGlobalScopeEventMap = { - fetch: FetchEvent; - scheduled: ScheduledEvent; - unhandledrejection: PromiseRejectionEvent; - rejectionhandled: PromiseRejectionEvent; -}; -declare abstract class WorkerGlobalScope extends EventTarget { - EventTarget: typeof EventTarget; -} -declare interface Console { - "assert"(condition?: boolean, ...data: any[]): void; - clear(): void; - count(label?: string): void; - countReset(label?: string): void; - debug(...data: any[]): void; - dir(item?: any, options?: any): void; - dirxml(...data: any[]): void; - error(...data: any[]): void; - group(...data: any[]): void; - groupCollapsed(...data: any[]): void; - groupEnd(): void; - info(...data: any[]): void; - log(...data: any[]): void; - table(tabularData?: any, properties?: string[]): void; - time(label?: string): void; - timeEnd(label?: string): void; - timeLog(label?: string, ...data: any[]): void; - timeStamp(label?: string): void; - trace(...data: any[]): void; - warn(...data: any[]): void; -} -declare const console: Console; -declare type BufferSource = ArrayBufferView | ArrayBuffer; -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; - type Imports = Record; - type ExportValue = Function | Global | Memory | Table; - type Exports = Record; - 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; - function validate(bytes: BufferSource): boolean; -} -/** This ServiceWorker API interface represents the global execution context of a service worker. */ -declare 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( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args - ): number; - clearTimeout(timeoutId: number | null): void; - setInterval(callback: (...args: any[]) => void, msDelay?: number): number; - setInterval( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args - ): number; - clearInterval(timeoutId: number | null): void; - queueMicrotask(task: Function): void; - structuredClone(value: T, options?: StructuredSerializeOptions): T; - fetch( - input: RequestInfo, - init?: RequestInit - ): Promise; - self: ServiceWorkerGlobalScope; - crypto: Crypto; - caches: CacheStorage; - scheduler: Scheduler; - Event: typeof Event; - ExtendableEvent: typeof ExtendableEvent; - PromiseRejectionEvent: typeof PromiseRejectionEvent; - FetchEvent: typeof FetchEvent; - TraceEvent: typeof TraceEvent; - 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; - ReadableStreamBYOBRequest: typeof ReadableStreamBYOBRequest; - ReadableStreamDefaultController: typeof ReadableStreamDefaultController; - ReadableByteStreamController: typeof ReadableByteStreamController; - WritableStreamDefaultController: typeof WritableStreamDefaultController; - 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; - 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: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetAddEventListenerOptions | boolean -): void; -declare function removeEventListener< - Type extends keyof WorkerGlobalScopeEventMap ->( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetEventListenerOptions | boolean -): void; -/** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */ -declare function dispatchEvent( - event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap] -): boolean; -declare function btoa(data: string): string; -declare function atob(data: string): string; -declare function setTimeout( - callback: (...args: any[]) => void, - msDelay?: number -): number; -declare function setTimeout( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args -): number; -declare function clearTimeout(timeoutId: number | null): void; -declare function setInterval( - callback: (...args: any[]) => void, - msDelay?: number -): number; -declare function setInterval( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args -): number; -declare function clearInterval(timeoutId: number | null): void; -declare function queueMicrotask(task: Function): void; -declare function structuredClone( - value: T, - options?: StructuredSerializeOptions -): T; -declare function fetch( - input: RequestInfo, - init?: RequestInit -): Promise; -declare const self: ServiceWorkerGlobalScope; -declare const crypto: Crypto; -declare const caches: CacheStorage; -declare const scheduler: Scheduler; -declare const navigator: Navigator; -declare interface TestController {} -declare interface ExecutionContext { - waitUntil(promise: Promise): void; - passThroughOnException(): void; -} -declare type ExportedHandlerFetchHandler< - Env = unknown, - CfHostMetadata = unknown -> = ( - request: Request>, - env: Env, - ctx: ExecutionContext -) => Response | Promise; -declare type ExportedHandlerTraceHandler = ( - traces: TraceItem[], - env: Env, - ctx: ExecutionContext -) => void | Promise; -declare type ExportedHandlerScheduledHandler = ( - controller: ScheduledController, - env: Env, - ctx: ExecutionContext -) => void | Promise; -declare type ExportedHandlerQueueHandler = ( - batch: MessageBatch, - env: Env, - ctx: ExecutionContext -) => void | Promise; -declare type ExportedHandlerTestHandler = ( - controller: TestController, - env: Env, - ctx: ExecutionContext -) => void | Promise; -declare interface ExportedHandler< - Env = unknown, - QueueMessage = unknown, - CfHostMetadata = unknown -> { - fetch?: ExportedHandlerFetchHandler; - trace?: ExportedHandlerTraceHandler; - scheduled?: ExportedHandlerScheduledHandler; - test?: ExportedHandlerTestHandler; - queue?: ExportedHandlerQueueHandler; -} -declare interface StructuredSerializeOptions { - transfer?: any[]; -} -declare abstract class PromiseRejectionEvent extends Event { - readonly promise: Promise; - readonly reason: any; -} -declare abstract class Navigator { - readonly userAgent: string; -} -declare interface DurableObject { - fetch(request: Request): Response | Promise; - alarm?(): void | Promise; -} -declare interface DurableObjectStub extends Fetcher { - readonly id: DurableObjectId; - readonly name?: string; -} -declare interface DurableObjectId { - toString(): string; - equals(other: DurableObjectId): boolean; - readonly name?: string; -} -declare interface DurableObjectNamespace { - newUniqueId( - options?: DurableObjectNamespaceNewUniqueIdOptions - ): DurableObjectId; - idFromName(name: string): DurableObjectId; - idFromString(id: string): DurableObjectId; - get( - id: DurableObjectId, - options?: DurableObjectNamespaceGetDurableObjectOptions - ): DurableObjectStub; - jurisdiction(jurisdiction: string): DurableObjectNamespace; -} -declare interface DurableObjectNamespaceNewUniqueIdOptions { - jurisdiction?: string; -} -declare interface DurableObjectNamespaceGetDurableObjectOptions { - locationHint?: string; -} -declare interface DurableObjectState { - waitUntil(promise: Promise): void; - readonly id: DurableObjectId; - readonly storage: DurableObjectStorage; - blockConcurrencyWhile(callback: () => Promise): Promise; -} -declare interface DurableObjectTransaction { - get( - key: string, - options?: DurableObjectGetOptions - ): Promise; - get( - keys: string[], - options?: DurableObjectGetOptions - ): Promise>; - list( - options?: DurableObjectListOptions - ): Promise>; - put( - key: string, - value: T, - options?: DurableObjectPutOptions - ): Promise; - put( - entries: Record, - options?: DurableObjectPutOptions - ): Promise; - delete(key: string, options?: DurableObjectPutOptions): Promise; - delete(keys: string[], options?: DurableObjectPutOptions): Promise; - rollback(): void; - getAlarm(options?: DurableObjectGetAlarmOptions): Promise; - setAlarm( - scheduledTime: number | Date, - options?: DurableObjectSetAlarmOptions - ): Promise; - deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise; -} -declare interface DurableObjectStorage { - get( - key: string, - options?: DurableObjectGetOptions - ): Promise; - get( - keys: string[], - options?: DurableObjectGetOptions - ): Promise>; - list( - options?: DurableObjectListOptions - ): Promise>; - put( - key: string, - value: T, - options?: DurableObjectPutOptions - ): Promise; - put( - entries: Record, - options?: DurableObjectPutOptions - ): Promise; - delete(key: string, options?: DurableObjectPutOptions): Promise; - delete(keys: string[], options?: DurableObjectPutOptions): Promise; - deleteAll(options?: DurableObjectPutOptions): Promise; - transaction( - closure: (txn: DurableObjectTransaction) => Promise - ): Promise; - getAlarm(options?: DurableObjectGetAlarmOptions): Promise; - setAlarm( - scheduledTime: number | Date, - options?: DurableObjectSetAlarmOptions - ): Promise; - deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise; - sync(): Promise; -} -declare interface DurableObjectListOptions { - start?: string; - startAfter?: string; - end?: string; - prefix?: string; - reverse?: boolean; - limit?: number; - allowConcurrency?: boolean; - noCache?: boolean; -} -declare interface DurableObjectGetOptions { - allowConcurrency?: boolean; - noCache?: boolean; -} -declare interface DurableObjectGetAlarmOptions { - allowConcurrency?: boolean; -} -declare interface DurableObjectPutOptions { - allowConcurrency?: boolean; - allowUnconfirmed?: boolean; - noCache?: boolean; -} -declare interface DurableObjectSetAlarmOptions { - allowConcurrency?: boolean; - allowUnconfirmed?: boolean; -} -declare interface AnalyticsEngineDataset { - writeDataPoint(event?: AnalyticsEngineDataPoint): void; -} -declare interface AnalyticsEngineDataPoint { - indexes?: ((ArrayBuffer | string) | null)[]; - doubles?: number[]; - blobs?: ((ArrayBuffer | string) | null)[]; -} -declare class Event { - constructor(type: string, init?: EventInit); - get type(): string; - get eventPhase(): number; - get composed(): boolean; - get bubbles(): boolean; - get cancelable(): boolean; - get defaultPrevented(): boolean; - get returnValue(): boolean; - get currentTarget(): EventTarget | undefined; - get srcElement(): EventTarget | undefined; - get timeStamp(): number; - get isTrusted(): boolean; - get cancelBubble(): boolean; - set cancelBubble(value: boolean); - stopImmediatePropagation(): void; - preventDefault(): void; - stopPropagation(): void; - composedPath(): EventTarget[]; - static readonly NONE: number; - static readonly CAPTURING_PHASE: number; - static readonly AT_TARGET: number; - static readonly BUBBLING_PHASE: number; -} -declare interface EventInit { - bubbles?: boolean; - cancelable?: boolean; - composed?: boolean; -} -declare type EventListener = ( - event: EventType -) => void; -declare interface EventListenerObject { - handleEvent(event: EventType): void; -} -declare type EventListenerOrEventListenerObject< - EventType extends Event = Event -> = EventListener | EventListenerObject; -declare class EventTarget< - EventMap extends Record = Record -> { - constructor(); - addEventListener( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetAddEventListenerOptions | boolean - ): void; - removeEventListener( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetEventListenerOptions | boolean - ): void; - dispatchEvent(event: EventMap[keyof EventMap]): boolean; -} -declare interface EventTargetEventListenerOptions { - capture?: boolean; -} -declare interface EventTargetAddEventListenerOptions { - capture?: boolean; - passive?: boolean; - once?: boolean; - signal?: AbortSignal; -} -declare interface EventTargetHandlerObject { - handleEvent: (event: Event) => any | undefined; -} -declare class AbortController { - constructor(); - get signal(): AbortSignal; - abort(reason?: any): void; -} -declare abstract class AbortSignal extends EventTarget { - static abort(reason?: any): AbortSignal; - static timeout(delay: number): AbortSignal; - get aborted(): boolean; - get reason(): any; - throwIfAborted(): void; -} -declare interface Scheduler { - wait(delay: number, maybeOptions?: SchedulerWaitOptions): Promise; -} -declare interface SchedulerWaitOptions { - signal?: AbortSignal; -} -declare abstract class ExtendableEvent extends Event { - waitUntil(promise: Promise): void; -} -declare class Blob { - constructor( - bits?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[], - options?: BlobOptions - ); - get size(): number; - get type(): string; - slice(start?: number, end?: number, type?: string): Blob; - arrayBuffer(): Promise; - text(): Promise; - stream(): ReadableStream; -} -declare interface BlobOptions { - type?: string; -} -declare class File extends Blob { - constructor( - bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined, - name: string, - options?: FileOptions - ); - get name(): string; - get lastModified(): number; -} -declare interface FileOptions { - type?: string; - lastModified?: number; -} -declare abstract class CacheStorage { - open(cacheName: string): Promise; - readonly default: Cache; -} -declare abstract class Cache { - delete(request: RequestInfo, options?: CacheQueryOptions): Promise; - match( - request: RequestInfo, - options?: CacheQueryOptions - ): Promise; - put(request: RequestInfo, response: Response): Promise; -} -declare interface CacheQueryOptions { - ignoreMethod?: boolean; -} -declare abstract class Crypto { - get subtle(): SubtleCrypto; - getRandomValues< - T extends - | Int8Array - | Uint8Array - | Int16Array - | Uint16Array - | Int32Array - | Uint32Array - | BigInt64Array - | BigUint64Array - >(buffer: T): T; - randomUUID(): string; - DigestStream: typeof DigestStream; -} -declare abstract class SubtleCrypto { - encrypt( - algorithm: string | SubtleCryptoEncryptAlgorithm, - key: CryptoKey, - plainText: ArrayBuffer | ArrayBufferView - ): Promise; - decrypt( - algorithm: string | SubtleCryptoEncryptAlgorithm, - key: CryptoKey, - cipherText: ArrayBuffer | ArrayBufferView - ): Promise; - sign( - algorithm: string | SubtleCryptoSignAlgorithm, - key: CryptoKey, - data: ArrayBuffer | ArrayBufferView - ): Promise; - verify( - algorithm: string | SubtleCryptoSignAlgorithm, - key: CryptoKey, - signature: ArrayBuffer | ArrayBufferView, - data: ArrayBuffer | ArrayBufferView - ): Promise; - digest( - algorithm: string | SubtleCryptoHashAlgorithm, - data: ArrayBuffer | ArrayBufferView - ): Promise; - generateKey( - algorithm: string | SubtleCryptoGenerateKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - deriveKey( - algorithm: string | SubtleCryptoDeriveKeyAlgorithm, - baseKey: CryptoKey, - derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - deriveBits( - algorithm: string | SubtleCryptoDeriveKeyAlgorithm, - baseKey: CryptoKey, - length: number | null - ): Promise; - importKey( - format: string, - keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey, - algorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - exportKey(format: string, key: CryptoKey): Promise; - wrapKey( - format: string, - key: CryptoKey, - wrappingKey: CryptoKey, - wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm - ): Promise; - unwrapKey( - format: string, - wrappedKey: ArrayBuffer | ArrayBufferView, - unwrappingKey: CryptoKey, - unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm, - unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - timingSafeEqual( - a: ArrayBuffer | ArrayBufferView, - b: ArrayBuffer | ArrayBufferView - ): boolean; -} -declare abstract class CryptoKey { - readonly type: string; - readonly extractable: boolean; - readonly algorithm: - | CryptoKeyKeyAlgorithm - | CryptoKeyAesKeyAlgorithm - | CryptoKeyHmacKeyAlgorithm - | CryptoKeyRsaKeyAlgorithm - | CryptoKeyEllipticKeyAlgorithm - | CryptoKeyArbitraryKeyAlgorithm; - readonly usages: string[]; -} -declare interface CryptoKeyPair { - publicKey: CryptoKey; - privateKey: CryptoKey; -} -declare 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; -} -declare interface RsaOtherPrimesInfo { - r?: string; - d?: string; - t?: string; -} -declare interface SubtleCryptoDeriveKeyAlgorithm { - name: string; - salt?: ArrayBuffer; - iterations?: number; - hash?: string | SubtleCryptoHashAlgorithm; - $public?: CryptoKey; - info?: ArrayBuffer; -} -declare interface SubtleCryptoEncryptAlgorithm { - name: string; - iv?: ArrayBuffer; - additionalData?: ArrayBuffer; - tagLength?: number; - counter?: ArrayBuffer; - length?: number; - label?: ArrayBuffer; -} -declare interface SubtleCryptoGenerateKeyAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - modulusLength?: number; - publicExponent?: ArrayBuffer; - length?: number; - namedCurve?: string; -} -declare interface SubtleCryptoHashAlgorithm { - name: string; -} -declare interface SubtleCryptoImportKeyAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - length?: number; - namedCurve?: string; - compressed?: boolean; -} -declare interface SubtleCryptoSignAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - dataLength?: number; - saltLength?: number; -} -declare interface CryptoKeyKeyAlgorithm { - name: string; -} -declare interface CryptoKeyAesKeyAlgorithm { - name: string; - length: number; -} -declare interface CryptoKeyHmacKeyAlgorithm { - name: string; - hash: CryptoKeyKeyAlgorithm; - length: number; -} -declare interface CryptoKeyRsaKeyAlgorithm { - name: string; - modulusLength: number; - publicExponent: ArrayBuffer; - hash?: CryptoKeyKeyAlgorithm; -} -declare interface CryptoKeyEllipticKeyAlgorithm { - name: string; - namedCurve: string; -} -declare interface CryptoKeyArbitraryKeyAlgorithm { - name: string; - hash?: CryptoKeyKeyAlgorithm; - namedCurve?: string; - length?: number; -} -declare class DigestStream extends WritableStream< - ArrayBuffer | ArrayBufferView -> { - constructor(algorithm: string | SubtleCryptoHashAlgorithm); - get digest(): Promise; -} -declare class TextDecoder { - constructor(decoder?: string, options?: TextDecoderConstructorOptions); - decode( - input?: ArrayBuffer | ArrayBufferView, - options?: TextDecoderDecodeOptions - ): string; - get encoding(): string; - get fatal(): boolean; - get ignoreBOM(): boolean; -} -declare class TextEncoder { - constructor(); - encode(input?: string): Uint8Array; - encodeInto(input: string, buffer: Uint8Array): TextEncoderEncodeIntoResult; - get encoding(): string; -} -declare interface TextDecoderConstructorOptions { - fatal: boolean; - ignoreBOM: boolean; -} -declare interface TextDecoderDecodeOptions { - stream: boolean; -} -declare interface TextEncoderEncodeIntoResult { - read: number; - written: number; -} -declare class FormData { - constructor(); - append(name: string, value: string): void; - append(name: string, value: Blob, filename?: string): void; - delete(name: string): void; - get(name: string): (File | string) | null; - getAll(name: string): (File | string)[]; - has(name: string): boolean; - set(name: string, value: string): void; - set(name: string, value: Blob, filename?: string): void; - entries(): IterableIterator<[key: string, value: File | string]>; - keys(): IterableIterator; - values(): IterableIterator; - forEach( - callback: ( - this: This, - value: File | string, - key: string, - parent: FormData - ) => void, - thisArg?: This - ): void; - [Symbol.iterator](): IterableIterator<[key: string, value: File | string]>; -} -declare interface ContentOptions { - html?: boolean; -} -declare class HTMLRewriter { - constructor(); - on( - selector: string, - handlers: HTMLRewriterElementContentHandlers - ): HTMLRewriter; - onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter; - transform(response: Response): Response; -} -declare interface HTMLRewriterElementContentHandlers { - element?(element: Element): void | Promise; - comments?(comment: Comment): void | Promise; - text?(element: Text): void | Promise; -} -declare interface HTMLRewriterDocumentContentHandlers { - doctype?(doctype: Doctype): void | Promise; - comments?(comment: Comment): void | Promise; - text?(text: Text): void | Promise; - end?(end: DocumentEnd): void | Promise; -} -declare interface Doctype { - readonly name: string | null; - readonly publicId: string | null; - readonly systemId: string | null; -} -declare interface Element { - tagName: string; - readonly attributes: IterableIterator; - 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, options?: ContentOptions): Element; - after(content: string, options?: ContentOptions): Element; - prepend(content: string, options?: ContentOptions): Element; - append(content: string, options?: ContentOptions): Element; - replace(content: string, options?: ContentOptions): Element; - remove(): Element; - removeAndKeepContent(): Element; - setInnerContent(content: string, options?: ContentOptions): Element; - onEndTag(handler: (tag: EndTag) => void | Promise): void; -} -declare interface EndTag { - name: string; - before(content: string, options?: ContentOptions): EndTag; - after(content: string, options?: ContentOptions): EndTag; - remove(): EndTag; -} -declare 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; -} -declare interface Text { - readonly text: string; - readonly lastInTextNode: boolean; - readonly removed: boolean; - before(content: string, options?: ContentOptions): Text; - after(content: string, options?: ContentOptions): Text; - replace(content: string, options?: ContentOptions): Text; - remove(): Text; -} -declare interface DocumentEnd { - append(content: string, options?: ContentOptions): DocumentEnd; -} -declare abstract class FetchEvent extends ExtendableEvent { - readonly request: Request; - respondWith(promise: Response | Promise): void; - passThroughOnException(): void; -} -declare type HeadersInit = - | Headers - | Iterable> - | Record; -declare class Headers { - constructor(init?: HeadersInit); - get(name: string): string | null; - getAll(name: string): string[]; - getSetCookie(): string[]; - has(name: string): boolean; - set(name: string, value: string): void; - append(name: string, value: string): void; - delete(name: string): void; - forEach( - callback: (this: This, value: string, key: string, parent: Headers) => void, - thisArg?: This - ): void; - entries(): IterableIterator<[key: string, value: string]>; - keys(): IterableIterator; - values(): IterableIterator; - [Symbol.iterator](): IterableIterator<[key: string, value: string]>; -} -declare type BodyInit = - | ReadableStream - | string - | ArrayBuffer - | ArrayBufferView - | Blob - | URLSearchParams - | FormData; -declare abstract class Body { - get body(): ReadableStream | null; - get bodyUsed(): boolean; - arrayBuffer(): Promise; - text(): Promise; - json(): Promise; - formData(): Promise; - blob(): Promise; -} -declare class Response extends Body { - constructor(body?: BodyInit | null, init?: ResponseInit); - static redirect(url: string, status?: number): Response; - static json(any: any, maybeInit?: ResponseInit | Response): Response; - clone(): Response; - get status(): number; - get statusText(): string; - get headers(): Headers; - get ok(): boolean; - get redirected(): boolean; - get url(): string; - get webSocket(): WebSocket | null; - get cf(): any | undefined; -} -declare interface ResponseInit { - status?: number; - statusText?: string; - headers?: HeadersInit; - cf?: any; - webSocket?: WebSocket | null; - encodeBody?: "automatic" | "manual"; -} -declare type RequestInfo< - CfHostMetadata = unknown, - Cf = CfProperties -> = Request | string | URL; -declare class Request< - CfHostMetadata = unknown, - Cf = CfProperties -> extends Body { - constructor(input: RequestInfo, init?: RequestInit); - clone(): Request; - get method(): string; - get url(): string; - get headers(): Headers; - get redirect(): string; - get fetcher(): Fetcher | null; - get signal(): AbortSignal; - get cf(): Cf | undefined; - get integrity(): string; - get keepalive(): boolean; -} -declare interface RequestInit { - /** 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 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; -} -declare abstract class Fetcher { - fetch(input: RequestInfo, init?: RequestInit): Promise; -} -declare interface FetcherPutOptions { - expiration?: number; - expirationTtl?: number; -} -declare interface KVNamespaceListKey { - name: Key; - expiration?: number; - metadata?: Metadata; -} -declare type KVNamespaceListResult = - | { - list_complete: false; - keys: KVNamespaceListKey[]; - cursor: string; - } - | { - list_complete: true; - keys: KVNamespaceListKey[]; - }; -declare interface KVNamespace { - get( - key: Key, - options?: Partial> - ): Promise; - get(key: Key, type: "text"): Promise; - get( - key: Key, - type: "json" - ): Promise; - get(key: Key, type: "arrayBuffer"): Promise; - get(key: Key, type: "stream"): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"text"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"json"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"arrayBuffer"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"stream"> - ): Promise; - list( - options?: KVNamespaceListOptions - ): Promise>; - put( - key: Key, - value: string | ArrayBuffer | ArrayBufferView | ReadableStream, - options?: KVNamespacePutOptions - ): Promise; - getWithMetadata( - key: Key, - options?: Partial> - ): Promise>; - getWithMetadata( - key: Key, - type: "text" - ): Promise>; - getWithMetadata( - key: Key, - type: "json" - ): Promise>; - getWithMetadata( - key: Key, - type: "arrayBuffer" - ): Promise>; - getWithMetadata( - key: Key, - type: "stream" - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"text"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"json"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"arrayBuffer"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"stream"> - ): Promise>; - delete(key: Key): Promise; -} -declare interface KVNamespaceListOptions { - limit?: number; - prefix?: string | null; - cursor?: string | null; -} -declare interface KVNamespaceGetOptions { - type: Type; - cacheTtl?: number; -} -declare interface KVNamespacePutOptions { - expiration?: number; - expirationTtl?: number; - metadata?: any | null; -} -declare interface KVNamespaceGetWithMetadataResult { - value: Value | null; - metadata: Metadata | null; -} -declare interface R2Error extends Error { - readonly name: string; - readonly code: number; - readonly message: string; - readonly action: string; - readonly stack: any; -} -declare interface R2ListOptions { - limit?: number; - prefix?: string; - cursor?: string; - delimiter?: string; - startAfter?: string; - include?: ("httpMetadata" | "customMetadata")[]; -} -declare abstract class R2Bucket { - head(key: string): Promise; - get( - key: string, - options: R2GetOptions & { - onlyIf: R2Conditional | Headers; - } - ): Promise; - get(key: string, options?: R2GetOptions): Promise; - put( - key: string, - value: - | ReadableStream - | ArrayBuffer - | ArrayBufferView - | string - | null - | Blob, - options?: R2PutOptions - ): Promise; - put( - key: string, - value: - | ReadableStream - | ArrayBuffer - | ArrayBufferView - | string - | null - | Blob, - options?: R2PutOptions & { - onlyIf: R2Conditional | Headers; - } - ): Promise; - createMultipartUpload( - key: string, - options?: R2MultipartOptions - ): Promise; - resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload; - delete(keys: string | string[]): Promise; - list(options?: R2ListOptions): Promise; -} -declare interface R2MultipartUpload { - readonly key: string; - readonly uploadId: string; - uploadPart( - partNumber: number, - value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob - ): Promise; - abort(): Promise; - complete(uploadedParts: R2UploadedPart[]): Promise; -} -declare 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; - readonly range?: R2Range; - writeHttpMetadata(headers: Headers): void; -} -declare interface R2ObjectBody extends R2Object { - get body(): ReadableStream; - get bodyUsed(): boolean; - arrayBuffer(): Promise; - text(): Promise; - json(): Promise; - blob(): Promise; -} -declare type R2Range = - | { - offset: number; - length?: number; - } - | { - offset?: number; - length: number; - } - | { - suffix: number; - }; -declare interface R2Conditional { - etagMatches?: string; - etagDoesNotMatch?: string; - uploadedBefore?: Date; - uploadedAfter?: Date; - secondsGranularity?: boolean; -} -declare interface R2GetOptions { - onlyIf?: R2Conditional | Headers; - range?: R2Range | Headers; -} -declare interface R2PutOptions { - onlyIf?: R2Conditional | Headers; - httpMetadata?: R2HTTPMetadata | Headers; - customMetadata?: Record; - md5?: ArrayBuffer | string; - sha1?: ArrayBuffer | string; - sha256?: ArrayBuffer | string; - sha384?: ArrayBuffer | string; - sha512?: ArrayBuffer | string; -} -declare interface R2MultipartOptions { - httpMetadata?: R2HTTPMetadata | Headers; - customMetadata?: Record; -} -declare interface R2Checksums { - readonly md5?: ArrayBuffer; - readonly sha1?: ArrayBuffer; - readonly sha256?: ArrayBuffer; - readonly sha384?: ArrayBuffer; - readonly sha512?: ArrayBuffer; - toJSON(): R2StringChecksums; -} -declare interface R2StringChecksums { - md5?: string; - sha1?: string; - sha256?: string; - sha384?: string; - sha512?: string; -} -declare interface R2HTTPMetadata { - contentType?: string; - contentLanguage?: string; - contentDisposition?: string; - contentEncoding?: string; - cacheControl?: string; - cacheExpiry?: Date; -} -declare interface R2Objects { - objects: R2Object[]; - truncated: boolean; - cursor?: string; - delimitedPrefixes: string[]; -} -declare abstract class ScheduledEvent extends ExtendableEvent { - readonly scheduledTime: number; - readonly cron: string; - noRetry(): void; -} -declare interface ScheduledController { - readonly scheduledTime: number; - readonly cron: string; - noRetry(): void; -} -declare interface QueuingStrategy { - highWaterMark?: number | bigint; - size?: (chunk: T) => number | bigint; -} -declare interface UnderlyingSink { - type?: string; - start?: (controller: WritableStreamDefaultController) => void | Promise; - write?: ( - chunk: W, - controller: WritableStreamDefaultController - ) => void | Promise; - abort?: (reason: any) => void | Promise; - close?: () => void | Promise; -} -declare interface UnderlyingByteSource { - type: "bytes"; - autoAllocateChunkSize?: number; - start?: (controller: ReadableByteStreamController) => void | Promise; - pull?: (controller: ReadableByteStreamController) => void | Promise; - cancel?: (reason: any) => void | Promise; -} -declare interface UnderlyingSource { - type?: "" | undefined; - start?: ( - controller: ReadableStreamDefaultController - ) => void | Promise; - pull?: ( - controller: ReadableStreamDefaultController - ) => void | Promise; - cancel?: (reason: any) => void | Promise; -} -declare interface Transformer { - readableType?: string; - writableType?: string; - start?: ( - controller: TransformStreamDefaultController - ) => void | Promise; - transform?: ( - chunk: I, - controller: TransformStreamDefaultController - ) => void | Promise; - flush?: ( - controller: TransformStreamDefaultController - ) => void | Promise; -} -declare interface StreamPipeOptions { - /** - * 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; - preventAbort?: boolean; - preventCancel?: boolean; - signal?: AbortSignal; -} -declare type ReadableStreamReadResult = - | { - done: false; - value: R; - } - | { - done: true; - value?: undefined; - }; -/** This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object. */ -declare interface ReadableStream { - get locked(): boolean; - cancel(reason?: any): Promise; - getReader(): ReadableStreamDefaultReader; - getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader; - pipeThrough( - transform: ReadableWritablePair, - options?: StreamPipeOptions - ): ReadableStream; - pipeTo( - destination: WritableStream, - options?: StreamPipeOptions - ): Promise; - tee(): [ReadableStream, ReadableStream]; - values(options?: ReadableStreamValuesOptions): AsyncIterableIterator; - [Symbol.asyncIterator]( - options?: ReadableStreamValuesOptions - ): AsyncIterableIterator; -} -declare const ReadableStream: { - prototype: ReadableStream; - new ( - underlyingSource: UnderlyingByteSource, - strategy?: QueuingStrategy - ): ReadableStream; - new ( - underlyingSource?: UnderlyingSource, - strategy?: QueuingStrategy - ): ReadableStream; -}; -declare class ReadableStreamDefaultReader { - constructor(stream: ReadableStream); - get closed(): Promise; - cancel(reason?: any): Promise; - read(): Promise>; - releaseLock(): void; -} -declare class ReadableStreamBYOBReader { - constructor(stream: ReadableStream); - get closed(): Promise; - cancel(reason?: any): Promise; - read( - view: T - ): Promise>; - releaseLock(): void; - readAtLeast( - minElements: number, - view: T - ): Promise>; -} -declare interface ReadableStreamGetReaderOptions { - mode: "byob"; -} -declare abstract class ReadableStreamBYOBRequest { - readonly view: Uint8Array | null; - respond(bytesWritten: number): void; - respondWithNewView(view: ArrayBuffer | ArrayBufferView): void; - readonly atLeast: number | null; -} -declare abstract class ReadableStreamDefaultController { - readonly desiredSize: number | null; - close(): void; - enqueue(chunk?: R): void; - error(reason: any): void; -} -declare abstract class ReadableByteStreamController { - readonly byobRequest: ReadableStreamBYOBRequest | null; - readonly desiredSize: number | null; - close(): void; - enqueue(chunk: ArrayBuffer | ArrayBufferView): void; - error(reason: any): void; -} -declare abstract class WritableStreamDefaultController { - readonly signal: AbortSignal; - error(reason?: any): void; -} -declare interface TransformStreamDefaultController { - get desiredSize(): number | null; - enqueue(chunk?: O): void; - error(reason: any): void; - terminate(): void; -} -declare interface ReadableWritablePair { - /** - * 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; - readable: ReadableStream; -} -declare class WritableStream { - constructor( - underlyingSink?: UnderlyingSink, - queuingStrategy?: QueuingStrategy - ); - get locked(): boolean; - abort(reason?: any): Promise; - close(): Promise; - getWriter(): WritableStreamDefaultWriter; -} -declare class WritableStreamDefaultWriter { - constructor(stream: WritableStream); - get closed(): Promise; - get ready(): Promise; - get desiredSize(): number | null; - abort(reason?: any): Promise; - close(): Promise; - write(chunk?: W): Promise; - releaseLock(): void; -} -declare class TransformStream { - constructor( - transformer?: Transformer, - writableStrategy?: QueuingStrategy, - readableStrategy?: QueuingStrategy - ); - get readable(): ReadableStream; - get writable(): WritableStream; -} -declare class FixedLengthStream extends IdentityTransformStream { - constructor(expectedLength: number | bigint); -} -declare class IdentityTransformStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(); -} -declare interface ReadableStreamValuesOptions { - preventCancel?: boolean; -} -declare class CompressionStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(format: "gzip" | "deflate" | "deflate-raw"); -} -declare class DecompressionStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(format: "gzip" | "deflate" | "deflate-raw"); -} -declare class TextEncoderStream extends TransformStream { - constructor(); -} -declare class TextDecoderStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - string -> { - constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit); -} -declare interface TextDecoderStreamTextDecoderStreamInit { - fatal?: boolean; -} -declare class ByteLengthQueuingStrategy - implements QueuingStrategy -{ - constructor(init: QueuingStrategyInit); - get highWaterMark(): number; - get size(): (chunk?: any) => number; -} -declare class CountQueuingStrategy implements QueuingStrategy { - constructor(init: QueuingStrategyInit); - get highWaterMark(): number; - get size(): (chunk?: any) => number; -} -declare 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; -} -declare abstract class TraceEvent extends ExtendableEvent { - readonly traces: TraceItem[]; -} -declare interface TraceItem { - readonly event: - | ( - | TraceItemFetchEventInfo - | TraceItemScheduledEventInfo - | TraceItemAlarmEventInfo - | TraceItemQueueEventInfo - | TraceItemEmailEventInfo - | TraceItemCustomEventInfo - ) - | null; - readonly eventTimestamp: number | null; - readonly logs: TraceLog[]; - readonly exceptions: TraceException[]; - readonly scriptName: string | null; - readonly dispatchNamespace?: string; - readonly scriptTags?: string[]; - readonly outcome: string; -} -declare interface TraceItemAlarmEventInfo { - readonly scheduledTime: Date; -} -declare interface TraceItemCustomEventInfo {} -declare interface TraceItemScheduledEventInfo { - readonly scheduledTime: number; - readonly cron: string; -} -declare interface TraceItemQueueEventInfo { - readonly queue: string; - readonly batchSize: number; -} -declare interface TraceItemEmailEventInfo { - readonly mailFrom: string; - readonly rcptTo: string; - readonly rawSize: number; -} -declare interface TraceItemFetchEventInfo { - readonly response?: TraceItemFetchEventInfoResponse; - readonly request: TraceItemFetchEventInfoRequest; -} -declare interface TraceItemFetchEventInfoRequest { - readonly cf?: any; - readonly headers: Record; - readonly method: string; - readonly url: string; - getUnredacted(): TraceItemFetchEventInfoRequest; -} -declare interface TraceItemFetchEventInfoResponse { - readonly status: number; -} -declare interface TraceLog { - readonly timestamp: number; - readonly level: string; - readonly message: any; -} -declare interface TraceException { - readonly timestamp: number; - readonly message: string; - readonly name: string; -} -declare interface TraceMetrics { - readonly cpuTime: number; - readonly wallTime: number; -} -declare interface UnsafeTraceMetrics { - fromTrace(item: TraceItem): TraceMetrics; -} -declare class URL { - constructor(url: string | URL, base?: string | URL); - get origin(): string; - get href(): string; - set href(value: string); - get protocol(): string; - set protocol(value: string); - get username(): string; - set username(value: string); - get password(): string; - set password(value: string); - get host(): string; - set host(value: string); - get hostname(): string; - set hostname(value: string); - get port(): string; - set port(value: string); - get pathname(): string; - set pathname(value: string); - get search(): string; - set search(value: string); - get hash(): string; - set hash(value: string); - get searchParams(): URLSearchParams; - toJSON(): string; - toString(): string; - static canParse(url: string, base?: string): boolean; -} -declare class URLSearchParams { - constructor( - init?: Iterable> | Record | string - ); - get size(): number; - append(name: string, value: string): void; - delete(name: string): void; - get(name: string): string | null; - getAll(name: string): string[]; - has(name: string): boolean; - set(name: string, value: string): void; - sort(): void; - entries(): IterableIterator<[key: string, value: string]>; - keys(): IterableIterator; - values(): IterableIterator; - forEach( - callback: ( - this: This, - value: string, - key: string, - parent: URLSearchParams - ) => void, - thisArg?: This - ): void; - toString(): string; - [Symbol.iterator](): IterableIterator<[key: string, value: string]>; -} -declare class URLPattern { - constructor(input?: string | URLPatternURLPatternInit, baseURL?: string); - get protocol(): string; - get username(): string; - get password(): string; - get hostname(): string; - get port(): string; - get pathname(): string; - get search(): string; - get hash(): string; - test(input?: string | URLPatternURLPatternInit, baseURL?: string): boolean; - exec( - input?: string | URLPatternURLPatternInit, - baseURL?: string - ): URLPatternURLPatternResult | null; -} -declare interface URLPatternURLPatternInit { - protocol?: string; - username?: string; - password?: string; - hostname?: string; - port?: string; - pathname?: string; - search?: string; - hash?: string; - baseURL?: string; -} -declare interface URLPatternURLPatternComponentResult { - input: string; - groups: Record; -} -declare interface URLPatternURLPatternResult { - inputs: (string | URLPatternURLPatternInit)[]; - protocol: URLPatternURLPatternComponentResult; - username: URLPatternURLPatternComponentResult; - password: URLPatternURLPatternComponentResult; - hostname: URLPatternURLPatternComponentResult; - port: URLPatternURLPatternComponentResult; - pathname: URLPatternURLPatternComponentResult; - search: URLPatternURLPatternComponentResult; - hash: URLPatternURLPatternComponentResult; -} -declare class CloseEvent extends Event { - constructor(type: string, initializer: CloseEventInit); - /** Returns the WebSocket connection close code provided by the server. */ - readonly code: number; - /** Returns the WebSocket connection close reason provided by the server. */ - readonly reason: string; - /** Returns true if the connection closed cleanly; false otherwise. */ - readonly wasClean: boolean; -} -declare interface CloseEventInit { - code?: number; - reason?: string; - wasClean?: boolean; -} -declare class MessageEvent extends Event { - constructor(type: string, initializer: MessageEventInit); - readonly data: ArrayBuffer | string; -} -declare interface MessageEventInit { - data: ArrayBuffer | string; -} -/** Events providing information related to errors in scripts or in files. */ -declare interface ErrorEvent extends Event { - readonly filename: string; - readonly message: string; - readonly lineno: number; - readonly colno: number; - readonly error: any; -} -declare type WebSocketEventMap = { - close: CloseEvent; - message: MessageEvent; - open: Event; - error: ErrorEvent; -}; -declare class WebSocket extends EventTarget { - constructor(url: string, protocols?: string[] | string); - accept(): void; - send(message: (ArrayBuffer | ArrayBufferView) | string): void; - close(code?: number, reason?: string): void; - static readonly READY_STATE_CONNECTING: number; - static readonly READY_STATE_OPEN: number; - static readonly READY_STATE_CLOSING: number; - static readonly READY_STATE_CLOSED: number; - get readyState(): number; - get url(): string | null; - get protocol(): string | null; - get extensions(): string | null; -} -declare const WebSocketPair: { - new (): { - 0: WebSocket; - 1: WebSocket; - }; -}; -declare interface BasicImageTransformations { - /** - * Maximum width in image pixels. The value must be an integer. - */ - width?: number; - /** - * Maximum height in image pixels. The value must be an integer. - */ - height?: number; - /** - * Resizing mode as a string. It affects interpretation of width and height - * options: - * - scale-down: Similar to contain, but the image is never enlarged. If - * the image is larger than given width or height, it will be resized. - * Otherwise its original size will be kept. - * - contain: Resizes to maximum size that fits within the given width and - * height. If only a single dimension is given (e.g. only width), the - * image will be shrunk or enlarged to exactly match that dimension. - * Aspect ratio is always preserved. - * - cover: Resizes (shrinks or enlarges) to fill the entire area of width - * and height. If the image has an aspect ratio different from the ratio - * of width and height, it will be cropped to fit. - * - crop: The image will be shrunk and cropped to fit within the area - * specified by width and height. The image will not be enlarged. For images - * smaller than the given dimensions it's the same as scale-down. For - * images larger than the given dimensions, it's the same as cover. - * See also trim. - * - pad: Resizes to the maximum size that fits within the given width and - * height, and then fills the remaining area with a background color - * (white by default). Use of this mode is not recommended, as the same - * effect can be more efficiently achieved with the contain mode and the - * CSS object-fit: contain property. - */ - fit?: "scale-down" | "contain" | "cover" | "crop" | "pad"; - /** - * When cropping with fit: "cover", this defines the side or point that should - * be left uncropped. The value is either a string - * "left", "right", "top", "bottom", "auto", or "center" (the default), - * or an object {x, y} containing focal point coordinates in the original - * image expressed as fractions ranging from 0.0 (top or left) to 1.0 - * (bottom or right), 0.5 being the center. {fit: "cover", gravity: "top"} will - * crop bottom or left and right sides as necessary, but won’t crop anything - * from the top. {fit: "cover", gravity: {x:0.5, y:0.2}} will crop each side to - * preserve as much as possible around a point at 20% of the height of the - * source image. - */ - gravity?: - | "left" - | "right" - | "top" - | "bottom" - | "center" - | "auto" - | BasicImageTransformationsGravityCoordinates; - /** - * Background color to add underneath the image. Applies only to images with - * transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…), - * hsl(…), etc.) - */ - background?: string; - /** - * Number of degrees (90, 180, 270) to rotate the image by. width and height - * options refer to axes after rotation. - */ - rotate?: 0 | 90 | 180 | 270 | 360; -} -declare interface BasicImageTransformationsGravityCoordinates { - x: number; - y: number; -} -/** - * In addition to the properties you can set in the RequestInit dict - * that you pass as an argument to the Request constructor, you can - * set certain properties of a `cf` object to control how Cloudflare - * features are applied to that new Request. - * - * Note: Currently, these properties cannot be tested in the - * playground. - */ -declare interface RequestInitCfProperties extends Record { - cacheEverything?: boolean; - /** - * A request's cache key is what determines if two requests are - * "the same" for caching purposes. If a request has the same cache key - * as some previous request, then we can serve the same cached response for - * both. (e.g. 'some-key') - * - * Only available for Enterprise customers. - */ - cacheKey?: string; - /** - * This allows you to append additional Cache-Tag response headers - * to the origin response without modifications to the origin server. - * This will allow for greater control over the Purge by Cache Tag feature - * utilizing changes only in the Workers process. - * - * Only available for Enterprise customers. - */ - cacheTags?: string[]; - /** - * Force response to be cached for a given number of seconds. (e.g. 300) - */ - cacheTtl?: number; - /** - * Force response to be cached for a given number of seconds based on the Origin status code. - * (e.g. { '200-299': 86400, '404': 1, '500-599': 0 }) - */ - cacheTtlByStatus?: Record; - scrapeShield?: boolean; - apps?: boolean; - image?: RequestInitCfPropertiesImage; - minify?: RequestInitCfPropertiesImageMinify; - mirage?: boolean; - polish?: "lossy" | "lossless" | "off"; - /** - * Redirects the request to an alternate origin server. You can use this, - * for example, to implement load balancing across several origins. - * (e.g.us-east.example.com) - * - * Note - For security reasons, the hostname set in resolveOverride must - * be proxied on the same Cloudflare zone of the incoming request. - * Otherwise, the setting is ignored. CNAME hosts are allowed, so to - * resolve to a host under a different domain or a DNS only domain first - * declare a CNAME record within your own zone’s DNS mapping to the - * external hostname, set proxy on Cloudflare, then set resolveOverride - * to point to that CNAME record. - */ - resolveOverride?: string; -} -declare interface RequestInitCfPropertiesImageDraw - extends BasicImageTransformations { - /** - * Absolute URL of the image file to use for the drawing. It can be any of - * the supported file formats. For drawing of watermarks or non-rectangular - * overlays we recommend using PNG or WebP images. - */ - url: string; - /** - * Floating-point number between 0 (transparent) and 1 (opaque). - * For example, opacity: 0.5 makes overlay semitransparent. - */ - opacity?: number; - /** - * - If set to true, the overlay image will be tiled to cover the entire - * area. This is useful for stock-photo-like watermarks. - * - If set to "x", the overlay image will be tiled horizontally only - * (form a line). - * - If set to "y", the overlay image will be tiled vertically only - * (form a line). - */ - repeat?: true | "x" | "y"; - /** - * Position of the overlay image relative to a given edge. Each property is - * an offset in pixels. 0 aligns exactly to the edge. For example, left: 10 - * positions left side of the overlay 10 pixels from the left edge of the - * image it's drawn over. bottom: 0 aligns bottom of the overlay with bottom - * of the background image. - * - * Setting both left & right, or both top & bottom is an error. - * - * If no position is specified, the image will be centered. - */ - top?: number; - left?: number; - bottom?: number; - right?: number; -} -declare interface RequestInitCfPropertiesImage - extends BasicImageTransformations { - /** - * Device Pixel Ratio. Default 1. Multiplier for width/height that makes it - * easier to specify higher-DPI sizes in . - */ - dpr?: number; - /** - * An object with four properties {left, top, right, bottom} that specify - * a number of pixels to cut off on each side. Allows removal of borders - * or cutting out a specific fragment of an image. Trimming is performed - * before resizing or rotation. Takes dpr into account. - */ - trim?: { - left?: number; - top?: number; - right?: number; - bottom?: number; - }; - /** - * Quality setting from 1-100 (useful values are in 60-90 range). Lower values - * make images look worse, but load faster. The default is 85. It applies only - * to JPEG and WebP images. It doesn’t have any effect on PNG. - */ - quality?: number; - /** - * Output format to generate. It can be: - * - avif: generate images in AVIF format. - * - webp: generate images in Google WebP format. Set quality to 100 to get - * the WebP-lossless format. - * - json: instead of generating an image, outputs information about the - * image, in JSON format. The JSON object will contain image size - * (before and after resizing), source image’s MIME type, file size, etc. - * - jpeg: generate images in JPEG format. - * - png: generate images in PNG format. - */ - format?: "avif" | "webp" | "json" | "jpeg" | "png"; - /** - * Whether to preserve animation frames from input files. Default is true. - * Setting it to false reduces animations to still images. This setting is - * recommended when enlarging images or processing arbitrary user content, - * because large GIF animations can weigh tens or even hundreds of megabytes. - * It is also useful to set anim:false when using format:"json" to get the - * response quicker without the number of frames. - */ - anim?: boolean; - /** - * What EXIF data should be preserved in the output image. Note that EXIF - * rotation and embedded color profiles are always applied ("baked in" into - * the image), and aren't affected by this option. Note that if the Polish - * feature is enabled, all metadata may have been removed already and this - * option may have no effect. - * - keep: Preserve most of EXIF metadata, including GPS location if there's - * any. - * - copyright: Only keep the copyright tag, and discard everything else. - * This is the default behavior for JPEG files. - * - none: Discard all invisible EXIF metadata. Currently WebP and PNG - * output formats always discard metadata. - */ - metadata?: "keep" | "copyright" | "none"; - /** - * Strength of sharpening filter to apply to the image. Floating-point - * number between 0 (no sharpening, default) and 10 (maximum). 1.0 is a - * recommended value for downscaled images. - */ - sharpen?: number; - /** - * Radius of a blur filter (approximate gaussian). Maximum supported radius - * is 250. - */ - blur?: number; - /** - * Overlays are drawn in the order they appear in the array (last array - * entry is the topmost layer). - */ - draw?: RequestInitCfPropertiesImageDraw[]; - /** - * Fetching image from authenticated origin. Setting this property will - * pass authentication headers (Authorization, Cookie, etc.) through to - * the origin. - */ - "origin-auth"?: "share-publicly"; - /** - * Adds a border around the image. The border is added after resizing. Border - * width takes dpr into account, and can be specified either using a single - * width property, or individually for each side. - */ - border?: - | { - color: string; - width: number; - } - | { - color: string; - top: number; - right: number; - bottom: number; - left: number; - }; - /** - * Increase brightness by a factor. A value of 1.0 equals no change, a value - * of 0.5 equals half brightness, and a value of 2.0 equals twice as bright. - * 0 is ignored. - */ - brightness?: number; - /** - * Increase contrast by a factor. A value of 1.0 equals no change, a value of - * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is - * ignored. - */ - contrast?: number; - /** - * Increase exposure by a factor. A value of 1.0 equals no change, a value of - * 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored. - */ - gamma?: number; - /** - * Slightly reduces latency on a cache miss by selecting a - * quickest-to-compress file format, at a cost of increased file size and - * lower image quality. It will usually override the format option and choose - * JPEG over WebP or AVIF. We do not recommend using this option, except in - * unusual circumstances like resizing uncacheable dynamically-generated - * images. - */ - compression?: "fast"; -} -declare interface RequestInitCfPropertiesImageMinify { - javascript?: boolean; - css?: boolean; - html?: boolean; -} -/** - * Request metadata provided by Cloudflare's edge. - */ -declare type IncomingRequestCfProperties = - IncomingRequestCfPropertiesBase & - IncomingRequestCfPropertiesBotManagementEnterprise & - IncomingRequestCfPropertiesCloudflareForSaaSEnterprise & - IncomingRequestCfPropertiesGeographicInformation & - IncomingRequestCfPropertiesCloudflareAccessOrApiShield; -declare interface IncomingRequestCfPropertiesBase - extends Record { - /** - * [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request. - * - * @example 395747 - */ - asn: number; - /** - * The organization which owns the ASN of the incoming request. - * - * @example "Google Cloud" - */ - asOrganization: string; - /** - * The original value of the `Accept-Encoding` header if Cloudflare modified it. - * - * @example "gzip, deflate, br" - */ - clientAcceptEncoding?: string; - /** - * The number of milliseconds it took for the request to reach your worker. - * - * @example 22 - */ - clientTcpRtt?: number; - /** - * The three-letter [IATA](https://en.wikipedia.org/wiki/IATA_airport_code) - * airport code of the data center that the request hit. - * - * @example "DFW" - */ - colo: string; - /** - * Represents the upstream's response to a - * [TCP `keepalive` message](https://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html) - * from cloudflare. - * - * For workers with no upstream, this will always be `1`. - * - * @example 3 - */ - edgeRequestKeepAliveStatus: IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus; - /** - * The HTTP Protocol the request used. - * - * @example "HTTP/2" - */ - httpProtocol: string; - /** - * The browser-requested prioritization information in the request object. - * - * If no information was set, defaults to the empty string `""` - * - * @example "weight=192;exclusive=0;group=3;group-weight=127" - * @default "" - */ - requestPriority: string; - /** - * The TLS version of the connection to Cloudflare. - * In requests served over plaintext (without TLS), this property is the empty string `""`. - * - * @example "TLSv1.3" - */ - tlsVersion: string; - /** - * The cipher for the connection to Cloudflare. - * In requests served over plaintext (without TLS), this property is the empty string `""`. - * - * @example "AEAD-AES128-GCM-SHA256" - */ - tlsCipher: string; - /** - * Metadata containing the [`HELLO`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2) and [`FINISHED`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9) messages from this request's TLS handshake. - * - * If the incoming request was served over plaintext (without TLS) this field is undefined. - */ - tlsExportedAuthenticator?: IncomingRequestCfPropertiesExportedAuthenticatorMetadata; -} -declare interface IncomingRequestCfPropertiesBotManagementBase { - /** - * Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot, - * represented as an integer percentage between `1` (almost certainly human) - * and `99` (almost certainly a bot). - * - * @example 54 - */ - score: number; - /** - * A boolean value that is true if the request comes from a good bot, like Google or Bing. - * Most customers choose to allow this traffic. For more details, see [Traffic from known bots](https://developers.cloudflare.com/firewall/known-issues-and-faq/#how-does-firewall-rules-handle-traffic-from-known-bots). - */ - verifiedBot: boolean; - /** - * A boolean value that is true if the request originates from a - * Cloudflare-verified proxy service. - */ - corporateProxy: boolean; - /** - * A boolean value that's true if the request matches [file extensions](https://developers.cloudflare.com/bots/reference/static-resources/) for many types of static resources. - */ - staticResource: boolean; - /** - * List of IDs that correlate to the Bot Management heuristic detections made on a request (you can have multiple heuristic detections on the same request). - */ - detectionIds: number[]; -} -declare interface IncomingRequestCfPropertiesBotManagement { - /** - * Results of Cloudflare's Bot Management analysis - */ - botManagement: IncomingRequestCfPropertiesBotManagementBase; - /** - * Duplicate of `botManagement.score`. - * - * @deprecated - */ - clientTrustScore: number; -} -declare interface IncomingRequestCfPropertiesBotManagementEnterprise - extends IncomingRequestCfPropertiesBotManagement { - /** - * Results of Cloudflare's Bot Management analysis - */ - botManagement: IncomingRequestCfPropertiesBotManagementBase & { - /** - * A [JA3 Fingerprint](https://developers.cloudflare.com/bots/concepts/ja3-fingerprint/) to help profile specific SSL/TLS clients - * across different destination IPs, Ports, and X509 certificates. - */ - ja3Hash: string; - }; -} -declare interface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise< - HostMetadata -> { - /** - * Custom metadata set per-host in [Cloudflare for SaaS](https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/). - * - * This field is only present if you have Cloudflare for SaaS enabled on your account - * and you have followed the [required steps to enable it]((https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/domain-support/custom-metadata/)). - */ - hostMetadata: HostMetadata; -} -declare interface IncomingRequestCfPropertiesCloudflareAccessOrApiShield { - /** - * Information about the client certificate presented to Cloudflare. - * - * This is populated when the incoming request is served over TLS using - * either Cloudflare Access or API Shield (mTLS) - * and the presented SSL certificate has a valid - * [Certificate Serial Number](https://ldapwiki.com/wiki/Certificate%20Serial%20Number) - * (i.e., not `null` or `""`). - * - * Otherwise, a set of placeholder values are used. - * - * The property `certPresented` will be set to `"1"` when - * the object is populated (i.e. the above conditions were met). - */ - tlsClientAuth: - | IncomingRequestCfPropertiesTLSClientAuth - | IncomingRequestCfPropertiesTLSClientAuthPlaceholder; -} -/** - * Metadata about the request's TLS handshake - */ -declare interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata { - /** - * The client's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal - * - * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d" - */ - clientHandshake: string; - /** - * The server's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal - * - * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d" - */ - serverHandshake: string; - /** - * The client's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal - * - * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b" - */ - clientFinished: string; - /** - * The server's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal - * - * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b" - */ - serverFinished: string; -} -/** - * Geographic data about the request's origin. - */ -declare interface IncomingRequestCfPropertiesGeographicInformation { - /** - * The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from. - * - * If your worker is [configured to accept TOR connections](https://support.cloudflare.com/hc/en-us/articles/203306930-Understanding-Cloudflare-Tor-support-and-Onion-Routing), this may also be `"T1"`, indicating a request that originated over TOR. - * - * If Cloudflare is unable to determine where the request originated this property is omitted. - * - * The country code `"T1"` is used for requests originating on TOR. - * - * @example "GB" - */ - country?: Iso3166Alpha2Code | "T1"; - /** - * If present, this property indicates that the request originated in the EU - * - * @example "1" - */ - isEUCountry?: "1"; - /** - * A two-letter code indicating the continent the request originated from. - * - * @example "AN" - */ - continent?: ContinentCode; - /** - * The city the request originated from - * - * @example "Austin" - */ - city?: string; - /** - * Postal code of the incoming request - * - * @example "78701" - */ - postalCode?: string; - /** - * Latitude of the incoming request - * - * @example "30.27130" - */ - latitude?: string; - /** - * Longitude of the incoming request - * - * @example "-97.74260" - */ - longitude?: string; - /** - * Timezone of the incoming request - * - * @example "America/Chicago" - */ - timezone?: string; - /** - * If known, the ISO 3166-2 name for the first level region associated with - * the IP address of the incoming request - * - * @example "Texas" - */ - region?: string; - /** - * If known, the ISO 3166-2 code for the first-level region associated with - * the IP address of the incoming request - * - * @example "TX" - */ - regionCode?: string; - /** - * Metro code (DMA) of the incoming request - * - * @example "635" - */ - metroCode?: string; -} -/** Data about the incoming request's TLS certificate */ -declare interface IncomingRequestCfPropertiesTLSClientAuth { - /** Always `"1"`, indicating that the certificate was presented */ - certPresented: "1"; - /** - * Result of certificate verification. - * - * @example "FAILED:self signed certificate" - */ - certVerified: Exclude; - /** The presented certificate's revokation status. - * - * - A value of `"1"` indicates the certificate has been revoked - * - A value of `"0"` indicates the certificate has not been revoked - */ - certRevoked: "1" | "0"; - /** - * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) - * - * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certIssuerDN: string; - /** - * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) - * - * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certSubjectDN: string; - /** - * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted) - * - * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certIssuerDNRFC2253: string; - /** - * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted) - * - * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certSubjectDNRFC2253: string; - /** The certificate issuer's distinguished name (legacy policies) */ - certIssuerDNLegacy: string; - /** The certificate subject's distinguished name (legacy policies) */ - certSubjectDNLegacy: string; - /** - * The certificate's serial number - * - * @example "00936EACBE07F201DF" - */ - certSerial: string; - /** - * The certificate issuer's serial number - * - * @example "2489002934BDFEA34" - */ - certIssuerSerial: string; - /** - * The certificate's Subject Key Identifier - * - * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4" - */ - certSKI: string; - /** - * The certificate issuer's Subject Key Identifier - * - * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4" - */ - certIssuerSKI: string; - /** - * The certificate's SHA-1 fingerprint - * - * @example "6b9109f323999e52259cda7373ff0b4d26bd232e" - */ - certFingerprintSHA1: string; - /** - * The certificate's SHA-256 fingerprint - * - * @example "acf77cf37b4156a2708e34c4eb755f9b5dbbe5ebb55adfec8f11493438d19e6ad3f157f81fa3b98278453d5652b0c1fd1d71e5695ae4d709803a4d3f39de9dea" - */ - certFingerprintSHA256: string; - /** - * The effective starting date of the certificate - * - * @example "Dec 22 19:39:00 2018 GMT" - */ - certNotBefore: string; - /** - * The effective expiration date of the certificate - * - * @example "Dec 22 19:39:00 2018 GMT" - */ - certNotAfter: string; -} -/** Placeholder values for TLS Client Authorization */ -declare interface IncomingRequestCfPropertiesTLSClientAuthPlaceholder { - certPresented: "0"; - certVerified: "NONE"; - certRevoked: "0"; - certIssuerDN: ""; - certSubjectDN: ""; - certIssuerDNRFC2253: ""; - certSubjectDNRFC2253: ""; - certIssuerDNLegacy: ""; - certSubjectDNLegacy: ""; - certSerial: ""; - certIssuerSerial: ""; - certSKI: ""; - certIssuerSKI: ""; - certFingerprintSHA1: ""; - certFingerprintSHA256: ""; - certNotBefore: ""; - certNotAfter: ""; -} -/** Possible outcomes of TLS verification */ -declare type CertVerificationStatus = - /** Authentication succeeded */ - | "SUCCESS" - /** No certificate was presented */ - | "NONE" - /** Failed because the certificate was self-signed */ - | "FAILED:self signed certificate" - /** Failed because the certificate failed a trust chain check */ - | "FAILED:unable to verify the first certificate" - /** Failed because the certificate not yet valid */ - | "FAILED:certificate is not yet valid" - /** Failed because the certificate is expired */ - | "FAILED:certificate has expired" - /** Failed for another unspecified reason */ - | "FAILED"; -/** - * An upstream endpoint's response to a TCP `keepalive` message from Cloudflare. - */ -declare type IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus = - | 0 /** Unknown */ - | 1 /** no keepalives (not found) */ - | 2 /** no connection re-use, opening keepalive connection failed */ - | 3 /** no connection re-use, keepalive accepted and saved */ - | 4 /** connection re-use, refused by the origin server (`TCP FIN`) */ - | 5; /** connection re-use, accepted by the origin server */ -/** ISO 3166-1 Alpha-2 codes */ -declare type Iso3166Alpha2Code = - | "AD" - | "AE" - | "AF" - | "AG" - | "AI" - | "AL" - | "AM" - | "AO" - | "AQ" - | "AR" - | "AS" - | "AT" - | "AU" - | "AW" - | "AX" - | "AZ" - | "BA" - | "BB" - | "BD" - | "BE" - | "BF" - | "BG" - | "BH" - | "BI" - | "BJ" - | "BL" - | "BM" - | "BN" - | "BO" - | "BQ" - | "BR" - | "BS" - | "BT" - | "BV" - | "BW" - | "BY" - | "BZ" - | "CA" - | "CC" - | "CD" - | "CF" - | "CG" - | "CH" - | "CI" - | "CK" - | "CL" - | "CM" - | "CN" - | "CO" - | "CR" - | "CU" - | "CV" - | "CW" - | "CX" - | "CY" - | "CZ" - | "DE" - | "DJ" - | "DK" - | "DM" - | "DO" - | "DZ" - | "EC" - | "EE" - | "EG" - | "EH" - | "ER" - | "ES" - | "ET" - | "FI" - | "FJ" - | "FK" - | "FM" - | "FO" - | "FR" - | "GA" - | "GB" - | "GD" - | "GE" - | "GF" - | "GG" - | "GH" - | "GI" - | "GL" - | "GM" - | "GN" - | "GP" - | "GQ" - | "GR" - | "GS" - | "GT" - | "GU" - | "GW" - | "GY" - | "HK" - | "HM" - | "HN" - | "HR" - | "HT" - | "HU" - | "ID" - | "IE" - | "IL" - | "IM" - | "IN" - | "IO" - | "IQ" - | "IR" - | "IS" - | "IT" - | "JE" - | "JM" - | "JO" - | "JP" - | "KE" - | "KG" - | "KH" - | "KI" - | "KM" - | "KN" - | "KP" - | "KR" - | "KW" - | "KY" - | "KZ" - | "LA" - | "LB" - | "LC" - | "LI" - | "LK" - | "LR" - | "LS" - | "LT" - | "LU" - | "LV" - | "LY" - | "MA" - | "MC" - | "MD" - | "ME" - | "MF" - | "MG" - | "MH" - | "MK" - | "ML" - | "MM" - | "MN" - | "MO" - | "MP" - | "MQ" - | "MR" - | "MS" - | "MT" - | "MU" - | "MV" - | "MW" - | "MX" - | "MY" - | "MZ" - | "NA" - | "NC" - | "NE" - | "NF" - | "NG" - | "NI" - | "NL" - | "NO" - | "NP" - | "NR" - | "NU" - | "NZ" - | "OM" - | "PA" - | "PE" - | "PF" - | "PG" - | "PH" - | "PK" - | "PL" - | "PM" - | "PN" - | "PR" - | "PS" - | "PT" - | "PW" - | "PY" - | "QA" - | "RE" - | "RO" - | "RS" - | "RU" - | "RW" - | "SA" - | "SB" - | "SC" - | "SD" - | "SE" - | "SG" - | "SH" - | "SI" - | "SJ" - | "SK" - | "SL" - | "SM" - | "SN" - | "SO" - | "SR" - | "SS" - | "ST" - | "SV" - | "SX" - | "SY" - | "SZ" - | "TC" - | "TD" - | "TF" - | "TG" - | "TH" - | "TJ" - | "TK" - | "TL" - | "TM" - | "TN" - | "TO" - | "TR" - | "TT" - | "TV" - | "TW" - | "TZ" - | "UA" - | "UG" - | "UM" - | "US" - | "UY" - | "UZ" - | "VA" - | "VC" - | "VE" - | "VG" - | "VI" - | "VN" - | "VU" - | "WF" - | "WS" - | "YE" - | "YT" - | "ZA" - | "ZM" - | "ZW"; -/** The 2-letter continent codes Cloudflare uses */ -declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA"; -declare type CfProperties = - | IncomingRequestCfProperties - | RequestInitCfProperties; -declare interface D1Result { - results?: T[]; - success: boolean; - error?: string; - meta: any; -} -declare abstract class D1Database { - prepare(query: string): D1PreparedStatement; - dump(): Promise; - batch(statements: D1PreparedStatement[]): Promise[]>; - exec(query: string): Promise>; -} -declare abstract class D1PreparedStatement { - bind(...values: any[]): D1PreparedStatement; - first(colName?: string): Promise; - run(): Promise>; - all(): Promise>; - raw(): Promise; -} -/** - * A email message that is sent to a consumer Worker. - */ -declare interface EmailMessage { - /** - * Envelope From attribute of the email message. - */ - readonly from: string; - /** - * Envelope To attribute of the email message. - */ - readonly to: string; - /** - * A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers). - */ - readonly headers: Headers; - /** - * Stream of the email message content. - */ - readonly raw: ReadableStream; - /** - * Size of the email message content. - */ - readonly rawSize: number; - /** - * Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason. - * @param reason The reject reason. - * @returns void - */ - setReject(reason: string): void; - /** - * Forward this email message to a verified destination address of the account. - * @param rcptTo Verified destination address. - * @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers). - * @returns A promise that resolves when the email message is forwarded. - */ - forward(rcptTo: string, headers?: Headers): Promise; -} -declare abstract class EmailEvent extends ExtendableEvent { - readonly message: EmailMessage; -} -declare type EmailExportedHandler = ( - message: EmailMessage, - env: Env, - ctx: ExecutionContext -) => void | Promise; -declare type Params

= Record; -declare type EventContext = { - request: Request; - functionPath: string; - waitUntil: (promise: Promise) => void; - passThroughOnException: () => void; - next: (input?: Request | string, init?: RequestInit) => Promise; - env: Env & { - ASSETS: { - fetch: typeof fetch; - }; - }; - params: Params

; - data: Data; -}; -declare type PagesFunction< - Env = unknown, - Params extends string = any, - Data extends Record = Record -> = (context: EventContext) => Response | Promise; -declare type EventPluginContext = { - request: Request; - functionPath: string; - waitUntil: (promise: Promise) => void; - passThroughOnException: () => void; - next: (input?: Request | string, init?: RequestInit) => Promise; - env: Env & { - ASSETS: { - fetch: typeof fetch; - }; - }; - params: Params

; - data: Data; - pluginArgs: PluginArgs; -}; -declare type PagesPluginFunction< - Env = unknown, - Params extends string = any, - Data extends Record = Record, - PluginArgs = unknown -> = ( - context: EventPluginContext -) => Response | Promise; -declare module "assets:*" { - export const onRequest: PagesFunction; -} -// https://developers.cloudflare.com/pub-sub/ -// PubSubMessage represents an incoming PubSub message. -// The message includes metadata about the broker, the client, and the payload -// itself. -declare interface PubSubMessage { - // Message ID - readonly mid: number; - // MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT - readonly broker: string; - // The MQTT topic the message was sent on. - readonly topic: string; - // The client ID of the client that published this message. - readonly clientId: string; - // The unique identifier (JWT ID) used by the client to authenticate, if token - // auth was used. - readonly jti?: string; - // A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker - // received the message from the client. - readonly receivedAt: number; - // An (optional) string with the MIME type of the payload, if set by the - // client. - readonly contentType: string; - // Set to 1 when the payload is a UTF-8 string - // https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063 - readonly payloadFormatIndicator: number; - // Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays. - // You can use payloadFormatIndicator to inspect this before decoding. - payload: string | Uint8Array; -} -// JsonWebKey extended by kid parameter -declare interface JsonWebKeyWithKid extends JsonWebKey { - // Key Identifier of the JWK - readonly kid: string; -} -/** - * A message that is sent to a consumer Worker. - */ -declare interface Message { - /** - * A unique, system-generated ID for the message. - */ - readonly id: string; - /** - * A timestamp when the message was sent. - */ - readonly timestamp: Date; - /** - * The body of the message. - */ - readonly body: Body; - /** - * Marks message to be retried. - */ - retry(): void; - /** - * Marks message acknowledged. - */ - ack(): void; -} -/** - * A batch of messages that are sent to a consumer Worker. - */ -declare interface MessageBatch { - /** - * The name of the Queue that belongs to this batch. - */ - readonly queue: string; - /** - * An array of messages in the batch. Ordering of messages is not guaranteed. - */ - readonly messages: readonly Message[]; - /** - * Marks every message to be retried in the next batch. - */ - retryAll(): void; - /** - * Marks every message acknowledged in the batch. - */ - ackAll(): void; -} -/** - * A wrapper class used to structure message batches. - */ -declare type MessageSendRequest = { - /** - * The body of the message. - */ - body: Body; -}; -/** - * A binding that allows a producer to send messages to a Queue. - */ -declare interface Queue { - /** - * Sends a message to the Queue. - * @param message The message can be any type supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types), as long as its size is less than 128 KB. - * @returns A promise that resolves when the message is confirmed to be written to disk. - */ - send(message: Body): Promise; - /** - * Sends a batch of messages to the Queue. - * @param messages Each item in the input must be supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types). A batch can contain up to 100 messages, though items are limited to 128 KB each, and the total size of the array cannot exceed 256 KB. - * @returns A promise that resolves when the messages are confirmed to be written to disk. - */ - sendBatch(messages: Iterable>): Promise; -} diff --git a/packages/denylist_bot/node_modules/@cloudflare/workers-types/experimental/index.ts b/packages/denylist_bot/node_modules/@cloudflare/workers-types/experimental/index.ts deleted file mode 100755 index dc87dd266..000000000 --- a/packages/denylist_bot/node_modules/@cloudflare/workers-types/experimental/index.ts +++ /dev/null @@ -1,2986 +0,0 @@ -/*! ***************************************************************************** -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 -export declare class DOMException extends Error { - constructor(message?: string, name?: string); - readonly message: string; - readonly name: string; - readonly code: number; - readonly stack: any; - 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; -} -export type WorkerGlobalScopeEventMap = { - fetch: FetchEvent; - scheduled: ScheduledEvent; - unhandledrejection: PromiseRejectionEvent; - rejectionhandled: PromiseRejectionEvent; -}; -export declare abstract class WorkerGlobalScope extends EventTarget { - EventTarget: typeof EventTarget; -} -export interface Console { - "assert"(condition?: boolean, ...data: any[]): void; - clear(): void; - count(label?: string): void; - countReset(label?: string): void; - debug(...data: any[]): void; - dir(item?: any, options?: any): void; - dirxml(...data: any[]): void; - error(...data: any[]): void; - group(...data: any[]): void; - groupCollapsed(...data: any[]): void; - groupEnd(): void; - info(...data: any[]): void; - log(...data: any[]): void; - table(tabularData?: any, properties?: string[]): void; - time(label?: string): void; - timeEnd(label?: string): void; - timeLog(label?: string, ...data: any[]): void; - timeStamp(label?: string): void; - trace(...data: any[]): void; - warn(...data: any[]): void; -} -export declare const console: Console; -export type BufferSource = ArrayBufferView | ArrayBuffer; -export 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; - type Imports = Record; - type ExportValue = Function | Global | Memory | Table; - type Exports = Record; - 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; - function validate(bytes: BufferSource): boolean; -} -/** This ServiceWorker API interface represents the global execution context of a service worker. */ -export 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( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args - ): number; - clearTimeout(timeoutId: number | null): void; - setInterval(callback: (...args: any[]) => void, msDelay?: number): number; - setInterval( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args - ): number; - clearInterval(timeoutId: number | null): void; - queueMicrotask(task: Function): void; - structuredClone(value: T, options?: StructuredSerializeOptions): T; - fetch( - input: RequestInfo, - init?: RequestInit - ): Promise; - self: ServiceWorkerGlobalScope; - crypto: Crypto; - caches: CacheStorage; - scheduler: Scheduler; - Event: typeof Event; - ExtendableEvent: typeof ExtendableEvent; - PromiseRejectionEvent: typeof PromiseRejectionEvent; - FetchEvent: typeof FetchEvent; - TraceEvent: typeof TraceEvent; - 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; - ReadableStreamBYOBRequest: typeof ReadableStreamBYOBRequest; - ReadableStreamDefaultController: typeof ReadableStreamDefaultController; - ReadableByteStreamController: typeof ReadableByteStreamController; - WritableStreamDefaultController: typeof WritableStreamDefaultController; - 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; - 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; -} -export declare function addEventListener< - Type extends keyof WorkerGlobalScopeEventMap ->( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetAddEventListenerOptions | boolean -): void; -export declare function removeEventListener< - Type extends keyof WorkerGlobalScopeEventMap ->( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetEventListenerOptions | boolean -): void; -/** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */ -export declare function dispatchEvent( - event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap] -): boolean; -export declare function btoa(data: string): string; -export declare function atob(data: string): string; -export declare function setTimeout( - callback: (...args: any[]) => void, - msDelay?: number -): number; -export declare function setTimeout( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args -): number; -export declare function clearTimeout(timeoutId: number | null): void; -export declare function setInterval( - callback: (...args: any[]) => void, - msDelay?: number -): number; -export declare function setInterval( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args -): number; -export declare function clearInterval(timeoutId: number | null): void; -export declare function queueMicrotask(task: Function): void; -export declare function structuredClone( - value: T, - options?: StructuredSerializeOptions -): T; -export declare function fetch( - input: RequestInfo, - init?: RequestInit -): Promise; -export declare const self: ServiceWorkerGlobalScope; -export declare const crypto: Crypto; -export declare const caches: CacheStorage; -export declare const scheduler: Scheduler; -export declare const navigator: Navigator; -export interface TestController {} -export interface ExecutionContext { - waitUntil(promise: Promise): void; - passThroughOnException(): void; -} -export type ExportedHandlerFetchHandler< - Env = unknown, - CfHostMetadata = unknown -> = ( - request: Request>, - env: Env, - ctx: ExecutionContext -) => Response | Promise; -export type ExportedHandlerTraceHandler = ( - traces: TraceItem[], - env: Env, - ctx: ExecutionContext -) => void | Promise; -export type ExportedHandlerScheduledHandler = ( - controller: ScheduledController, - env: Env, - ctx: ExecutionContext -) => void | Promise; -export type ExportedHandlerQueueHandler = ( - batch: MessageBatch, - env: Env, - ctx: ExecutionContext -) => void | Promise; -export type ExportedHandlerTestHandler = ( - controller: TestController, - env: Env, - ctx: ExecutionContext -) => void | Promise; -export interface ExportedHandler< - Env = unknown, - QueueMessage = unknown, - CfHostMetadata = unknown -> { - fetch?: ExportedHandlerFetchHandler; - trace?: ExportedHandlerTraceHandler; - scheduled?: ExportedHandlerScheduledHandler; - test?: ExportedHandlerTestHandler; - queue?: ExportedHandlerQueueHandler; -} -export interface StructuredSerializeOptions { - transfer?: any[]; -} -export declare abstract class PromiseRejectionEvent extends Event { - readonly promise: Promise; - readonly reason: any; -} -export declare abstract class Navigator { - readonly userAgent: string; -} -export interface DurableObject { - fetch(request: Request): Response | Promise; - alarm?(): void | Promise; -} -export interface DurableObjectStub extends Fetcher { - readonly id: DurableObjectId; - readonly name?: string; -} -export interface DurableObjectId { - toString(): string; - equals(other: DurableObjectId): boolean; - readonly name?: string; -} -export interface DurableObjectNamespace { - newUniqueId( - options?: DurableObjectNamespaceNewUniqueIdOptions - ): DurableObjectId; - idFromName(name: string): DurableObjectId; - idFromString(id: string): DurableObjectId; - get( - id: DurableObjectId, - options?: DurableObjectNamespaceGetDurableObjectOptions - ): DurableObjectStub; - jurisdiction(jurisdiction: string): DurableObjectNamespace; -} -export interface DurableObjectNamespaceNewUniqueIdOptions { - jurisdiction?: string; -} -export interface DurableObjectNamespaceGetDurableObjectOptions { - locationHint?: string; -} -export interface DurableObjectState { - waitUntil(promise: Promise): void; - readonly id: DurableObjectId; - readonly storage: DurableObjectStorage; - blockConcurrencyWhile(callback: () => Promise): Promise; -} -export interface DurableObjectTransaction { - get( - key: string, - options?: DurableObjectGetOptions - ): Promise; - get( - keys: string[], - options?: DurableObjectGetOptions - ): Promise>; - list( - options?: DurableObjectListOptions - ): Promise>; - put( - key: string, - value: T, - options?: DurableObjectPutOptions - ): Promise; - put( - entries: Record, - options?: DurableObjectPutOptions - ): Promise; - delete(key: string, options?: DurableObjectPutOptions): Promise; - delete(keys: string[], options?: DurableObjectPutOptions): Promise; - rollback(): void; - getAlarm(options?: DurableObjectGetAlarmOptions): Promise; - setAlarm( - scheduledTime: number | Date, - options?: DurableObjectSetAlarmOptions - ): Promise; - deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise; -} -export interface DurableObjectStorage { - get( - key: string, - options?: DurableObjectGetOptions - ): Promise; - get( - keys: string[], - options?: DurableObjectGetOptions - ): Promise>; - list( - options?: DurableObjectListOptions - ): Promise>; - put( - key: string, - value: T, - options?: DurableObjectPutOptions - ): Promise; - put( - entries: Record, - options?: DurableObjectPutOptions - ): Promise; - delete(key: string, options?: DurableObjectPutOptions): Promise; - delete(keys: string[], options?: DurableObjectPutOptions): Promise; - deleteAll(options?: DurableObjectPutOptions): Promise; - transaction( - closure: (txn: DurableObjectTransaction) => Promise - ): Promise; - getAlarm(options?: DurableObjectGetAlarmOptions): Promise; - setAlarm( - scheduledTime: number | Date, - options?: DurableObjectSetAlarmOptions - ): Promise; - deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise; - sync(): Promise; -} -export interface DurableObjectListOptions { - start?: string; - startAfter?: string; - end?: string; - prefix?: string; - reverse?: boolean; - limit?: number; - allowConcurrency?: boolean; - noCache?: boolean; -} -export interface DurableObjectGetOptions { - allowConcurrency?: boolean; - noCache?: boolean; -} -export interface DurableObjectGetAlarmOptions { - allowConcurrency?: boolean; -} -export interface DurableObjectPutOptions { - allowConcurrency?: boolean; - allowUnconfirmed?: boolean; - noCache?: boolean; -} -export interface DurableObjectSetAlarmOptions { - allowConcurrency?: boolean; - allowUnconfirmed?: boolean; -} -export interface AnalyticsEngineDataset { - writeDataPoint(event?: AnalyticsEngineDataPoint): void; -} -export interface AnalyticsEngineDataPoint { - indexes?: ((ArrayBuffer | string) | null)[]; - doubles?: number[]; - blobs?: ((ArrayBuffer | string) | null)[]; -} -export declare class Event { - constructor(type: string, init?: EventInit); - get type(): string; - get eventPhase(): number; - get composed(): boolean; - get bubbles(): boolean; - get cancelable(): boolean; - get defaultPrevented(): boolean; - get returnValue(): boolean; - get currentTarget(): EventTarget | undefined; - get srcElement(): EventTarget | undefined; - get timeStamp(): number; - get isTrusted(): boolean; - get cancelBubble(): boolean; - set cancelBubble(value: boolean); - stopImmediatePropagation(): void; - preventDefault(): void; - stopPropagation(): void; - composedPath(): EventTarget[]; - static readonly NONE: number; - static readonly CAPTURING_PHASE: number; - static readonly AT_TARGET: number; - static readonly BUBBLING_PHASE: number; -} -export interface EventInit { - bubbles?: boolean; - cancelable?: boolean; - composed?: boolean; -} -export type EventListener = ( - event: EventType -) => void; -export interface EventListenerObject { - handleEvent(event: EventType): void; -} -export type EventListenerOrEventListenerObject< - EventType extends Event = Event -> = EventListener | EventListenerObject; -export declare class EventTarget< - EventMap extends Record = Record -> { - constructor(); - addEventListener( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetAddEventListenerOptions | boolean - ): void; - removeEventListener( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetEventListenerOptions | boolean - ): void; - dispatchEvent(event: EventMap[keyof EventMap]): boolean; -} -export interface EventTargetEventListenerOptions { - capture?: boolean; -} -export interface EventTargetAddEventListenerOptions { - capture?: boolean; - passive?: boolean; - once?: boolean; - signal?: AbortSignal; -} -export interface EventTargetHandlerObject { - handleEvent: (event: Event) => any | undefined; -} -export declare class AbortController { - constructor(); - get signal(): AbortSignal; - abort(reason?: any): void; -} -export declare abstract class AbortSignal extends EventTarget { - static abort(reason?: any): AbortSignal; - static timeout(delay: number): AbortSignal; - get aborted(): boolean; - get reason(): any; - throwIfAborted(): void; -} -export interface Scheduler { - wait(delay: number, maybeOptions?: SchedulerWaitOptions): Promise; -} -export interface SchedulerWaitOptions { - signal?: AbortSignal; -} -export declare abstract class ExtendableEvent extends Event { - waitUntil(promise: Promise): void; -} -export declare class Blob { - constructor( - bits?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[], - options?: BlobOptions - ); - get size(): number; - get type(): string; - slice(start?: number, end?: number, type?: string): Blob; - arrayBuffer(): Promise; - text(): Promise; - stream(): ReadableStream; -} -export interface BlobOptions { - type?: string; -} -export declare class File extends Blob { - constructor( - bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined, - name: string, - options?: FileOptions - ); - get name(): string; - get lastModified(): number; -} -export interface FileOptions { - type?: string; - lastModified?: number; -} -export declare abstract class CacheStorage { - open(cacheName: string): Promise; - readonly default: Cache; -} -export declare abstract class Cache { - delete(request: RequestInfo, options?: CacheQueryOptions): Promise; - match( - request: RequestInfo, - options?: CacheQueryOptions - ): Promise; - put(request: RequestInfo, response: Response): Promise; -} -export interface CacheQueryOptions { - ignoreMethod?: boolean; -} -export declare abstract class Crypto { - get subtle(): SubtleCrypto; - getRandomValues< - T extends - | Int8Array - | Uint8Array - | Int16Array - | Uint16Array - | Int32Array - | Uint32Array - | BigInt64Array - | BigUint64Array - >(buffer: T): T; - randomUUID(): string; - DigestStream: typeof DigestStream; -} -export declare abstract class SubtleCrypto { - encrypt( - algorithm: string | SubtleCryptoEncryptAlgorithm, - key: CryptoKey, - plainText: ArrayBuffer | ArrayBufferView - ): Promise; - decrypt( - algorithm: string | SubtleCryptoEncryptAlgorithm, - key: CryptoKey, - cipherText: ArrayBuffer | ArrayBufferView - ): Promise; - sign( - algorithm: string | SubtleCryptoSignAlgorithm, - key: CryptoKey, - data: ArrayBuffer | ArrayBufferView - ): Promise; - verify( - algorithm: string | SubtleCryptoSignAlgorithm, - key: CryptoKey, - signature: ArrayBuffer | ArrayBufferView, - data: ArrayBuffer | ArrayBufferView - ): Promise; - digest( - algorithm: string | SubtleCryptoHashAlgorithm, - data: ArrayBuffer | ArrayBufferView - ): Promise; - generateKey( - algorithm: string | SubtleCryptoGenerateKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - deriveKey( - algorithm: string | SubtleCryptoDeriveKeyAlgorithm, - baseKey: CryptoKey, - derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - deriveBits( - algorithm: string | SubtleCryptoDeriveKeyAlgorithm, - baseKey: CryptoKey, - length: number | null - ): Promise; - importKey( - format: string, - keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey, - algorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - exportKey(format: string, key: CryptoKey): Promise; - wrapKey( - format: string, - key: CryptoKey, - wrappingKey: CryptoKey, - wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm - ): Promise; - unwrapKey( - format: string, - wrappedKey: ArrayBuffer | ArrayBufferView, - unwrappingKey: CryptoKey, - unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm, - unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - timingSafeEqual( - a: ArrayBuffer | ArrayBufferView, - b: ArrayBuffer | ArrayBufferView - ): boolean; -} -export declare abstract class CryptoKey { - readonly type: string; - readonly extractable: boolean; - readonly algorithm: - | CryptoKeyKeyAlgorithm - | CryptoKeyAesKeyAlgorithm - | CryptoKeyHmacKeyAlgorithm - | CryptoKeyRsaKeyAlgorithm - | CryptoKeyEllipticKeyAlgorithm - | CryptoKeyArbitraryKeyAlgorithm; - readonly usages: string[]; -} -export interface CryptoKeyPair { - publicKey: CryptoKey; - privateKey: CryptoKey; -} -export 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; -} -export interface RsaOtherPrimesInfo { - r?: string; - d?: string; - t?: string; -} -export interface SubtleCryptoDeriveKeyAlgorithm { - name: string; - salt?: ArrayBuffer; - iterations?: number; - hash?: string | SubtleCryptoHashAlgorithm; - $public?: CryptoKey; - info?: ArrayBuffer; -} -export interface SubtleCryptoEncryptAlgorithm { - name: string; - iv?: ArrayBuffer; - additionalData?: ArrayBuffer; - tagLength?: number; - counter?: ArrayBuffer; - length?: number; - label?: ArrayBuffer; -} -export interface SubtleCryptoGenerateKeyAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - modulusLength?: number; - publicExponent?: ArrayBuffer; - length?: number; - namedCurve?: string; -} -export interface SubtleCryptoHashAlgorithm { - name: string; -} -export interface SubtleCryptoImportKeyAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - length?: number; - namedCurve?: string; - compressed?: boolean; -} -export interface SubtleCryptoSignAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - dataLength?: number; - saltLength?: number; -} -export interface CryptoKeyKeyAlgorithm { - name: string; -} -export interface CryptoKeyAesKeyAlgorithm { - name: string; - length: number; -} -export interface CryptoKeyHmacKeyAlgorithm { - name: string; - hash: CryptoKeyKeyAlgorithm; - length: number; -} -export interface CryptoKeyRsaKeyAlgorithm { - name: string; - modulusLength: number; - publicExponent: ArrayBuffer; - hash?: CryptoKeyKeyAlgorithm; -} -export interface CryptoKeyEllipticKeyAlgorithm { - name: string; - namedCurve: string; -} -export interface CryptoKeyArbitraryKeyAlgorithm { - name: string; - hash?: CryptoKeyKeyAlgorithm; - namedCurve?: string; - length?: number; -} -export declare class DigestStream extends WritableStream< - ArrayBuffer | ArrayBufferView -> { - constructor(algorithm: string | SubtleCryptoHashAlgorithm); - get digest(): Promise; -} -export declare class TextDecoder { - constructor(decoder?: string, options?: TextDecoderConstructorOptions); - decode( - input?: ArrayBuffer | ArrayBufferView, - options?: TextDecoderDecodeOptions - ): string; - get encoding(): string; - get fatal(): boolean; - get ignoreBOM(): boolean; -} -export declare class TextEncoder { - constructor(); - encode(input?: string): Uint8Array; - encodeInto(input: string, buffer: Uint8Array): TextEncoderEncodeIntoResult; - get encoding(): string; -} -export interface TextDecoderConstructorOptions { - fatal: boolean; - ignoreBOM: boolean; -} -export interface TextDecoderDecodeOptions { - stream: boolean; -} -export interface TextEncoderEncodeIntoResult { - read: number; - written: number; -} -export declare class FormData { - constructor(); - append(name: string, value: string): void; - append(name: string, value: Blob, filename?: string): void; - delete(name: string): void; - get(name: string): (File | string) | null; - getAll(name: string): (File | string)[]; - has(name: string): boolean; - set(name: string, value: string): void; - set(name: string, value: Blob, filename?: string): void; - entries(): IterableIterator<[key: string, value: File | string]>; - keys(): IterableIterator; - values(): IterableIterator; - forEach( - callback: ( - this: This, - value: File | string, - key: string, - parent: FormData - ) => void, - thisArg?: This - ): void; - [Symbol.iterator](): IterableIterator<[key: string, value: File | string]>; -} -export interface ContentOptions { - html?: boolean; -} -export declare class HTMLRewriter { - constructor(); - on( - selector: string, - handlers: HTMLRewriterElementContentHandlers - ): HTMLRewriter; - onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter; - transform(response: Response): Response; -} -export interface HTMLRewriterElementContentHandlers { - element?(element: Element): void | Promise; - comments?(comment: Comment): void | Promise; - text?(element: Text): void | Promise; -} -export interface HTMLRewriterDocumentContentHandlers { - doctype?(doctype: Doctype): void | Promise; - comments?(comment: Comment): void | Promise; - text?(text: Text): void | Promise; - end?(end: DocumentEnd): void | Promise; -} -export interface Doctype { - readonly name: string | null; - readonly publicId: string | null; - readonly systemId: string | null; -} -export interface Element { - tagName: string; - readonly attributes: IterableIterator; - 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, options?: ContentOptions): Element; - after(content: string, options?: ContentOptions): Element; - prepend(content: string, options?: ContentOptions): Element; - append(content: string, options?: ContentOptions): Element; - replace(content: string, options?: ContentOptions): Element; - remove(): Element; - removeAndKeepContent(): Element; - setInnerContent(content: string, options?: ContentOptions): Element; - onEndTag(handler: (tag: EndTag) => void | Promise): void; -} -export interface EndTag { - name: string; - before(content: string, options?: ContentOptions): EndTag; - after(content: string, options?: ContentOptions): EndTag; - remove(): EndTag; -} -export 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; -} -export interface Text { - readonly text: string; - readonly lastInTextNode: boolean; - readonly removed: boolean; - before(content: string, options?: ContentOptions): Text; - after(content: string, options?: ContentOptions): Text; - replace(content: string, options?: ContentOptions): Text; - remove(): Text; -} -export interface DocumentEnd { - append(content: string, options?: ContentOptions): DocumentEnd; -} -export declare abstract class FetchEvent extends ExtendableEvent { - readonly request: Request; - respondWith(promise: Response | Promise): void; - passThroughOnException(): void; -} -export type HeadersInit = - | Headers - | Iterable> - | Record; -export declare class Headers { - constructor(init?: HeadersInit); - get(name: string): string | null; - getAll(name: string): string[]; - getSetCookie(): string[]; - has(name: string): boolean; - set(name: string, value: string): void; - append(name: string, value: string): void; - delete(name: string): void; - forEach( - callback: (this: This, value: string, key: string, parent: Headers) => void, - thisArg?: This - ): void; - entries(): IterableIterator<[key: string, value: string]>; - keys(): IterableIterator; - values(): IterableIterator; - [Symbol.iterator](): IterableIterator<[key: string, value: string]>; -} -export type BodyInit = - | ReadableStream - | string - | ArrayBuffer - | ArrayBufferView - | Blob - | URLSearchParams - | FormData; -export declare abstract class Body { - get body(): ReadableStream | null; - get bodyUsed(): boolean; - arrayBuffer(): Promise; - text(): Promise; - json(): Promise; - formData(): Promise; - blob(): Promise; -} -export declare class Response extends Body { - constructor(body?: BodyInit | null, init?: ResponseInit); - static redirect(url: string, status?: number): Response; - static json(any: any, maybeInit?: ResponseInit | Response): Response; - clone(): Response; - get status(): number; - get statusText(): string; - get headers(): Headers; - get ok(): boolean; - get redirected(): boolean; - get url(): string; - get webSocket(): WebSocket | null; - get cf(): any | undefined; -} -export interface ResponseInit { - status?: number; - statusText?: string; - headers?: HeadersInit; - cf?: any; - webSocket?: WebSocket | null; - encodeBody?: "automatic" | "manual"; -} -export type RequestInfo< - CfHostMetadata = unknown, - Cf = CfProperties -> = Request | string | URL; -export declare class Request< - CfHostMetadata = unknown, - Cf = CfProperties -> extends Body { - constructor(input: RequestInfo, init?: RequestInit); - clone(): Request; - get method(): string; - get url(): string; - get headers(): Headers; - get redirect(): string; - get fetcher(): Fetcher | null; - get signal(): AbortSignal; - get cf(): Cf | undefined; - get integrity(): string; - get keepalive(): boolean; -} -export interface RequestInit { - /** 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 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; -} -export declare abstract class Fetcher { - fetch(input: RequestInfo, init?: RequestInit): Promise; -} -export interface FetcherPutOptions { - expiration?: number; - expirationTtl?: number; -} -export interface KVNamespaceListKey { - name: Key; - expiration?: number; - metadata?: Metadata; -} -export type KVNamespaceListResult = - | { - list_complete: false; - keys: KVNamespaceListKey[]; - cursor: string; - } - | { - list_complete: true; - keys: KVNamespaceListKey[]; - }; -export interface KVNamespace { - get( - key: Key, - options?: Partial> - ): Promise; - get(key: Key, type: "text"): Promise; - get( - key: Key, - type: "json" - ): Promise; - get(key: Key, type: "arrayBuffer"): Promise; - get(key: Key, type: "stream"): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"text"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"json"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"arrayBuffer"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"stream"> - ): Promise; - list( - options?: KVNamespaceListOptions - ): Promise>; - put( - key: Key, - value: string | ArrayBuffer | ArrayBufferView | ReadableStream, - options?: KVNamespacePutOptions - ): Promise; - getWithMetadata( - key: Key, - options?: Partial> - ): Promise>; - getWithMetadata( - key: Key, - type: "text" - ): Promise>; - getWithMetadata( - key: Key, - type: "json" - ): Promise>; - getWithMetadata( - key: Key, - type: "arrayBuffer" - ): Promise>; - getWithMetadata( - key: Key, - type: "stream" - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"text"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"json"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"arrayBuffer"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"stream"> - ): Promise>; - delete(key: Key): Promise; -} -export interface KVNamespaceListOptions { - limit?: number; - prefix?: string | null; - cursor?: string | null; -} -export interface KVNamespaceGetOptions { - type: Type; - cacheTtl?: number; -} -export interface KVNamespacePutOptions { - expiration?: number; - expirationTtl?: number; - metadata?: any | null; -} -export interface KVNamespaceGetWithMetadataResult { - value: Value | null; - metadata: Metadata | null; -} -export interface R2Error extends Error { - readonly name: string; - readonly code: number; - readonly message: string; - readonly action: string; - readonly stack: any; -} -export interface R2ListOptions { - limit?: number; - prefix?: string; - cursor?: string; - delimiter?: string; - startAfter?: string; - include?: ("httpMetadata" | "customMetadata")[]; -} -export declare abstract class R2Bucket { - head(key: string): Promise; - get( - key: string, - options: R2GetOptions & { - onlyIf: R2Conditional | Headers; - } - ): Promise; - get(key: string, options?: R2GetOptions): Promise; - put( - key: string, - value: - | ReadableStream - | ArrayBuffer - | ArrayBufferView - | string - | null - | Blob, - options?: R2PutOptions - ): Promise; - put( - key: string, - value: - | ReadableStream - | ArrayBuffer - | ArrayBufferView - | string - | null - | Blob, - options?: R2PutOptions & { - onlyIf: R2Conditional | Headers; - } - ): Promise; - createMultipartUpload( - key: string, - options?: R2MultipartOptions - ): Promise; - resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload; - delete(keys: string | string[]): Promise; - list(options?: R2ListOptions): Promise; -} -export interface R2MultipartUpload { - readonly key: string; - readonly uploadId: string; - uploadPart( - partNumber: number, - value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob - ): Promise; - abort(): Promise; - complete(uploadedParts: R2UploadedPart[]): Promise; -} -export interface R2UploadedPart { - partNumber: number; - etag: string; -} -export 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; - readonly range?: R2Range; - writeHttpMetadata(headers: Headers): void; -} -export interface R2ObjectBody extends R2Object { - get body(): ReadableStream; - get bodyUsed(): boolean; - arrayBuffer(): Promise; - text(): Promise; - json(): Promise; - blob(): Promise; -} -export type R2Range = - | { - offset: number; - length?: number; - } - | { - offset?: number; - length: number; - } - | { - suffix: number; - }; -export interface R2Conditional { - etagMatches?: string; - etagDoesNotMatch?: string; - uploadedBefore?: Date; - uploadedAfter?: Date; - secondsGranularity?: boolean; -} -export interface R2GetOptions { - onlyIf?: R2Conditional | Headers; - range?: R2Range | Headers; -} -export interface R2PutOptions { - onlyIf?: R2Conditional | Headers; - httpMetadata?: R2HTTPMetadata | Headers; - customMetadata?: Record; - md5?: ArrayBuffer | string; - sha1?: ArrayBuffer | string; - sha256?: ArrayBuffer | string; - sha384?: ArrayBuffer | string; - sha512?: ArrayBuffer | string; -} -export interface R2MultipartOptions { - httpMetadata?: R2HTTPMetadata | Headers; - customMetadata?: Record; -} -export interface R2Checksums { - readonly md5?: ArrayBuffer; - readonly sha1?: ArrayBuffer; - readonly sha256?: ArrayBuffer; - readonly sha384?: ArrayBuffer; - readonly sha512?: ArrayBuffer; - toJSON(): R2StringChecksums; -} -export interface R2StringChecksums { - md5?: string; - sha1?: string; - sha256?: string; - sha384?: string; - sha512?: string; -} -export interface R2HTTPMetadata { - contentType?: string; - contentLanguage?: string; - contentDisposition?: string; - contentEncoding?: string; - cacheControl?: string; - cacheExpiry?: Date; -} -export interface R2Objects { - objects: R2Object[]; - truncated: boolean; - cursor?: string; - delimitedPrefixes: string[]; -} -export declare abstract class ScheduledEvent extends ExtendableEvent { - readonly scheduledTime: number; - readonly cron: string; - noRetry(): void; -} -export interface ScheduledController { - readonly scheduledTime: number; - readonly cron: string; - noRetry(): void; -} -export interface QueuingStrategy { - highWaterMark?: number | bigint; - size?: (chunk: T) => number | bigint; -} -export interface UnderlyingSink { - type?: string; - start?: (controller: WritableStreamDefaultController) => void | Promise; - write?: ( - chunk: W, - controller: WritableStreamDefaultController - ) => void | Promise; - abort?: (reason: any) => void | Promise; - close?: () => void | Promise; -} -export interface UnderlyingByteSource { - type: "bytes"; - autoAllocateChunkSize?: number; - start?: (controller: ReadableByteStreamController) => void | Promise; - pull?: (controller: ReadableByteStreamController) => void | Promise; - cancel?: (reason: any) => void | Promise; -} -export interface UnderlyingSource { - type?: "" | undefined; - start?: ( - controller: ReadableStreamDefaultController - ) => void | Promise; - pull?: ( - controller: ReadableStreamDefaultController - ) => void | Promise; - cancel?: (reason: any) => void | Promise; -} -export interface Transformer { - readableType?: string; - writableType?: string; - start?: ( - controller: TransformStreamDefaultController - ) => void | Promise; - transform?: ( - chunk: I, - controller: TransformStreamDefaultController - ) => void | Promise; - flush?: ( - controller: TransformStreamDefaultController - ) => void | Promise; -} -export interface StreamPipeOptions { - /** - * 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; - preventAbort?: boolean; - preventCancel?: boolean; - signal?: AbortSignal; -} -export type ReadableStreamReadResult = - | { - done: false; - value: R; - } - | { - done: true; - value?: undefined; - }; -/** This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object. */ -export interface ReadableStream { - get locked(): boolean; - cancel(reason?: any): Promise; - getReader(): ReadableStreamDefaultReader; - getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader; - pipeThrough( - transform: ReadableWritablePair, - options?: StreamPipeOptions - ): ReadableStream; - pipeTo( - destination: WritableStream, - options?: StreamPipeOptions - ): Promise; - tee(): [ReadableStream, ReadableStream]; - values(options?: ReadableStreamValuesOptions): AsyncIterableIterator; - [Symbol.asyncIterator]( - options?: ReadableStreamValuesOptions - ): AsyncIterableIterator; -} -export declare const ReadableStream: { - prototype: ReadableStream; - new ( - underlyingSource: UnderlyingByteSource, - strategy?: QueuingStrategy - ): ReadableStream; - new ( - underlyingSource?: UnderlyingSource, - strategy?: QueuingStrategy - ): ReadableStream; -}; -export declare class ReadableStreamDefaultReader { - constructor(stream: ReadableStream); - get closed(): Promise; - cancel(reason?: any): Promise; - read(): Promise>; - releaseLock(): void; -} -export declare class ReadableStreamBYOBReader { - constructor(stream: ReadableStream); - get closed(): Promise; - cancel(reason?: any): Promise; - read( - view: T - ): Promise>; - releaseLock(): void; - readAtLeast( - minElements: number, - view: T - ): Promise>; -} -export interface ReadableStreamGetReaderOptions { - mode: "byob"; -} -export declare abstract class ReadableStreamBYOBRequest { - readonly view: Uint8Array | null; - respond(bytesWritten: number): void; - respondWithNewView(view: ArrayBuffer | ArrayBufferView): void; - readonly atLeast: number | null; -} -export declare abstract class ReadableStreamDefaultController { - readonly desiredSize: number | null; - close(): void; - enqueue(chunk?: R): void; - error(reason: any): void; -} -export declare abstract class ReadableByteStreamController { - readonly byobRequest: ReadableStreamBYOBRequest | null; - readonly desiredSize: number | null; - close(): void; - enqueue(chunk: ArrayBuffer | ArrayBufferView): void; - error(reason: any): void; -} -export declare abstract class WritableStreamDefaultController { - readonly signal: AbortSignal; - error(reason?: any): void; -} -export interface TransformStreamDefaultController { - get desiredSize(): number | null; - enqueue(chunk?: O): void; - error(reason: any): void; - terminate(): void; -} -export interface ReadableWritablePair { - /** - * 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; - readable: ReadableStream; -} -export declare class WritableStream { - constructor( - underlyingSink?: UnderlyingSink, - queuingStrategy?: QueuingStrategy - ); - get locked(): boolean; - abort(reason?: any): Promise; - close(): Promise; - getWriter(): WritableStreamDefaultWriter; -} -export declare class WritableStreamDefaultWriter { - constructor(stream: WritableStream); - get closed(): Promise; - get ready(): Promise; - get desiredSize(): number | null; - abort(reason?: any): Promise; - close(): Promise; - write(chunk?: W): Promise; - releaseLock(): void; -} -export declare class TransformStream { - constructor( - transformer?: Transformer, - writableStrategy?: QueuingStrategy, - readableStrategy?: QueuingStrategy - ); - get readable(): ReadableStream; - get writable(): WritableStream; -} -export declare class FixedLengthStream extends IdentityTransformStream { - constructor(expectedLength: number | bigint); -} -export declare class IdentityTransformStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(); -} -export interface ReadableStreamValuesOptions { - preventCancel?: boolean; -} -export declare class CompressionStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(format: "gzip" | "deflate" | "deflate-raw"); -} -export declare class DecompressionStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(format: "gzip" | "deflate" | "deflate-raw"); -} -export declare class TextEncoderStream extends TransformStream< - string, - Uint8Array -> { - constructor(); -} -export declare class TextDecoderStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - string -> { - constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit); -} -export interface TextDecoderStreamTextDecoderStreamInit { - fatal?: boolean; -} -export declare class ByteLengthQueuingStrategy - implements QueuingStrategy -{ - constructor(init: QueuingStrategyInit); - get highWaterMark(): number; - get size(): (chunk?: any) => number; -} -export declare class CountQueuingStrategy implements QueuingStrategy { - constructor(init: QueuingStrategyInit); - get highWaterMark(): number; - get size(): (chunk?: any) => number; -} -export 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; -} -export declare abstract class TraceEvent extends ExtendableEvent { - readonly traces: TraceItem[]; -} -export interface TraceItem { - readonly event: - | ( - | TraceItemFetchEventInfo - | TraceItemScheduledEventInfo - | TraceItemAlarmEventInfo - | TraceItemQueueEventInfo - | TraceItemEmailEventInfo - | TraceItemCustomEventInfo - ) - | null; - readonly eventTimestamp: number | null; - readonly logs: TraceLog[]; - readonly exceptions: TraceException[]; - readonly scriptName: string | null; - readonly dispatchNamespace?: string; - readonly scriptTags?: string[]; - readonly outcome: string; -} -export interface TraceItemAlarmEventInfo { - readonly scheduledTime: Date; -} -export interface TraceItemCustomEventInfo {} -export interface TraceItemScheduledEventInfo { - readonly scheduledTime: number; - readonly cron: string; -} -export interface TraceItemQueueEventInfo { - readonly queue: string; - readonly batchSize: number; -} -export interface TraceItemEmailEventInfo { - readonly mailFrom: string; - readonly rcptTo: string; - readonly rawSize: number; -} -export interface TraceItemFetchEventInfo { - readonly response?: TraceItemFetchEventInfoResponse; - readonly request: TraceItemFetchEventInfoRequest; -} -export interface TraceItemFetchEventInfoRequest { - readonly cf?: any; - readonly headers: Record; - readonly method: string; - readonly url: string; - getUnredacted(): TraceItemFetchEventInfoRequest; -} -export interface TraceItemFetchEventInfoResponse { - readonly status: number; -} -export interface TraceLog { - readonly timestamp: number; - readonly level: string; - readonly message: any; -} -export interface TraceException { - readonly timestamp: number; - readonly message: string; - readonly name: string; -} -export interface TraceMetrics { - readonly cpuTime: number; - readonly wallTime: number; -} -export interface UnsafeTraceMetrics { - fromTrace(item: TraceItem): TraceMetrics; -} -export declare class URL { - constructor(url: string | URL, base?: string | URL); - get origin(): string; - get href(): string; - set href(value: string); - get protocol(): string; - set protocol(value: string); - get username(): string; - set username(value: string); - get password(): string; - set password(value: string); - get host(): string; - set host(value: string); - get hostname(): string; - set hostname(value: string); - get port(): string; - set port(value: string); - get pathname(): string; - set pathname(value: string); - get search(): string; - set search(value: string); - get hash(): string; - set hash(value: string); - get searchParams(): URLSearchParams; - toJSON(): string; - toString(): string; - static canParse(url: string, base?: string): boolean; -} -export declare class URLSearchParams { - constructor( - init?: Iterable> | Record | string - ); - get size(): number; - append(name: string, value: string): void; - delete(name: string): void; - get(name: string): string | null; - getAll(name: string): string[]; - has(name: string): boolean; - set(name: string, value: string): void; - sort(): void; - entries(): IterableIterator<[key: string, value: string]>; - keys(): IterableIterator; - values(): IterableIterator; - forEach( - callback: ( - this: This, - value: string, - key: string, - parent: URLSearchParams - ) => void, - thisArg?: This - ): void; - toString(): string; - [Symbol.iterator](): IterableIterator<[key: string, value: string]>; -} -export declare class URLPattern { - constructor(input?: string | URLPatternURLPatternInit, baseURL?: string); - get protocol(): string; - get username(): string; - get password(): string; - get hostname(): string; - get port(): string; - get pathname(): string; - get search(): string; - get hash(): string; - test(input?: string | URLPatternURLPatternInit, baseURL?: string): boolean; - exec( - input?: string | URLPatternURLPatternInit, - baseURL?: string - ): URLPatternURLPatternResult | null; -} -export interface URLPatternURLPatternInit { - protocol?: string; - username?: string; - password?: string; - hostname?: string; - port?: string; - pathname?: string; - search?: string; - hash?: string; - baseURL?: string; -} -export interface URLPatternURLPatternComponentResult { - input: string; - groups: Record; -} -export interface URLPatternURLPatternResult { - inputs: (string | URLPatternURLPatternInit)[]; - protocol: URLPatternURLPatternComponentResult; - username: URLPatternURLPatternComponentResult; - password: URLPatternURLPatternComponentResult; - hostname: URLPatternURLPatternComponentResult; - port: URLPatternURLPatternComponentResult; - pathname: URLPatternURLPatternComponentResult; - search: URLPatternURLPatternComponentResult; - hash: URLPatternURLPatternComponentResult; -} -export declare class CloseEvent extends Event { - constructor(type: string, initializer: CloseEventInit); - /** Returns the WebSocket connection close code provided by the server. */ - readonly code: number; - /** Returns the WebSocket connection close reason provided by the server. */ - readonly reason: string; - /** Returns true if the connection closed cleanly; false otherwise. */ - readonly wasClean: boolean; -} -export interface CloseEventInit { - code?: number; - reason?: string; - wasClean?: boolean; -} -export declare class MessageEvent extends Event { - constructor(type: string, initializer: MessageEventInit); - readonly data: ArrayBuffer | string; -} -export interface MessageEventInit { - data: ArrayBuffer | string; -} -/** Events providing information related to errors in scripts or in files. */ -export interface ErrorEvent extends Event { - readonly filename: string; - readonly message: string; - readonly lineno: number; - readonly colno: number; - readonly error: any; -} -export type WebSocketEventMap = { - close: CloseEvent; - message: MessageEvent; - open: Event; - error: ErrorEvent; -}; -export declare class WebSocket extends EventTarget { - constructor(url: string, protocols?: string[] | string); - accept(): void; - send(message: (ArrayBuffer | ArrayBufferView) | string): void; - close(code?: number, reason?: string): void; - static readonly READY_STATE_CONNECTING: number; - static readonly READY_STATE_OPEN: number; - static readonly READY_STATE_CLOSING: number; - static readonly READY_STATE_CLOSED: number; - get readyState(): number; - get url(): string | null; - get protocol(): string | null; - get extensions(): string | null; -} -export declare const WebSocketPair: { - new (): { - 0: WebSocket; - 1: WebSocket; - }; -}; -export interface BasicImageTransformations { - /** - * Maximum width in image pixels. The value must be an integer. - */ - width?: number; - /** - * Maximum height in image pixels. The value must be an integer. - */ - height?: number; - /** - * Resizing mode as a string. It affects interpretation of width and height - * options: - * - scale-down: Similar to contain, but the image is never enlarged. If - * the image is larger than given width or height, it will be resized. - * Otherwise its original size will be kept. - * - contain: Resizes to maximum size that fits within the given width and - * height. If only a single dimension is given (e.g. only width), the - * image will be shrunk or enlarged to exactly match that dimension. - * Aspect ratio is always preserved. - * - cover: Resizes (shrinks or enlarges) to fill the entire area of width - * and height. If the image has an aspect ratio different from the ratio - * of width and height, it will be cropped to fit. - * - crop: The image will be shrunk and cropped to fit within the area - * specified by width and height. The image will not be enlarged. For images - * smaller than the given dimensions it's the same as scale-down. For - * images larger than the given dimensions, it's the same as cover. - * See also trim. - * - pad: Resizes to the maximum size that fits within the given width and - * height, and then fills the remaining area with a background color - * (white by default). Use of this mode is not recommended, as the same - * effect can be more efficiently achieved with the contain mode and the - * CSS object-fit: contain property. - */ - fit?: "scale-down" | "contain" | "cover" | "crop" | "pad"; - /** - * When cropping with fit: "cover", this defines the side or point that should - * be left uncropped. The value is either a string - * "left", "right", "top", "bottom", "auto", or "center" (the default), - * or an object {x, y} containing focal point coordinates in the original - * image expressed as fractions ranging from 0.0 (top or left) to 1.0 - * (bottom or right), 0.5 being the center. {fit: "cover", gravity: "top"} will - * crop bottom or left and right sides as necessary, but won’t crop anything - * from the top. {fit: "cover", gravity: {x:0.5, y:0.2}} will crop each side to - * preserve as much as possible around a point at 20% of the height of the - * source image. - */ - gravity?: - | "left" - | "right" - | "top" - | "bottom" - | "center" - | "auto" - | BasicImageTransformationsGravityCoordinates; - /** - * Background color to add underneath the image. Applies only to images with - * transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…), - * hsl(…), etc.) - */ - background?: string; - /** - * Number of degrees (90, 180, 270) to rotate the image by. width and height - * options refer to axes after rotation. - */ - rotate?: 0 | 90 | 180 | 270 | 360; -} -export interface BasicImageTransformationsGravityCoordinates { - x: number; - y: number; -} -/** - * In addition to the properties you can set in the RequestInit dict - * that you pass as an argument to the Request constructor, you can - * set certain properties of a `cf` object to control how Cloudflare - * features are applied to that new Request. - * - * Note: Currently, these properties cannot be tested in the - * playground. - */ -export interface RequestInitCfProperties extends Record { - cacheEverything?: boolean; - /** - * A request's cache key is what determines if two requests are - * "the same" for caching purposes. If a request has the same cache key - * as some previous request, then we can serve the same cached response for - * both. (e.g. 'some-key') - * - * Only available for Enterprise customers. - */ - cacheKey?: string; - /** - * This allows you to append additional Cache-Tag response headers - * to the origin response without modifications to the origin server. - * This will allow for greater control over the Purge by Cache Tag feature - * utilizing changes only in the Workers process. - * - * Only available for Enterprise customers. - */ - cacheTags?: string[]; - /** - * Force response to be cached for a given number of seconds. (e.g. 300) - */ - cacheTtl?: number; - /** - * Force response to be cached for a given number of seconds based on the Origin status code. - * (e.g. { '200-299': 86400, '404': 1, '500-599': 0 }) - */ - cacheTtlByStatus?: Record; - scrapeShield?: boolean; - apps?: boolean; - image?: RequestInitCfPropertiesImage; - minify?: RequestInitCfPropertiesImageMinify; - mirage?: boolean; - polish?: "lossy" | "lossless" | "off"; - /** - * Redirects the request to an alternate origin server. You can use this, - * for example, to implement load balancing across several origins. - * (e.g.us-east.example.com) - * - * Note - For security reasons, the hostname set in resolveOverride must - * be proxied on the same Cloudflare zone of the incoming request. - * Otherwise, the setting is ignored. CNAME hosts are allowed, so to - * resolve to a host under a different domain or a DNS only domain first - * declare a CNAME record within your own zone’s DNS mapping to the - * external hostname, set proxy on Cloudflare, then set resolveOverride - * to point to that CNAME record. - */ - resolveOverride?: string; -} -export interface RequestInitCfPropertiesImageDraw - extends BasicImageTransformations { - /** - * Absolute URL of the image file to use for the drawing. It can be any of - * the supported file formats. For drawing of watermarks or non-rectangular - * overlays we recommend using PNG or WebP images. - */ - url: string; - /** - * Floating-point number between 0 (transparent) and 1 (opaque). - * For example, opacity: 0.5 makes overlay semitransparent. - */ - opacity?: number; - /** - * - If set to true, the overlay image will be tiled to cover the entire - * area. This is useful for stock-photo-like watermarks. - * - If set to "x", the overlay image will be tiled horizontally only - * (form a line). - * - If set to "y", the overlay image will be tiled vertically only - * (form a line). - */ - repeat?: true | "x" | "y"; - /** - * Position of the overlay image relative to a given edge. Each property is - * an offset in pixels. 0 aligns exactly to the edge. For example, left: 10 - * positions left side of the overlay 10 pixels from the left edge of the - * image it's drawn over. bottom: 0 aligns bottom of the overlay with bottom - * of the background image. - * - * Setting both left & right, or both top & bottom is an error. - * - * If no position is specified, the image will be centered. - */ - top?: number; - left?: number; - bottom?: number; - right?: number; -} -export interface RequestInitCfPropertiesImage - extends BasicImageTransformations { - /** - * Device Pixel Ratio. Default 1. Multiplier for width/height that makes it - * easier to specify higher-DPI sizes in . - */ - dpr?: number; - /** - * An object with four properties {left, top, right, bottom} that specify - * a number of pixels to cut off on each side. Allows removal of borders - * or cutting out a specific fragment of an image. Trimming is performed - * before resizing or rotation. Takes dpr into account. - */ - trim?: { - left?: number; - top?: number; - right?: number; - bottom?: number; - }; - /** - * Quality setting from 1-100 (useful values are in 60-90 range). Lower values - * make images look worse, but load faster. The default is 85. It applies only - * to JPEG and WebP images. It doesn’t have any effect on PNG. - */ - quality?: number; - /** - * Output format to generate. It can be: - * - avif: generate images in AVIF format. - * - webp: generate images in Google WebP format. Set quality to 100 to get - * the WebP-lossless format. - * - json: instead of generating an image, outputs information about the - * image, in JSON format. The JSON object will contain image size - * (before and after resizing), source image’s MIME type, file size, etc. - * - jpeg: generate images in JPEG format. - * - png: generate images in PNG format. - */ - format?: "avif" | "webp" | "json" | "jpeg" | "png"; - /** - * Whether to preserve animation frames from input files. Default is true. - * Setting it to false reduces animations to still images. This setting is - * recommended when enlarging images or processing arbitrary user content, - * because large GIF animations can weigh tens or even hundreds of megabytes. - * It is also useful to set anim:false when using format:"json" to get the - * response quicker without the number of frames. - */ - anim?: boolean; - /** - * What EXIF data should be preserved in the output image. Note that EXIF - * rotation and embedded color profiles are always applied ("baked in" into - * the image), and aren't affected by this option. Note that if the Polish - * feature is enabled, all metadata may have been removed already and this - * option may have no effect. - * - keep: Preserve most of EXIF metadata, including GPS location if there's - * any. - * - copyright: Only keep the copyright tag, and discard everything else. - * This is the default behavior for JPEG files. - * - none: Discard all invisible EXIF metadata. Currently WebP and PNG - * output formats always discard metadata. - */ - metadata?: "keep" | "copyright" | "none"; - /** - * Strength of sharpening filter to apply to the image. Floating-point - * number between 0 (no sharpening, default) and 10 (maximum). 1.0 is a - * recommended value for downscaled images. - */ - sharpen?: number; - /** - * Radius of a blur filter (approximate gaussian). Maximum supported radius - * is 250. - */ - blur?: number; - /** - * Overlays are drawn in the order they appear in the array (last array - * entry is the topmost layer). - */ - draw?: RequestInitCfPropertiesImageDraw[]; - /** - * Fetching image from authenticated origin. Setting this property will - * pass authentication headers (Authorization, Cookie, etc.) through to - * the origin. - */ - "origin-auth"?: "share-publicly"; - /** - * Adds a border around the image. The border is added after resizing. Border - * width takes dpr into account, and can be specified either using a single - * width property, or individually for each side. - */ - border?: - | { - color: string; - width: number; - } - | { - color: string; - top: number; - right: number; - bottom: number; - left: number; - }; - /** - * Increase brightness by a factor. A value of 1.0 equals no change, a value - * of 0.5 equals half brightness, and a value of 2.0 equals twice as bright. - * 0 is ignored. - */ - brightness?: number; - /** - * Increase contrast by a factor. A value of 1.0 equals no change, a value of - * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is - * ignored. - */ - contrast?: number; - /** - * Increase exposure by a factor. A value of 1.0 equals no change, a value of - * 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored. - */ - gamma?: number; - /** - * Slightly reduces latency on a cache miss by selecting a - * quickest-to-compress file format, at a cost of increased file size and - * lower image quality. It will usually override the format option and choose - * JPEG over WebP or AVIF. We do not recommend using this option, except in - * unusual circumstances like resizing uncacheable dynamically-generated - * images. - */ - compression?: "fast"; -} -export interface RequestInitCfPropertiesImageMinify { - javascript?: boolean; - css?: boolean; - html?: boolean; -} -/** - * Request metadata provided by Cloudflare's edge. - */ -export type IncomingRequestCfProperties = - IncomingRequestCfPropertiesBase & - IncomingRequestCfPropertiesBotManagementEnterprise & - IncomingRequestCfPropertiesCloudflareForSaaSEnterprise & - IncomingRequestCfPropertiesGeographicInformation & - IncomingRequestCfPropertiesCloudflareAccessOrApiShield; -export interface IncomingRequestCfPropertiesBase - extends Record { - /** - * [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request. - * - * @example 395747 - */ - asn: number; - /** - * The organization which owns the ASN of the incoming request. - * - * @example "Google Cloud" - */ - asOrganization: string; - /** - * The original value of the `Accept-Encoding` header if Cloudflare modified it. - * - * @example "gzip, deflate, br" - */ - clientAcceptEncoding?: string; - /** - * The number of milliseconds it took for the request to reach your worker. - * - * @example 22 - */ - clientTcpRtt?: number; - /** - * The three-letter [IATA](https://en.wikipedia.org/wiki/IATA_airport_code) - * airport code of the data center that the request hit. - * - * @example "DFW" - */ - colo: string; - /** - * Represents the upstream's response to a - * [TCP `keepalive` message](https://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html) - * from cloudflare. - * - * For workers with no upstream, this will always be `1`. - * - * @example 3 - */ - edgeRequestKeepAliveStatus: IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus; - /** - * The HTTP Protocol the request used. - * - * @example "HTTP/2" - */ - httpProtocol: string; - /** - * The browser-requested prioritization information in the request object. - * - * If no information was set, defaults to the empty string `""` - * - * @example "weight=192;exclusive=0;group=3;group-weight=127" - * @default "" - */ - requestPriority: string; - /** - * The TLS version of the connection to Cloudflare. - * In requests served over plaintext (without TLS), this property is the empty string `""`. - * - * @example "TLSv1.3" - */ - tlsVersion: string; - /** - * The cipher for the connection to Cloudflare. - * In requests served over plaintext (without TLS), this property is the empty string `""`. - * - * @example "AEAD-AES128-GCM-SHA256" - */ - tlsCipher: string; - /** - * Metadata containing the [`HELLO`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2) and [`FINISHED`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9) messages from this request's TLS handshake. - * - * If the incoming request was served over plaintext (without TLS) this field is undefined. - */ - tlsExportedAuthenticator?: IncomingRequestCfPropertiesExportedAuthenticatorMetadata; -} -export interface IncomingRequestCfPropertiesBotManagementBase { - /** - * Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot, - * represented as an integer percentage between `1` (almost certainly human) - * and `99` (almost certainly a bot). - * - * @example 54 - */ - score: number; - /** - * A boolean value that is true if the request comes from a good bot, like Google or Bing. - * Most customers choose to allow this traffic. For more details, see [Traffic from known bots](https://developers.cloudflare.com/firewall/known-issues-and-faq/#how-does-firewall-rules-handle-traffic-from-known-bots). - */ - verifiedBot: boolean; - /** - * A boolean value that is true if the request originates from a - * Cloudflare-verified proxy service. - */ - corporateProxy: boolean; - /** - * A boolean value that's true if the request matches [file extensions](https://developers.cloudflare.com/bots/reference/static-resources/) for many types of static resources. - */ - staticResource: boolean; - /** - * List of IDs that correlate to the Bot Management heuristic detections made on a request (you can have multiple heuristic detections on the same request). - */ - detectionIds: number[]; -} -export interface IncomingRequestCfPropertiesBotManagement { - /** - * Results of Cloudflare's Bot Management analysis - */ - botManagement: IncomingRequestCfPropertiesBotManagementBase; - /** - * Duplicate of `botManagement.score`. - * - * @deprecated - */ - clientTrustScore: number; -} -export interface IncomingRequestCfPropertiesBotManagementEnterprise - extends IncomingRequestCfPropertiesBotManagement { - /** - * Results of Cloudflare's Bot Management analysis - */ - botManagement: IncomingRequestCfPropertiesBotManagementBase & { - /** - * A [JA3 Fingerprint](https://developers.cloudflare.com/bots/concepts/ja3-fingerprint/) to help profile specific SSL/TLS clients - * across different destination IPs, Ports, and X509 certificates. - */ - ja3Hash: string; - }; -} -export interface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise< - HostMetadata -> { - /** - * Custom metadata set per-host in [Cloudflare for SaaS](https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/). - * - * This field is only present if you have Cloudflare for SaaS enabled on your account - * and you have followed the [required steps to enable it]((https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/domain-support/custom-metadata/)). - */ - hostMetadata: HostMetadata; -} -export interface IncomingRequestCfPropertiesCloudflareAccessOrApiShield { - /** - * Information about the client certificate presented to Cloudflare. - * - * This is populated when the incoming request is served over TLS using - * either Cloudflare Access or API Shield (mTLS) - * and the presented SSL certificate has a valid - * [Certificate Serial Number](https://ldapwiki.com/wiki/Certificate%20Serial%20Number) - * (i.e., not `null` or `""`). - * - * Otherwise, a set of placeholder values are used. - * - * The property `certPresented` will be set to `"1"` when - * the object is populated (i.e. the above conditions were met). - */ - tlsClientAuth: - | IncomingRequestCfPropertiesTLSClientAuth - | IncomingRequestCfPropertiesTLSClientAuthPlaceholder; -} -/** - * Metadata about the request's TLS handshake - */ -export interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata { - /** - * The client's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal - * - * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d" - */ - clientHandshake: string; - /** - * The server's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal - * - * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d" - */ - serverHandshake: string; - /** - * The client's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal - * - * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b" - */ - clientFinished: string; - /** - * The server's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal - * - * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b" - */ - serverFinished: string; -} -/** - * Geographic data about the request's origin. - */ -export interface IncomingRequestCfPropertiesGeographicInformation { - /** - * The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from. - * - * If your worker is [configured to accept TOR connections](https://support.cloudflare.com/hc/en-us/articles/203306930-Understanding-Cloudflare-Tor-support-and-Onion-Routing), this may also be `"T1"`, indicating a request that originated over TOR. - * - * If Cloudflare is unable to determine where the request originated this property is omitted. - * - * The country code `"T1"` is used for requests originating on TOR. - * - * @example "GB" - */ - country?: Iso3166Alpha2Code | "T1"; - /** - * If present, this property indicates that the request originated in the EU - * - * @example "1" - */ - isEUCountry?: "1"; - /** - * A two-letter code indicating the continent the request originated from. - * - * @example "AN" - */ - continent?: ContinentCode; - /** - * The city the request originated from - * - * @example "Austin" - */ - city?: string; - /** - * Postal code of the incoming request - * - * @example "78701" - */ - postalCode?: string; - /** - * Latitude of the incoming request - * - * @example "30.27130" - */ - latitude?: string; - /** - * Longitude of the incoming request - * - * @example "-97.74260" - */ - longitude?: string; - /** - * Timezone of the incoming request - * - * @example "America/Chicago" - */ - timezone?: string; - /** - * If known, the ISO 3166-2 name for the first level region associated with - * the IP address of the incoming request - * - * @example "Texas" - */ - region?: string; - /** - * If known, the ISO 3166-2 code for the first-level region associated with - * the IP address of the incoming request - * - * @example "TX" - */ - regionCode?: string; - /** - * Metro code (DMA) of the incoming request - * - * @example "635" - */ - metroCode?: string; -} -/** Data about the incoming request's TLS certificate */ -export interface IncomingRequestCfPropertiesTLSClientAuth { - /** Always `"1"`, indicating that the certificate was presented */ - certPresented: "1"; - /** - * Result of certificate verification. - * - * @example "FAILED:self signed certificate" - */ - certVerified: Exclude; - /** The presented certificate's revokation status. - * - * - A value of `"1"` indicates the certificate has been revoked - * - A value of `"0"` indicates the certificate has not been revoked - */ - certRevoked: "1" | "0"; - /** - * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) - * - * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certIssuerDN: string; - /** - * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) - * - * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certSubjectDN: string; - /** - * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted) - * - * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certIssuerDNRFC2253: string; - /** - * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted) - * - * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certSubjectDNRFC2253: string; - /** The certificate issuer's distinguished name (legacy policies) */ - certIssuerDNLegacy: string; - /** The certificate subject's distinguished name (legacy policies) */ - certSubjectDNLegacy: string; - /** - * The certificate's serial number - * - * @example "00936EACBE07F201DF" - */ - certSerial: string; - /** - * The certificate issuer's serial number - * - * @example "2489002934BDFEA34" - */ - certIssuerSerial: string; - /** - * The certificate's Subject Key Identifier - * - * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4" - */ - certSKI: string; - /** - * The certificate issuer's Subject Key Identifier - * - * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4" - */ - certIssuerSKI: string; - /** - * The certificate's SHA-1 fingerprint - * - * @example "6b9109f323999e52259cda7373ff0b4d26bd232e" - */ - certFingerprintSHA1: string; - /** - * The certificate's SHA-256 fingerprint - * - * @example "acf77cf37b4156a2708e34c4eb755f9b5dbbe5ebb55adfec8f11493438d19e6ad3f157f81fa3b98278453d5652b0c1fd1d71e5695ae4d709803a4d3f39de9dea" - */ - certFingerprintSHA256: string; - /** - * The effective starting date of the certificate - * - * @example "Dec 22 19:39:00 2018 GMT" - */ - certNotBefore: string; - /** - * The effective expiration date of the certificate - * - * @example "Dec 22 19:39:00 2018 GMT" - */ - certNotAfter: string; -} -/** Placeholder values for TLS Client Authorization */ -export interface IncomingRequestCfPropertiesTLSClientAuthPlaceholder { - certPresented: "0"; - certVerified: "NONE"; - certRevoked: "0"; - certIssuerDN: ""; - certSubjectDN: ""; - certIssuerDNRFC2253: ""; - certSubjectDNRFC2253: ""; - certIssuerDNLegacy: ""; - certSubjectDNLegacy: ""; - certSerial: ""; - certIssuerSerial: ""; - certSKI: ""; - certIssuerSKI: ""; - certFingerprintSHA1: ""; - certFingerprintSHA256: ""; - certNotBefore: ""; - certNotAfter: ""; -} -/** Possible outcomes of TLS verification */ -export type CertVerificationStatus = - /** Authentication succeeded */ - | "SUCCESS" - /** No certificate was presented */ - | "NONE" - /** Failed because the certificate was self-signed */ - | "FAILED:self signed certificate" - /** Failed because the certificate failed a trust chain check */ - | "FAILED:unable to verify the first certificate" - /** Failed because the certificate not yet valid */ - | "FAILED:certificate is not yet valid" - /** Failed because the certificate is expired */ - | "FAILED:certificate has expired" - /** Failed for another unspecified reason */ - | "FAILED"; -/** - * An upstream endpoint's response to a TCP `keepalive` message from Cloudflare. - */ -export type IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus = - | 0 /** Unknown */ - | 1 /** no keepalives (not found) */ - | 2 /** no connection re-use, opening keepalive connection failed */ - | 3 /** no connection re-use, keepalive accepted and saved */ - | 4 /** connection re-use, refused by the origin server (`TCP FIN`) */ - | 5; /** connection re-use, accepted by the origin server */ -/** ISO 3166-1 Alpha-2 codes */ -export type Iso3166Alpha2Code = - | "AD" - | "AE" - | "AF" - | "AG" - | "AI" - | "AL" - | "AM" - | "AO" - | "AQ" - | "AR" - | "AS" - | "AT" - | "AU" - | "AW" - | "AX" - | "AZ" - | "BA" - | "BB" - | "BD" - | "BE" - | "BF" - | "BG" - | "BH" - | "BI" - | "BJ" - | "BL" - | "BM" - | "BN" - | "BO" - | "BQ" - | "BR" - | "BS" - | "BT" - | "BV" - | "BW" - | "BY" - | "BZ" - | "CA" - | "CC" - | "CD" - | "CF" - | "CG" - | "CH" - | "CI" - | "CK" - | "CL" - | "CM" - | "CN" - | "CO" - | "CR" - | "CU" - | "CV" - | "CW" - | "CX" - | "CY" - | "CZ" - | "DE" - | "DJ" - | "DK" - | "DM" - | "DO" - | "DZ" - | "EC" - | "EE" - | "EG" - | "EH" - | "ER" - | "ES" - | "ET" - | "FI" - | "FJ" - | "FK" - | "FM" - | "FO" - | "FR" - | "GA" - | "GB" - | "GD" - | "GE" - | "GF" - | "GG" - | "GH" - | "GI" - | "GL" - | "GM" - | "GN" - | "GP" - | "GQ" - | "GR" - | "GS" - | "GT" - | "GU" - | "GW" - | "GY" - | "HK" - | "HM" - | "HN" - | "HR" - | "HT" - | "HU" - | "ID" - | "IE" - | "IL" - | "IM" - | "IN" - | "IO" - | "IQ" - | "IR" - | "IS" - | "IT" - | "JE" - | "JM" - | "JO" - | "JP" - | "KE" - | "KG" - | "KH" - | "KI" - | "KM" - | "KN" - | "KP" - | "KR" - | "KW" - | "KY" - | "KZ" - | "LA" - | "LB" - | "LC" - | "LI" - | "LK" - | "LR" - | "LS" - | "LT" - | "LU" - | "LV" - | "LY" - | "MA" - | "MC" - | "MD" - | "ME" - | "MF" - | "MG" - | "MH" - | "MK" - | "ML" - | "MM" - | "MN" - | "MO" - | "MP" - | "MQ" - | "MR" - | "MS" - | "MT" - | "MU" - | "MV" - | "MW" - | "MX" - | "MY" - | "MZ" - | "NA" - | "NC" - | "NE" - | "NF" - | "NG" - | "NI" - | "NL" - | "NO" - | "NP" - | "NR" - | "NU" - | "NZ" - | "OM" - | "PA" - | "PE" - | "PF" - | "PG" - | "PH" - | "PK" - | "PL" - | "PM" - | "PN" - | "PR" - | "PS" - | "PT" - | "PW" - | "PY" - | "QA" - | "RE" - | "RO" - | "RS" - | "RU" - | "RW" - | "SA" - | "SB" - | "SC" - | "SD" - | "SE" - | "SG" - | "SH" - | "SI" - | "SJ" - | "SK" - | "SL" - | "SM" - | "SN" - | "SO" - | "SR" - | "SS" - | "ST" - | "SV" - | "SX" - | "SY" - | "SZ" - | "TC" - | "TD" - | "TF" - | "TG" - | "TH" - | "TJ" - | "TK" - | "TL" - | "TM" - | "TN" - | "TO" - | "TR" - | "TT" - | "TV" - | "TW" - | "TZ" - | "UA" - | "UG" - | "UM" - | "US" - | "UY" - | "UZ" - | "VA" - | "VC" - | "VE" - | "VG" - | "VI" - | "VN" - | "VU" - | "WF" - | "WS" - | "YE" - | "YT" - | "ZA" - | "ZM" - | "ZW"; -/** The 2-letter continent codes Cloudflare uses */ -export type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA"; -export type CfProperties = - | IncomingRequestCfProperties - | RequestInitCfProperties; -export interface D1Result { - results?: T[]; - success: boolean; - error?: string; - meta: any; -} -export declare abstract class D1Database { - prepare(query: string): D1PreparedStatement; - dump(): Promise; - batch(statements: D1PreparedStatement[]): Promise[]>; - exec(query: string): Promise>; -} -export declare abstract class D1PreparedStatement { - bind(...values: any[]): D1PreparedStatement; - first(colName?: string): Promise; - run(): Promise>; - all(): Promise>; - raw(): Promise; -} -/** - * A email message that is sent to a consumer Worker. - */ -export interface EmailMessage { - /** - * Envelope From attribute of the email message. - */ - readonly from: string; - /** - * Envelope To attribute of the email message. - */ - readonly to: string; - /** - * A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers). - */ - readonly headers: Headers; - /** - * Stream of the email message content. - */ - readonly raw: ReadableStream; - /** - * Size of the email message content. - */ - readonly rawSize: number; - /** - * Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason. - * @param reason The reject reason. - * @returns void - */ - setReject(reason: string): void; - /** - * Forward this email message to a verified destination address of the account. - * @param rcptTo Verified destination address. - * @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers). - * @returns A promise that resolves when the email message is forwarded. - */ - forward(rcptTo: string, headers?: Headers): Promise; -} -export declare abstract class EmailEvent extends ExtendableEvent { - readonly message: EmailMessage; -} -export type EmailExportedHandler = ( - message: EmailMessage, - env: Env, - ctx: ExecutionContext -) => void | Promise; -export type Params

= Record; -export type EventContext = { - request: Request; - functionPath: string; - waitUntil: (promise: Promise) => void; - passThroughOnException: () => void; - next: (input?: Request | string, init?: RequestInit) => Promise; - env: Env & { - ASSETS: { - fetch: typeof fetch; - }; - }; - params: Params

; - data: Data; -}; -export type PagesFunction< - Env = unknown, - Params extends string = any, - Data extends Record = Record -> = (context: EventContext) => Response | Promise; -export type EventPluginContext = { - request: Request; - functionPath: string; - waitUntil: (promise: Promise) => void; - passThroughOnException: () => void; - next: (input?: Request | string, init?: RequestInit) => Promise; - env: Env & { - ASSETS: { - fetch: typeof fetch; - }; - }; - params: Params

; - data: Data; - pluginArgs: PluginArgs; -}; -export type PagesPluginFunction< - Env = unknown, - Params extends string = any, - Data extends Record = Record, - PluginArgs = unknown -> = ( - context: EventPluginContext -) => Response | Promise; -// https://developers.cloudflare.com/pub-sub/ -// PubSubMessage represents an incoming PubSub message. -// The message includes metadata about the broker, the client, and the payload -// itself. -export interface PubSubMessage { - // Message ID - readonly mid: number; - // MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT - readonly broker: string; - // The MQTT topic the message was sent on. - readonly topic: string; - // The client ID of the client that published this message. - readonly clientId: string; - // The unique identifier (JWT ID) used by the client to authenticate, if token - // auth was used. - readonly jti?: string; - // A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker - // received the message from the client. - readonly receivedAt: number; - // An (optional) string with the MIME type of the payload, if set by the - // client. - readonly contentType: string; - // Set to 1 when the payload is a UTF-8 string - // https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063 - readonly payloadFormatIndicator: number; - // Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays. - // You can use payloadFormatIndicator to inspect this before decoding. - payload: string | Uint8Array; -} -// JsonWebKey extended by kid parameter -export interface JsonWebKeyWithKid extends JsonWebKey { - // Key Identifier of the JWK - readonly kid: string; -} -/** - * A message that is sent to a consumer Worker. - */ -export interface Message { - /** - * A unique, system-generated ID for the message. - */ - readonly id: string; - /** - * A timestamp when the message was sent. - */ - readonly timestamp: Date; - /** - * The body of the message. - */ - readonly body: Body; - /** - * Marks message to be retried. - */ - retry(): void; - /** - * Marks message acknowledged. - */ - ack(): void; -} -/** - * A batch of messages that are sent to a consumer Worker. - */ -export interface MessageBatch { - /** - * The name of the Queue that belongs to this batch. - */ - readonly queue: string; - /** - * An array of messages in the batch. Ordering of messages is not guaranteed. - */ - readonly messages: readonly Message[]; - /** - * Marks every message to be retried in the next batch. - */ - retryAll(): void; - /** - * Marks every message acknowledged in the batch. - */ - ackAll(): void; -} -/** - * A wrapper class used to structure message batches. - */ -export type MessageSendRequest = { - /** - * The body of the message. - */ - body: Body; -}; -/** - * A binding that allows a producer to send messages to a Queue. - */ -export interface Queue { - /** - * Sends a message to the Queue. - * @param message The message can be any type supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types), as long as its size is less than 128 KB. - * @returns A promise that resolves when the message is confirmed to be written to disk. - */ - send(message: Body): Promise; - /** - * Sends a batch of messages to the Queue. - * @param messages Each item in the input must be supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types). A batch can contain up to 100 messages, though items are limited to 128 KB each, and the total size of the array cannot exceed 256 KB. - * @returns A promise that resolves when the messages are confirmed to be written to disk. - */ - sendBatch(messages: Iterable>): Promise; -} diff --git a/packages/denylist_bot/node_modules/@cloudflare/workers-types/index.d.ts b/packages/denylist_bot/node_modules/@cloudflare/workers-types/index.d.ts deleted file mode 100755 index f435510e5..000000000 --- a/packages/denylist_bot/node_modules/@cloudflare/workers-types/index.d.ts +++ /dev/null @@ -1,2990 +0,0 @@ -/*! ***************************************************************************** -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 class DOMException extends Error { - constructor(message?: string, name?: string); - readonly message: string; - readonly name: string; - readonly code: number; - readonly stack: any; - 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; -} -declare type WorkerGlobalScopeEventMap = { - fetch: FetchEvent; - scheduled: ScheduledEvent; - unhandledrejection: PromiseRejectionEvent; - rejectionhandled: PromiseRejectionEvent; -}; -declare abstract class WorkerGlobalScope extends EventTarget { - EventTarget: typeof EventTarget; -} -declare interface Console { - "assert"(condition?: boolean, ...data: any[]): void; - clear(): void; - count(label?: string): void; - countReset(label?: string): void; - debug(...data: any[]): void; - dir(item?: any, options?: any): void; - dirxml(...data: any[]): void; - error(...data: any[]): void; - group(...data: any[]): void; - groupCollapsed(...data: any[]): void; - groupEnd(): void; - info(...data: any[]): void; - log(...data: any[]): void; - table(tabularData?: any, properties?: string[]): void; - time(label?: string): void; - timeEnd(label?: string): void; - timeLog(label?: string, ...data: any[]): void; - timeStamp(label?: string): void; - trace(...data: any[]): void; - warn(...data: any[]): void; -} -declare const console: Console; -declare type BufferSource = ArrayBufferView | ArrayBuffer; -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; - type Imports = Record; - type ExportValue = Function | Global | Memory | Table; - type Exports = Record; - 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; - function validate(bytes: BufferSource): boolean; -} -/** This ServiceWorker API interface represents the global execution context of a service worker. */ -declare 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( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args - ): number; - clearTimeout(timeoutId: number | null): void; - setInterval(callback: (...args: any[]) => void, msDelay?: number): number; - setInterval( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args - ): number; - clearInterval(timeoutId: number | null): void; - queueMicrotask(task: Function): void; - structuredClone(value: T, options?: StructuredSerializeOptions): T; - fetch( - input: RequestInfo, - init?: RequestInit - ): Promise; - self: ServiceWorkerGlobalScope; - crypto: Crypto; - caches: CacheStorage; - scheduler: Scheduler; - Event: typeof Event; - ExtendableEvent: typeof ExtendableEvent; - PromiseRejectionEvent: typeof PromiseRejectionEvent; - FetchEvent: typeof FetchEvent; - TraceEvent: typeof TraceEvent; - 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; - 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; - AbortController: typeof AbortController; - AbortSignal: typeof AbortSignal; - TextDecoder: typeof TextDecoder; - TextEncoder: typeof TextEncoder; - 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: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetAddEventListenerOptions | boolean -): void; -declare function removeEventListener< - Type extends keyof WorkerGlobalScopeEventMap ->( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetEventListenerOptions | boolean -): void; -/** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */ -declare function dispatchEvent( - event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap] -): boolean; -declare function btoa(data: string): string; -declare function atob(data: string): string; -declare function setTimeout( - callback: (...args: any[]) => void, - msDelay?: number -): number; -declare function setTimeout( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args -): number; -declare function clearTimeout(timeoutId: number | null): void; -declare function setInterval( - callback: (...args: any[]) => void, - msDelay?: number -): number; -declare function setInterval( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args -): number; -declare function clearInterval(timeoutId: number | null): void; -declare function queueMicrotask(task: Function): void; -declare function structuredClone( - value: T, - options?: StructuredSerializeOptions -): T; -declare function fetch( - input: RequestInfo, - init?: RequestInit -): Promise; -declare const self: ServiceWorkerGlobalScope; -declare const crypto: Crypto; -declare const caches: CacheStorage; -declare const scheduler: Scheduler; -declare interface TestController {} -declare interface ExecutionContext { - waitUntil(promise: Promise): void; - passThroughOnException(): void; -} -declare type ExportedHandlerFetchHandler< - Env = unknown, - CfHostMetadata = unknown -> = ( - request: Request>, - env: Env, - ctx: ExecutionContext -) => Response | Promise; -declare type ExportedHandlerTraceHandler = ( - traces: TraceItem[], - env: Env, - ctx: ExecutionContext -) => void | Promise; -declare type ExportedHandlerScheduledHandler = ( - controller: ScheduledController, - env: Env, - ctx: ExecutionContext -) => void | Promise; -declare type ExportedHandlerQueueHandler = ( - batch: MessageBatch, - env: Env, - ctx: ExecutionContext -) => void | Promise; -declare type ExportedHandlerTestHandler = ( - controller: TestController, - env: Env, - ctx: ExecutionContext -) => void | Promise; -declare interface ExportedHandler< - Env = unknown, - QueueMessage = unknown, - CfHostMetadata = unknown -> { - fetch?: ExportedHandlerFetchHandler; - trace?: ExportedHandlerTraceHandler; - scheduled?: ExportedHandlerScheduledHandler; - test?: ExportedHandlerTestHandler; - queue?: ExportedHandlerQueueHandler; -} -declare interface StructuredSerializeOptions { - transfer?: any[]; -} -declare abstract class PromiseRejectionEvent extends Event { - readonly promise: Promise; - readonly reason: any; -} -declare interface DurableObject { - fetch(request: Request): Response | Promise; - alarm?(): void | Promise; -} -declare interface DurableObjectStub extends Fetcher { - readonly id: DurableObjectId; - readonly name?: string; -} -declare interface DurableObjectId { - toString(): string; - equals(other: DurableObjectId): boolean; - readonly name?: string; -} -declare interface DurableObjectNamespace { - newUniqueId( - options?: DurableObjectNamespaceNewUniqueIdOptions - ): DurableObjectId; - idFromName(name: string): DurableObjectId; - idFromString(id: string): DurableObjectId; - get( - id: DurableObjectId, - options?: DurableObjectNamespaceGetDurableObjectOptions - ): DurableObjectStub; - jurisdiction(jurisdiction: string): DurableObjectNamespace; -} -declare interface DurableObjectNamespaceNewUniqueIdOptions { - jurisdiction?: string; -} -declare interface DurableObjectNamespaceGetDurableObjectOptions { - locationHint?: string; -} -declare interface DurableObjectState { - waitUntil(promise: Promise): void; - readonly id: DurableObjectId; - readonly storage: DurableObjectStorage; - blockConcurrencyWhile(callback: () => Promise): Promise; -} -declare interface DurableObjectTransaction { - get( - key: string, - options?: DurableObjectGetOptions - ): Promise; - get( - keys: string[], - options?: DurableObjectGetOptions - ): Promise>; - list( - options?: DurableObjectListOptions - ): Promise>; - put( - key: string, - value: T, - options?: DurableObjectPutOptions - ): Promise; - put( - entries: Record, - options?: DurableObjectPutOptions - ): Promise; - delete(key: string, options?: DurableObjectPutOptions): Promise; - delete(keys: string[], options?: DurableObjectPutOptions): Promise; - rollback(): void; - getAlarm(options?: DurableObjectGetAlarmOptions): Promise; - setAlarm( - scheduledTime: number | Date, - options?: DurableObjectSetAlarmOptions - ): Promise; - deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise; -} -declare interface DurableObjectStorage { - get( - key: string, - options?: DurableObjectGetOptions - ): Promise; - get( - keys: string[], - options?: DurableObjectGetOptions - ): Promise>; - list( - options?: DurableObjectListOptions - ): Promise>; - put( - key: string, - value: T, - options?: DurableObjectPutOptions - ): Promise; - put( - entries: Record, - options?: DurableObjectPutOptions - ): Promise; - delete(key: string, options?: DurableObjectPutOptions): Promise; - delete(keys: string[], options?: DurableObjectPutOptions): Promise; - deleteAll(options?: DurableObjectPutOptions): Promise; - transaction( - closure: (txn: DurableObjectTransaction) => Promise - ): Promise; - getAlarm(options?: DurableObjectGetAlarmOptions): Promise; - setAlarm( - scheduledTime: number | Date, - options?: DurableObjectSetAlarmOptions - ): Promise; - deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise; - sync(): Promise; -} -declare interface DurableObjectListOptions { - start?: string; - startAfter?: string; - end?: string; - prefix?: string; - reverse?: boolean; - limit?: number; - allowConcurrency?: boolean; - noCache?: boolean; -} -declare interface DurableObjectGetOptions { - allowConcurrency?: boolean; - noCache?: boolean; -} -declare interface DurableObjectGetAlarmOptions { - allowConcurrency?: boolean; -} -declare interface DurableObjectPutOptions { - allowConcurrency?: boolean; - allowUnconfirmed?: boolean; - noCache?: boolean; -} -declare interface DurableObjectSetAlarmOptions { - allowConcurrency?: boolean; - allowUnconfirmed?: boolean; -} -declare interface AnalyticsEngineDataset { - writeDataPoint(event?: AnalyticsEngineDataPoint): void; -} -declare interface AnalyticsEngineDataPoint { - indexes?: ((ArrayBuffer | string) | null)[]; - doubles?: number[]; - blobs?: ((ArrayBuffer | string) | null)[]; -} -declare class Event { - constructor(type: string, init?: EventInit); - /** Returns the type of event, e.g. "click", "hashchange", or "submit". */ - readonly type: string; - /** Returns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE. */ - readonly eventPhase: number; - /** Returns true or false depending on how event was initialized. True if event invokes listeners past a ShadowRoot node that is the root of its target, and false otherwise. */ - readonly composed: boolean; - /** Returns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise. */ - readonly bubbles: boolean; - /** Returns true or false depending on how event was initialized. Its return value does not always carry meaning, but true can indicate that part of the operation during which event was dispatched, can be canceled by invoking the preventDefault() method. */ - readonly cancelable: boolean; - /** Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise. */ - readonly defaultPrevented: boolean; - /** @deprecated */ - readonly returnValue: boolean; - /** Returns the object whose event listener's callback is currently being invoked. */ - readonly currentTarget?: EventTarget; - /** @deprecated */ - readonly srcElement?: EventTarget; - /** Returns the event's timestamp as the number of milliseconds measured relative to the time origin. */ - readonly timeStamp: number; - /** Returns true if event was dispatched by the user agent, and false otherwise. */ - readonly isTrusted: boolean; - cancelBubble: boolean; - stopImmediatePropagation(): void; - preventDefault(): void; - stopPropagation(): void; - composedPath(): EventTarget[]; - static readonly NONE: number; - static readonly CAPTURING_PHASE: number; - static readonly AT_TARGET: number; - static readonly BUBBLING_PHASE: number; -} -declare interface EventInit { - bubbles?: boolean; - cancelable?: boolean; - composed?: boolean; -} -declare type EventListener = ( - event: EventType -) => void; -declare interface EventListenerObject { - handleEvent(event: EventType): void; -} -declare type EventListenerOrEventListenerObject< - EventType extends Event = Event -> = EventListener | EventListenerObject; -declare class EventTarget< - EventMap extends Record = Record -> { - constructor(); - addEventListener( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetAddEventListenerOptions | boolean - ): void; - removeEventListener( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetEventListenerOptions | boolean - ): void; - dispatchEvent(event: EventMap[keyof EventMap]): boolean; -} -declare interface EventTargetEventListenerOptions { - capture?: boolean; -} -declare interface EventTargetAddEventListenerOptions { - capture?: boolean; - passive?: boolean; - once?: boolean; - signal?: AbortSignal; -} -declare interface EventTargetHandlerObject { - handleEvent: (event: Event) => any | undefined; -} -declare class AbortController { - constructor(); - /** Returns the AbortSignal object associated with this object. */ - readonly signal: AbortSignal; - abort(reason?: any): void; -} -declare abstract class AbortSignal extends EventTarget { - static abort(reason?: any): AbortSignal; - static timeout(delay: number): AbortSignal; - /** Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. */ - readonly aborted: boolean; - readonly reason: any; - throwIfAborted(): void; -} -declare interface Scheduler { - wait(delay: number, maybeOptions?: SchedulerWaitOptions): Promise; -} -declare interface SchedulerWaitOptions { - signal?: AbortSignal; -} -declare abstract class ExtendableEvent extends Event { - waitUntil(promise: Promise): void; -} -declare class Blob { - constructor( - bits?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[], - options?: BlobOptions - ); - readonly size: number; - readonly type: string; - slice(start?: number, end?: number, type?: string): Blob; - arrayBuffer(): Promise; - text(): Promise; - stream(): ReadableStream; -} -declare interface BlobOptions { - type?: string; -} -declare class File extends Blob { - constructor( - bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined, - name: string, - options?: FileOptions - ); - readonly name: string; - readonly lastModified: number; -} -declare interface FileOptions { - type?: string; - lastModified?: number; -} -declare abstract class CacheStorage { - open(cacheName: string): Promise; - readonly default: Cache; -} -declare abstract class Cache { - delete(request: RequestInfo, options?: CacheQueryOptions): Promise; - match( - request: RequestInfo, - options?: CacheQueryOptions - ): Promise; - put(request: RequestInfo, response: Response): Promise; -} -declare interface CacheQueryOptions { - ignoreMethod?: boolean; -} -declare abstract class Crypto { - /** Available only in secure contexts. */ - readonly subtle: SubtleCrypto; - getRandomValues< - T extends - | Int8Array - | Uint8Array - | Int16Array - | Uint16Array - | Int32Array - | Uint32Array - | BigInt64Array - | BigUint64Array - >(buffer: T): T; - randomUUID(): string; - DigestStream: typeof DigestStream; -} -declare abstract class SubtleCrypto { - encrypt( - algorithm: string | SubtleCryptoEncryptAlgorithm, - key: CryptoKey, - plainText: ArrayBuffer | ArrayBufferView - ): Promise; - decrypt( - algorithm: string | SubtleCryptoEncryptAlgorithm, - key: CryptoKey, - cipherText: ArrayBuffer | ArrayBufferView - ): Promise; - sign( - algorithm: string | SubtleCryptoSignAlgorithm, - key: CryptoKey, - data: ArrayBuffer | ArrayBufferView - ): Promise; - verify( - algorithm: string | SubtleCryptoSignAlgorithm, - key: CryptoKey, - signature: ArrayBuffer | ArrayBufferView, - data: ArrayBuffer | ArrayBufferView - ): Promise; - digest( - algorithm: string | SubtleCryptoHashAlgorithm, - data: ArrayBuffer | ArrayBufferView - ): Promise; - generateKey( - algorithm: string | SubtleCryptoGenerateKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - deriveKey( - algorithm: string | SubtleCryptoDeriveKeyAlgorithm, - baseKey: CryptoKey, - derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - deriveBits( - algorithm: string | SubtleCryptoDeriveKeyAlgorithm, - baseKey: CryptoKey, - length: number | null - ): Promise; - importKey( - format: string, - keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey, - algorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - exportKey(format: string, key: CryptoKey): Promise; - wrapKey( - format: string, - key: CryptoKey, - wrappingKey: CryptoKey, - wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm - ): Promise; - unwrapKey( - format: string, - wrappedKey: ArrayBuffer | ArrayBufferView, - unwrappingKey: CryptoKey, - unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm, - unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - timingSafeEqual( - a: ArrayBuffer | ArrayBufferView, - b: ArrayBuffer | ArrayBufferView - ): boolean; -} -declare abstract class CryptoKey { - readonly type: string; - readonly extractable: boolean; - readonly algorithm: - | CryptoKeyKeyAlgorithm - | CryptoKeyAesKeyAlgorithm - | CryptoKeyHmacKeyAlgorithm - | CryptoKeyRsaKeyAlgorithm - | CryptoKeyEllipticKeyAlgorithm - | CryptoKeyArbitraryKeyAlgorithm; - readonly usages: string[]; -} -declare interface CryptoKeyPair { - publicKey: CryptoKey; - privateKey: CryptoKey; -} -declare 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; -} -declare interface RsaOtherPrimesInfo { - r?: string; - d?: string; - t?: string; -} -declare interface SubtleCryptoDeriveKeyAlgorithm { - name: string; - salt?: ArrayBuffer; - iterations?: number; - hash?: string | SubtleCryptoHashAlgorithm; - $public?: CryptoKey; - info?: ArrayBuffer; -} -declare interface SubtleCryptoEncryptAlgorithm { - name: string; - iv?: ArrayBuffer; - additionalData?: ArrayBuffer; - tagLength?: number; - counter?: ArrayBuffer; - length?: number; - label?: ArrayBuffer; -} -declare interface SubtleCryptoGenerateKeyAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - modulusLength?: number; - publicExponent?: ArrayBuffer; - length?: number; - namedCurve?: string; -} -declare interface SubtleCryptoHashAlgorithm { - name: string; -} -declare interface SubtleCryptoImportKeyAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - length?: number; - namedCurve?: string; - compressed?: boolean; -} -declare interface SubtleCryptoSignAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - dataLength?: number; - saltLength?: number; -} -declare interface CryptoKeyKeyAlgorithm { - name: string; -} -declare interface CryptoKeyAesKeyAlgorithm { - name: string; - length: number; -} -declare interface CryptoKeyHmacKeyAlgorithm { - name: string; - hash: CryptoKeyKeyAlgorithm; - length: number; -} -declare interface CryptoKeyRsaKeyAlgorithm { - name: string; - modulusLength: number; - publicExponent: ArrayBuffer; - hash?: CryptoKeyKeyAlgorithm; -} -declare interface CryptoKeyEllipticKeyAlgorithm { - name: string; - namedCurve: string; -} -declare interface CryptoKeyArbitraryKeyAlgorithm { - name: string; - hash?: CryptoKeyKeyAlgorithm; - namedCurve?: string; - length?: number; -} -declare class DigestStream extends WritableStream< - ArrayBuffer | ArrayBufferView -> { - constructor(algorithm: string | SubtleCryptoHashAlgorithm); - readonly digest: Promise; -} -declare class TextDecoder { - constructor(decoder?: string, options?: TextDecoderConstructorOptions); - decode( - input?: ArrayBuffer | ArrayBufferView, - options?: TextDecoderDecodeOptions - ): string; - readonly encoding: string; - readonly fatal: boolean; - readonly ignoreBOM: boolean; -} -declare class TextEncoder { - constructor(); - encode(input?: string): Uint8Array; - encodeInto(input: string, buffer: Uint8Array): TextEncoderEncodeIntoResult; - readonly encoding: string; -} -declare interface TextDecoderConstructorOptions { - fatal: boolean; - ignoreBOM: boolean; -} -declare interface TextDecoderDecodeOptions { - stream: boolean; -} -declare interface TextEncoderEncodeIntoResult { - read: number; - written: number; -} -declare class FormData { - constructor(); - append(name: string, value: string): void; - append(name: string, value: Blob, filename?: string): void; - delete(name: string): void; - get(name: string): string | null; - getAll(name: string): string[]; - has(name: string): boolean; - set(name: string, value: string): void; - set(name: string, value: Blob, filename?: string): void; - entries(): IterableIterator<[key: string, value: string]>; - keys(): IterableIterator; - values(): IterableIterator; - forEach( - callback: ( - this: This, - value: string, - key: string, - parent: FormData - ) => void, - thisArg?: This - ): void; - [Symbol.iterator](): IterableIterator<[key: string, value: string]>; -} -declare interface ContentOptions { - html?: boolean; -} -declare class HTMLRewriter { - constructor(); - on( - selector: string, - handlers: HTMLRewriterElementContentHandlers - ): HTMLRewriter; - onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter; - transform(response: Response): Response; -} -declare interface HTMLRewriterElementContentHandlers { - element?(element: Element): void | Promise; - comments?(comment: Comment): void | Promise; - text?(element: Text): void | Promise; -} -declare interface HTMLRewriterDocumentContentHandlers { - doctype?(doctype: Doctype): void | Promise; - comments?(comment: Comment): void | Promise; - text?(text: Text): void | Promise; - end?(end: DocumentEnd): void | Promise; -} -declare interface Doctype { - readonly name: string | null; - readonly publicId: string | null; - readonly systemId: string | null; -} -declare interface Element { - tagName: string; - readonly attributes: IterableIterator; - 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, options?: ContentOptions): Element; - after(content: string, options?: ContentOptions): Element; - prepend(content: string, options?: ContentOptions): Element; - append(content: string, options?: ContentOptions): Element; - replace(content: string, options?: ContentOptions): Element; - remove(): Element; - removeAndKeepContent(): Element; - setInnerContent(content: string, options?: ContentOptions): Element; - onEndTag(handler: (tag: EndTag) => void | Promise): void; -} -declare interface EndTag { - name: string; - before(content: string, options?: ContentOptions): EndTag; - after(content: string, options?: ContentOptions): EndTag; - remove(): EndTag; -} -declare 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; -} -declare interface Text { - readonly text: string; - readonly lastInTextNode: boolean; - readonly removed: boolean; - before(content: string, options?: ContentOptions): Text; - after(content: string, options?: ContentOptions): Text; - replace(content: string, options?: ContentOptions): Text; - remove(): Text; -} -declare interface DocumentEnd { - append(content: string, options?: ContentOptions): DocumentEnd; -} -declare abstract class FetchEvent extends ExtendableEvent { - readonly request: Request; - respondWith(promise: Response | Promise): void; - passThroughOnException(): void; -} -declare type HeadersInit = - | Headers - | Iterable> - | Record; -declare class Headers { - constructor(init?: HeadersInit); - get(name: string): string | null; - getAll(name: string): string[]; - has(name: string): boolean; - set(name: string, value: string): void; - append(name: string, value: string): void; - delete(name: string): void; - forEach( - callback: (this: This, value: string, key: string, parent: Headers) => void, - thisArg?: This - ): void; - entries(): IterableIterator<[key: string, value: string]>; - keys(): IterableIterator; - values(): IterableIterator; - [Symbol.iterator](): IterableIterator<[key: string, value: string]>; -} -declare type BodyInit = - | ReadableStream - | string - | ArrayBuffer - | ArrayBufferView - | Blob - | URLSearchParams - | FormData; -declare abstract class Body { - readonly body: ReadableStream | null; - readonly bodyUsed: boolean; - arrayBuffer(): Promise; - text(): Promise; - json(): Promise; - formData(): Promise; - blob(): Promise; -} -declare class Response extends Body { - constructor(body?: BodyInit | null, init?: ResponseInit); - static redirect(url: string, status?: number): Response; - static json(any: any, maybeInit?: ResponseInit | Response): Response; - clone(): Response; - readonly status: number; - readonly statusText: string; - readonly headers: Headers; - readonly ok: boolean; - readonly redirected: boolean; - readonly url: string; - readonly webSocket: WebSocket | null; - readonly cf?: any; -} -declare interface ResponseInit { - status?: number; - statusText?: string; - headers?: HeadersInit; - cf?: any; - webSocket?: WebSocket | null; - encodeBody?: "automatic" | "manual"; -} -declare type RequestInfo< - CfHostMetadata = unknown, - Cf = CfProperties -> = Request | string | URL; -declare class Request< - CfHostMetadata = unknown, - Cf = CfProperties -> extends Body { - constructor(input: RequestInfo, init?: RequestInit); - clone(): Request; - /** Returns request's HTTP method, which is "GET" by default. */ - readonly method: string; - /** Returns the URL of request as a string. */ - readonly url: string; - /** Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the "Host" header. */ - readonly headers: Headers; - /** Returns the redirect mode associated with request, which is a string indicating how redirects for the request will be handled during fetching. A request will follow redirects by default. */ - readonly redirect: string; - readonly fetcher: Fetcher | null; - /** Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler. */ - readonly signal: AbortSignal; - readonly cf?: Cf; - /** Returns request's subresource integrity metadata, which is a cryptographic hash of the resource being fetched. Its value consists of multiple hashes separated by whitespace. [SRI] */ - readonly integrity: string; - /** Returns a boolean indicating whether or not request can outlive the global in which it was created. */ - readonly keepalive: boolean; -} -declare interface RequestInit { - /** 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 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; -} -declare abstract class Fetcher { - fetch(input: RequestInfo, init?: RequestInit): Promise; -} -declare interface FetcherPutOptions { - expiration?: number; - expirationTtl?: number; -} -declare interface KVNamespaceListKey { - name: Key; - expiration?: number; - metadata?: Metadata; -} -declare type KVNamespaceListResult = - | { - list_complete: false; - keys: KVNamespaceListKey[]; - cursor: string; - } - | { - list_complete: true; - keys: KVNamespaceListKey[]; - }; -declare interface KVNamespace { - get( - key: Key, - options?: Partial> - ): Promise; - get(key: Key, type: "text"): Promise; - get( - key: Key, - type: "json" - ): Promise; - get(key: Key, type: "arrayBuffer"): Promise; - get(key: Key, type: "stream"): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"text"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"json"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"arrayBuffer"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"stream"> - ): Promise; - list( - options?: KVNamespaceListOptions - ): Promise>; - put( - key: Key, - value: string | ArrayBuffer | ArrayBufferView | ReadableStream, - options?: KVNamespacePutOptions - ): Promise; - getWithMetadata( - key: Key, - options?: Partial> - ): Promise>; - getWithMetadata( - key: Key, - type: "text" - ): Promise>; - getWithMetadata( - key: Key, - type: "json" - ): Promise>; - getWithMetadata( - key: Key, - type: "arrayBuffer" - ): Promise>; - getWithMetadata( - key: Key, - type: "stream" - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"text"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"json"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"arrayBuffer"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"stream"> - ): Promise>; - delete(key: Key): Promise; -} -declare interface KVNamespaceListOptions { - limit?: number; - prefix?: string | null; - cursor?: string | null; -} -declare interface KVNamespaceGetOptions { - type: Type; - cacheTtl?: number; -} -declare interface KVNamespacePutOptions { - expiration?: number; - expirationTtl?: number; - metadata?: any | null; -} -declare interface KVNamespaceGetWithMetadataResult { - value: Value | null; - metadata: Metadata | null; -} -declare interface R2Error extends Error { - readonly name: string; - readonly code: number; - readonly message: string; - readonly action: string; - readonly stack: any; -} -declare interface R2ListOptions { - limit?: number; - prefix?: string; - cursor?: string; - delimiter?: string; - startAfter?: string; -} -declare abstract class R2Bucket { - head(key: string): Promise; - get( - key: string, - options: R2GetOptions & { - onlyIf: R2Conditional | Headers; - } - ): Promise; - get(key: string, options?: R2GetOptions): Promise; - put( - key: string, - value: - | ReadableStream - | ArrayBuffer - | ArrayBufferView - | string - | null - | Blob, - options?: R2PutOptions - ): Promise; - put( - key: string, - value: - | ReadableStream - | ArrayBuffer - | ArrayBufferView - | string - | null - | Blob, - options?: R2PutOptions & { - onlyIf: R2Conditional | Headers; - } - ): Promise; - createMultipartUpload( - key: string, - options?: R2MultipartOptions - ): Promise; - resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload; - delete(keys: string | string[]): Promise; - list(options?: R2ListOptions): Promise; -} -declare interface R2MultipartUpload { - readonly key: string; - readonly uploadId: string; - uploadPart( - partNumber: number, - value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob - ): Promise; - abort(): Promise; - complete(uploadedParts: R2UploadedPart[]): Promise; -} -declare 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; - readonly range?: R2Range; - writeHttpMetadata(headers: Headers): void; -} -declare interface R2ObjectBody extends R2Object { - get body(): ReadableStream; - get bodyUsed(): boolean; - arrayBuffer(): Promise; - text(): Promise; - json(): Promise; - blob(): Promise; -} -declare type R2Range = - | { - offset: number; - length?: number; - } - | { - offset?: number; - length: number; - } - | { - suffix: number; - }; -declare interface R2Conditional { - etagMatches?: string; - etagDoesNotMatch?: string; - uploadedBefore?: Date; - uploadedAfter?: Date; - secondsGranularity?: boolean; -} -declare interface R2GetOptions { - onlyIf?: R2Conditional | Headers; - range?: R2Range | Headers; -} -declare interface R2PutOptions { - onlyIf?: R2Conditional | Headers; - httpMetadata?: R2HTTPMetadata | Headers; - customMetadata?: Record; - md5?: ArrayBuffer | string; - sha1?: ArrayBuffer | string; - sha256?: ArrayBuffer | string; - sha384?: ArrayBuffer | string; - sha512?: ArrayBuffer | string; -} -declare interface R2MultipartOptions { - httpMetadata?: R2HTTPMetadata | Headers; - customMetadata?: Record; -} -declare interface R2Checksums { - readonly md5?: ArrayBuffer; - readonly sha1?: ArrayBuffer; - readonly sha256?: ArrayBuffer; - readonly sha384?: ArrayBuffer; - readonly sha512?: ArrayBuffer; - toJSON(): R2StringChecksums; -} -declare interface R2StringChecksums { - md5?: string; - sha1?: string; - sha256?: string; - sha384?: string; - sha512?: string; -} -declare interface R2HTTPMetadata { - contentType?: string; - contentLanguage?: string; - contentDisposition?: string; - contentEncoding?: string; - cacheControl?: string; - cacheExpiry?: Date; -} -declare interface R2Objects { - objects: R2Object[]; - truncated: boolean; - cursor?: string; - delimitedPrefixes: string[]; -} -declare abstract class ScheduledEvent extends ExtendableEvent { - readonly scheduledTime: number; - readonly cron: string; - noRetry(): void; -} -declare interface ScheduledController { - readonly scheduledTime: number; - readonly cron: string; - noRetry(): void; -} -declare interface QueuingStrategy { - highWaterMark?: number | bigint; - size?: (chunk: T) => number | bigint; -} -declare interface UnderlyingSink { - type?: string; - start?: (controller: WritableStreamDefaultController) => void | Promise; - write?: ( - chunk: W, - controller: WritableStreamDefaultController - ) => void | Promise; - abort?: (reason: any) => void | Promise; - close?: () => void | Promise; -} -declare interface UnderlyingByteSource { - type: "bytes"; - autoAllocateChunkSize?: number; - start?: (controller: ReadableByteStreamController) => void | Promise; - pull?: (controller: ReadableByteStreamController) => void | Promise; - cancel?: (reason: any) => void | Promise; -} -declare interface UnderlyingSource { - type?: "" | undefined; - start?: ( - controller: ReadableStreamDefaultController - ) => void | Promise; - pull?: ( - controller: ReadableStreamDefaultController - ) => void | Promise; - cancel?: (reason: any) => void | Promise; -} -declare interface Transformer { - readableType?: string; - writableType?: string; - start?: ( - controller: TransformStreamDefaultController - ) => void | Promise; - transform?: ( - chunk: I, - controller: TransformStreamDefaultController - ) => void | Promise; - flush?: ( - controller: TransformStreamDefaultController - ) => void | Promise; -} -declare interface StreamPipeOptions { - /** - * 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; - preventAbort?: boolean; - preventCancel?: boolean; - signal?: AbortSignal; -} -declare type ReadableStreamReadResult = - | { - done: false; - value: R; - } - | { - done: true; - value?: undefined; - }; -/** This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object. */ -declare interface ReadableStream { - readonly locked: boolean; - cancel(reason?: any): Promise; - getReader(): ReadableStreamDefaultReader; - getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader; - pipeThrough( - transform: ReadableWritablePair, - options?: StreamPipeOptions - ): ReadableStream; - pipeTo( - destination: WritableStream, - options?: StreamPipeOptions - ): Promise; - tee(): [ReadableStream, ReadableStream]; - values(options?: ReadableStreamValuesOptions): AsyncIterableIterator; - [Symbol.asyncIterator]( - options?: ReadableStreamValuesOptions - ): AsyncIterableIterator; -} -declare const ReadableStream: { - prototype: ReadableStream; - new ( - underlyingSource: UnderlyingByteSource, - strategy?: QueuingStrategy - ): ReadableStream; - new ( - underlyingSource?: UnderlyingSource, - strategy?: QueuingStrategy - ): ReadableStream; -}; -declare class ReadableStreamDefaultReader { - constructor(stream: ReadableStream); - readonly closed: Promise; - cancel(reason?: any): Promise; - read(): Promise>; - releaseLock(): void; -} -declare class ReadableStreamBYOBReader { - constructor(stream: ReadableStream); - readonly closed: Promise; - cancel(reason?: any): Promise; - read( - view: T - ): Promise>; - releaseLock(): void; - readAtLeast( - minElements: number, - view: T - ): Promise>; -} -declare interface ReadableStreamGetReaderOptions { - mode: "byob"; -} -declare interface ReadableStreamBYOBRequest { - readonly view: Uint8Array | null; - respond(bytesWritten: number): void; - respondWithNewView(view: ArrayBuffer | ArrayBufferView): void; - readonly atLeast: number | null; -} -declare interface ReadableStreamDefaultController { - readonly desiredSize: number | null; - close(): void; - enqueue(chunk?: R): void; - error(reason: any): void; -} -declare interface ReadableByteStreamController { - readonly byobRequest: ReadableStreamBYOBRequest | null; - readonly desiredSize: number | null; - close(): void; - enqueue(chunk: ArrayBuffer | ArrayBufferView): void; - error(reason: any): void; -} -/** This Streams API interface represents a controller allowing control of a WritableStream's state. When constructing a WritableStream, the underlying sink is given a corresponding WritableStreamDefaultController instance to manipulate. */ -declare interface WritableStreamDefaultController { - readonly signal: AbortSignal; - error(reason?: any): void; -} -declare interface TransformStreamDefaultController { - get desiredSize(): number | null; - enqueue(chunk?: O): void; - error(reason: any): void; - terminate(): void; -} -declare interface ReadableWritablePair { - /** - * 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; - readable: ReadableStream; -} -declare class WritableStream { - constructor( - underlyingSink?: UnderlyingSink, - queuingStrategy?: QueuingStrategy - ); - readonly locked: boolean; - abort(reason?: any): Promise; - close(): Promise; - getWriter(): WritableStreamDefaultWriter; -} -declare class WritableStreamDefaultWriter { - constructor(stream: WritableStream); - readonly closed: Promise; - readonly ready: Promise; - readonly desiredSize: number | null; - abort(reason?: any): Promise; - close(): Promise; - write(chunk?: W): Promise; - releaseLock(): void; -} -declare class TransformStream { - constructor( - transformer?: Transformer, - writableStrategy?: QueuingStrategy, - readableStrategy?: QueuingStrategy - ); - readonly readable: ReadableStream; - readonly writable: WritableStream; -} -declare class FixedLengthStream extends IdentityTransformStream { - constructor(expectedLength: number | bigint); -} -declare class IdentityTransformStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(); -} -declare interface ReadableStreamValuesOptions { - preventCancel?: boolean; -} -declare class CompressionStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(format: "gzip" | "deflate" | "deflate-raw"); -} -declare class DecompressionStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(format: "gzip" | "deflate" | "deflate-raw"); -} -declare class TextEncoderStream extends TransformStream { - constructor(); -} -declare class TextDecoderStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - string -> { - constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit); -} -declare interface TextDecoderStreamTextDecoderStreamInit { - fatal?: boolean; -} -declare class ByteLengthQueuingStrategy - implements QueuingStrategy -{ - constructor(init: QueuingStrategyInit); - get highWaterMark(): number; - get size(): (chunk?: any) => number; -} -declare class CountQueuingStrategy implements QueuingStrategy { - constructor(init: QueuingStrategyInit); - get highWaterMark(): number; - get size(): (chunk?: any) => number; -} -declare 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; -} -declare abstract class TraceEvent extends ExtendableEvent { - readonly traces: TraceItem[]; -} -declare interface TraceItem { - readonly event: - | ( - | TraceItemFetchEventInfo - | TraceItemScheduledEventInfo - | TraceItemAlarmEventInfo - | TraceItemQueueEventInfo - | TraceItemEmailEventInfo - | TraceItemCustomEventInfo - ) - | null; - readonly eventTimestamp: number | null; - readonly logs: TraceLog[]; - readonly exceptions: TraceException[]; - readonly scriptName: string | null; - readonly dispatchNamespace?: string; - readonly scriptTags?: string[]; - readonly outcome: string; -} -declare interface TraceItemAlarmEventInfo { - readonly scheduledTime: Date; -} -declare interface TraceItemCustomEventInfo {} -declare interface TraceItemScheduledEventInfo { - readonly scheduledTime: number; - readonly cron: string; -} -declare interface TraceItemQueueEventInfo { - readonly queue: string; - readonly batchSize: number; -} -declare interface TraceItemEmailEventInfo { - readonly mailFrom: string; - readonly rcptTo: string; - readonly rawSize: number; -} -declare interface TraceItemFetchEventInfo { - readonly response?: TraceItemFetchEventInfoResponse; - readonly request: TraceItemFetchEventInfoRequest; -} -declare interface TraceItemFetchEventInfoRequest { - readonly cf?: any; - readonly headers: Record; - readonly method: string; - readonly url: string; - getUnredacted(): TraceItemFetchEventInfoRequest; -} -declare interface TraceItemFetchEventInfoResponse { - readonly status: number; -} -declare interface TraceLog { - readonly timestamp: number; - readonly level: string; - readonly message: any; -} -declare interface TraceException { - readonly timestamp: number; - readonly message: string; - readonly name: string; -} -declare interface TraceMetrics { - readonly cpuTime: number; - readonly wallTime: number; -} -declare interface UnsafeTraceMetrics { - fromTrace(item: TraceItem): TraceMetrics; -} -declare class URL { - constructor(url: string | URL, base?: string | URL); - href: string; - readonly origin: string; - protocol: string; - username: string; - password: string; - host: string; - hostname: string; - port: string; - pathname: string; - search: string; - readonly searchParams: URLSearchParams; - hash: string; - toString(): string; - toJSON(): string; -} -declare class URLSearchParams { - constructor( - init?: - | URLSearchParams - | string - | Record - | [key: string, value: string][] - ); - get size(): number; - append(name: string, value: string): void; - delete(name: string): void; - get(name: string): string | null; - getAll(name: string): string[]; - has(name: string): boolean; - set(name: string, value: string): void; - sort(): void; - entries(): IterableIterator<[key: string, value: string]>; - keys(): IterableIterator; - values(): IterableIterator; - forEach( - callback: ( - this: This, - value: string, - key: string, - parent: URLSearchParams - ) => void, - thisArg?: This - ): void; - toString(): string; - [Symbol.iterator](): IterableIterator<[key: string, value: string]>; -} -declare class URLPattern { - constructor(input?: string | URLPatternURLPatternInit, baseURL?: string); - get protocol(): string; - get username(): string; - get password(): string; - get hostname(): string; - get port(): string; - get pathname(): string; - get search(): string; - get hash(): string; - test(input?: string | URLPatternURLPatternInit, baseURL?: string): boolean; - exec( - input?: string | URLPatternURLPatternInit, - baseURL?: string - ): URLPatternURLPatternResult | null; -} -declare interface URLPatternURLPatternInit { - protocol?: string; - username?: string; - password?: string; - hostname?: string; - port?: string; - pathname?: string; - search?: string; - hash?: string; - baseURL?: string; -} -declare interface URLPatternURLPatternComponentResult { - input: string; - groups: Record; -} -declare interface URLPatternURLPatternResult { - inputs: (string | URLPatternURLPatternInit)[]; - protocol: URLPatternURLPatternComponentResult; - username: URLPatternURLPatternComponentResult; - password: URLPatternURLPatternComponentResult; - hostname: URLPatternURLPatternComponentResult; - port: URLPatternURLPatternComponentResult; - pathname: URLPatternURLPatternComponentResult; - search: URLPatternURLPatternComponentResult; - hash: URLPatternURLPatternComponentResult; -} -declare class CloseEvent extends Event { - constructor(type: string, initializer: CloseEventInit); - /** Returns the WebSocket connection close code provided by the server. */ - readonly code: number; - /** Returns the WebSocket connection close reason provided by the server. */ - readonly reason: string; - /** Returns true if the connection closed cleanly; false otherwise. */ - readonly wasClean: boolean; -} -declare interface CloseEventInit { - code?: number; - reason?: string; - wasClean?: boolean; -} -declare class MessageEvent extends Event { - constructor(type: string, initializer: MessageEventInit); - readonly data: ArrayBuffer | string; -} -declare interface MessageEventInit { - data: ArrayBuffer | string; -} -/** Events providing information related to errors in scripts or in files. */ -declare interface ErrorEvent extends Event { - readonly filename: string; - readonly message: string; - readonly lineno: number; - readonly colno: number; - readonly error: any; -} -declare type WebSocketEventMap = { - close: CloseEvent; - message: MessageEvent; - open: Event; - error: ErrorEvent; -}; -declare class WebSocket extends EventTarget { - constructor(url: string, protocols?: string[] | string); - accept(): void; - send(message: (ArrayBuffer | ArrayBufferView) | string): void; - close(code?: number, reason?: string): void; - static readonly READY_STATE_CONNECTING: number; - static readonly READY_STATE_OPEN: number; - static readonly READY_STATE_CLOSING: number; - static readonly READY_STATE_CLOSED: number; - /** Returns the state of the WebSocket object's connection. It can have the values described below. */ - readonly readyState: number; - /** Returns the URL that was used to establish the WebSocket connection. */ - readonly url: string | null; - /** Returns the subprotocol selected by the server, if any. It can be used in conjunction with the array form of the constructor's second argument to perform subprotocol negotiation. */ - readonly protocol: string | null; - /** Returns the extensions selected by the server, if any. */ - readonly extensions: string | null; -} -declare const WebSocketPair: { - new (): { - 0: WebSocket; - 1: WebSocket; - }; -}; -declare interface BasicImageTransformations { - /** - * Maximum width in image pixels. The value must be an integer. - */ - width?: number; - /** - * Maximum height in image pixels. The value must be an integer. - */ - height?: number; - /** - * Resizing mode as a string. It affects interpretation of width and height - * options: - * - scale-down: Similar to contain, but the image is never enlarged. If - * the image is larger than given width or height, it will be resized. - * Otherwise its original size will be kept. - * - contain: Resizes to maximum size that fits within the given width and - * height. If only a single dimension is given (e.g. only width), the - * image will be shrunk or enlarged to exactly match that dimension. - * Aspect ratio is always preserved. - * - cover: Resizes (shrinks or enlarges) to fill the entire area of width - * and height. If the image has an aspect ratio different from the ratio - * of width and height, it will be cropped to fit. - * - crop: The image will be shrunk and cropped to fit within the area - * specified by width and height. The image will not be enlarged. For images - * smaller than the given dimensions it's the same as scale-down. For - * images larger than the given dimensions, it's the same as cover. - * See also trim. - * - pad: Resizes to the maximum size that fits within the given width and - * height, and then fills the remaining area with a background color - * (white by default). Use of this mode is not recommended, as the same - * effect can be more efficiently achieved with the contain mode and the - * CSS object-fit: contain property. - */ - fit?: "scale-down" | "contain" | "cover" | "crop" | "pad"; - /** - * When cropping with fit: "cover", this defines the side or point that should - * be left uncropped. The value is either a string - * "left", "right", "top", "bottom", "auto", or "center" (the default), - * or an object {x, y} containing focal point coordinates in the original - * image expressed as fractions ranging from 0.0 (top or left) to 1.0 - * (bottom or right), 0.5 being the center. {fit: "cover", gravity: "top"} will - * crop bottom or left and right sides as necessary, but won’t crop anything - * from the top. {fit: "cover", gravity: {x:0.5, y:0.2}} will crop each side to - * preserve as much as possible around a point at 20% of the height of the - * source image. - */ - gravity?: - | "left" - | "right" - | "top" - | "bottom" - | "center" - | "auto" - | BasicImageTransformationsGravityCoordinates; - /** - * Background color to add underneath the image. Applies only to images with - * transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…), - * hsl(…), etc.) - */ - background?: string; - /** - * Number of degrees (90, 180, 270) to rotate the image by. width and height - * options refer to axes after rotation. - */ - rotate?: 0 | 90 | 180 | 270 | 360; -} -declare interface BasicImageTransformationsGravityCoordinates { - x: number; - y: number; -} -/** - * In addition to the properties you can set in the RequestInit dict - * that you pass as an argument to the Request constructor, you can - * set certain properties of a `cf` object to control how Cloudflare - * features are applied to that new Request. - * - * Note: Currently, these properties cannot be tested in the - * playground. - */ -declare interface RequestInitCfProperties extends Record { - cacheEverything?: boolean; - /** - * A request's cache key is what determines if two requests are - * "the same" for caching purposes. If a request has the same cache key - * as some previous request, then we can serve the same cached response for - * both. (e.g. 'some-key') - * - * Only available for Enterprise customers. - */ - cacheKey?: string; - /** - * This allows you to append additional Cache-Tag response headers - * to the origin response without modifications to the origin server. - * This will allow for greater control over the Purge by Cache Tag feature - * utilizing changes only in the Workers process. - * - * Only available for Enterprise customers. - */ - cacheTags?: string[]; - /** - * Force response to be cached for a given number of seconds. (e.g. 300) - */ - cacheTtl?: number; - /** - * Force response to be cached for a given number of seconds based on the Origin status code. - * (e.g. { '200-299': 86400, '404': 1, '500-599': 0 }) - */ - cacheTtlByStatus?: Record; - scrapeShield?: boolean; - apps?: boolean; - image?: RequestInitCfPropertiesImage; - minify?: RequestInitCfPropertiesImageMinify; - mirage?: boolean; - polish?: "lossy" | "lossless" | "off"; - /** - * Redirects the request to an alternate origin server. You can use this, - * for example, to implement load balancing across several origins. - * (e.g.us-east.example.com) - * - * Note - For security reasons, the hostname set in resolveOverride must - * be proxied on the same Cloudflare zone of the incoming request. - * Otherwise, the setting is ignored. CNAME hosts are allowed, so to - * resolve to a host under a different domain or a DNS only domain first - * declare a CNAME record within your own zone’s DNS mapping to the - * external hostname, set proxy on Cloudflare, then set resolveOverride - * to point to that CNAME record. - */ - resolveOverride?: string; -} -declare interface RequestInitCfPropertiesImageDraw - extends BasicImageTransformations { - /** - * Absolute URL of the image file to use for the drawing. It can be any of - * the supported file formats. For drawing of watermarks or non-rectangular - * overlays we recommend using PNG or WebP images. - */ - url: string; - /** - * Floating-point number between 0 (transparent) and 1 (opaque). - * For example, opacity: 0.5 makes overlay semitransparent. - */ - opacity?: number; - /** - * - If set to true, the overlay image will be tiled to cover the entire - * area. This is useful for stock-photo-like watermarks. - * - If set to "x", the overlay image will be tiled horizontally only - * (form a line). - * - If set to "y", the overlay image will be tiled vertically only - * (form a line). - */ - repeat?: true | "x" | "y"; - /** - * Position of the overlay image relative to a given edge. Each property is - * an offset in pixels. 0 aligns exactly to the edge. For example, left: 10 - * positions left side of the overlay 10 pixels from the left edge of the - * image it's drawn over. bottom: 0 aligns bottom of the overlay with bottom - * of the background image. - * - * Setting both left & right, or both top & bottom is an error. - * - * If no position is specified, the image will be centered. - */ - top?: number; - left?: number; - bottom?: number; - right?: number; -} -declare interface RequestInitCfPropertiesImage - extends BasicImageTransformations { - /** - * Device Pixel Ratio. Default 1. Multiplier for width/height that makes it - * easier to specify higher-DPI sizes in . - */ - dpr?: number; - /** - * An object with four properties {left, top, right, bottom} that specify - * a number of pixels to cut off on each side. Allows removal of borders - * or cutting out a specific fragment of an image. Trimming is performed - * before resizing or rotation. Takes dpr into account. - */ - trim?: { - left?: number; - top?: number; - right?: number; - bottom?: number; - }; - /** - * Quality setting from 1-100 (useful values are in 60-90 range). Lower values - * make images look worse, but load faster. The default is 85. It applies only - * to JPEG and WebP images. It doesn’t have any effect on PNG. - */ - quality?: number; - /** - * Output format to generate. It can be: - * - avif: generate images in AVIF format. - * - webp: generate images in Google WebP format. Set quality to 100 to get - * the WebP-lossless format. - * - json: instead of generating an image, outputs information about the - * image, in JSON format. The JSON object will contain image size - * (before and after resizing), source image’s MIME type, file size, etc. - * - jpeg: generate images in JPEG format. - * - png: generate images in PNG format. - */ - format?: "avif" | "webp" | "json" | "jpeg" | "png"; - /** - * Whether to preserve animation frames from input files. Default is true. - * Setting it to false reduces animations to still images. This setting is - * recommended when enlarging images or processing arbitrary user content, - * because large GIF animations can weigh tens or even hundreds of megabytes. - * It is also useful to set anim:false when using format:"json" to get the - * response quicker without the number of frames. - */ - anim?: boolean; - /** - * What EXIF data should be preserved in the output image. Note that EXIF - * rotation and embedded color profiles are always applied ("baked in" into - * the image), and aren't affected by this option. Note that if the Polish - * feature is enabled, all metadata may have been removed already and this - * option may have no effect. - * - keep: Preserve most of EXIF metadata, including GPS location if there's - * any. - * - copyright: Only keep the copyright tag, and discard everything else. - * This is the default behavior for JPEG files. - * - none: Discard all invisible EXIF metadata. Currently WebP and PNG - * output formats always discard metadata. - */ - metadata?: "keep" | "copyright" | "none"; - /** - * Strength of sharpening filter to apply to the image. Floating-point - * number between 0 (no sharpening, default) and 10 (maximum). 1.0 is a - * recommended value for downscaled images. - */ - sharpen?: number; - /** - * Radius of a blur filter (approximate gaussian). Maximum supported radius - * is 250. - */ - blur?: number; - /** - * Overlays are drawn in the order they appear in the array (last array - * entry is the topmost layer). - */ - draw?: RequestInitCfPropertiesImageDraw[]; - /** - * Fetching image from authenticated origin. Setting this property will - * pass authentication headers (Authorization, Cookie, etc.) through to - * the origin. - */ - "origin-auth"?: "share-publicly"; - /** - * Adds a border around the image. The border is added after resizing. Border - * width takes dpr into account, and can be specified either using a single - * width property, or individually for each side. - */ - border?: - | { - color: string; - width: number; - } - | { - color: string; - top: number; - right: number; - bottom: number; - left: number; - }; - /** - * Increase brightness by a factor. A value of 1.0 equals no change, a value - * of 0.5 equals half brightness, and a value of 2.0 equals twice as bright. - * 0 is ignored. - */ - brightness?: number; - /** - * Increase contrast by a factor. A value of 1.0 equals no change, a value of - * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is - * ignored. - */ - contrast?: number; - /** - * Increase exposure by a factor. A value of 1.0 equals no change, a value of - * 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored. - */ - gamma?: number; - /** - * Slightly reduces latency on a cache miss by selecting a - * quickest-to-compress file format, at a cost of increased file size and - * lower image quality. It will usually override the format option and choose - * JPEG over WebP or AVIF. We do not recommend using this option, except in - * unusual circumstances like resizing uncacheable dynamically-generated - * images. - */ - compression?: "fast"; -} -declare interface RequestInitCfPropertiesImageMinify { - javascript?: boolean; - css?: boolean; - html?: boolean; -} -/** - * Request metadata provided by Cloudflare's edge. - */ -declare type IncomingRequestCfProperties = - IncomingRequestCfPropertiesBase & - IncomingRequestCfPropertiesBotManagementEnterprise & - IncomingRequestCfPropertiesCloudflareForSaaSEnterprise & - IncomingRequestCfPropertiesGeographicInformation & - IncomingRequestCfPropertiesCloudflareAccessOrApiShield; -declare interface IncomingRequestCfPropertiesBase - extends Record { - /** - * [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request. - * - * @example 395747 - */ - asn: number; - /** - * The organization which owns the ASN of the incoming request. - * - * @example "Google Cloud" - */ - asOrganization: string; - /** - * The original value of the `Accept-Encoding` header if Cloudflare modified it. - * - * @example "gzip, deflate, br" - */ - clientAcceptEncoding?: string; - /** - * The number of milliseconds it took for the request to reach your worker. - * - * @example 22 - */ - clientTcpRtt?: number; - /** - * The three-letter [IATA](https://en.wikipedia.org/wiki/IATA_airport_code) - * airport code of the data center that the request hit. - * - * @example "DFW" - */ - colo: string; - /** - * Represents the upstream's response to a - * [TCP `keepalive` message](https://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html) - * from cloudflare. - * - * For workers with no upstream, this will always be `1`. - * - * @example 3 - */ - edgeRequestKeepAliveStatus: IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus; - /** - * The HTTP Protocol the request used. - * - * @example "HTTP/2" - */ - httpProtocol: string; - /** - * The browser-requested prioritization information in the request object. - * - * If no information was set, defaults to the empty string `""` - * - * @example "weight=192;exclusive=0;group=3;group-weight=127" - * @default "" - */ - requestPriority: string; - /** - * The TLS version of the connection to Cloudflare. - * In requests served over plaintext (without TLS), this property is the empty string `""`. - * - * @example "TLSv1.3" - */ - tlsVersion: string; - /** - * The cipher for the connection to Cloudflare. - * In requests served over plaintext (without TLS), this property is the empty string `""`. - * - * @example "AEAD-AES128-GCM-SHA256" - */ - tlsCipher: string; - /** - * Metadata containing the [`HELLO`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2) and [`FINISHED`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9) messages from this request's TLS handshake. - * - * If the incoming request was served over plaintext (without TLS) this field is undefined. - */ - tlsExportedAuthenticator?: IncomingRequestCfPropertiesExportedAuthenticatorMetadata; -} -declare interface IncomingRequestCfPropertiesBotManagementBase { - /** - * Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot, - * represented as an integer percentage between `1` (almost certainly human) - * and `99` (almost certainly a bot). - * - * @example 54 - */ - score: number; - /** - * A boolean value that is true if the request comes from a good bot, like Google or Bing. - * Most customers choose to allow this traffic. For more details, see [Traffic from known bots](https://developers.cloudflare.com/firewall/known-issues-and-faq/#how-does-firewall-rules-handle-traffic-from-known-bots). - */ - verifiedBot: boolean; - /** - * A boolean value that is true if the request originates from a - * Cloudflare-verified proxy service. - */ - corporateProxy: boolean; - /** - * A boolean value that's true if the request matches [file extensions](https://developers.cloudflare.com/bots/reference/static-resources/) for many types of static resources. - */ - staticResource: boolean; - /** - * List of IDs that correlate to the Bot Management heuristic detections made on a request (you can have multiple heuristic detections on the same request). - */ - detectionIds: number[]; -} -declare interface IncomingRequestCfPropertiesBotManagement { - /** - * Results of Cloudflare's Bot Management analysis - */ - botManagement: IncomingRequestCfPropertiesBotManagementBase; - /** - * Duplicate of `botManagement.score`. - * - * @deprecated - */ - clientTrustScore: number; -} -declare interface IncomingRequestCfPropertiesBotManagementEnterprise - extends IncomingRequestCfPropertiesBotManagement { - /** - * Results of Cloudflare's Bot Management analysis - */ - botManagement: IncomingRequestCfPropertiesBotManagementBase & { - /** - * A [JA3 Fingerprint](https://developers.cloudflare.com/bots/concepts/ja3-fingerprint/) to help profile specific SSL/TLS clients - * across different destination IPs, Ports, and X509 certificates. - */ - ja3Hash: string; - }; -} -declare interface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise< - HostMetadata -> { - /** - * Custom metadata set per-host in [Cloudflare for SaaS](https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/). - * - * This field is only present if you have Cloudflare for SaaS enabled on your account - * and you have followed the [required steps to enable it]((https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/domain-support/custom-metadata/)). - */ - hostMetadata: HostMetadata; -} -declare interface IncomingRequestCfPropertiesCloudflareAccessOrApiShield { - /** - * Information about the client certificate presented to Cloudflare. - * - * This is populated when the incoming request is served over TLS using - * either Cloudflare Access or API Shield (mTLS) - * and the presented SSL certificate has a valid - * [Certificate Serial Number](https://ldapwiki.com/wiki/Certificate%20Serial%20Number) - * (i.e., not `null` or `""`). - * - * Otherwise, a set of placeholder values are used. - * - * The property `certPresented` will be set to `"1"` when - * the object is populated (i.e. the above conditions were met). - */ - tlsClientAuth: - | IncomingRequestCfPropertiesTLSClientAuth - | IncomingRequestCfPropertiesTLSClientAuthPlaceholder; -} -/** - * Metadata about the request's TLS handshake - */ -declare interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata { - /** - * The client's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal - * - * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d" - */ - clientHandshake: string; - /** - * The server's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal - * - * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d" - */ - serverHandshake: string; - /** - * The client's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal - * - * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b" - */ - clientFinished: string; - /** - * The server's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal - * - * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b" - */ - serverFinished: string; -} -/** - * Geographic data about the request's origin. - */ -declare interface IncomingRequestCfPropertiesGeographicInformation { - /** - * The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from. - * - * If your worker is [configured to accept TOR connections](https://support.cloudflare.com/hc/en-us/articles/203306930-Understanding-Cloudflare-Tor-support-and-Onion-Routing), this may also be `"T1"`, indicating a request that originated over TOR. - * - * If Cloudflare is unable to determine where the request originated this property is omitted. - * - * The country code `"T1"` is used for requests originating on TOR. - * - * @example "GB" - */ - country?: Iso3166Alpha2Code | "T1"; - /** - * If present, this property indicates that the request originated in the EU - * - * @example "1" - */ - isEUCountry?: "1"; - /** - * A two-letter code indicating the continent the request originated from. - * - * @example "AN" - */ - continent?: ContinentCode; - /** - * The city the request originated from - * - * @example "Austin" - */ - city?: string; - /** - * Postal code of the incoming request - * - * @example "78701" - */ - postalCode?: string; - /** - * Latitude of the incoming request - * - * @example "30.27130" - */ - latitude?: string; - /** - * Longitude of the incoming request - * - * @example "-97.74260" - */ - longitude?: string; - /** - * Timezone of the incoming request - * - * @example "America/Chicago" - */ - timezone?: string; - /** - * If known, the ISO 3166-2 name for the first level region associated with - * the IP address of the incoming request - * - * @example "Texas" - */ - region?: string; - /** - * If known, the ISO 3166-2 code for the first-level region associated with - * the IP address of the incoming request - * - * @example "TX" - */ - regionCode?: string; - /** - * Metro code (DMA) of the incoming request - * - * @example "635" - */ - metroCode?: string; -} -/** Data about the incoming request's TLS certificate */ -declare interface IncomingRequestCfPropertiesTLSClientAuth { - /** Always `"1"`, indicating that the certificate was presented */ - certPresented: "1"; - /** - * Result of certificate verification. - * - * @example "FAILED:self signed certificate" - */ - certVerified: Exclude; - /** The presented certificate's revokation status. - * - * - A value of `"1"` indicates the certificate has been revoked - * - A value of `"0"` indicates the certificate has not been revoked - */ - certRevoked: "1" | "0"; - /** - * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) - * - * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certIssuerDN: string; - /** - * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) - * - * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certSubjectDN: string; - /** - * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted) - * - * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certIssuerDNRFC2253: string; - /** - * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted) - * - * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certSubjectDNRFC2253: string; - /** The certificate issuer's distinguished name (legacy policies) */ - certIssuerDNLegacy: string; - /** The certificate subject's distinguished name (legacy policies) */ - certSubjectDNLegacy: string; - /** - * The certificate's serial number - * - * @example "00936EACBE07F201DF" - */ - certSerial: string; - /** - * The certificate issuer's serial number - * - * @example "2489002934BDFEA34" - */ - certIssuerSerial: string; - /** - * The certificate's Subject Key Identifier - * - * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4" - */ - certSKI: string; - /** - * The certificate issuer's Subject Key Identifier - * - * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4" - */ - certIssuerSKI: string; - /** - * The certificate's SHA-1 fingerprint - * - * @example "6b9109f323999e52259cda7373ff0b4d26bd232e" - */ - certFingerprintSHA1: string; - /** - * The certificate's SHA-256 fingerprint - * - * @example "acf77cf37b4156a2708e34c4eb755f9b5dbbe5ebb55adfec8f11493438d19e6ad3f157f81fa3b98278453d5652b0c1fd1d71e5695ae4d709803a4d3f39de9dea" - */ - certFingerprintSHA256: string; - /** - * The effective starting date of the certificate - * - * @example "Dec 22 19:39:00 2018 GMT" - */ - certNotBefore: string; - /** - * The effective expiration date of the certificate - * - * @example "Dec 22 19:39:00 2018 GMT" - */ - certNotAfter: string; -} -/** Placeholder values for TLS Client Authorization */ -declare interface IncomingRequestCfPropertiesTLSClientAuthPlaceholder { - certPresented: "0"; - certVerified: "NONE"; - certRevoked: "0"; - certIssuerDN: ""; - certSubjectDN: ""; - certIssuerDNRFC2253: ""; - certSubjectDNRFC2253: ""; - certIssuerDNLegacy: ""; - certSubjectDNLegacy: ""; - certSerial: ""; - certIssuerSerial: ""; - certSKI: ""; - certIssuerSKI: ""; - certFingerprintSHA1: ""; - certFingerprintSHA256: ""; - certNotBefore: ""; - certNotAfter: ""; -} -/** Possible outcomes of TLS verification */ -declare type CertVerificationStatus = - /** Authentication succeeded */ - | "SUCCESS" - /** No certificate was presented */ - | "NONE" - /** Failed because the certificate was self-signed */ - | "FAILED:self signed certificate" - /** Failed because the certificate failed a trust chain check */ - | "FAILED:unable to verify the first certificate" - /** Failed because the certificate not yet valid */ - | "FAILED:certificate is not yet valid" - /** Failed because the certificate is expired */ - | "FAILED:certificate has expired" - /** Failed for another unspecified reason */ - | "FAILED"; -/** - * An upstream endpoint's response to a TCP `keepalive` message from Cloudflare. - */ -declare type IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus = - | 0 /** Unknown */ - | 1 /** no keepalives (not found) */ - | 2 /** no connection re-use, opening keepalive connection failed */ - | 3 /** no connection re-use, keepalive accepted and saved */ - | 4 /** connection re-use, refused by the origin server (`TCP FIN`) */ - | 5; /** connection re-use, accepted by the origin server */ -/** ISO 3166-1 Alpha-2 codes */ -declare type Iso3166Alpha2Code = - | "AD" - | "AE" - | "AF" - | "AG" - | "AI" - | "AL" - | "AM" - | "AO" - | "AQ" - | "AR" - | "AS" - | "AT" - | "AU" - | "AW" - | "AX" - | "AZ" - | "BA" - | "BB" - | "BD" - | "BE" - | "BF" - | "BG" - | "BH" - | "BI" - | "BJ" - | "BL" - | "BM" - | "BN" - | "BO" - | "BQ" - | "BR" - | "BS" - | "BT" - | "BV" - | "BW" - | "BY" - | "BZ" - | "CA" - | "CC" - | "CD" - | "CF" - | "CG" - | "CH" - | "CI" - | "CK" - | "CL" - | "CM" - | "CN" - | "CO" - | "CR" - | "CU" - | "CV" - | "CW" - | "CX" - | "CY" - | "CZ" - | "DE" - | "DJ" - | "DK" - | "DM" - | "DO" - | "DZ" - | "EC" - | "EE" - | "EG" - | "EH" - | "ER" - | "ES" - | "ET" - | "FI" - | "FJ" - | "FK" - | "FM" - | "FO" - | "FR" - | "GA" - | "GB" - | "GD" - | "GE" - | "GF" - | "GG" - | "GH" - | "GI" - | "GL" - | "GM" - | "GN" - | "GP" - | "GQ" - | "GR" - | "GS" - | "GT" - | "GU" - | "GW" - | "GY" - | "HK" - | "HM" - | "HN" - | "HR" - | "HT" - | "HU" - | "ID" - | "IE" - | "IL" - | "IM" - | "IN" - | "IO" - | "IQ" - | "IR" - | "IS" - | "IT" - | "JE" - | "JM" - | "JO" - | "JP" - | "KE" - | "KG" - | "KH" - | "KI" - | "KM" - | "KN" - | "KP" - | "KR" - | "KW" - | "KY" - | "KZ" - | "LA" - | "LB" - | "LC" - | "LI" - | "LK" - | "LR" - | "LS" - | "LT" - | "LU" - | "LV" - | "LY" - | "MA" - | "MC" - | "MD" - | "ME" - | "MF" - | "MG" - | "MH" - | "MK" - | "ML" - | "MM" - | "MN" - | "MO" - | "MP" - | "MQ" - | "MR" - | "MS" - | "MT" - | "MU" - | "MV" - | "MW" - | "MX" - | "MY" - | "MZ" - | "NA" - | "NC" - | "NE" - | "NF" - | "NG" - | "NI" - | "NL" - | "NO" - | "NP" - | "NR" - | "NU" - | "NZ" - | "OM" - | "PA" - | "PE" - | "PF" - | "PG" - | "PH" - | "PK" - | "PL" - | "PM" - | "PN" - | "PR" - | "PS" - | "PT" - | "PW" - | "PY" - | "QA" - | "RE" - | "RO" - | "RS" - | "RU" - | "RW" - | "SA" - | "SB" - | "SC" - | "SD" - | "SE" - | "SG" - | "SH" - | "SI" - | "SJ" - | "SK" - | "SL" - | "SM" - | "SN" - | "SO" - | "SR" - | "SS" - | "ST" - | "SV" - | "SX" - | "SY" - | "SZ" - | "TC" - | "TD" - | "TF" - | "TG" - | "TH" - | "TJ" - | "TK" - | "TL" - | "TM" - | "TN" - | "TO" - | "TR" - | "TT" - | "TV" - | "TW" - | "TZ" - | "UA" - | "UG" - | "UM" - | "US" - | "UY" - | "UZ" - | "VA" - | "VC" - | "VE" - | "VG" - | "VI" - | "VN" - | "VU" - | "WF" - | "WS" - | "YE" - | "YT" - | "ZA" - | "ZM" - | "ZW"; -/** The 2-letter continent codes Cloudflare uses */ -declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA"; -declare type CfProperties = - | IncomingRequestCfProperties - | RequestInitCfProperties; -declare interface D1Result { - results?: T[]; - success: boolean; - error?: string; - meta: any; -} -declare abstract class D1Database { - prepare(query: string): D1PreparedStatement; - dump(): Promise; - batch(statements: D1PreparedStatement[]): Promise[]>; - exec(query: string): Promise>; -} -declare abstract class D1PreparedStatement { - bind(...values: any[]): D1PreparedStatement; - first(colName?: string): Promise; - run(): Promise>; - all(): Promise>; - raw(): Promise; -} -/** - * A email message that is sent to a consumer Worker. - */ -declare interface EmailMessage { - /** - * Envelope From attribute of the email message. - */ - readonly from: string; - /** - * Envelope To attribute of the email message. - */ - readonly to: string; - /** - * A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers). - */ - readonly headers: Headers; - /** - * Stream of the email message content. - */ - readonly raw: ReadableStream; - /** - * Size of the email message content. - */ - readonly rawSize: number; - /** - * Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason. - * @param reason The reject reason. - * @returns void - */ - setReject(reason: string): void; - /** - * Forward this email message to a verified destination address of the account. - * @param rcptTo Verified destination address. - * @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers). - * @returns A promise that resolves when the email message is forwarded. - */ - forward(rcptTo: string, headers?: Headers): Promise; -} -declare abstract class EmailEvent extends ExtendableEvent { - readonly message: EmailMessage; -} -declare type EmailExportedHandler = ( - message: EmailMessage, - env: Env, - ctx: ExecutionContext -) => void | Promise; -declare type Params

= Record; -declare type EventContext = { - request: Request; - functionPath: string; - waitUntil: (promise: Promise) => void; - passThroughOnException: () => void; - next: (input?: Request | string, init?: RequestInit) => Promise; - env: Env & { - ASSETS: { - fetch: typeof fetch; - }; - }; - params: Params

; - data: Data; -}; -declare type PagesFunction< - Env = unknown, - Params extends string = any, - Data extends Record = Record -> = (context: EventContext) => Response | Promise; -declare type EventPluginContext = { - request: Request; - functionPath: string; - waitUntil: (promise: Promise) => void; - passThroughOnException: () => void; - next: (input?: Request | string, init?: RequestInit) => Promise; - env: Env & { - ASSETS: { - fetch: typeof fetch; - }; - }; - params: Params

; - data: Data; - pluginArgs: PluginArgs; -}; -declare type PagesPluginFunction< - Env = unknown, - Params extends string = any, - Data extends Record = Record, - PluginArgs = unknown -> = ( - context: EventPluginContext -) => Response | Promise; -declare module "assets:*" { - export const onRequest: PagesFunction; -} -// https://developers.cloudflare.com/pub-sub/ -// PubSubMessage represents an incoming PubSub message. -// The message includes metadata about the broker, the client, and the payload -// itself. -declare interface PubSubMessage { - // Message ID - readonly mid: number; - // MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT - readonly broker: string; - // The MQTT topic the message was sent on. - readonly topic: string; - // The client ID of the client that published this message. - readonly clientId: string; - // The unique identifier (JWT ID) used by the client to authenticate, if token - // auth was used. - readonly jti?: string; - // A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker - // received the message from the client. - readonly receivedAt: number; - // An (optional) string with the MIME type of the payload, if set by the - // client. - readonly contentType: string; - // Set to 1 when the payload is a UTF-8 string - // https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063 - readonly payloadFormatIndicator: number; - // Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays. - // You can use payloadFormatIndicator to inspect this before decoding. - payload: string | Uint8Array; -} -// JsonWebKey extended by kid parameter -declare interface JsonWebKeyWithKid extends JsonWebKey { - // Key Identifier of the JWK - readonly kid: string; -} -/** - * A message that is sent to a consumer Worker. - */ -declare interface Message { - /** - * A unique, system-generated ID for the message. - */ - readonly id: string; - /** - * A timestamp when the message was sent. - */ - readonly timestamp: Date; - /** - * The body of the message. - */ - readonly body: Body; - /** - * Marks message to be retried. - */ - retry(): void; - /** - * Marks message acknowledged. - */ - ack(): void; -} -/** - * A batch of messages that are sent to a consumer Worker. - */ -declare interface MessageBatch { - /** - * The name of the Queue that belongs to this batch. - */ - readonly queue: string; - /** - * An array of messages in the batch. Ordering of messages is not guaranteed. - */ - readonly messages: readonly Message[]; - /** - * Marks every message to be retried in the next batch. - */ - retryAll(): void; - /** - * Marks every message acknowledged in the batch. - */ - ackAll(): void; -} -/** - * A wrapper class used to structure message batches. - */ -declare type MessageSendRequest = { - /** - * The body of the message. - */ - body: Body; -}; -/** - * A binding that allows a producer to send messages to a Queue. - */ -declare interface Queue { - /** - * Sends a message to the Queue. - * @param message The message can be any type supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types), as long as its size is less than 128 KB. - * @returns A promise that resolves when the message is confirmed to be written to disk. - */ - send(message: Body): Promise; - /** - * Sends a batch of messages to the Queue. - * @param messages Each item in the input must be supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types). A batch can contain up to 100 messages, though items are limited to 128 KB each, and the total size of the array cannot exceed 256 KB. - * @returns A promise that resolves when the messages are confirmed to be written to disk. - */ - sendBatch(messages: Iterable>): Promise; -} diff --git a/packages/denylist_bot/node_modules/@cloudflare/workers-types/index.ts b/packages/denylist_bot/node_modules/@cloudflare/workers-types/index.ts deleted file mode 100755 index 1f1e83007..000000000 --- a/packages/denylist_bot/node_modules/@cloudflare/workers-types/index.ts +++ /dev/null @@ -1,2992 +0,0 @@ -/*! ***************************************************************************** -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 -export declare class DOMException extends Error { - constructor(message?: string, name?: string); - readonly message: string; - readonly name: string; - readonly code: number; - readonly stack: any; - 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; -} -export type WorkerGlobalScopeEventMap = { - fetch: FetchEvent; - scheduled: ScheduledEvent; - unhandledrejection: PromiseRejectionEvent; - rejectionhandled: PromiseRejectionEvent; -}; -export declare abstract class WorkerGlobalScope extends EventTarget { - EventTarget: typeof EventTarget; -} -export interface Console { - "assert"(condition?: boolean, ...data: any[]): void; - clear(): void; - count(label?: string): void; - countReset(label?: string): void; - debug(...data: any[]): void; - dir(item?: any, options?: any): void; - dirxml(...data: any[]): void; - error(...data: any[]): void; - group(...data: any[]): void; - groupCollapsed(...data: any[]): void; - groupEnd(): void; - info(...data: any[]): void; - log(...data: any[]): void; - table(tabularData?: any, properties?: string[]): void; - time(label?: string): void; - timeEnd(label?: string): void; - timeLog(label?: string, ...data: any[]): void; - timeStamp(label?: string): void; - trace(...data: any[]): void; - warn(...data: any[]): void; -} -export declare const console: Console; -export type BufferSource = ArrayBufferView | ArrayBuffer; -export 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; - type Imports = Record; - type ExportValue = Function | Global | Memory | Table; - type Exports = Record; - 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; - function validate(bytes: BufferSource): boolean; -} -/** This ServiceWorker API interface represents the global execution context of a service worker. */ -export 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( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args - ): number; - clearTimeout(timeoutId: number | null): void; - setInterval(callback: (...args: any[]) => void, msDelay?: number): number; - setInterval( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args - ): number; - clearInterval(timeoutId: number | null): void; - queueMicrotask(task: Function): void; - structuredClone(value: T, options?: StructuredSerializeOptions): T; - fetch( - input: RequestInfo, - init?: RequestInit - ): Promise; - self: ServiceWorkerGlobalScope; - crypto: Crypto; - caches: CacheStorage; - scheduler: Scheduler; - Event: typeof Event; - ExtendableEvent: typeof ExtendableEvent; - PromiseRejectionEvent: typeof PromiseRejectionEvent; - FetchEvent: typeof FetchEvent; - TraceEvent: typeof TraceEvent; - 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; - 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; - AbortController: typeof AbortController; - AbortSignal: typeof AbortSignal; - TextDecoder: typeof TextDecoder; - TextEncoder: typeof TextEncoder; - 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; -} -export declare function addEventListener< - Type extends keyof WorkerGlobalScopeEventMap ->( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetAddEventListenerOptions | boolean -): void; -export declare function removeEventListener< - Type extends keyof WorkerGlobalScopeEventMap ->( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetEventListenerOptions | boolean -): void; -/** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */ -export declare function dispatchEvent( - event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap] -): boolean; -export declare function btoa(data: string): string; -export declare function atob(data: string): string; -export declare function setTimeout( - callback: (...args: any[]) => void, - msDelay?: number -): number; -export declare function setTimeout( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args -): number; -export declare function clearTimeout(timeoutId: number | null): void; -export declare function setInterval( - callback: (...args: any[]) => void, - msDelay?: number -): number; -export declare function setInterval( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args -): number; -export declare function clearInterval(timeoutId: number | null): void; -export declare function queueMicrotask(task: Function): void; -export declare function structuredClone( - value: T, - options?: StructuredSerializeOptions -): T; -export declare function fetch( - input: RequestInfo, - init?: RequestInit -): Promise; -export declare const self: ServiceWorkerGlobalScope; -export declare const crypto: Crypto; -export declare const caches: CacheStorage; -export declare const scheduler: Scheduler; -export interface TestController {} -export interface ExecutionContext { - waitUntil(promise: Promise): void; - passThroughOnException(): void; -} -export type ExportedHandlerFetchHandler< - Env = unknown, - CfHostMetadata = unknown -> = ( - request: Request>, - env: Env, - ctx: ExecutionContext -) => Response | Promise; -export type ExportedHandlerTraceHandler = ( - traces: TraceItem[], - env: Env, - ctx: ExecutionContext -) => void | Promise; -export type ExportedHandlerScheduledHandler = ( - controller: ScheduledController, - env: Env, - ctx: ExecutionContext -) => void | Promise; -export type ExportedHandlerQueueHandler = ( - batch: MessageBatch, - env: Env, - ctx: ExecutionContext -) => void | Promise; -export type ExportedHandlerTestHandler = ( - controller: TestController, - env: Env, - ctx: ExecutionContext -) => void | Promise; -export interface ExportedHandler< - Env = unknown, - QueueMessage = unknown, - CfHostMetadata = unknown -> { - fetch?: ExportedHandlerFetchHandler; - trace?: ExportedHandlerTraceHandler; - scheduled?: ExportedHandlerScheduledHandler; - test?: ExportedHandlerTestHandler; - queue?: ExportedHandlerQueueHandler; -} -export interface StructuredSerializeOptions { - transfer?: any[]; -} -export declare abstract class PromiseRejectionEvent extends Event { - readonly promise: Promise; - readonly reason: any; -} -export interface DurableObject { - fetch(request: Request): Response | Promise; - alarm?(): void | Promise; -} -export interface DurableObjectStub extends Fetcher { - readonly id: DurableObjectId; - readonly name?: string; -} -export interface DurableObjectId { - toString(): string; - equals(other: DurableObjectId): boolean; - readonly name?: string; -} -export interface DurableObjectNamespace { - newUniqueId( - options?: DurableObjectNamespaceNewUniqueIdOptions - ): DurableObjectId; - idFromName(name: string): DurableObjectId; - idFromString(id: string): DurableObjectId; - get( - id: DurableObjectId, - options?: DurableObjectNamespaceGetDurableObjectOptions - ): DurableObjectStub; - jurisdiction(jurisdiction: string): DurableObjectNamespace; -} -export interface DurableObjectNamespaceNewUniqueIdOptions { - jurisdiction?: string; -} -export interface DurableObjectNamespaceGetDurableObjectOptions { - locationHint?: string; -} -export interface DurableObjectState { - waitUntil(promise: Promise): void; - readonly id: DurableObjectId; - readonly storage: DurableObjectStorage; - blockConcurrencyWhile(callback: () => Promise): Promise; -} -export interface DurableObjectTransaction { - get( - key: string, - options?: DurableObjectGetOptions - ): Promise; - get( - keys: string[], - options?: DurableObjectGetOptions - ): Promise>; - list( - options?: DurableObjectListOptions - ): Promise>; - put( - key: string, - value: T, - options?: DurableObjectPutOptions - ): Promise; - put( - entries: Record, - options?: DurableObjectPutOptions - ): Promise; - delete(key: string, options?: DurableObjectPutOptions): Promise; - delete(keys: string[], options?: DurableObjectPutOptions): Promise; - rollback(): void; - getAlarm(options?: DurableObjectGetAlarmOptions): Promise; - setAlarm( - scheduledTime: number | Date, - options?: DurableObjectSetAlarmOptions - ): Promise; - deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise; -} -export interface DurableObjectStorage { - get( - key: string, - options?: DurableObjectGetOptions - ): Promise; - get( - keys: string[], - options?: DurableObjectGetOptions - ): Promise>; - list( - options?: DurableObjectListOptions - ): Promise>; - put( - key: string, - value: T, - options?: DurableObjectPutOptions - ): Promise; - put( - entries: Record, - options?: DurableObjectPutOptions - ): Promise; - delete(key: string, options?: DurableObjectPutOptions): Promise; - delete(keys: string[], options?: DurableObjectPutOptions): Promise; - deleteAll(options?: DurableObjectPutOptions): Promise; - transaction( - closure: (txn: DurableObjectTransaction) => Promise - ): Promise; - getAlarm(options?: DurableObjectGetAlarmOptions): Promise; - setAlarm( - scheduledTime: number | Date, - options?: DurableObjectSetAlarmOptions - ): Promise; - deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise; - sync(): Promise; -} -export interface DurableObjectListOptions { - start?: string; - startAfter?: string; - end?: string; - prefix?: string; - reverse?: boolean; - limit?: number; - allowConcurrency?: boolean; - noCache?: boolean; -} -export interface DurableObjectGetOptions { - allowConcurrency?: boolean; - noCache?: boolean; -} -export interface DurableObjectGetAlarmOptions { - allowConcurrency?: boolean; -} -export interface DurableObjectPutOptions { - allowConcurrency?: boolean; - allowUnconfirmed?: boolean; - noCache?: boolean; -} -export interface DurableObjectSetAlarmOptions { - allowConcurrency?: boolean; - allowUnconfirmed?: boolean; -} -export interface AnalyticsEngineDataset { - writeDataPoint(event?: AnalyticsEngineDataPoint): void; -} -export interface AnalyticsEngineDataPoint { - indexes?: ((ArrayBuffer | string) | null)[]; - doubles?: number[]; - blobs?: ((ArrayBuffer | string) | null)[]; -} -export declare class Event { - constructor(type: string, init?: EventInit); - /** Returns the type of event, e.g. "click", "hashchange", or "submit". */ - readonly type: string; - /** Returns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE. */ - readonly eventPhase: number; - /** Returns true or false depending on how event was initialized. True if event invokes listeners past a ShadowRoot node that is the root of its target, and false otherwise. */ - readonly composed: boolean; - /** Returns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise. */ - readonly bubbles: boolean; - /** Returns true or false depending on how event was initialized. Its return value does not always carry meaning, but true can indicate that part of the operation during which event was dispatched, can be canceled by invoking the preventDefault() method. */ - readonly cancelable: boolean; - /** Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise. */ - readonly defaultPrevented: boolean; - /** @deprecated */ - readonly returnValue: boolean; - /** Returns the object whose event listener's callback is currently being invoked. */ - readonly currentTarget?: EventTarget; - /** @deprecated */ - readonly srcElement?: EventTarget; - /** Returns the event's timestamp as the number of milliseconds measured relative to the time origin. */ - readonly timeStamp: number; - /** Returns true if event was dispatched by the user agent, and false otherwise. */ - readonly isTrusted: boolean; - cancelBubble: boolean; - stopImmediatePropagation(): void; - preventDefault(): void; - stopPropagation(): void; - composedPath(): EventTarget[]; - static readonly NONE: number; - static readonly CAPTURING_PHASE: number; - static readonly AT_TARGET: number; - static readonly BUBBLING_PHASE: number; -} -export interface EventInit { - bubbles?: boolean; - cancelable?: boolean; - composed?: boolean; -} -export type EventListener = ( - event: EventType -) => void; -export interface EventListenerObject { - handleEvent(event: EventType): void; -} -export type EventListenerOrEventListenerObject< - EventType extends Event = Event -> = EventListener | EventListenerObject; -export declare class EventTarget< - EventMap extends Record = Record -> { - constructor(); - addEventListener( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetAddEventListenerOptions | boolean - ): void; - removeEventListener( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetEventListenerOptions | boolean - ): void; - dispatchEvent(event: EventMap[keyof EventMap]): boolean; -} -export interface EventTargetEventListenerOptions { - capture?: boolean; -} -export interface EventTargetAddEventListenerOptions { - capture?: boolean; - passive?: boolean; - once?: boolean; - signal?: AbortSignal; -} -export interface EventTargetHandlerObject { - handleEvent: (event: Event) => any | undefined; -} -export declare class AbortController { - constructor(); - /** Returns the AbortSignal object associated with this object. */ - readonly signal: AbortSignal; - abort(reason?: any): void; -} -export declare abstract class AbortSignal extends EventTarget { - static abort(reason?: any): AbortSignal; - static timeout(delay: number): AbortSignal; - /** Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. */ - readonly aborted: boolean; - readonly reason: any; - throwIfAborted(): void; -} -export interface Scheduler { - wait(delay: number, maybeOptions?: SchedulerWaitOptions): Promise; -} -export interface SchedulerWaitOptions { - signal?: AbortSignal; -} -export declare abstract class ExtendableEvent extends Event { - waitUntil(promise: Promise): void; -} -export declare class Blob { - constructor( - bits?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[], - options?: BlobOptions - ); - readonly size: number; - readonly type: string; - slice(start?: number, end?: number, type?: string): Blob; - arrayBuffer(): Promise; - text(): Promise; - stream(): ReadableStream; -} -export interface BlobOptions { - type?: string; -} -export declare class File extends Blob { - constructor( - bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined, - name: string, - options?: FileOptions - ); - readonly name: string; - readonly lastModified: number; -} -export interface FileOptions { - type?: string; - lastModified?: number; -} -export declare abstract class CacheStorage { - open(cacheName: string): Promise; - readonly default: Cache; -} -export declare abstract class Cache { - delete(request: RequestInfo, options?: CacheQueryOptions): Promise; - match( - request: RequestInfo, - options?: CacheQueryOptions - ): Promise; - put(request: RequestInfo, response: Response): Promise; -} -export interface CacheQueryOptions { - ignoreMethod?: boolean; -} -export declare abstract class Crypto { - /** Available only in secure contexts. */ - readonly subtle: SubtleCrypto; - getRandomValues< - T extends - | Int8Array - | Uint8Array - | Int16Array - | Uint16Array - | Int32Array - | Uint32Array - | BigInt64Array - | BigUint64Array - >(buffer: T): T; - randomUUID(): string; - DigestStream: typeof DigestStream; -} -export declare abstract class SubtleCrypto { - encrypt( - algorithm: string | SubtleCryptoEncryptAlgorithm, - key: CryptoKey, - plainText: ArrayBuffer | ArrayBufferView - ): Promise; - decrypt( - algorithm: string | SubtleCryptoEncryptAlgorithm, - key: CryptoKey, - cipherText: ArrayBuffer | ArrayBufferView - ): Promise; - sign( - algorithm: string | SubtleCryptoSignAlgorithm, - key: CryptoKey, - data: ArrayBuffer | ArrayBufferView - ): Promise; - verify( - algorithm: string | SubtleCryptoSignAlgorithm, - key: CryptoKey, - signature: ArrayBuffer | ArrayBufferView, - data: ArrayBuffer | ArrayBufferView - ): Promise; - digest( - algorithm: string | SubtleCryptoHashAlgorithm, - data: ArrayBuffer | ArrayBufferView - ): Promise; - generateKey( - algorithm: string | SubtleCryptoGenerateKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - deriveKey( - algorithm: string | SubtleCryptoDeriveKeyAlgorithm, - baseKey: CryptoKey, - derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - deriveBits( - algorithm: string | SubtleCryptoDeriveKeyAlgorithm, - baseKey: CryptoKey, - length: number | null - ): Promise; - importKey( - format: string, - keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey, - algorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - exportKey(format: string, key: CryptoKey): Promise; - wrapKey( - format: string, - key: CryptoKey, - wrappingKey: CryptoKey, - wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm - ): Promise; - unwrapKey( - format: string, - wrappedKey: ArrayBuffer | ArrayBufferView, - unwrappingKey: CryptoKey, - unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm, - unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - timingSafeEqual( - a: ArrayBuffer | ArrayBufferView, - b: ArrayBuffer | ArrayBufferView - ): boolean; -} -export declare abstract class CryptoKey { - readonly type: string; - readonly extractable: boolean; - readonly algorithm: - | CryptoKeyKeyAlgorithm - | CryptoKeyAesKeyAlgorithm - | CryptoKeyHmacKeyAlgorithm - | CryptoKeyRsaKeyAlgorithm - | CryptoKeyEllipticKeyAlgorithm - | CryptoKeyArbitraryKeyAlgorithm; - readonly usages: string[]; -} -export interface CryptoKeyPair { - publicKey: CryptoKey; - privateKey: CryptoKey; -} -export 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; -} -export interface RsaOtherPrimesInfo { - r?: string; - d?: string; - t?: string; -} -export interface SubtleCryptoDeriveKeyAlgorithm { - name: string; - salt?: ArrayBuffer; - iterations?: number; - hash?: string | SubtleCryptoHashAlgorithm; - $public?: CryptoKey; - info?: ArrayBuffer; -} -export interface SubtleCryptoEncryptAlgorithm { - name: string; - iv?: ArrayBuffer; - additionalData?: ArrayBuffer; - tagLength?: number; - counter?: ArrayBuffer; - length?: number; - label?: ArrayBuffer; -} -export interface SubtleCryptoGenerateKeyAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - modulusLength?: number; - publicExponent?: ArrayBuffer; - length?: number; - namedCurve?: string; -} -export interface SubtleCryptoHashAlgorithm { - name: string; -} -export interface SubtleCryptoImportKeyAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - length?: number; - namedCurve?: string; - compressed?: boolean; -} -export interface SubtleCryptoSignAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - dataLength?: number; - saltLength?: number; -} -export interface CryptoKeyKeyAlgorithm { - name: string; -} -export interface CryptoKeyAesKeyAlgorithm { - name: string; - length: number; -} -export interface CryptoKeyHmacKeyAlgorithm { - name: string; - hash: CryptoKeyKeyAlgorithm; - length: number; -} -export interface CryptoKeyRsaKeyAlgorithm { - name: string; - modulusLength: number; - publicExponent: ArrayBuffer; - hash?: CryptoKeyKeyAlgorithm; -} -export interface CryptoKeyEllipticKeyAlgorithm { - name: string; - namedCurve: string; -} -export interface CryptoKeyArbitraryKeyAlgorithm { - name: string; - hash?: CryptoKeyKeyAlgorithm; - namedCurve?: string; - length?: number; -} -export declare class DigestStream extends WritableStream< - ArrayBuffer | ArrayBufferView -> { - constructor(algorithm: string | SubtleCryptoHashAlgorithm); - readonly digest: Promise; -} -export declare class TextDecoder { - constructor(decoder?: string, options?: TextDecoderConstructorOptions); - decode( - input?: ArrayBuffer | ArrayBufferView, - options?: TextDecoderDecodeOptions - ): string; - readonly encoding: string; - readonly fatal: boolean; - readonly ignoreBOM: boolean; -} -export declare class TextEncoder { - constructor(); - encode(input?: string): Uint8Array; - encodeInto(input: string, buffer: Uint8Array): TextEncoderEncodeIntoResult; - readonly encoding: string; -} -export interface TextDecoderConstructorOptions { - fatal: boolean; - ignoreBOM: boolean; -} -export interface TextDecoderDecodeOptions { - stream: boolean; -} -export interface TextEncoderEncodeIntoResult { - read: number; - written: number; -} -export declare class FormData { - constructor(); - append(name: string, value: string): void; - append(name: string, value: Blob, filename?: string): void; - delete(name: string): void; - get(name: string): string | null; - getAll(name: string): string[]; - has(name: string): boolean; - set(name: string, value: string): void; - set(name: string, value: Blob, filename?: string): void; - entries(): IterableIterator<[key: string, value: string]>; - keys(): IterableIterator; - values(): IterableIterator; - forEach( - callback: ( - this: This, - value: string, - key: string, - parent: FormData - ) => void, - thisArg?: This - ): void; - [Symbol.iterator](): IterableIterator<[key: string, value: string]>; -} -export interface ContentOptions { - html?: boolean; -} -export declare class HTMLRewriter { - constructor(); - on( - selector: string, - handlers: HTMLRewriterElementContentHandlers - ): HTMLRewriter; - onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter; - transform(response: Response): Response; -} -export interface HTMLRewriterElementContentHandlers { - element?(element: Element): void | Promise; - comments?(comment: Comment): void | Promise; - text?(element: Text): void | Promise; -} -export interface HTMLRewriterDocumentContentHandlers { - doctype?(doctype: Doctype): void | Promise; - comments?(comment: Comment): void | Promise; - text?(text: Text): void | Promise; - end?(end: DocumentEnd): void | Promise; -} -export interface Doctype { - readonly name: string | null; - readonly publicId: string | null; - readonly systemId: string | null; -} -export interface Element { - tagName: string; - readonly attributes: IterableIterator; - 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, options?: ContentOptions): Element; - after(content: string, options?: ContentOptions): Element; - prepend(content: string, options?: ContentOptions): Element; - append(content: string, options?: ContentOptions): Element; - replace(content: string, options?: ContentOptions): Element; - remove(): Element; - removeAndKeepContent(): Element; - setInnerContent(content: string, options?: ContentOptions): Element; - onEndTag(handler: (tag: EndTag) => void | Promise): void; -} -export interface EndTag { - name: string; - before(content: string, options?: ContentOptions): EndTag; - after(content: string, options?: ContentOptions): EndTag; - remove(): EndTag; -} -export 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; -} -export interface Text { - readonly text: string; - readonly lastInTextNode: boolean; - readonly removed: boolean; - before(content: string, options?: ContentOptions): Text; - after(content: string, options?: ContentOptions): Text; - replace(content: string, options?: ContentOptions): Text; - remove(): Text; -} -export interface DocumentEnd { - append(content: string, options?: ContentOptions): DocumentEnd; -} -export declare abstract class FetchEvent extends ExtendableEvent { - readonly request: Request; - respondWith(promise: Response | Promise): void; - passThroughOnException(): void; -} -export type HeadersInit = - | Headers - | Iterable> - | Record; -export declare class Headers { - constructor(init?: HeadersInit); - get(name: string): string | null; - getAll(name: string): string[]; - has(name: string): boolean; - set(name: string, value: string): void; - append(name: string, value: string): void; - delete(name: string): void; - forEach( - callback: (this: This, value: string, key: string, parent: Headers) => void, - thisArg?: This - ): void; - entries(): IterableIterator<[key: string, value: string]>; - keys(): IterableIterator; - values(): IterableIterator; - [Symbol.iterator](): IterableIterator<[key: string, value: string]>; -} -export type BodyInit = - | ReadableStream - | string - | ArrayBuffer - | ArrayBufferView - | Blob - | URLSearchParams - | FormData; -export declare abstract class Body { - readonly body: ReadableStream | null; - readonly bodyUsed: boolean; - arrayBuffer(): Promise; - text(): Promise; - json(): Promise; - formData(): Promise; - blob(): Promise; -} -export declare class Response extends Body { - constructor(body?: BodyInit | null, init?: ResponseInit); - static redirect(url: string, status?: number): Response; - static json(any: any, maybeInit?: ResponseInit | Response): Response; - clone(): Response; - readonly status: number; - readonly statusText: string; - readonly headers: Headers; - readonly ok: boolean; - readonly redirected: boolean; - readonly url: string; - readonly webSocket: WebSocket | null; - readonly cf?: any; -} -export interface ResponseInit { - status?: number; - statusText?: string; - headers?: HeadersInit; - cf?: any; - webSocket?: WebSocket | null; - encodeBody?: "automatic" | "manual"; -} -export type RequestInfo< - CfHostMetadata = unknown, - Cf = CfProperties -> = Request | string | URL; -export declare class Request< - CfHostMetadata = unknown, - Cf = CfProperties -> extends Body { - constructor(input: RequestInfo, init?: RequestInit); - clone(): Request; - /** Returns request's HTTP method, which is "GET" by default. */ - readonly method: string; - /** Returns the URL of request as a string. */ - readonly url: string; - /** Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the "Host" header. */ - readonly headers: Headers; - /** Returns the redirect mode associated with request, which is a string indicating how redirects for the request will be handled during fetching. A request will follow redirects by default. */ - readonly redirect: string; - readonly fetcher: Fetcher | null; - /** Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler. */ - readonly signal: AbortSignal; - readonly cf?: Cf; - /** Returns request's subresource integrity metadata, which is a cryptographic hash of the resource being fetched. Its value consists of multiple hashes separated by whitespace. [SRI] */ - readonly integrity: string; - /** Returns a boolean indicating whether or not request can outlive the global in which it was created. */ - readonly keepalive: boolean; -} -export interface RequestInit { - /** 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 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; -} -export declare abstract class Fetcher { - fetch(input: RequestInfo, init?: RequestInit): Promise; -} -export interface FetcherPutOptions { - expiration?: number; - expirationTtl?: number; -} -export interface KVNamespaceListKey { - name: Key; - expiration?: number; - metadata?: Metadata; -} -export type KVNamespaceListResult = - | { - list_complete: false; - keys: KVNamespaceListKey[]; - cursor: string; - } - | { - list_complete: true; - keys: KVNamespaceListKey[]; - }; -export interface KVNamespace { - get( - key: Key, - options?: Partial> - ): Promise; - get(key: Key, type: "text"): Promise; - get( - key: Key, - type: "json" - ): Promise; - get(key: Key, type: "arrayBuffer"): Promise; - get(key: Key, type: "stream"): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"text"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"json"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"arrayBuffer"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"stream"> - ): Promise; - list( - options?: KVNamespaceListOptions - ): Promise>; - put( - key: Key, - value: string | ArrayBuffer | ArrayBufferView | ReadableStream, - options?: KVNamespacePutOptions - ): Promise; - getWithMetadata( - key: Key, - options?: Partial> - ): Promise>; - getWithMetadata( - key: Key, - type: "text" - ): Promise>; - getWithMetadata( - key: Key, - type: "json" - ): Promise>; - getWithMetadata( - key: Key, - type: "arrayBuffer" - ): Promise>; - getWithMetadata( - key: Key, - type: "stream" - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"text"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"json"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"arrayBuffer"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"stream"> - ): Promise>; - delete(key: Key): Promise; -} -export interface KVNamespaceListOptions { - limit?: number; - prefix?: string | null; - cursor?: string | null; -} -export interface KVNamespaceGetOptions { - type: Type; - cacheTtl?: number; -} -export interface KVNamespacePutOptions { - expiration?: number; - expirationTtl?: number; - metadata?: any | null; -} -export interface KVNamespaceGetWithMetadataResult { - value: Value | null; - metadata: Metadata | null; -} -export interface R2Error extends Error { - readonly name: string; - readonly code: number; - readonly message: string; - readonly action: string; - readonly stack: any; -} -export interface R2ListOptions { - limit?: number; - prefix?: string; - cursor?: string; - delimiter?: string; - startAfter?: string; -} -export declare abstract class R2Bucket { - head(key: string): Promise; - get( - key: string, - options: R2GetOptions & { - onlyIf: R2Conditional | Headers; - } - ): Promise; - get(key: string, options?: R2GetOptions): Promise; - put( - key: string, - value: - | ReadableStream - | ArrayBuffer - | ArrayBufferView - | string - | null - | Blob, - options?: R2PutOptions - ): Promise; - put( - key: string, - value: - | ReadableStream - | ArrayBuffer - | ArrayBufferView - | string - | null - | Blob, - options?: R2PutOptions & { - onlyIf: R2Conditional | Headers; - } - ): Promise; - createMultipartUpload( - key: string, - options?: R2MultipartOptions - ): Promise; - resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload; - delete(keys: string | string[]): Promise; - list(options?: R2ListOptions): Promise; -} -export interface R2MultipartUpload { - readonly key: string; - readonly uploadId: string; - uploadPart( - partNumber: number, - value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob - ): Promise; - abort(): Promise; - complete(uploadedParts: R2UploadedPart[]): Promise; -} -export interface R2UploadedPart { - partNumber: number; - etag: string; -} -export 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; - readonly range?: R2Range; - writeHttpMetadata(headers: Headers): void; -} -export interface R2ObjectBody extends R2Object { - get body(): ReadableStream; - get bodyUsed(): boolean; - arrayBuffer(): Promise; - text(): Promise; - json(): Promise; - blob(): Promise; -} -export type R2Range = - | { - offset: number; - length?: number; - } - | { - offset?: number; - length: number; - } - | { - suffix: number; - }; -export interface R2Conditional { - etagMatches?: string; - etagDoesNotMatch?: string; - uploadedBefore?: Date; - uploadedAfter?: Date; - secondsGranularity?: boolean; -} -export interface R2GetOptions { - onlyIf?: R2Conditional | Headers; - range?: R2Range | Headers; -} -export interface R2PutOptions { - onlyIf?: R2Conditional | Headers; - httpMetadata?: R2HTTPMetadata | Headers; - customMetadata?: Record; - md5?: ArrayBuffer | string; - sha1?: ArrayBuffer | string; - sha256?: ArrayBuffer | string; - sha384?: ArrayBuffer | string; - sha512?: ArrayBuffer | string; -} -export interface R2MultipartOptions { - httpMetadata?: R2HTTPMetadata | Headers; - customMetadata?: Record; -} -export interface R2Checksums { - readonly md5?: ArrayBuffer; - readonly sha1?: ArrayBuffer; - readonly sha256?: ArrayBuffer; - readonly sha384?: ArrayBuffer; - readonly sha512?: ArrayBuffer; - toJSON(): R2StringChecksums; -} -export interface R2StringChecksums { - md5?: string; - sha1?: string; - sha256?: string; - sha384?: string; - sha512?: string; -} -export interface R2HTTPMetadata { - contentType?: string; - contentLanguage?: string; - contentDisposition?: string; - contentEncoding?: string; - cacheControl?: string; - cacheExpiry?: Date; -} -export interface R2Objects { - objects: R2Object[]; - truncated: boolean; - cursor?: string; - delimitedPrefixes: string[]; -} -export declare abstract class ScheduledEvent extends ExtendableEvent { - readonly scheduledTime: number; - readonly cron: string; - noRetry(): void; -} -export interface ScheduledController { - readonly scheduledTime: number; - readonly cron: string; - noRetry(): void; -} -export interface QueuingStrategy { - highWaterMark?: number | bigint; - size?: (chunk: T) => number | bigint; -} -export interface UnderlyingSink { - type?: string; - start?: (controller: WritableStreamDefaultController) => void | Promise; - write?: ( - chunk: W, - controller: WritableStreamDefaultController - ) => void | Promise; - abort?: (reason: any) => void | Promise; - close?: () => void | Promise; -} -export interface UnderlyingByteSource { - type: "bytes"; - autoAllocateChunkSize?: number; - start?: (controller: ReadableByteStreamController) => void | Promise; - pull?: (controller: ReadableByteStreamController) => void | Promise; - cancel?: (reason: any) => void | Promise; -} -export interface UnderlyingSource { - type?: "" | undefined; - start?: ( - controller: ReadableStreamDefaultController - ) => void | Promise; - pull?: ( - controller: ReadableStreamDefaultController - ) => void | Promise; - cancel?: (reason: any) => void | Promise; -} -export interface Transformer { - readableType?: string; - writableType?: string; - start?: ( - controller: TransformStreamDefaultController - ) => void | Promise; - transform?: ( - chunk: I, - controller: TransformStreamDefaultController - ) => void | Promise; - flush?: ( - controller: TransformStreamDefaultController - ) => void | Promise; -} -export interface StreamPipeOptions { - /** - * 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; - preventAbort?: boolean; - preventCancel?: boolean; - signal?: AbortSignal; -} -export type ReadableStreamReadResult = - | { - done: false; - value: R; - } - | { - done: true; - value?: undefined; - }; -/** This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object. */ -export interface ReadableStream { - readonly locked: boolean; - cancel(reason?: any): Promise; - getReader(): ReadableStreamDefaultReader; - getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader; - pipeThrough( - transform: ReadableWritablePair, - options?: StreamPipeOptions - ): ReadableStream; - pipeTo( - destination: WritableStream, - options?: StreamPipeOptions - ): Promise; - tee(): [ReadableStream, ReadableStream]; - values(options?: ReadableStreamValuesOptions): AsyncIterableIterator; - [Symbol.asyncIterator]( - options?: ReadableStreamValuesOptions - ): AsyncIterableIterator; -} -export declare const ReadableStream: { - prototype: ReadableStream; - new ( - underlyingSource: UnderlyingByteSource, - strategy?: QueuingStrategy - ): ReadableStream; - new ( - underlyingSource?: UnderlyingSource, - strategy?: QueuingStrategy - ): ReadableStream; -}; -export declare class ReadableStreamDefaultReader { - constructor(stream: ReadableStream); - readonly closed: Promise; - cancel(reason?: any): Promise; - read(): Promise>; - releaseLock(): void; -} -export declare class ReadableStreamBYOBReader { - constructor(stream: ReadableStream); - readonly closed: Promise; - cancel(reason?: any): Promise; - read( - view: T - ): Promise>; - releaseLock(): void; - readAtLeast( - minElements: number, - view: T - ): Promise>; -} -export interface ReadableStreamGetReaderOptions { - mode: "byob"; -} -export interface ReadableStreamBYOBRequest { - readonly view: Uint8Array | null; - respond(bytesWritten: number): void; - respondWithNewView(view: ArrayBuffer | ArrayBufferView): void; - readonly atLeast: number | null; -} -export interface ReadableStreamDefaultController { - readonly desiredSize: number | null; - close(): void; - enqueue(chunk?: R): void; - error(reason: any): void; -} -export interface ReadableByteStreamController { - readonly byobRequest: ReadableStreamBYOBRequest | null; - readonly desiredSize: number | null; - close(): void; - enqueue(chunk: ArrayBuffer | ArrayBufferView): void; - error(reason: any): void; -} -/** This Streams API interface represents a controller allowing control of a WritableStream's state. When constructing a WritableStream, the underlying sink is given a corresponding WritableStreamDefaultController instance to manipulate. */ -export interface WritableStreamDefaultController { - readonly signal: AbortSignal; - error(reason?: any): void; -} -export interface TransformStreamDefaultController { - get desiredSize(): number | null; - enqueue(chunk?: O): void; - error(reason: any): void; - terminate(): void; -} -export interface ReadableWritablePair { - /** - * 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; - readable: ReadableStream; -} -export declare class WritableStream { - constructor( - underlyingSink?: UnderlyingSink, - queuingStrategy?: QueuingStrategy - ); - readonly locked: boolean; - abort(reason?: any): Promise; - close(): Promise; - getWriter(): WritableStreamDefaultWriter; -} -export declare class WritableStreamDefaultWriter { - constructor(stream: WritableStream); - readonly closed: Promise; - readonly ready: Promise; - readonly desiredSize: number | null; - abort(reason?: any): Promise; - close(): Promise; - write(chunk?: W): Promise; - releaseLock(): void; -} -export declare class TransformStream { - constructor( - transformer?: Transformer, - writableStrategy?: QueuingStrategy, - readableStrategy?: QueuingStrategy - ); - readonly readable: ReadableStream; - readonly writable: WritableStream; -} -export declare class FixedLengthStream extends IdentityTransformStream { - constructor(expectedLength: number | bigint); -} -export declare class IdentityTransformStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(); -} -export interface ReadableStreamValuesOptions { - preventCancel?: boolean; -} -export declare class CompressionStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(format: "gzip" | "deflate" | "deflate-raw"); -} -export declare class DecompressionStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(format: "gzip" | "deflate" | "deflate-raw"); -} -export declare class TextEncoderStream extends TransformStream< - string, - Uint8Array -> { - constructor(); -} -export declare class TextDecoderStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - string -> { - constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit); -} -export interface TextDecoderStreamTextDecoderStreamInit { - fatal?: boolean; -} -export declare class ByteLengthQueuingStrategy - implements QueuingStrategy -{ - constructor(init: QueuingStrategyInit); - get highWaterMark(): number; - get size(): (chunk?: any) => number; -} -export declare class CountQueuingStrategy implements QueuingStrategy { - constructor(init: QueuingStrategyInit); - get highWaterMark(): number; - get size(): (chunk?: any) => number; -} -export 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; -} -export declare abstract class TraceEvent extends ExtendableEvent { - readonly traces: TraceItem[]; -} -export interface TraceItem { - readonly event: - | ( - | TraceItemFetchEventInfo - | TraceItemScheduledEventInfo - | TraceItemAlarmEventInfo - | TraceItemQueueEventInfo - | TraceItemEmailEventInfo - | TraceItemCustomEventInfo - ) - | null; - readonly eventTimestamp: number | null; - readonly logs: TraceLog[]; - readonly exceptions: TraceException[]; - readonly scriptName: string | null; - readonly dispatchNamespace?: string; - readonly scriptTags?: string[]; - readonly outcome: string; -} -export interface TraceItemAlarmEventInfo { - readonly scheduledTime: Date; -} -export interface TraceItemCustomEventInfo {} -export interface TraceItemScheduledEventInfo { - readonly scheduledTime: number; - readonly cron: string; -} -export interface TraceItemQueueEventInfo { - readonly queue: string; - readonly batchSize: number; -} -export interface TraceItemEmailEventInfo { - readonly mailFrom: string; - readonly rcptTo: string; - readonly rawSize: number; -} -export interface TraceItemFetchEventInfo { - readonly response?: TraceItemFetchEventInfoResponse; - readonly request: TraceItemFetchEventInfoRequest; -} -export interface TraceItemFetchEventInfoRequest { - readonly cf?: any; - readonly headers: Record; - readonly method: string; - readonly url: string; - getUnredacted(): TraceItemFetchEventInfoRequest; -} -export interface TraceItemFetchEventInfoResponse { - readonly status: number; -} -export interface TraceLog { - readonly timestamp: number; - readonly level: string; - readonly message: any; -} -export interface TraceException { - readonly timestamp: number; - readonly message: string; - readonly name: string; -} -export interface TraceMetrics { - readonly cpuTime: number; - readonly wallTime: number; -} -export interface UnsafeTraceMetrics { - fromTrace(item: TraceItem): TraceMetrics; -} -export declare class URL { - constructor(url: string | URL, base?: string | URL); - href: string; - readonly origin: string; - protocol: string; - username: string; - password: string; - host: string; - hostname: string; - port: string; - pathname: string; - search: string; - readonly searchParams: URLSearchParams; - hash: string; - toString(): string; - toJSON(): string; -} -export declare class URLSearchParams { - constructor( - init?: - | URLSearchParams - | string - | Record - | [key: string, value: string][] - ); - get size(): number; - append(name: string, value: string): void; - delete(name: string): void; - get(name: string): string | null; - getAll(name: string): string[]; - has(name: string): boolean; - set(name: string, value: string): void; - sort(): void; - entries(): IterableIterator<[key: string, value: string]>; - keys(): IterableIterator; - values(): IterableIterator; - forEach( - callback: ( - this: This, - value: string, - key: string, - parent: URLSearchParams - ) => void, - thisArg?: This - ): void; - toString(): string; - [Symbol.iterator](): IterableIterator<[key: string, value: string]>; -} -export declare class URLPattern { - constructor(input?: string | URLPatternURLPatternInit, baseURL?: string); - get protocol(): string; - get username(): string; - get password(): string; - get hostname(): string; - get port(): string; - get pathname(): string; - get search(): string; - get hash(): string; - test(input?: string | URLPatternURLPatternInit, baseURL?: string): boolean; - exec( - input?: string | URLPatternURLPatternInit, - baseURL?: string - ): URLPatternURLPatternResult | null; -} -export interface URLPatternURLPatternInit { - protocol?: string; - username?: string; - password?: string; - hostname?: string; - port?: string; - pathname?: string; - search?: string; - hash?: string; - baseURL?: string; -} -export interface URLPatternURLPatternComponentResult { - input: string; - groups: Record; -} -export interface URLPatternURLPatternResult { - inputs: (string | URLPatternURLPatternInit)[]; - protocol: URLPatternURLPatternComponentResult; - username: URLPatternURLPatternComponentResult; - password: URLPatternURLPatternComponentResult; - hostname: URLPatternURLPatternComponentResult; - port: URLPatternURLPatternComponentResult; - pathname: URLPatternURLPatternComponentResult; - search: URLPatternURLPatternComponentResult; - hash: URLPatternURLPatternComponentResult; -} -export declare class CloseEvent extends Event { - constructor(type: string, initializer: CloseEventInit); - /** Returns the WebSocket connection close code provided by the server. */ - readonly code: number; - /** Returns the WebSocket connection close reason provided by the server. */ - readonly reason: string; - /** Returns true if the connection closed cleanly; false otherwise. */ - readonly wasClean: boolean; -} -export interface CloseEventInit { - code?: number; - reason?: string; - wasClean?: boolean; -} -export declare class MessageEvent extends Event { - constructor(type: string, initializer: MessageEventInit); - readonly data: ArrayBuffer | string; -} -export interface MessageEventInit { - data: ArrayBuffer | string; -} -/** Events providing information related to errors in scripts or in files. */ -export interface ErrorEvent extends Event { - readonly filename: string; - readonly message: string; - readonly lineno: number; - readonly colno: number; - readonly error: any; -} -export type WebSocketEventMap = { - close: CloseEvent; - message: MessageEvent; - open: Event; - error: ErrorEvent; -}; -export declare class WebSocket extends EventTarget { - constructor(url: string, protocols?: string[] | string); - accept(): void; - send(message: (ArrayBuffer | ArrayBufferView) | string): void; - close(code?: number, reason?: string): void; - static readonly READY_STATE_CONNECTING: number; - static readonly READY_STATE_OPEN: number; - static readonly READY_STATE_CLOSING: number; - static readonly READY_STATE_CLOSED: number; - /** Returns the state of the WebSocket object's connection. It can have the values described below. */ - readonly readyState: number; - /** Returns the URL that was used to establish the WebSocket connection. */ - readonly url: string | null; - /** Returns the subprotocol selected by the server, if any. It can be used in conjunction with the array form of the constructor's second argument to perform subprotocol negotiation. */ - readonly protocol: string | null; - /** Returns the extensions selected by the server, if any. */ - readonly extensions: string | null; -} -export declare const WebSocketPair: { - new (): { - 0: WebSocket; - 1: WebSocket; - }; -}; -export interface BasicImageTransformations { - /** - * Maximum width in image pixels. The value must be an integer. - */ - width?: number; - /** - * Maximum height in image pixels. The value must be an integer. - */ - height?: number; - /** - * Resizing mode as a string. It affects interpretation of width and height - * options: - * - scale-down: Similar to contain, but the image is never enlarged. If - * the image is larger than given width or height, it will be resized. - * Otherwise its original size will be kept. - * - contain: Resizes to maximum size that fits within the given width and - * height. If only a single dimension is given (e.g. only width), the - * image will be shrunk or enlarged to exactly match that dimension. - * Aspect ratio is always preserved. - * - cover: Resizes (shrinks or enlarges) to fill the entire area of width - * and height. If the image has an aspect ratio different from the ratio - * of width and height, it will be cropped to fit. - * - crop: The image will be shrunk and cropped to fit within the area - * specified by width and height. The image will not be enlarged. For images - * smaller than the given dimensions it's the same as scale-down. For - * images larger than the given dimensions, it's the same as cover. - * See also trim. - * - pad: Resizes to the maximum size that fits within the given width and - * height, and then fills the remaining area with a background color - * (white by default). Use of this mode is not recommended, as the same - * effect can be more efficiently achieved with the contain mode and the - * CSS object-fit: contain property. - */ - fit?: "scale-down" | "contain" | "cover" | "crop" | "pad"; - /** - * When cropping with fit: "cover", this defines the side or point that should - * be left uncropped. The value is either a string - * "left", "right", "top", "bottom", "auto", or "center" (the default), - * or an object {x, y} containing focal point coordinates in the original - * image expressed as fractions ranging from 0.0 (top or left) to 1.0 - * (bottom or right), 0.5 being the center. {fit: "cover", gravity: "top"} will - * crop bottom or left and right sides as necessary, but won’t crop anything - * from the top. {fit: "cover", gravity: {x:0.5, y:0.2}} will crop each side to - * preserve as much as possible around a point at 20% of the height of the - * source image. - */ - gravity?: - | "left" - | "right" - | "top" - | "bottom" - | "center" - | "auto" - | BasicImageTransformationsGravityCoordinates; - /** - * Background color to add underneath the image. Applies only to images with - * transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…), - * hsl(…), etc.) - */ - background?: string; - /** - * Number of degrees (90, 180, 270) to rotate the image by. width and height - * options refer to axes after rotation. - */ - rotate?: 0 | 90 | 180 | 270 | 360; -} -export interface BasicImageTransformationsGravityCoordinates { - x: number; - y: number; -} -/** - * In addition to the properties you can set in the RequestInit dict - * that you pass as an argument to the Request constructor, you can - * set certain properties of a `cf` object to control how Cloudflare - * features are applied to that new Request. - * - * Note: Currently, these properties cannot be tested in the - * playground. - */ -export interface RequestInitCfProperties extends Record { - cacheEverything?: boolean; - /** - * A request's cache key is what determines if two requests are - * "the same" for caching purposes. If a request has the same cache key - * as some previous request, then we can serve the same cached response for - * both. (e.g. 'some-key') - * - * Only available for Enterprise customers. - */ - cacheKey?: string; - /** - * This allows you to append additional Cache-Tag response headers - * to the origin response without modifications to the origin server. - * This will allow for greater control over the Purge by Cache Tag feature - * utilizing changes only in the Workers process. - * - * Only available for Enterprise customers. - */ - cacheTags?: string[]; - /** - * Force response to be cached for a given number of seconds. (e.g. 300) - */ - cacheTtl?: number; - /** - * Force response to be cached for a given number of seconds based on the Origin status code. - * (e.g. { '200-299': 86400, '404': 1, '500-599': 0 }) - */ - cacheTtlByStatus?: Record; - scrapeShield?: boolean; - apps?: boolean; - image?: RequestInitCfPropertiesImage; - minify?: RequestInitCfPropertiesImageMinify; - mirage?: boolean; - polish?: "lossy" | "lossless" | "off"; - /** - * Redirects the request to an alternate origin server. You can use this, - * for example, to implement load balancing across several origins. - * (e.g.us-east.example.com) - * - * Note - For security reasons, the hostname set in resolveOverride must - * be proxied on the same Cloudflare zone of the incoming request. - * Otherwise, the setting is ignored. CNAME hosts are allowed, so to - * resolve to a host under a different domain or a DNS only domain first - * declare a CNAME record within your own zone’s DNS mapping to the - * external hostname, set proxy on Cloudflare, then set resolveOverride - * to point to that CNAME record. - */ - resolveOverride?: string; -} -export interface RequestInitCfPropertiesImageDraw - extends BasicImageTransformations { - /** - * Absolute URL of the image file to use for the drawing. It can be any of - * the supported file formats. For drawing of watermarks or non-rectangular - * overlays we recommend using PNG or WebP images. - */ - url: string; - /** - * Floating-point number between 0 (transparent) and 1 (opaque). - * For example, opacity: 0.5 makes overlay semitransparent. - */ - opacity?: number; - /** - * - If set to true, the overlay image will be tiled to cover the entire - * area. This is useful for stock-photo-like watermarks. - * - If set to "x", the overlay image will be tiled horizontally only - * (form a line). - * - If set to "y", the overlay image will be tiled vertically only - * (form a line). - */ - repeat?: true | "x" | "y"; - /** - * Position of the overlay image relative to a given edge. Each property is - * an offset in pixels. 0 aligns exactly to the edge. For example, left: 10 - * positions left side of the overlay 10 pixels from the left edge of the - * image it's drawn over. bottom: 0 aligns bottom of the overlay with bottom - * of the background image. - * - * Setting both left & right, or both top & bottom is an error. - * - * If no position is specified, the image will be centered. - */ - top?: number; - left?: number; - bottom?: number; - right?: number; -} -export interface RequestInitCfPropertiesImage - extends BasicImageTransformations { - /** - * Device Pixel Ratio. Default 1. Multiplier for width/height that makes it - * easier to specify higher-DPI sizes in . - */ - dpr?: number; - /** - * An object with four properties {left, top, right, bottom} that specify - * a number of pixels to cut off on each side. Allows removal of borders - * or cutting out a specific fragment of an image. Trimming is performed - * before resizing or rotation. Takes dpr into account. - */ - trim?: { - left?: number; - top?: number; - right?: number; - bottom?: number; - }; - /** - * Quality setting from 1-100 (useful values are in 60-90 range). Lower values - * make images look worse, but load faster. The default is 85. It applies only - * to JPEG and WebP images. It doesn’t have any effect on PNG. - */ - quality?: number; - /** - * Output format to generate. It can be: - * - avif: generate images in AVIF format. - * - webp: generate images in Google WebP format. Set quality to 100 to get - * the WebP-lossless format. - * - json: instead of generating an image, outputs information about the - * image, in JSON format. The JSON object will contain image size - * (before and after resizing), source image’s MIME type, file size, etc. - * - jpeg: generate images in JPEG format. - * - png: generate images in PNG format. - */ - format?: "avif" | "webp" | "json" | "jpeg" | "png"; - /** - * Whether to preserve animation frames from input files. Default is true. - * Setting it to false reduces animations to still images. This setting is - * recommended when enlarging images or processing arbitrary user content, - * because large GIF animations can weigh tens or even hundreds of megabytes. - * It is also useful to set anim:false when using format:"json" to get the - * response quicker without the number of frames. - */ - anim?: boolean; - /** - * What EXIF data should be preserved in the output image. Note that EXIF - * rotation and embedded color profiles are always applied ("baked in" into - * the image), and aren't affected by this option. Note that if the Polish - * feature is enabled, all metadata may have been removed already and this - * option may have no effect. - * - keep: Preserve most of EXIF metadata, including GPS location if there's - * any. - * - copyright: Only keep the copyright tag, and discard everything else. - * This is the default behavior for JPEG files. - * - none: Discard all invisible EXIF metadata. Currently WebP and PNG - * output formats always discard metadata. - */ - metadata?: "keep" | "copyright" | "none"; - /** - * Strength of sharpening filter to apply to the image. Floating-point - * number between 0 (no sharpening, default) and 10 (maximum). 1.0 is a - * recommended value for downscaled images. - */ - sharpen?: number; - /** - * Radius of a blur filter (approximate gaussian). Maximum supported radius - * is 250. - */ - blur?: number; - /** - * Overlays are drawn in the order they appear in the array (last array - * entry is the topmost layer). - */ - draw?: RequestInitCfPropertiesImageDraw[]; - /** - * Fetching image from authenticated origin. Setting this property will - * pass authentication headers (Authorization, Cookie, etc.) through to - * the origin. - */ - "origin-auth"?: "share-publicly"; - /** - * Adds a border around the image. The border is added after resizing. Border - * width takes dpr into account, and can be specified either using a single - * width property, or individually for each side. - */ - border?: - | { - color: string; - width: number; - } - | { - color: string; - top: number; - right: number; - bottom: number; - left: number; - }; - /** - * Increase brightness by a factor. A value of 1.0 equals no change, a value - * of 0.5 equals half brightness, and a value of 2.0 equals twice as bright. - * 0 is ignored. - */ - brightness?: number; - /** - * Increase contrast by a factor. A value of 1.0 equals no change, a value of - * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is - * ignored. - */ - contrast?: number; - /** - * Increase exposure by a factor. A value of 1.0 equals no change, a value of - * 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored. - */ - gamma?: number; - /** - * Slightly reduces latency on a cache miss by selecting a - * quickest-to-compress file format, at a cost of increased file size and - * lower image quality. It will usually override the format option and choose - * JPEG over WebP or AVIF. We do not recommend using this option, except in - * unusual circumstances like resizing uncacheable dynamically-generated - * images. - */ - compression?: "fast"; -} -export interface RequestInitCfPropertiesImageMinify { - javascript?: boolean; - css?: boolean; - html?: boolean; -} -/** - * Request metadata provided by Cloudflare's edge. - */ -export type IncomingRequestCfProperties = - IncomingRequestCfPropertiesBase & - IncomingRequestCfPropertiesBotManagementEnterprise & - IncomingRequestCfPropertiesCloudflareForSaaSEnterprise & - IncomingRequestCfPropertiesGeographicInformation & - IncomingRequestCfPropertiesCloudflareAccessOrApiShield; -export interface IncomingRequestCfPropertiesBase - extends Record { - /** - * [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request. - * - * @example 395747 - */ - asn: number; - /** - * The organization which owns the ASN of the incoming request. - * - * @example "Google Cloud" - */ - asOrganization: string; - /** - * The original value of the `Accept-Encoding` header if Cloudflare modified it. - * - * @example "gzip, deflate, br" - */ - clientAcceptEncoding?: string; - /** - * The number of milliseconds it took for the request to reach your worker. - * - * @example 22 - */ - clientTcpRtt?: number; - /** - * The three-letter [IATA](https://en.wikipedia.org/wiki/IATA_airport_code) - * airport code of the data center that the request hit. - * - * @example "DFW" - */ - colo: string; - /** - * Represents the upstream's response to a - * [TCP `keepalive` message](https://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html) - * from cloudflare. - * - * For workers with no upstream, this will always be `1`. - * - * @example 3 - */ - edgeRequestKeepAliveStatus: IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus; - /** - * The HTTP Protocol the request used. - * - * @example "HTTP/2" - */ - httpProtocol: string; - /** - * The browser-requested prioritization information in the request object. - * - * If no information was set, defaults to the empty string `""` - * - * @example "weight=192;exclusive=0;group=3;group-weight=127" - * @default "" - */ - requestPriority: string; - /** - * The TLS version of the connection to Cloudflare. - * In requests served over plaintext (without TLS), this property is the empty string `""`. - * - * @example "TLSv1.3" - */ - tlsVersion: string; - /** - * The cipher for the connection to Cloudflare. - * In requests served over plaintext (without TLS), this property is the empty string `""`. - * - * @example "AEAD-AES128-GCM-SHA256" - */ - tlsCipher: string; - /** - * Metadata containing the [`HELLO`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2) and [`FINISHED`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9) messages from this request's TLS handshake. - * - * If the incoming request was served over plaintext (without TLS) this field is undefined. - */ - tlsExportedAuthenticator?: IncomingRequestCfPropertiesExportedAuthenticatorMetadata; -} -export interface IncomingRequestCfPropertiesBotManagementBase { - /** - * Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot, - * represented as an integer percentage between `1` (almost certainly human) - * and `99` (almost certainly a bot). - * - * @example 54 - */ - score: number; - /** - * A boolean value that is true if the request comes from a good bot, like Google or Bing. - * Most customers choose to allow this traffic. For more details, see [Traffic from known bots](https://developers.cloudflare.com/firewall/known-issues-and-faq/#how-does-firewall-rules-handle-traffic-from-known-bots). - */ - verifiedBot: boolean; - /** - * A boolean value that is true if the request originates from a - * Cloudflare-verified proxy service. - */ - corporateProxy: boolean; - /** - * A boolean value that's true if the request matches [file extensions](https://developers.cloudflare.com/bots/reference/static-resources/) for many types of static resources. - */ - staticResource: boolean; - /** - * List of IDs that correlate to the Bot Management heuristic detections made on a request (you can have multiple heuristic detections on the same request). - */ - detectionIds: number[]; -} -export interface IncomingRequestCfPropertiesBotManagement { - /** - * Results of Cloudflare's Bot Management analysis - */ - botManagement: IncomingRequestCfPropertiesBotManagementBase; - /** - * Duplicate of `botManagement.score`. - * - * @deprecated - */ - clientTrustScore: number; -} -export interface IncomingRequestCfPropertiesBotManagementEnterprise - extends IncomingRequestCfPropertiesBotManagement { - /** - * Results of Cloudflare's Bot Management analysis - */ - botManagement: IncomingRequestCfPropertiesBotManagementBase & { - /** - * A [JA3 Fingerprint](https://developers.cloudflare.com/bots/concepts/ja3-fingerprint/) to help profile specific SSL/TLS clients - * across different destination IPs, Ports, and X509 certificates. - */ - ja3Hash: string; - }; -} -export interface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise< - HostMetadata -> { - /** - * Custom metadata set per-host in [Cloudflare for SaaS](https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/). - * - * This field is only present if you have Cloudflare for SaaS enabled on your account - * and you have followed the [required steps to enable it]((https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/domain-support/custom-metadata/)). - */ - hostMetadata: HostMetadata; -} -export interface IncomingRequestCfPropertiesCloudflareAccessOrApiShield { - /** - * Information about the client certificate presented to Cloudflare. - * - * This is populated when the incoming request is served over TLS using - * either Cloudflare Access or API Shield (mTLS) - * and the presented SSL certificate has a valid - * [Certificate Serial Number](https://ldapwiki.com/wiki/Certificate%20Serial%20Number) - * (i.e., not `null` or `""`). - * - * Otherwise, a set of placeholder values are used. - * - * The property `certPresented` will be set to `"1"` when - * the object is populated (i.e. the above conditions were met). - */ - tlsClientAuth: - | IncomingRequestCfPropertiesTLSClientAuth - | IncomingRequestCfPropertiesTLSClientAuthPlaceholder; -} -/** - * Metadata about the request's TLS handshake - */ -export interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata { - /** - * The client's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal - * - * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d" - */ - clientHandshake: string; - /** - * The server's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal - * - * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d" - */ - serverHandshake: string; - /** - * The client's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal - * - * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b" - */ - clientFinished: string; - /** - * The server's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal - * - * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b" - */ - serverFinished: string; -} -/** - * Geographic data about the request's origin. - */ -export interface IncomingRequestCfPropertiesGeographicInformation { - /** - * The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from. - * - * If your worker is [configured to accept TOR connections](https://support.cloudflare.com/hc/en-us/articles/203306930-Understanding-Cloudflare-Tor-support-and-Onion-Routing), this may also be `"T1"`, indicating a request that originated over TOR. - * - * If Cloudflare is unable to determine where the request originated this property is omitted. - * - * The country code `"T1"` is used for requests originating on TOR. - * - * @example "GB" - */ - country?: Iso3166Alpha2Code | "T1"; - /** - * If present, this property indicates that the request originated in the EU - * - * @example "1" - */ - isEUCountry?: "1"; - /** - * A two-letter code indicating the continent the request originated from. - * - * @example "AN" - */ - continent?: ContinentCode; - /** - * The city the request originated from - * - * @example "Austin" - */ - city?: string; - /** - * Postal code of the incoming request - * - * @example "78701" - */ - postalCode?: string; - /** - * Latitude of the incoming request - * - * @example "30.27130" - */ - latitude?: string; - /** - * Longitude of the incoming request - * - * @example "-97.74260" - */ - longitude?: string; - /** - * Timezone of the incoming request - * - * @example "America/Chicago" - */ - timezone?: string; - /** - * If known, the ISO 3166-2 name for the first level region associated with - * the IP address of the incoming request - * - * @example "Texas" - */ - region?: string; - /** - * If known, the ISO 3166-2 code for the first-level region associated with - * the IP address of the incoming request - * - * @example "TX" - */ - regionCode?: string; - /** - * Metro code (DMA) of the incoming request - * - * @example "635" - */ - metroCode?: string; -} -/** Data about the incoming request's TLS certificate */ -export interface IncomingRequestCfPropertiesTLSClientAuth { - /** Always `"1"`, indicating that the certificate was presented */ - certPresented: "1"; - /** - * Result of certificate verification. - * - * @example "FAILED:self signed certificate" - */ - certVerified: Exclude; - /** The presented certificate's revokation status. - * - * - A value of `"1"` indicates the certificate has been revoked - * - A value of `"0"` indicates the certificate has not been revoked - */ - certRevoked: "1" | "0"; - /** - * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) - * - * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certIssuerDN: string; - /** - * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) - * - * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certSubjectDN: string; - /** - * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted) - * - * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certIssuerDNRFC2253: string; - /** - * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted) - * - * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certSubjectDNRFC2253: string; - /** The certificate issuer's distinguished name (legacy policies) */ - certIssuerDNLegacy: string; - /** The certificate subject's distinguished name (legacy policies) */ - certSubjectDNLegacy: string; - /** - * The certificate's serial number - * - * @example "00936EACBE07F201DF" - */ - certSerial: string; - /** - * The certificate issuer's serial number - * - * @example "2489002934BDFEA34" - */ - certIssuerSerial: string; - /** - * The certificate's Subject Key Identifier - * - * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4" - */ - certSKI: string; - /** - * The certificate issuer's Subject Key Identifier - * - * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4" - */ - certIssuerSKI: string; - /** - * The certificate's SHA-1 fingerprint - * - * @example "6b9109f323999e52259cda7373ff0b4d26bd232e" - */ - certFingerprintSHA1: string; - /** - * The certificate's SHA-256 fingerprint - * - * @example "acf77cf37b4156a2708e34c4eb755f9b5dbbe5ebb55adfec8f11493438d19e6ad3f157f81fa3b98278453d5652b0c1fd1d71e5695ae4d709803a4d3f39de9dea" - */ - certFingerprintSHA256: string; - /** - * The effective starting date of the certificate - * - * @example "Dec 22 19:39:00 2018 GMT" - */ - certNotBefore: string; - /** - * The effective expiration date of the certificate - * - * @example "Dec 22 19:39:00 2018 GMT" - */ - certNotAfter: string; -} -/** Placeholder values for TLS Client Authorization */ -export interface IncomingRequestCfPropertiesTLSClientAuthPlaceholder { - certPresented: "0"; - certVerified: "NONE"; - certRevoked: "0"; - certIssuerDN: ""; - certSubjectDN: ""; - certIssuerDNRFC2253: ""; - certSubjectDNRFC2253: ""; - certIssuerDNLegacy: ""; - certSubjectDNLegacy: ""; - certSerial: ""; - certIssuerSerial: ""; - certSKI: ""; - certIssuerSKI: ""; - certFingerprintSHA1: ""; - certFingerprintSHA256: ""; - certNotBefore: ""; - certNotAfter: ""; -} -/** Possible outcomes of TLS verification */ -export type CertVerificationStatus = - /** Authentication succeeded */ - | "SUCCESS" - /** No certificate was presented */ - | "NONE" - /** Failed because the certificate was self-signed */ - | "FAILED:self signed certificate" - /** Failed because the certificate failed a trust chain check */ - | "FAILED:unable to verify the first certificate" - /** Failed because the certificate not yet valid */ - | "FAILED:certificate is not yet valid" - /** Failed because the certificate is expired */ - | "FAILED:certificate has expired" - /** Failed for another unspecified reason */ - | "FAILED"; -/** - * An upstream endpoint's response to a TCP `keepalive` message from Cloudflare. - */ -export type IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus = - | 0 /** Unknown */ - | 1 /** no keepalives (not found) */ - | 2 /** no connection re-use, opening keepalive connection failed */ - | 3 /** no connection re-use, keepalive accepted and saved */ - | 4 /** connection re-use, refused by the origin server (`TCP FIN`) */ - | 5; /** connection re-use, accepted by the origin server */ -/** ISO 3166-1 Alpha-2 codes */ -export type Iso3166Alpha2Code = - | "AD" - | "AE" - | "AF" - | "AG" - | "AI" - | "AL" - | "AM" - | "AO" - | "AQ" - | "AR" - | "AS" - | "AT" - | "AU" - | "AW" - | "AX" - | "AZ" - | "BA" - | "BB" - | "BD" - | "BE" - | "BF" - | "BG" - | "BH" - | "BI" - | "BJ" - | "BL" - | "BM" - | "BN" - | "BO" - | "BQ" - | "BR" - | "BS" - | "BT" - | "BV" - | "BW" - | "BY" - | "BZ" - | "CA" - | "CC" - | "CD" - | "CF" - | "CG" - | "CH" - | "CI" - | "CK" - | "CL" - | "CM" - | "CN" - | "CO" - | "CR" - | "CU" - | "CV" - | "CW" - | "CX" - | "CY" - | "CZ" - | "DE" - | "DJ" - | "DK" - | "DM" - | "DO" - | "DZ" - | "EC" - | "EE" - | "EG" - | "EH" - | "ER" - | "ES" - | "ET" - | "FI" - | "FJ" - | "FK" - | "FM" - | "FO" - | "FR" - | "GA" - | "GB" - | "GD" - | "GE" - | "GF" - | "GG" - | "GH" - | "GI" - | "GL" - | "GM" - | "GN" - | "GP" - | "GQ" - | "GR" - | "GS" - | "GT" - | "GU" - | "GW" - | "GY" - | "HK" - | "HM" - | "HN" - | "HR" - | "HT" - | "HU" - | "ID" - | "IE" - | "IL" - | "IM" - | "IN" - | "IO" - | "IQ" - | "IR" - | "IS" - | "IT" - | "JE" - | "JM" - | "JO" - | "JP" - | "KE" - | "KG" - | "KH" - | "KI" - | "KM" - | "KN" - | "KP" - | "KR" - | "KW" - | "KY" - | "KZ" - | "LA" - | "LB" - | "LC" - | "LI" - | "LK" - | "LR" - | "LS" - | "LT" - | "LU" - | "LV" - | "LY" - | "MA" - | "MC" - | "MD" - | "ME" - | "MF" - | "MG" - | "MH" - | "MK" - | "ML" - | "MM" - | "MN" - | "MO" - | "MP" - | "MQ" - | "MR" - | "MS" - | "MT" - | "MU" - | "MV" - | "MW" - | "MX" - | "MY" - | "MZ" - | "NA" - | "NC" - | "NE" - | "NF" - | "NG" - | "NI" - | "NL" - | "NO" - | "NP" - | "NR" - | "NU" - | "NZ" - | "OM" - | "PA" - | "PE" - | "PF" - | "PG" - | "PH" - | "PK" - | "PL" - | "PM" - | "PN" - | "PR" - | "PS" - | "PT" - | "PW" - | "PY" - | "QA" - | "RE" - | "RO" - | "RS" - | "RU" - | "RW" - | "SA" - | "SB" - | "SC" - | "SD" - | "SE" - | "SG" - | "SH" - | "SI" - | "SJ" - | "SK" - | "SL" - | "SM" - | "SN" - | "SO" - | "SR" - | "SS" - | "ST" - | "SV" - | "SX" - | "SY" - | "SZ" - | "TC" - | "TD" - | "TF" - | "TG" - | "TH" - | "TJ" - | "TK" - | "TL" - | "TM" - | "TN" - | "TO" - | "TR" - | "TT" - | "TV" - | "TW" - | "TZ" - | "UA" - | "UG" - | "UM" - | "US" - | "UY" - | "UZ" - | "VA" - | "VC" - | "VE" - | "VG" - | "VI" - | "VN" - | "VU" - | "WF" - | "WS" - | "YE" - | "YT" - | "ZA" - | "ZM" - | "ZW"; -/** The 2-letter continent codes Cloudflare uses */ -export type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA"; -export type CfProperties = - | IncomingRequestCfProperties - | RequestInitCfProperties; -export interface D1Result { - results?: T[]; - success: boolean; - error?: string; - meta: any; -} -export declare abstract class D1Database { - prepare(query: string): D1PreparedStatement; - dump(): Promise; - batch(statements: D1PreparedStatement[]): Promise[]>; - exec(query: string): Promise>; -} -export declare abstract class D1PreparedStatement { - bind(...values: any[]): D1PreparedStatement; - first(colName?: string): Promise; - run(): Promise>; - all(): Promise>; - raw(): Promise; -} -/** - * A email message that is sent to a consumer Worker. - */ -export interface EmailMessage { - /** - * Envelope From attribute of the email message. - */ - readonly from: string; - /** - * Envelope To attribute of the email message. - */ - readonly to: string; - /** - * A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers). - */ - readonly headers: Headers; - /** - * Stream of the email message content. - */ - readonly raw: ReadableStream; - /** - * Size of the email message content. - */ - readonly rawSize: number; - /** - * Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason. - * @param reason The reject reason. - * @returns void - */ - setReject(reason: string): void; - /** - * Forward this email message to a verified destination address of the account. - * @param rcptTo Verified destination address. - * @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers). - * @returns A promise that resolves when the email message is forwarded. - */ - forward(rcptTo: string, headers?: Headers): Promise; -} -export declare abstract class EmailEvent extends ExtendableEvent { - readonly message: EmailMessage; -} -export type EmailExportedHandler = ( - message: EmailMessage, - env: Env, - ctx: ExecutionContext -) => void | Promise; -export type Params

= Record; -export type EventContext = { - request: Request; - functionPath: string; - waitUntil: (promise: Promise) => void; - passThroughOnException: () => void; - next: (input?: Request | string, init?: RequestInit) => Promise; - env: Env & { - ASSETS: { - fetch: typeof fetch; - }; - }; - params: Params

; - data: Data; -}; -export type PagesFunction< - Env = unknown, - Params extends string = any, - Data extends Record = Record -> = (context: EventContext) => Response | Promise; -export type EventPluginContext = { - request: Request; - functionPath: string; - waitUntil: (promise: Promise) => void; - passThroughOnException: () => void; - next: (input?: Request | string, init?: RequestInit) => Promise; - env: Env & { - ASSETS: { - fetch: typeof fetch; - }; - }; - params: Params

; - data: Data; - pluginArgs: PluginArgs; -}; -export type PagesPluginFunction< - Env = unknown, - Params extends string = any, - Data extends Record = Record, - PluginArgs = unknown -> = ( - context: EventPluginContext -) => Response | Promise; -// https://developers.cloudflare.com/pub-sub/ -// PubSubMessage represents an incoming PubSub message. -// The message includes metadata about the broker, the client, and the payload -// itself. -export interface PubSubMessage { - // Message ID - readonly mid: number; - // MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT - readonly broker: string; - // The MQTT topic the message was sent on. - readonly topic: string; - // The client ID of the client that published this message. - readonly clientId: string; - // The unique identifier (JWT ID) used by the client to authenticate, if token - // auth was used. - readonly jti?: string; - // A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker - // received the message from the client. - readonly receivedAt: number; - // An (optional) string with the MIME type of the payload, if set by the - // client. - readonly contentType: string; - // Set to 1 when the payload is a UTF-8 string - // https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063 - readonly payloadFormatIndicator: number; - // Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays. - // You can use payloadFormatIndicator to inspect this before decoding. - payload: string | Uint8Array; -} -// JsonWebKey extended by kid parameter -export interface JsonWebKeyWithKid extends JsonWebKey { - // Key Identifier of the JWK - readonly kid: string; -} -/** - * A message that is sent to a consumer Worker. - */ -export interface Message { - /** - * A unique, system-generated ID for the message. - */ - readonly id: string; - /** - * A timestamp when the message was sent. - */ - readonly timestamp: Date; - /** - * The body of the message. - */ - readonly body: Body; - /** - * Marks message to be retried. - */ - retry(): void; - /** - * Marks message acknowledged. - */ - ack(): void; -} -/** - * A batch of messages that are sent to a consumer Worker. - */ -export interface MessageBatch { - /** - * The name of the Queue that belongs to this batch. - */ - readonly queue: string; - /** - * An array of messages in the batch. Ordering of messages is not guaranteed. - */ - readonly messages: readonly Message[]; - /** - * Marks every message to be retried in the next batch. - */ - retryAll(): void; - /** - * Marks every message acknowledged in the batch. - */ - ackAll(): void; -} -/** - * A wrapper class used to structure message batches. - */ -export type MessageSendRequest = { - /** - * The body of the message. - */ - body: Body; -}; -/** - * A binding that allows a producer to send messages to a Queue. - */ -export interface Queue { - /** - * Sends a message to the Queue. - * @param message The message can be any type supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types), as long as its size is less than 128 KB. - * @returns A promise that resolves when the message is confirmed to be written to disk. - */ - send(message: Body): Promise; - /** - * Sends a batch of messages to the Queue. - * @param messages Each item in the input must be supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types). A batch can contain up to 100 messages, though items are limited to 128 KB each, and the total size of the array cannot exceed 256 KB. - * @returns A promise that resolves when the messages are confirmed to be written to disk. - */ - sendBatch(messages: Iterable>): Promise; -} diff --git a/packages/denylist_bot/node_modules/@cloudflare/workers-types/oldest/index.d.ts b/packages/denylist_bot/node_modules/@cloudflare/workers-types/oldest/index.d.ts deleted file mode 100755 index f435510e5..000000000 --- a/packages/denylist_bot/node_modules/@cloudflare/workers-types/oldest/index.d.ts +++ /dev/null @@ -1,2990 +0,0 @@ -/*! ***************************************************************************** -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 class DOMException extends Error { - constructor(message?: string, name?: string); - readonly message: string; - readonly name: string; - readonly code: number; - readonly stack: any; - 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; -} -declare type WorkerGlobalScopeEventMap = { - fetch: FetchEvent; - scheduled: ScheduledEvent; - unhandledrejection: PromiseRejectionEvent; - rejectionhandled: PromiseRejectionEvent; -}; -declare abstract class WorkerGlobalScope extends EventTarget { - EventTarget: typeof EventTarget; -} -declare interface Console { - "assert"(condition?: boolean, ...data: any[]): void; - clear(): void; - count(label?: string): void; - countReset(label?: string): void; - debug(...data: any[]): void; - dir(item?: any, options?: any): void; - dirxml(...data: any[]): void; - error(...data: any[]): void; - group(...data: any[]): void; - groupCollapsed(...data: any[]): void; - groupEnd(): void; - info(...data: any[]): void; - log(...data: any[]): void; - table(tabularData?: any, properties?: string[]): void; - time(label?: string): void; - timeEnd(label?: string): void; - timeLog(label?: string, ...data: any[]): void; - timeStamp(label?: string): void; - trace(...data: any[]): void; - warn(...data: any[]): void; -} -declare const console: Console; -declare type BufferSource = ArrayBufferView | ArrayBuffer; -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; - type Imports = Record; - type ExportValue = Function | Global | Memory | Table; - type Exports = Record; - 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; - function validate(bytes: BufferSource): boolean; -} -/** This ServiceWorker API interface represents the global execution context of a service worker. */ -declare 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( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args - ): number; - clearTimeout(timeoutId: number | null): void; - setInterval(callback: (...args: any[]) => void, msDelay?: number): number; - setInterval( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args - ): number; - clearInterval(timeoutId: number | null): void; - queueMicrotask(task: Function): void; - structuredClone(value: T, options?: StructuredSerializeOptions): T; - fetch( - input: RequestInfo, - init?: RequestInit - ): Promise; - self: ServiceWorkerGlobalScope; - crypto: Crypto; - caches: CacheStorage; - scheduler: Scheduler; - Event: typeof Event; - ExtendableEvent: typeof ExtendableEvent; - PromiseRejectionEvent: typeof PromiseRejectionEvent; - FetchEvent: typeof FetchEvent; - TraceEvent: typeof TraceEvent; - 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; - 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; - AbortController: typeof AbortController; - AbortSignal: typeof AbortSignal; - TextDecoder: typeof TextDecoder; - TextEncoder: typeof TextEncoder; - 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: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetAddEventListenerOptions | boolean -): void; -declare function removeEventListener< - Type extends keyof WorkerGlobalScopeEventMap ->( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetEventListenerOptions | boolean -): void; -/** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */ -declare function dispatchEvent( - event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap] -): boolean; -declare function btoa(data: string): string; -declare function atob(data: string): string; -declare function setTimeout( - callback: (...args: any[]) => void, - msDelay?: number -): number; -declare function setTimeout( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args -): number; -declare function clearTimeout(timeoutId: number | null): void; -declare function setInterval( - callback: (...args: any[]) => void, - msDelay?: number -): number; -declare function setInterval( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args -): number; -declare function clearInterval(timeoutId: number | null): void; -declare function queueMicrotask(task: Function): void; -declare function structuredClone( - value: T, - options?: StructuredSerializeOptions -): T; -declare function fetch( - input: RequestInfo, - init?: RequestInit -): Promise; -declare const self: ServiceWorkerGlobalScope; -declare const crypto: Crypto; -declare const caches: CacheStorage; -declare const scheduler: Scheduler; -declare interface TestController {} -declare interface ExecutionContext { - waitUntil(promise: Promise): void; - passThroughOnException(): void; -} -declare type ExportedHandlerFetchHandler< - Env = unknown, - CfHostMetadata = unknown -> = ( - request: Request>, - env: Env, - ctx: ExecutionContext -) => Response | Promise; -declare type ExportedHandlerTraceHandler = ( - traces: TraceItem[], - env: Env, - ctx: ExecutionContext -) => void | Promise; -declare type ExportedHandlerScheduledHandler = ( - controller: ScheduledController, - env: Env, - ctx: ExecutionContext -) => void | Promise; -declare type ExportedHandlerQueueHandler = ( - batch: MessageBatch, - env: Env, - ctx: ExecutionContext -) => void | Promise; -declare type ExportedHandlerTestHandler = ( - controller: TestController, - env: Env, - ctx: ExecutionContext -) => void | Promise; -declare interface ExportedHandler< - Env = unknown, - QueueMessage = unknown, - CfHostMetadata = unknown -> { - fetch?: ExportedHandlerFetchHandler; - trace?: ExportedHandlerTraceHandler; - scheduled?: ExportedHandlerScheduledHandler; - test?: ExportedHandlerTestHandler; - queue?: ExportedHandlerQueueHandler; -} -declare interface StructuredSerializeOptions { - transfer?: any[]; -} -declare abstract class PromiseRejectionEvent extends Event { - readonly promise: Promise; - readonly reason: any; -} -declare interface DurableObject { - fetch(request: Request): Response | Promise; - alarm?(): void | Promise; -} -declare interface DurableObjectStub extends Fetcher { - readonly id: DurableObjectId; - readonly name?: string; -} -declare interface DurableObjectId { - toString(): string; - equals(other: DurableObjectId): boolean; - readonly name?: string; -} -declare interface DurableObjectNamespace { - newUniqueId( - options?: DurableObjectNamespaceNewUniqueIdOptions - ): DurableObjectId; - idFromName(name: string): DurableObjectId; - idFromString(id: string): DurableObjectId; - get( - id: DurableObjectId, - options?: DurableObjectNamespaceGetDurableObjectOptions - ): DurableObjectStub; - jurisdiction(jurisdiction: string): DurableObjectNamespace; -} -declare interface DurableObjectNamespaceNewUniqueIdOptions { - jurisdiction?: string; -} -declare interface DurableObjectNamespaceGetDurableObjectOptions { - locationHint?: string; -} -declare interface DurableObjectState { - waitUntil(promise: Promise): void; - readonly id: DurableObjectId; - readonly storage: DurableObjectStorage; - blockConcurrencyWhile(callback: () => Promise): Promise; -} -declare interface DurableObjectTransaction { - get( - key: string, - options?: DurableObjectGetOptions - ): Promise; - get( - keys: string[], - options?: DurableObjectGetOptions - ): Promise>; - list( - options?: DurableObjectListOptions - ): Promise>; - put( - key: string, - value: T, - options?: DurableObjectPutOptions - ): Promise; - put( - entries: Record, - options?: DurableObjectPutOptions - ): Promise; - delete(key: string, options?: DurableObjectPutOptions): Promise; - delete(keys: string[], options?: DurableObjectPutOptions): Promise; - rollback(): void; - getAlarm(options?: DurableObjectGetAlarmOptions): Promise; - setAlarm( - scheduledTime: number | Date, - options?: DurableObjectSetAlarmOptions - ): Promise; - deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise; -} -declare interface DurableObjectStorage { - get( - key: string, - options?: DurableObjectGetOptions - ): Promise; - get( - keys: string[], - options?: DurableObjectGetOptions - ): Promise>; - list( - options?: DurableObjectListOptions - ): Promise>; - put( - key: string, - value: T, - options?: DurableObjectPutOptions - ): Promise; - put( - entries: Record, - options?: DurableObjectPutOptions - ): Promise; - delete(key: string, options?: DurableObjectPutOptions): Promise; - delete(keys: string[], options?: DurableObjectPutOptions): Promise; - deleteAll(options?: DurableObjectPutOptions): Promise; - transaction( - closure: (txn: DurableObjectTransaction) => Promise - ): Promise; - getAlarm(options?: DurableObjectGetAlarmOptions): Promise; - setAlarm( - scheduledTime: number | Date, - options?: DurableObjectSetAlarmOptions - ): Promise; - deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise; - sync(): Promise; -} -declare interface DurableObjectListOptions { - start?: string; - startAfter?: string; - end?: string; - prefix?: string; - reverse?: boolean; - limit?: number; - allowConcurrency?: boolean; - noCache?: boolean; -} -declare interface DurableObjectGetOptions { - allowConcurrency?: boolean; - noCache?: boolean; -} -declare interface DurableObjectGetAlarmOptions { - allowConcurrency?: boolean; -} -declare interface DurableObjectPutOptions { - allowConcurrency?: boolean; - allowUnconfirmed?: boolean; - noCache?: boolean; -} -declare interface DurableObjectSetAlarmOptions { - allowConcurrency?: boolean; - allowUnconfirmed?: boolean; -} -declare interface AnalyticsEngineDataset { - writeDataPoint(event?: AnalyticsEngineDataPoint): void; -} -declare interface AnalyticsEngineDataPoint { - indexes?: ((ArrayBuffer | string) | null)[]; - doubles?: number[]; - blobs?: ((ArrayBuffer | string) | null)[]; -} -declare class Event { - constructor(type: string, init?: EventInit); - /** Returns the type of event, e.g. "click", "hashchange", or "submit". */ - readonly type: string; - /** Returns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE. */ - readonly eventPhase: number; - /** Returns true or false depending on how event was initialized. True if event invokes listeners past a ShadowRoot node that is the root of its target, and false otherwise. */ - readonly composed: boolean; - /** Returns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise. */ - readonly bubbles: boolean; - /** Returns true or false depending on how event was initialized. Its return value does not always carry meaning, but true can indicate that part of the operation during which event was dispatched, can be canceled by invoking the preventDefault() method. */ - readonly cancelable: boolean; - /** Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise. */ - readonly defaultPrevented: boolean; - /** @deprecated */ - readonly returnValue: boolean; - /** Returns the object whose event listener's callback is currently being invoked. */ - readonly currentTarget?: EventTarget; - /** @deprecated */ - readonly srcElement?: EventTarget; - /** Returns the event's timestamp as the number of milliseconds measured relative to the time origin. */ - readonly timeStamp: number; - /** Returns true if event was dispatched by the user agent, and false otherwise. */ - readonly isTrusted: boolean; - cancelBubble: boolean; - stopImmediatePropagation(): void; - preventDefault(): void; - stopPropagation(): void; - composedPath(): EventTarget[]; - static readonly NONE: number; - static readonly CAPTURING_PHASE: number; - static readonly AT_TARGET: number; - static readonly BUBBLING_PHASE: number; -} -declare interface EventInit { - bubbles?: boolean; - cancelable?: boolean; - composed?: boolean; -} -declare type EventListener = ( - event: EventType -) => void; -declare interface EventListenerObject { - handleEvent(event: EventType): void; -} -declare type EventListenerOrEventListenerObject< - EventType extends Event = Event -> = EventListener | EventListenerObject; -declare class EventTarget< - EventMap extends Record = Record -> { - constructor(); - addEventListener( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetAddEventListenerOptions | boolean - ): void; - removeEventListener( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetEventListenerOptions | boolean - ): void; - dispatchEvent(event: EventMap[keyof EventMap]): boolean; -} -declare interface EventTargetEventListenerOptions { - capture?: boolean; -} -declare interface EventTargetAddEventListenerOptions { - capture?: boolean; - passive?: boolean; - once?: boolean; - signal?: AbortSignal; -} -declare interface EventTargetHandlerObject { - handleEvent: (event: Event) => any | undefined; -} -declare class AbortController { - constructor(); - /** Returns the AbortSignal object associated with this object. */ - readonly signal: AbortSignal; - abort(reason?: any): void; -} -declare abstract class AbortSignal extends EventTarget { - static abort(reason?: any): AbortSignal; - static timeout(delay: number): AbortSignal; - /** Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. */ - readonly aborted: boolean; - readonly reason: any; - throwIfAborted(): void; -} -declare interface Scheduler { - wait(delay: number, maybeOptions?: SchedulerWaitOptions): Promise; -} -declare interface SchedulerWaitOptions { - signal?: AbortSignal; -} -declare abstract class ExtendableEvent extends Event { - waitUntil(promise: Promise): void; -} -declare class Blob { - constructor( - bits?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[], - options?: BlobOptions - ); - readonly size: number; - readonly type: string; - slice(start?: number, end?: number, type?: string): Blob; - arrayBuffer(): Promise; - text(): Promise; - stream(): ReadableStream; -} -declare interface BlobOptions { - type?: string; -} -declare class File extends Blob { - constructor( - bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined, - name: string, - options?: FileOptions - ); - readonly name: string; - readonly lastModified: number; -} -declare interface FileOptions { - type?: string; - lastModified?: number; -} -declare abstract class CacheStorage { - open(cacheName: string): Promise; - readonly default: Cache; -} -declare abstract class Cache { - delete(request: RequestInfo, options?: CacheQueryOptions): Promise; - match( - request: RequestInfo, - options?: CacheQueryOptions - ): Promise; - put(request: RequestInfo, response: Response): Promise; -} -declare interface CacheQueryOptions { - ignoreMethod?: boolean; -} -declare abstract class Crypto { - /** Available only in secure contexts. */ - readonly subtle: SubtleCrypto; - getRandomValues< - T extends - | Int8Array - | Uint8Array - | Int16Array - | Uint16Array - | Int32Array - | Uint32Array - | BigInt64Array - | BigUint64Array - >(buffer: T): T; - randomUUID(): string; - DigestStream: typeof DigestStream; -} -declare abstract class SubtleCrypto { - encrypt( - algorithm: string | SubtleCryptoEncryptAlgorithm, - key: CryptoKey, - plainText: ArrayBuffer | ArrayBufferView - ): Promise; - decrypt( - algorithm: string | SubtleCryptoEncryptAlgorithm, - key: CryptoKey, - cipherText: ArrayBuffer | ArrayBufferView - ): Promise; - sign( - algorithm: string | SubtleCryptoSignAlgorithm, - key: CryptoKey, - data: ArrayBuffer | ArrayBufferView - ): Promise; - verify( - algorithm: string | SubtleCryptoSignAlgorithm, - key: CryptoKey, - signature: ArrayBuffer | ArrayBufferView, - data: ArrayBuffer | ArrayBufferView - ): Promise; - digest( - algorithm: string | SubtleCryptoHashAlgorithm, - data: ArrayBuffer | ArrayBufferView - ): Promise; - generateKey( - algorithm: string | SubtleCryptoGenerateKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - deriveKey( - algorithm: string | SubtleCryptoDeriveKeyAlgorithm, - baseKey: CryptoKey, - derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - deriveBits( - algorithm: string | SubtleCryptoDeriveKeyAlgorithm, - baseKey: CryptoKey, - length: number | null - ): Promise; - importKey( - format: string, - keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey, - algorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - exportKey(format: string, key: CryptoKey): Promise; - wrapKey( - format: string, - key: CryptoKey, - wrappingKey: CryptoKey, - wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm - ): Promise; - unwrapKey( - format: string, - wrappedKey: ArrayBuffer | ArrayBufferView, - unwrappingKey: CryptoKey, - unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm, - unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - timingSafeEqual( - a: ArrayBuffer | ArrayBufferView, - b: ArrayBuffer | ArrayBufferView - ): boolean; -} -declare abstract class CryptoKey { - readonly type: string; - readonly extractable: boolean; - readonly algorithm: - | CryptoKeyKeyAlgorithm - | CryptoKeyAesKeyAlgorithm - | CryptoKeyHmacKeyAlgorithm - | CryptoKeyRsaKeyAlgorithm - | CryptoKeyEllipticKeyAlgorithm - | CryptoKeyArbitraryKeyAlgorithm; - readonly usages: string[]; -} -declare interface CryptoKeyPair { - publicKey: CryptoKey; - privateKey: CryptoKey; -} -declare 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; -} -declare interface RsaOtherPrimesInfo { - r?: string; - d?: string; - t?: string; -} -declare interface SubtleCryptoDeriveKeyAlgorithm { - name: string; - salt?: ArrayBuffer; - iterations?: number; - hash?: string | SubtleCryptoHashAlgorithm; - $public?: CryptoKey; - info?: ArrayBuffer; -} -declare interface SubtleCryptoEncryptAlgorithm { - name: string; - iv?: ArrayBuffer; - additionalData?: ArrayBuffer; - tagLength?: number; - counter?: ArrayBuffer; - length?: number; - label?: ArrayBuffer; -} -declare interface SubtleCryptoGenerateKeyAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - modulusLength?: number; - publicExponent?: ArrayBuffer; - length?: number; - namedCurve?: string; -} -declare interface SubtleCryptoHashAlgorithm { - name: string; -} -declare interface SubtleCryptoImportKeyAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - length?: number; - namedCurve?: string; - compressed?: boolean; -} -declare interface SubtleCryptoSignAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - dataLength?: number; - saltLength?: number; -} -declare interface CryptoKeyKeyAlgorithm { - name: string; -} -declare interface CryptoKeyAesKeyAlgorithm { - name: string; - length: number; -} -declare interface CryptoKeyHmacKeyAlgorithm { - name: string; - hash: CryptoKeyKeyAlgorithm; - length: number; -} -declare interface CryptoKeyRsaKeyAlgorithm { - name: string; - modulusLength: number; - publicExponent: ArrayBuffer; - hash?: CryptoKeyKeyAlgorithm; -} -declare interface CryptoKeyEllipticKeyAlgorithm { - name: string; - namedCurve: string; -} -declare interface CryptoKeyArbitraryKeyAlgorithm { - name: string; - hash?: CryptoKeyKeyAlgorithm; - namedCurve?: string; - length?: number; -} -declare class DigestStream extends WritableStream< - ArrayBuffer | ArrayBufferView -> { - constructor(algorithm: string | SubtleCryptoHashAlgorithm); - readonly digest: Promise; -} -declare class TextDecoder { - constructor(decoder?: string, options?: TextDecoderConstructorOptions); - decode( - input?: ArrayBuffer | ArrayBufferView, - options?: TextDecoderDecodeOptions - ): string; - readonly encoding: string; - readonly fatal: boolean; - readonly ignoreBOM: boolean; -} -declare class TextEncoder { - constructor(); - encode(input?: string): Uint8Array; - encodeInto(input: string, buffer: Uint8Array): TextEncoderEncodeIntoResult; - readonly encoding: string; -} -declare interface TextDecoderConstructorOptions { - fatal: boolean; - ignoreBOM: boolean; -} -declare interface TextDecoderDecodeOptions { - stream: boolean; -} -declare interface TextEncoderEncodeIntoResult { - read: number; - written: number; -} -declare class FormData { - constructor(); - append(name: string, value: string): void; - append(name: string, value: Blob, filename?: string): void; - delete(name: string): void; - get(name: string): string | null; - getAll(name: string): string[]; - has(name: string): boolean; - set(name: string, value: string): void; - set(name: string, value: Blob, filename?: string): void; - entries(): IterableIterator<[key: string, value: string]>; - keys(): IterableIterator; - values(): IterableIterator; - forEach( - callback: ( - this: This, - value: string, - key: string, - parent: FormData - ) => void, - thisArg?: This - ): void; - [Symbol.iterator](): IterableIterator<[key: string, value: string]>; -} -declare interface ContentOptions { - html?: boolean; -} -declare class HTMLRewriter { - constructor(); - on( - selector: string, - handlers: HTMLRewriterElementContentHandlers - ): HTMLRewriter; - onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter; - transform(response: Response): Response; -} -declare interface HTMLRewriterElementContentHandlers { - element?(element: Element): void | Promise; - comments?(comment: Comment): void | Promise; - text?(element: Text): void | Promise; -} -declare interface HTMLRewriterDocumentContentHandlers { - doctype?(doctype: Doctype): void | Promise; - comments?(comment: Comment): void | Promise; - text?(text: Text): void | Promise; - end?(end: DocumentEnd): void | Promise; -} -declare interface Doctype { - readonly name: string | null; - readonly publicId: string | null; - readonly systemId: string | null; -} -declare interface Element { - tagName: string; - readonly attributes: IterableIterator; - 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, options?: ContentOptions): Element; - after(content: string, options?: ContentOptions): Element; - prepend(content: string, options?: ContentOptions): Element; - append(content: string, options?: ContentOptions): Element; - replace(content: string, options?: ContentOptions): Element; - remove(): Element; - removeAndKeepContent(): Element; - setInnerContent(content: string, options?: ContentOptions): Element; - onEndTag(handler: (tag: EndTag) => void | Promise): void; -} -declare interface EndTag { - name: string; - before(content: string, options?: ContentOptions): EndTag; - after(content: string, options?: ContentOptions): EndTag; - remove(): EndTag; -} -declare 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; -} -declare interface Text { - readonly text: string; - readonly lastInTextNode: boolean; - readonly removed: boolean; - before(content: string, options?: ContentOptions): Text; - after(content: string, options?: ContentOptions): Text; - replace(content: string, options?: ContentOptions): Text; - remove(): Text; -} -declare interface DocumentEnd { - append(content: string, options?: ContentOptions): DocumentEnd; -} -declare abstract class FetchEvent extends ExtendableEvent { - readonly request: Request; - respondWith(promise: Response | Promise): void; - passThroughOnException(): void; -} -declare type HeadersInit = - | Headers - | Iterable> - | Record; -declare class Headers { - constructor(init?: HeadersInit); - get(name: string): string | null; - getAll(name: string): string[]; - has(name: string): boolean; - set(name: string, value: string): void; - append(name: string, value: string): void; - delete(name: string): void; - forEach( - callback: (this: This, value: string, key: string, parent: Headers) => void, - thisArg?: This - ): void; - entries(): IterableIterator<[key: string, value: string]>; - keys(): IterableIterator; - values(): IterableIterator; - [Symbol.iterator](): IterableIterator<[key: string, value: string]>; -} -declare type BodyInit = - | ReadableStream - | string - | ArrayBuffer - | ArrayBufferView - | Blob - | URLSearchParams - | FormData; -declare abstract class Body { - readonly body: ReadableStream | null; - readonly bodyUsed: boolean; - arrayBuffer(): Promise; - text(): Promise; - json(): Promise; - formData(): Promise; - blob(): Promise; -} -declare class Response extends Body { - constructor(body?: BodyInit | null, init?: ResponseInit); - static redirect(url: string, status?: number): Response; - static json(any: any, maybeInit?: ResponseInit | Response): Response; - clone(): Response; - readonly status: number; - readonly statusText: string; - readonly headers: Headers; - readonly ok: boolean; - readonly redirected: boolean; - readonly url: string; - readonly webSocket: WebSocket | null; - readonly cf?: any; -} -declare interface ResponseInit { - status?: number; - statusText?: string; - headers?: HeadersInit; - cf?: any; - webSocket?: WebSocket | null; - encodeBody?: "automatic" | "manual"; -} -declare type RequestInfo< - CfHostMetadata = unknown, - Cf = CfProperties -> = Request | string | URL; -declare class Request< - CfHostMetadata = unknown, - Cf = CfProperties -> extends Body { - constructor(input: RequestInfo, init?: RequestInit); - clone(): Request; - /** Returns request's HTTP method, which is "GET" by default. */ - readonly method: string; - /** Returns the URL of request as a string. */ - readonly url: string; - /** Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the "Host" header. */ - readonly headers: Headers; - /** Returns the redirect mode associated with request, which is a string indicating how redirects for the request will be handled during fetching. A request will follow redirects by default. */ - readonly redirect: string; - readonly fetcher: Fetcher | null; - /** Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler. */ - readonly signal: AbortSignal; - readonly cf?: Cf; - /** Returns request's subresource integrity metadata, which is a cryptographic hash of the resource being fetched. Its value consists of multiple hashes separated by whitespace. [SRI] */ - readonly integrity: string; - /** Returns a boolean indicating whether or not request can outlive the global in which it was created. */ - readonly keepalive: boolean; -} -declare interface RequestInit { - /** 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 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; -} -declare abstract class Fetcher { - fetch(input: RequestInfo, init?: RequestInit): Promise; -} -declare interface FetcherPutOptions { - expiration?: number; - expirationTtl?: number; -} -declare interface KVNamespaceListKey { - name: Key; - expiration?: number; - metadata?: Metadata; -} -declare type KVNamespaceListResult = - | { - list_complete: false; - keys: KVNamespaceListKey[]; - cursor: string; - } - | { - list_complete: true; - keys: KVNamespaceListKey[]; - }; -declare interface KVNamespace { - get( - key: Key, - options?: Partial> - ): Promise; - get(key: Key, type: "text"): Promise; - get( - key: Key, - type: "json" - ): Promise; - get(key: Key, type: "arrayBuffer"): Promise; - get(key: Key, type: "stream"): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"text"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"json"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"arrayBuffer"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"stream"> - ): Promise; - list( - options?: KVNamespaceListOptions - ): Promise>; - put( - key: Key, - value: string | ArrayBuffer | ArrayBufferView | ReadableStream, - options?: KVNamespacePutOptions - ): Promise; - getWithMetadata( - key: Key, - options?: Partial> - ): Promise>; - getWithMetadata( - key: Key, - type: "text" - ): Promise>; - getWithMetadata( - key: Key, - type: "json" - ): Promise>; - getWithMetadata( - key: Key, - type: "arrayBuffer" - ): Promise>; - getWithMetadata( - key: Key, - type: "stream" - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"text"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"json"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"arrayBuffer"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"stream"> - ): Promise>; - delete(key: Key): Promise; -} -declare interface KVNamespaceListOptions { - limit?: number; - prefix?: string | null; - cursor?: string | null; -} -declare interface KVNamespaceGetOptions { - type: Type; - cacheTtl?: number; -} -declare interface KVNamespacePutOptions { - expiration?: number; - expirationTtl?: number; - metadata?: any | null; -} -declare interface KVNamespaceGetWithMetadataResult { - value: Value | null; - metadata: Metadata | null; -} -declare interface R2Error extends Error { - readonly name: string; - readonly code: number; - readonly message: string; - readonly action: string; - readonly stack: any; -} -declare interface R2ListOptions { - limit?: number; - prefix?: string; - cursor?: string; - delimiter?: string; - startAfter?: string; -} -declare abstract class R2Bucket { - head(key: string): Promise; - get( - key: string, - options: R2GetOptions & { - onlyIf: R2Conditional | Headers; - } - ): Promise; - get(key: string, options?: R2GetOptions): Promise; - put( - key: string, - value: - | ReadableStream - | ArrayBuffer - | ArrayBufferView - | string - | null - | Blob, - options?: R2PutOptions - ): Promise; - put( - key: string, - value: - | ReadableStream - | ArrayBuffer - | ArrayBufferView - | string - | null - | Blob, - options?: R2PutOptions & { - onlyIf: R2Conditional | Headers; - } - ): Promise; - createMultipartUpload( - key: string, - options?: R2MultipartOptions - ): Promise; - resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload; - delete(keys: string | string[]): Promise; - list(options?: R2ListOptions): Promise; -} -declare interface R2MultipartUpload { - readonly key: string; - readonly uploadId: string; - uploadPart( - partNumber: number, - value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob - ): Promise; - abort(): Promise; - complete(uploadedParts: R2UploadedPart[]): Promise; -} -declare 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; - readonly range?: R2Range; - writeHttpMetadata(headers: Headers): void; -} -declare interface R2ObjectBody extends R2Object { - get body(): ReadableStream; - get bodyUsed(): boolean; - arrayBuffer(): Promise; - text(): Promise; - json(): Promise; - blob(): Promise; -} -declare type R2Range = - | { - offset: number; - length?: number; - } - | { - offset?: number; - length: number; - } - | { - suffix: number; - }; -declare interface R2Conditional { - etagMatches?: string; - etagDoesNotMatch?: string; - uploadedBefore?: Date; - uploadedAfter?: Date; - secondsGranularity?: boolean; -} -declare interface R2GetOptions { - onlyIf?: R2Conditional | Headers; - range?: R2Range | Headers; -} -declare interface R2PutOptions { - onlyIf?: R2Conditional | Headers; - httpMetadata?: R2HTTPMetadata | Headers; - customMetadata?: Record; - md5?: ArrayBuffer | string; - sha1?: ArrayBuffer | string; - sha256?: ArrayBuffer | string; - sha384?: ArrayBuffer | string; - sha512?: ArrayBuffer | string; -} -declare interface R2MultipartOptions { - httpMetadata?: R2HTTPMetadata | Headers; - customMetadata?: Record; -} -declare interface R2Checksums { - readonly md5?: ArrayBuffer; - readonly sha1?: ArrayBuffer; - readonly sha256?: ArrayBuffer; - readonly sha384?: ArrayBuffer; - readonly sha512?: ArrayBuffer; - toJSON(): R2StringChecksums; -} -declare interface R2StringChecksums { - md5?: string; - sha1?: string; - sha256?: string; - sha384?: string; - sha512?: string; -} -declare interface R2HTTPMetadata { - contentType?: string; - contentLanguage?: string; - contentDisposition?: string; - contentEncoding?: string; - cacheControl?: string; - cacheExpiry?: Date; -} -declare interface R2Objects { - objects: R2Object[]; - truncated: boolean; - cursor?: string; - delimitedPrefixes: string[]; -} -declare abstract class ScheduledEvent extends ExtendableEvent { - readonly scheduledTime: number; - readonly cron: string; - noRetry(): void; -} -declare interface ScheduledController { - readonly scheduledTime: number; - readonly cron: string; - noRetry(): void; -} -declare interface QueuingStrategy { - highWaterMark?: number | bigint; - size?: (chunk: T) => number | bigint; -} -declare interface UnderlyingSink { - type?: string; - start?: (controller: WritableStreamDefaultController) => void | Promise; - write?: ( - chunk: W, - controller: WritableStreamDefaultController - ) => void | Promise; - abort?: (reason: any) => void | Promise; - close?: () => void | Promise; -} -declare interface UnderlyingByteSource { - type: "bytes"; - autoAllocateChunkSize?: number; - start?: (controller: ReadableByteStreamController) => void | Promise; - pull?: (controller: ReadableByteStreamController) => void | Promise; - cancel?: (reason: any) => void | Promise; -} -declare interface UnderlyingSource { - type?: "" | undefined; - start?: ( - controller: ReadableStreamDefaultController - ) => void | Promise; - pull?: ( - controller: ReadableStreamDefaultController - ) => void | Promise; - cancel?: (reason: any) => void | Promise; -} -declare interface Transformer { - readableType?: string; - writableType?: string; - start?: ( - controller: TransformStreamDefaultController - ) => void | Promise; - transform?: ( - chunk: I, - controller: TransformStreamDefaultController - ) => void | Promise; - flush?: ( - controller: TransformStreamDefaultController - ) => void | Promise; -} -declare interface StreamPipeOptions { - /** - * 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; - preventAbort?: boolean; - preventCancel?: boolean; - signal?: AbortSignal; -} -declare type ReadableStreamReadResult = - | { - done: false; - value: R; - } - | { - done: true; - value?: undefined; - }; -/** This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object. */ -declare interface ReadableStream { - readonly locked: boolean; - cancel(reason?: any): Promise; - getReader(): ReadableStreamDefaultReader; - getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader; - pipeThrough( - transform: ReadableWritablePair, - options?: StreamPipeOptions - ): ReadableStream; - pipeTo( - destination: WritableStream, - options?: StreamPipeOptions - ): Promise; - tee(): [ReadableStream, ReadableStream]; - values(options?: ReadableStreamValuesOptions): AsyncIterableIterator; - [Symbol.asyncIterator]( - options?: ReadableStreamValuesOptions - ): AsyncIterableIterator; -} -declare const ReadableStream: { - prototype: ReadableStream; - new ( - underlyingSource: UnderlyingByteSource, - strategy?: QueuingStrategy - ): ReadableStream; - new ( - underlyingSource?: UnderlyingSource, - strategy?: QueuingStrategy - ): ReadableStream; -}; -declare class ReadableStreamDefaultReader { - constructor(stream: ReadableStream); - readonly closed: Promise; - cancel(reason?: any): Promise; - read(): Promise>; - releaseLock(): void; -} -declare class ReadableStreamBYOBReader { - constructor(stream: ReadableStream); - readonly closed: Promise; - cancel(reason?: any): Promise; - read( - view: T - ): Promise>; - releaseLock(): void; - readAtLeast( - minElements: number, - view: T - ): Promise>; -} -declare interface ReadableStreamGetReaderOptions { - mode: "byob"; -} -declare interface ReadableStreamBYOBRequest { - readonly view: Uint8Array | null; - respond(bytesWritten: number): void; - respondWithNewView(view: ArrayBuffer | ArrayBufferView): void; - readonly atLeast: number | null; -} -declare interface ReadableStreamDefaultController { - readonly desiredSize: number | null; - close(): void; - enqueue(chunk?: R): void; - error(reason: any): void; -} -declare interface ReadableByteStreamController { - readonly byobRequest: ReadableStreamBYOBRequest | null; - readonly desiredSize: number | null; - close(): void; - enqueue(chunk: ArrayBuffer | ArrayBufferView): void; - error(reason: any): void; -} -/** This Streams API interface represents a controller allowing control of a WritableStream's state. When constructing a WritableStream, the underlying sink is given a corresponding WritableStreamDefaultController instance to manipulate. */ -declare interface WritableStreamDefaultController { - readonly signal: AbortSignal; - error(reason?: any): void; -} -declare interface TransformStreamDefaultController { - get desiredSize(): number | null; - enqueue(chunk?: O): void; - error(reason: any): void; - terminate(): void; -} -declare interface ReadableWritablePair { - /** - * 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; - readable: ReadableStream; -} -declare class WritableStream { - constructor( - underlyingSink?: UnderlyingSink, - queuingStrategy?: QueuingStrategy - ); - readonly locked: boolean; - abort(reason?: any): Promise; - close(): Promise; - getWriter(): WritableStreamDefaultWriter; -} -declare class WritableStreamDefaultWriter { - constructor(stream: WritableStream); - readonly closed: Promise; - readonly ready: Promise; - readonly desiredSize: number | null; - abort(reason?: any): Promise; - close(): Promise; - write(chunk?: W): Promise; - releaseLock(): void; -} -declare class TransformStream { - constructor( - transformer?: Transformer, - writableStrategy?: QueuingStrategy, - readableStrategy?: QueuingStrategy - ); - readonly readable: ReadableStream; - readonly writable: WritableStream; -} -declare class FixedLengthStream extends IdentityTransformStream { - constructor(expectedLength: number | bigint); -} -declare class IdentityTransformStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(); -} -declare interface ReadableStreamValuesOptions { - preventCancel?: boolean; -} -declare class CompressionStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(format: "gzip" | "deflate" | "deflate-raw"); -} -declare class DecompressionStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(format: "gzip" | "deflate" | "deflate-raw"); -} -declare class TextEncoderStream extends TransformStream { - constructor(); -} -declare class TextDecoderStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - string -> { - constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit); -} -declare interface TextDecoderStreamTextDecoderStreamInit { - fatal?: boolean; -} -declare class ByteLengthQueuingStrategy - implements QueuingStrategy -{ - constructor(init: QueuingStrategyInit); - get highWaterMark(): number; - get size(): (chunk?: any) => number; -} -declare class CountQueuingStrategy implements QueuingStrategy { - constructor(init: QueuingStrategyInit); - get highWaterMark(): number; - get size(): (chunk?: any) => number; -} -declare 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; -} -declare abstract class TraceEvent extends ExtendableEvent { - readonly traces: TraceItem[]; -} -declare interface TraceItem { - readonly event: - | ( - | TraceItemFetchEventInfo - | TraceItemScheduledEventInfo - | TraceItemAlarmEventInfo - | TraceItemQueueEventInfo - | TraceItemEmailEventInfo - | TraceItemCustomEventInfo - ) - | null; - readonly eventTimestamp: number | null; - readonly logs: TraceLog[]; - readonly exceptions: TraceException[]; - readonly scriptName: string | null; - readonly dispatchNamespace?: string; - readonly scriptTags?: string[]; - readonly outcome: string; -} -declare interface TraceItemAlarmEventInfo { - readonly scheduledTime: Date; -} -declare interface TraceItemCustomEventInfo {} -declare interface TraceItemScheduledEventInfo { - readonly scheduledTime: number; - readonly cron: string; -} -declare interface TraceItemQueueEventInfo { - readonly queue: string; - readonly batchSize: number; -} -declare interface TraceItemEmailEventInfo { - readonly mailFrom: string; - readonly rcptTo: string; - readonly rawSize: number; -} -declare interface TraceItemFetchEventInfo { - readonly response?: TraceItemFetchEventInfoResponse; - readonly request: TraceItemFetchEventInfoRequest; -} -declare interface TraceItemFetchEventInfoRequest { - readonly cf?: any; - readonly headers: Record; - readonly method: string; - readonly url: string; - getUnredacted(): TraceItemFetchEventInfoRequest; -} -declare interface TraceItemFetchEventInfoResponse { - readonly status: number; -} -declare interface TraceLog { - readonly timestamp: number; - readonly level: string; - readonly message: any; -} -declare interface TraceException { - readonly timestamp: number; - readonly message: string; - readonly name: string; -} -declare interface TraceMetrics { - readonly cpuTime: number; - readonly wallTime: number; -} -declare interface UnsafeTraceMetrics { - fromTrace(item: TraceItem): TraceMetrics; -} -declare class URL { - constructor(url: string | URL, base?: string | URL); - href: string; - readonly origin: string; - protocol: string; - username: string; - password: string; - host: string; - hostname: string; - port: string; - pathname: string; - search: string; - readonly searchParams: URLSearchParams; - hash: string; - toString(): string; - toJSON(): string; -} -declare class URLSearchParams { - constructor( - init?: - | URLSearchParams - | string - | Record - | [key: string, value: string][] - ); - get size(): number; - append(name: string, value: string): void; - delete(name: string): void; - get(name: string): string | null; - getAll(name: string): string[]; - has(name: string): boolean; - set(name: string, value: string): void; - sort(): void; - entries(): IterableIterator<[key: string, value: string]>; - keys(): IterableIterator; - values(): IterableIterator; - forEach( - callback: ( - this: This, - value: string, - key: string, - parent: URLSearchParams - ) => void, - thisArg?: This - ): void; - toString(): string; - [Symbol.iterator](): IterableIterator<[key: string, value: string]>; -} -declare class URLPattern { - constructor(input?: string | URLPatternURLPatternInit, baseURL?: string); - get protocol(): string; - get username(): string; - get password(): string; - get hostname(): string; - get port(): string; - get pathname(): string; - get search(): string; - get hash(): string; - test(input?: string | URLPatternURLPatternInit, baseURL?: string): boolean; - exec( - input?: string | URLPatternURLPatternInit, - baseURL?: string - ): URLPatternURLPatternResult | null; -} -declare interface URLPatternURLPatternInit { - protocol?: string; - username?: string; - password?: string; - hostname?: string; - port?: string; - pathname?: string; - search?: string; - hash?: string; - baseURL?: string; -} -declare interface URLPatternURLPatternComponentResult { - input: string; - groups: Record; -} -declare interface URLPatternURLPatternResult { - inputs: (string | URLPatternURLPatternInit)[]; - protocol: URLPatternURLPatternComponentResult; - username: URLPatternURLPatternComponentResult; - password: URLPatternURLPatternComponentResult; - hostname: URLPatternURLPatternComponentResult; - port: URLPatternURLPatternComponentResult; - pathname: URLPatternURLPatternComponentResult; - search: URLPatternURLPatternComponentResult; - hash: URLPatternURLPatternComponentResult; -} -declare class CloseEvent extends Event { - constructor(type: string, initializer: CloseEventInit); - /** Returns the WebSocket connection close code provided by the server. */ - readonly code: number; - /** Returns the WebSocket connection close reason provided by the server. */ - readonly reason: string; - /** Returns true if the connection closed cleanly; false otherwise. */ - readonly wasClean: boolean; -} -declare interface CloseEventInit { - code?: number; - reason?: string; - wasClean?: boolean; -} -declare class MessageEvent extends Event { - constructor(type: string, initializer: MessageEventInit); - readonly data: ArrayBuffer | string; -} -declare interface MessageEventInit { - data: ArrayBuffer | string; -} -/** Events providing information related to errors in scripts or in files. */ -declare interface ErrorEvent extends Event { - readonly filename: string; - readonly message: string; - readonly lineno: number; - readonly colno: number; - readonly error: any; -} -declare type WebSocketEventMap = { - close: CloseEvent; - message: MessageEvent; - open: Event; - error: ErrorEvent; -}; -declare class WebSocket extends EventTarget { - constructor(url: string, protocols?: string[] | string); - accept(): void; - send(message: (ArrayBuffer | ArrayBufferView) | string): void; - close(code?: number, reason?: string): void; - static readonly READY_STATE_CONNECTING: number; - static readonly READY_STATE_OPEN: number; - static readonly READY_STATE_CLOSING: number; - static readonly READY_STATE_CLOSED: number; - /** Returns the state of the WebSocket object's connection. It can have the values described below. */ - readonly readyState: number; - /** Returns the URL that was used to establish the WebSocket connection. */ - readonly url: string | null; - /** Returns the subprotocol selected by the server, if any. It can be used in conjunction with the array form of the constructor's second argument to perform subprotocol negotiation. */ - readonly protocol: string | null; - /** Returns the extensions selected by the server, if any. */ - readonly extensions: string | null; -} -declare const WebSocketPair: { - new (): { - 0: WebSocket; - 1: WebSocket; - }; -}; -declare interface BasicImageTransformations { - /** - * Maximum width in image pixels. The value must be an integer. - */ - width?: number; - /** - * Maximum height in image pixels. The value must be an integer. - */ - height?: number; - /** - * Resizing mode as a string. It affects interpretation of width and height - * options: - * - scale-down: Similar to contain, but the image is never enlarged. If - * the image is larger than given width or height, it will be resized. - * Otherwise its original size will be kept. - * - contain: Resizes to maximum size that fits within the given width and - * height. If only a single dimension is given (e.g. only width), the - * image will be shrunk or enlarged to exactly match that dimension. - * Aspect ratio is always preserved. - * - cover: Resizes (shrinks or enlarges) to fill the entire area of width - * and height. If the image has an aspect ratio different from the ratio - * of width and height, it will be cropped to fit. - * - crop: The image will be shrunk and cropped to fit within the area - * specified by width and height. The image will not be enlarged. For images - * smaller than the given dimensions it's the same as scale-down. For - * images larger than the given dimensions, it's the same as cover. - * See also trim. - * - pad: Resizes to the maximum size that fits within the given width and - * height, and then fills the remaining area with a background color - * (white by default). Use of this mode is not recommended, as the same - * effect can be more efficiently achieved with the contain mode and the - * CSS object-fit: contain property. - */ - fit?: "scale-down" | "contain" | "cover" | "crop" | "pad"; - /** - * When cropping with fit: "cover", this defines the side or point that should - * be left uncropped. The value is either a string - * "left", "right", "top", "bottom", "auto", or "center" (the default), - * or an object {x, y} containing focal point coordinates in the original - * image expressed as fractions ranging from 0.0 (top or left) to 1.0 - * (bottom or right), 0.5 being the center. {fit: "cover", gravity: "top"} will - * crop bottom or left and right sides as necessary, but won’t crop anything - * from the top. {fit: "cover", gravity: {x:0.5, y:0.2}} will crop each side to - * preserve as much as possible around a point at 20% of the height of the - * source image. - */ - gravity?: - | "left" - | "right" - | "top" - | "bottom" - | "center" - | "auto" - | BasicImageTransformationsGravityCoordinates; - /** - * Background color to add underneath the image. Applies only to images with - * transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…), - * hsl(…), etc.) - */ - background?: string; - /** - * Number of degrees (90, 180, 270) to rotate the image by. width and height - * options refer to axes after rotation. - */ - rotate?: 0 | 90 | 180 | 270 | 360; -} -declare interface BasicImageTransformationsGravityCoordinates { - x: number; - y: number; -} -/** - * In addition to the properties you can set in the RequestInit dict - * that you pass as an argument to the Request constructor, you can - * set certain properties of a `cf` object to control how Cloudflare - * features are applied to that new Request. - * - * Note: Currently, these properties cannot be tested in the - * playground. - */ -declare interface RequestInitCfProperties extends Record { - cacheEverything?: boolean; - /** - * A request's cache key is what determines if two requests are - * "the same" for caching purposes. If a request has the same cache key - * as some previous request, then we can serve the same cached response for - * both. (e.g. 'some-key') - * - * Only available for Enterprise customers. - */ - cacheKey?: string; - /** - * This allows you to append additional Cache-Tag response headers - * to the origin response without modifications to the origin server. - * This will allow for greater control over the Purge by Cache Tag feature - * utilizing changes only in the Workers process. - * - * Only available for Enterprise customers. - */ - cacheTags?: string[]; - /** - * Force response to be cached for a given number of seconds. (e.g. 300) - */ - cacheTtl?: number; - /** - * Force response to be cached for a given number of seconds based on the Origin status code. - * (e.g. { '200-299': 86400, '404': 1, '500-599': 0 }) - */ - cacheTtlByStatus?: Record; - scrapeShield?: boolean; - apps?: boolean; - image?: RequestInitCfPropertiesImage; - minify?: RequestInitCfPropertiesImageMinify; - mirage?: boolean; - polish?: "lossy" | "lossless" | "off"; - /** - * Redirects the request to an alternate origin server. You can use this, - * for example, to implement load balancing across several origins. - * (e.g.us-east.example.com) - * - * Note - For security reasons, the hostname set in resolveOverride must - * be proxied on the same Cloudflare zone of the incoming request. - * Otherwise, the setting is ignored. CNAME hosts are allowed, so to - * resolve to a host under a different domain or a DNS only domain first - * declare a CNAME record within your own zone’s DNS mapping to the - * external hostname, set proxy on Cloudflare, then set resolveOverride - * to point to that CNAME record. - */ - resolveOverride?: string; -} -declare interface RequestInitCfPropertiesImageDraw - extends BasicImageTransformations { - /** - * Absolute URL of the image file to use for the drawing. It can be any of - * the supported file formats. For drawing of watermarks or non-rectangular - * overlays we recommend using PNG or WebP images. - */ - url: string; - /** - * Floating-point number between 0 (transparent) and 1 (opaque). - * For example, opacity: 0.5 makes overlay semitransparent. - */ - opacity?: number; - /** - * - If set to true, the overlay image will be tiled to cover the entire - * area. This is useful for stock-photo-like watermarks. - * - If set to "x", the overlay image will be tiled horizontally only - * (form a line). - * - If set to "y", the overlay image will be tiled vertically only - * (form a line). - */ - repeat?: true | "x" | "y"; - /** - * Position of the overlay image relative to a given edge. Each property is - * an offset in pixels. 0 aligns exactly to the edge. For example, left: 10 - * positions left side of the overlay 10 pixels from the left edge of the - * image it's drawn over. bottom: 0 aligns bottom of the overlay with bottom - * of the background image. - * - * Setting both left & right, or both top & bottom is an error. - * - * If no position is specified, the image will be centered. - */ - top?: number; - left?: number; - bottom?: number; - right?: number; -} -declare interface RequestInitCfPropertiesImage - extends BasicImageTransformations { - /** - * Device Pixel Ratio. Default 1. Multiplier for width/height that makes it - * easier to specify higher-DPI sizes in . - */ - dpr?: number; - /** - * An object with four properties {left, top, right, bottom} that specify - * a number of pixels to cut off on each side. Allows removal of borders - * or cutting out a specific fragment of an image. Trimming is performed - * before resizing or rotation. Takes dpr into account. - */ - trim?: { - left?: number; - top?: number; - right?: number; - bottom?: number; - }; - /** - * Quality setting from 1-100 (useful values are in 60-90 range). Lower values - * make images look worse, but load faster. The default is 85. It applies only - * to JPEG and WebP images. It doesn’t have any effect on PNG. - */ - quality?: number; - /** - * Output format to generate. It can be: - * - avif: generate images in AVIF format. - * - webp: generate images in Google WebP format. Set quality to 100 to get - * the WebP-lossless format. - * - json: instead of generating an image, outputs information about the - * image, in JSON format. The JSON object will contain image size - * (before and after resizing), source image’s MIME type, file size, etc. - * - jpeg: generate images in JPEG format. - * - png: generate images in PNG format. - */ - format?: "avif" | "webp" | "json" | "jpeg" | "png"; - /** - * Whether to preserve animation frames from input files. Default is true. - * Setting it to false reduces animations to still images. This setting is - * recommended when enlarging images or processing arbitrary user content, - * because large GIF animations can weigh tens or even hundreds of megabytes. - * It is also useful to set anim:false when using format:"json" to get the - * response quicker without the number of frames. - */ - anim?: boolean; - /** - * What EXIF data should be preserved in the output image. Note that EXIF - * rotation and embedded color profiles are always applied ("baked in" into - * the image), and aren't affected by this option. Note that if the Polish - * feature is enabled, all metadata may have been removed already and this - * option may have no effect. - * - keep: Preserve most of EXIF metadata, including GPS location if there's - * any. - * - copyright: Only keep the copyright tag, and discard everything else. - * This is the default behavior for JPEG files. - * - none: Discard all invisible EXIF metadata. Currently WebP and PNG - * output formats always discard metadata. - */ - metadata?: "keep" | "copyright" | "none"; - /** - * Strength of sharpening filter to apply to the image. Floating-point - * number between 0 (no sharpening, default) and 10 (maximum). 1.0 is a - * recommended value for downscaled images. - */ - sharpen?: number; - /** - * Radius of a blur filter (approximate gaussian). Maximum supported radius - * is 250. - */ - blur?: number; - /** - * Overlays are drawn in the order they appear in the array (last array - * entry is the topmost layer). - */ - draw?: RequestInitCfPropertiesImageDraw[]; - /** - * Fetching image from authenticated origin. Setting this property will - * pass authentication headers (Authorization, Cookie, etc.) through to - * the origin. - */ - "origin-auth"?: "share-publicly"; - /** - * Adds a border around the image. The border is added after resizing. Border - * width takes dpr into account, and can be specified either using a single - * width property, or individually for each side. - */ - border?: - | { - color: string; - width: number; - } - | { - color: string; - top: number; - right: number; - bottom: number; - left: number; - }; - /** - * Increase brightness by a factor. A value of 1.0 equals no change, a value - * of 0.5 equals half brightness, and a value of 2.0 equals twice as bright. - * 0 is ignored. - */ - brightness?: number; - /** - * Increase contrast by a factor. A value of 1.0 equals no change, a value of - * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is - * ignored. - */ - contrast?: number; - /** - * Increase exposure by a factor. A value of 1.0 equals no change, a value of - * 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored. - */ - gamma?: number; - /** - * Slightly reduces latency on a cache miss by selecting a - * quickest-to-compress file format, at a cost of increased file size and - * lower image quality. It will usually override the format option and choose - * JPEG over WebP or AVIF. We do not recommend using this option, except in - * unusual circumstances like resizing uncacheable dynamically-generated - * images. - */ - compression?: "fast"; -} -declare interface RequestInitCfPropertiesImageMinify { - javascript?: boolean; - css?: boolean; - html?: boolean; -} -/** - * Request metadata provided by Cloudflare's edge. - */ -declare type IncomingRequestCfProperties = - IncomingRequestCfPropertiesBase & - IncomingRequestCfPropertiesBotManagementEnterprise & - IncomingRequestCfPropertiesCloudflareForSaaSEnterprise & - IncomingRequestCfPropertiesGeographicInformation & - IncomingRequestCfPropertiesCloudflareAccessOrApiShield; -declare interface IncomingRequestCfPropertiesBase - extends Record { - /** - * [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request. - * - * @example 395747 - */ - asn: number; - /** - * The organization which owns the ASN of the incoming request. - * - * @example "Google Cloud" - */ - asOrganization: string; - /** - * The original value of the `Accept-Encoding` header if Cloudflare modified it. - * - * @example "gzip, deflate, br" - */ - clientAcceptEncoding?: string; - /** - * The number of milliseconds it took for the request to reach your worker. - * - * @example 22 - */ - clientTcpRtt?: number; - /** - * The three-letter [IATA](https://en.wikipedia.org/wiki/IATA_airport_code) - * airport code of the data center that the request hit. - * - * @example "DFW" - */ - colo: string; - /** - * Represents the upstream's response to a - * [TCP `keepalive` message](https://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html) - * from cloudflare. - * - * For workers with no upstream, this will always be `1`. - * - * @example 3 - */ - edgeRequestKeepAliveStatus: IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus; - /** - * The HTTP Protocol the request used. - * - * @example "HTTP/2" - */ - httpProtocol: string; - /** - * The browser-requested prioritization information in the request object. - * - * If no information was set, defaults to the empty string `""` - * - * @example "weight=192;exclusive=0;group=3;group-weight=127" - * @default "" - */ - requestPriority: string; - /** - * The TLS version of the connection to Cloudflare. - * In requests served over plaintext (without TLS), this property is the empty string `""`. - * - * @example "TLSv1.3" - */ - tlsVersion: string; - /** - * The cipher for the connection to Cloudflare. - * In requests served over plaintext (without TLS), this property is the empty string `""`. - * - * @example "AEAD-AES128-GCM-SHA256" - */ - tlsCipher: string; - /** - * Metadata containing the [`HELLO`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2) and [`FINISHED`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9) messages from this request's TLS handshake. - * - * If the incoming request was served over plaintext (without TLS) this field is undefined. - */ - tlsExportedAuthenticator?: IncomingRequestCfPropertiesExportedAuthenticatorMetadata; -} -declare interface IncomingRequestCfPropertiesBotManagementBase { - /** - * Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot, - * represented as an integer percentage between `1` (almost certainly human) - * and `99` (almost certainly a bot). - * - * @example 54 - */ - score: number; - /** - * A boolean value that is true if the request comes from a good bot, like Google or Bing. - * Most customers choose to allow this traffic. For more details, see [Traffic from known bots](https://developers.cloudflare.com/firewall/known-issues-and-faq/#how-does-firewall-rules-handle-traffic-from-known-bots). - */ - verifiedBot: boolean; - /** - * A boolean value that is true if the request originates from a - * Cloudflare-verified proxy service. - */ - corporateProxy: boolean; - /** - * A boolean value that's true if the request matches [file extensions](https://developers.cloudflare.com/bots/reference/static-resources/) for many types of static resources. - */ - staticResource: boolean; - /** - * List of IDs that correlate to the Bot Management heuristic detections made on a request (you can have multiple heuristic detections on the same request). - */ - detectionIds: number[]; -} -declare interface IncomingRequestCfPropertiesBotManagement { - /** - * Results of Cloudflare's Bot Management analysis - */ - botManagement: IncomingRequestCfPropertiesBotManagementBase; - /** - * Duplicate of `botManagement.score`. - * - * @deprecated - */ - clientTrustScore: number; -} -declare interface IncomingRequestCfPropertiesBotManagementEnterprise - extends IncomingRequestCfPropertiesBotManagement { - /** - * Results of Cloudflare's Bot Management analysis - */ - botManagement: IncomingRequestCfPropertiesBotManagementBase & { - /** - * A [JA3 Fingerprint](https://developers.cloudflare.com/bots/concepts/ja3-fingerprint/) to help profile specific SSL/TLS clients - * across different destination IPs, Ports, and X509 certificates. - */ - ja3Hash: string; - }; -} -declare interface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise< - HostMetadata -> { - /** - * Custom metadata set per-host in [Cloudflare for SaaS](https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/). - * - * This field is only present if you have Cloudflare for SaaS enabled on your account - * and you have followed the [required steps to enable it]((https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/domain-support/custom-metadata/)). - */ - hostMetadata: HostMetadata; -} -declare interface IncomingRequestCfPropertiesCloudflareAccessOrApiShield { - /** - * Information about the client certificate presented to Cloudflare. - * - * This is populated when the incoming request is served over TLS using - * either Cloudflare Access or API Shield (mTLS) - * and the presented SSL certificate has a valid - * [Certificate Serial Number](https://ldapwiki.com/wiki/Certificate%20Serial%20Number) - * (i.e., not `null` or `""`). - * - * Otherwise, a set of placeholder values are used. - * - * The property `certPresented` will be set to `"1"` when - * the object is populated (i.e. the above conditions were met). - */ - tlsClientAuth: - | IncomingRequestCfPropertiesTLSClientAuth - | IncomingRequestCfPropertiesTLSClientAuthPlaceholder; -} -/** - * Metadata about the request's TLS handshake - */ -declare interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata { - /** - * The client's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal - * - * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d" - */ - clientHandshake: string; - /** - * The server's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal - * - * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d" - */ - serverHandshake: string; - /** - * The client's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal - * - * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b" - */ - clientFinished: string; - /** - * The server's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal - * - * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b" - */ - serverFinished: string; -} -/** - * Geographic data about the request's origin. - */ -declare interface IncomingRequestCfPropertiesGeographicInformation { - /** - * The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from. - * - * If your worker is [configured to accept TOR connections](https://support.cloudflare.com/hc/en-us/articles/203306930-Understanding-Cloudflare-Tor-support-and-Onion-Routing), this may also be `"T1"`, indicating a request that originated over TOR. - * - * If Cloudflare is unable to determine where the request originated this property is omitted. - * - * The country code `"T1"` is used for requests originating on TOR. - * - * @example "GB" - */ - country?: Iso3166Alpha2Code | "T1"; - /** - * If present, this property indicates that the request originated in the EU - * - * @example "1" - */ - isEUCountry?: "1"; - /** - * A two-letter code indicating the continent the request originated from. - * - * @example "AN" - */ - continent?: ContinentCode; - /** - * The city the request originated from - * - * @example "Austin" - */ - city?: string; - /** - * Postal code of the incoming request - * - * @example "78701" - */ - postalCode?: string; - /** - * Latitude of the incoming request - * - * @example "30.27130" - */ - latitude?: string; - /** - * Longitude of the incoming request - * - * @example "-97.74260" - */ - longitude?: string; - /** - * Timezone of the incoming request - * - * @example "America/Chicago" - */ - timezone?: string; - /** - * If known, the ISO 3166-2 name for the first level region associated with - * the IP address of the incoming request - * - * @example "Texas" - */ - region?: string; - /** - * If known, the ISO 3166-2 code for the first-level region associated with - * the IP address of the incoming request - * - * @example "TX" - */ - regionCode?: string; - /** - * Metro code (DMA) of the incoming request - * - * @example "635" - */ - metroCode?: string; -} -/** Data about the incoming request's TLS certificate */ -declare interface IncomingRequestCfPropertiesTLSClientAuth { - /** Always `"1"`, indicating that the certificate was presented */ - certPresented: "1"; - /** - * Result of certificate verification. - * - * @example "FAILED:self signed certificate" - */ - certVerified: Exclude; - /** The presented certificate's revokation status. - * - * - A value of `"1"` indicates the certificate has been revoked - * - A value of `"0"` indicates the certificate has not been revoked - */ - certRevoked: "1" | "0"; - /** - * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) - * - * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certIssuerDN: string; - /** - * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) - * - * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certSubjectDN: string; - /** - * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted) - * - * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certIssuerDNRFC2253: string; - /** - * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted) - * - * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certSubjectDNRFC2253: string; - /** The certificate issuer's distinguished name (legacy policies) */ - certIssuerDNLegacy: string; - /** The certificate subject's distinguished name (legacy policies) */ - certSubjectDNLegacy: string; - /** - * The certificate's serial number - * - * @example "00936EACBE07F201DF" - */ - certSerial: string; - /** - * The certificate issuer's serial number - * - * @example "2489002934BDFEA34" - */ - certIssuerSerial: string; - /** - * The certificate's Subject Key Identifier - * - * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4" - */ - certSKI: string; - /** - * The certificate issuer's Subject Key Identifier - * - * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4" - */ - certIssuerSKI: string; - /** - * The certificate's SHA-1 fingerprint - * - * @example "6b9109f323999e52259cda7373ff0b4d26bd232e" - */ - certFingerprintSHA1: string; - /** - * The certificate's SHA-256 fingerprint - * - * @example "acf77cf37b4156a2708e34c4eb755f9b5dbbe5ebb55adfec8f11493438d19e6ad3f157f81fa3b98278453d5652b0c1fd1d71e5695ae4d709803a4d3f39de9dea" - */ - certFingerprintSHA256: string; - /** - * The effective starting date of the certificate - * - * @example "Dec 22 19:39:00 2018 GMT" - */ - certNotBefore: string; - /** - * The effective expiration date of the certificate - * - * @example "Dec 22 19:39:00 2018 GMT" - */ - certNotAfter: string; -} -/** Placeholder values for TLS Client Authorization */ -declare interface IncomingRequestCfPropertiesTLSClientAuthPlaceholder { - certPresented: "0"; - certVerified: "NONE"; - certRevoked: "0"; - certIssuerDN: ""; - certSubjectDN: ""; - certIssuerDNRFC2253: ""; - certSubjectDNRFC2253: ""; - certIssuerDNLegacy: ""; - certSubjectDNLegacy: ""; - certSerial: ""; - certIssuerSerial: ""; - certSKI: ""; - certIssuerSKI: ""; - certFingerprintSHA1: ""; - certFingerprintSHA256: ""; - certNotBefore: ""; - certNotAfter: ""; -} -/** Possible outcomes of TLS verification */ -declare type CertVerificationStatus = - /** Authentication succeeded */ - | "SUCCESS" - /** No certificate was presented */ - | "NONE" - /** Failed because the certificate was self-signed */ - | "FAILED:self signed certificate" - /** Failed because the certificate failed a trust chain check */ - | "FAILED:unable to verify the first certificate" - /** Failed because the certificate not yet valid */ - | "FAILED:certificate is not yet valid" - /** Failed because the certificate is expired */ - | "FAILED:certificate has expired" - /** Failed for another unspecified reason */ - | "FAILED"; -/** - * An upstream endpoint's response to a TCP `keepalive` message from Cloudflare. - */ -declare type IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus = - | 0 /** Unknown */ - | 1 /** no keepalives (not found) */ - | 2 /** no connection re-use, opening keepalive connection failed */ - | 3 /** no connection re-use, keepalive accepted and saved */ - | 4 /** connection re-use, refused by the origin server (`TCP FIN`) */ - | 5; /** connection re-use, accepted by the origin server */ -/** ISO 3166-1 Alpha-2 codes */ -declare type Iso3166Alpha2Code = - | "AD" - | "AE" - | "AF" - | "AG" - | "AI" - | "AL" - | "AM" - | "AO" - | "AQ" - | "AR" - | "AS" - | "AT" - | "AU" - | "AW" - | "AX" - | "AZ" - | "BA" - | "BB" - | "BD" - | "BE" - | "BF" - | "BG" - | "BH" - | "BI" - | "BJ" - | "BL" - | "BM" - | "BN" - | "BO" - | "BQ" - | "BR" - | "BS" - | "BT" - | "BV" - | "BW" - | "BY" - | "BZ" - | "CA" - | "CC" - | "CD" - | "CF" - | "CG" - | "CH" - | "CI" - | "CK" - | "CL" - | "CM" - | "CN" - | "CO" - | "CR" - | "CU" - | "CV" - | "CW" - | "CX" - | "CY" - | "CZ" - | "DE" - | "DJ" - | "DK" - | "DM" - | "DO" - | "DZ" - | "EC" - | "EE" - | "EG" - | "EH" - | "ER" - | "ES" - | "ET" - | "FI" - | "FJ" - | "FK" - | "FM" - | "FO" - | "FR" - | "GA" - | "GB" - | "GD" - | "GE" - | "GF" - | "GG" - | "GH" - | "GI" - | "GL" - | "GM" - | "GN" - | "GP" - | "GQ" - | "GR" - | "GS" - | "GT" - | "GU" - | "GW" - | "GY" - | "HK" - | "HM" - | "HN" - | "HR" - | "HT" - | "HU" - | "ID" - | "IE" - | "IL" - | "IM" - | "IN" - | "IO" - | "IQ" - | "IR" - | "IS" - | "IT" - | "JE" - | "JM" - | "JO" - | "JP" - | "KE" - | "KG" - | "KH" - | "KI" - | "KM" - | "KN" - | "KP" - | "KR" - | "KW" - | "KY" - | "KZ" - | "LA" - | "LB" - | "LC" - | "LI" - | "LK" - | "LR" - | "LS" - | "LT" - | "LU" - | "LV" - | "LY" - | "MA" - | "MC" - | "MD" - | "ME" - | "MF" - | "MG" - | "MH" - | "MK" - | "ML" - | "MM" - | "MN" - | "MO" - | "MP" - | "MQ" - | "MR" - | "MS" - | "MT" - | "MU" - | "MV" - | "MW" - | "MX" - | "MY" - | "MZ" - | "NA" - | "NC" - | "NE" - | "NF" - | "NG" - | "NI" - | "NL" - | "NO" - | "NP" - | "NR" - | "NU" - | "NZ" - | "OM" - | "PA" - | "PE" - | "PF" - | "PG" - | "PH" - | "PK" - | "PL" - | "PM" - | "PN" - | "PR" - | "PS" - | "PT" - | "PW" - | "PY" - | "QA" - | "RE" - | "RO" - | "RS" - | "RU" - | "RW" - | "SA" - | "SB" - | "SC" - | "SD" - | "SE" - | "SG" - | "SH" - | "SI" - | "SJ" - | "SK" - | "SL" - | "SM" - | "SN" - | "SO" - | "SR" - | "SS" - | "ST" - | "SV" - | "SX" - | "SY" - | "SZ" - | "TC" - | "TD" - | "TF" - | "TG" - | "TH" - | "TJ" - | "TK" - | "TL" - | "TM" - | "TN" - | "TO" - | "TR" - | "TT" - | "TV" - | "TW" - | "TZ" - | "UA" - | "UG" - | "UM" - | "US" - | "UY" - | "UZ" - | "VA" - | "VC" - | "VE" - | "VG" - | "VI" - | "VN" - | "VU" - | "WF" - | "WS" - | "YE" - | "YT" - | "ZA" - | "ZM" - | "ZW"; -/** The 2-letter continent codes Cloudflare uses */ -declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA"; -declare type CfProperties = - | IncomingRequestCfProperties - | RequestInitCfProperties; -declare interface D1Result { - results?: T[]; - success: boolean; - error?: string; - meta: any; -} -declare abstract class D1Database { - prepare(query: string): D1PreparedStatement; - dump(): Promise; - batch(statements: D1PreparedStatement[]): Promise[]>; - exec(query: string): Promise>; -} -declare abstract class D1PreparedStatement { - bind(...values: any[]): D1PreparedStatement; - first(colName?: string): Promise; - run(): Promise>; - all(): Promise>; - raw(): Promise; -} -/** - * A email message that is sent to a consumer Worker. - */ -declare interface EmailMessage { - /** - * Envelope From attribute of the email message. - */ - readonly from: string; - /** - * Envelope To attribute of the email message. - */ - readonly to: string; - /** - * A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers). - */ - readonly headers: Headers; - /** - * Stream of the email message content. - */ - readonly raw: ReadableStream; - /** - * Size of the email message content. - */ - readonly rawSize: number; - /** - * Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason. - * @param reason The reject reason. - * @returns void - */ - setReject(reason: string): void; - /** - * Forward this email message to a verified destination address of the account. - * @param rcptTo Verified destination address. - * @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers). - * @returns A promise that resolves when the email message is forwarded. - */ - forward(rcptTo: string, headers?: Headers): Promise; -} -declare abstract class EmailEvent extends ExtendableEvent { - readonly message: EmailMessage; -} -declare type EmailExportedHandler = ( - message: EmailMessage, - env: Env, - ctx: ExecutionContext -) => void | Promise; -declare type Params

= Record; -declare type EventContext = { - request: Request; - functionPath: string; - waitUntil: (promise: Promise) => void; - passThroughOnException: () => void; - next: (input?: Request | string, init?: RequestInit) => Promise; - env: Env & { - ASSETS: { - fetch: typeof fetch; - }; - }; - params: Params

; - data: Data; -}; -declare type PagesFunction< - Env = unknown, - Params extends string = any, - Data extends Record = Record -> = (context: EventContext) => Response | Promise; -declare type EventPluginContext = { - request: Request; - functionPath: string; - waitUntil: (promise: Promise) => void; - passThroughOnException: () => void; - next: (input?: Request | string, init?: RequestInit) => Promise; - env: Env & { - ASSETS: { - fetch: typeof fetch; - }; - }; - params: Params

; - data: Data; - pluginArgs: PluginArgs; -}; -declare type PagesPluginFunction< - Env = unknown, - Params extends string = any, - Data extends Record = Record, - PluginArgs = unknown -> = ( - context: EventPluginContext -) => Response | Promise; -declare module "assets:*" { - export const onRequest: PagesFunction; -} -// https://developers.cloudflare.com/pub-sub/ -// PubSubMessage represents an incoming PubSub message. -// The message includes metadata about the broker, the client, and the payload -// itself. -declare interface PubSubMessage { - // Message ID - readonly mid: number; - // MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT - readonly broker: string; - // The MQTT topic the message was sent on. - readonly topic: string; - // The client ID of the client that published this message. - readonly clientId: string; - // The unique identifier (JWT ID) used by the client to authenticate, if token - // auth was used. - readonly jti?: string; - // A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker - // received the message from the client. - readonly receivedAt: number; - // An (optional) string with the MIME type of the payload, if set by the - // client. - readonly contentType: string; - // Set to 1 when the payload is a UTF-8 string - // https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063 - readonly payloadFormatIndicator: number; - // Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays. - // You can use payloadFormatIndicator to inspect this before decoding. - payload: string | Uint8Array; -} -// JsonWebKey extended by kid parameter -declare interface JsonWebKeyWithKid extends JsonWebKey { - // Key Identifier of the JWK - readonly kid: string; -} -/** - * A message that is sent to a consumer Worker. - */ -declare interface Message { - /** - * A unique, system-generated ID for the message. - */ - readonly id: string; - /** - * A timestamp when the message was sent. - */ - readonly timestamp: Date; - /** - * The body of the message. - */ - readonly body: Body; - /** - * Marks message to be retried. - */ - retry(): void; - /** - * Marks message acknowledged. - */ - ack(): void; -} -/** - * A batch of messages that are sent to a consumer Worker. - */ -declare interface MessageBatch { - /** - * The name of the Queue that belongs to this batch. - */ - readonly queue: string; - /** - * An array of messages in the batch. Ordering of messages is not guaranteed. - */ - readonly messages: readonly Message[]; - /** - * Marks every message to be retried in the next batch. - */ - retryAll(): void; - /** - * Marks every message acknowledged in the batch. - */ - ackAll(): void; -} -/** - * A wrapper class used to structure message batches. - */ -declare type MessageSendRequest = { - /** - * The body of the message. - */ - body: Body; -}; -/** - * A binding that allows a producer to send messages to a Queue. - */ -declare interface Queue { - /** - * Sends a message to the Queue. - * @param message The message can be any type supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types), as long as its size is less than 128 KB. - * @returns A promise that resolves when the message is confirmed to be written to disk. - */ - send(message: Body): Promise; - /** - * Sends a batch of messages to the Queue. - * @param messages Each item in the input must be supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types). A batch can contain up to 100 messages, though items are limited to 128 KB each, and the total size of the array cannot exceed 256 KB. - * @returns A promise that resolves when the messages are confirmed to be written to disk. - */ - sendBatch(messages: Iterable>): Promise; -} diff --git a/packages/denylist_bot/node_modules/@cloudflare/workers-types/oldest/index.ts b/packages/denylist_bot/node_modules/@cloudflare/workers-types/oldest/index.ts deleted file mode 100755 index 1f1e83007..000000000 --- a/packages/denylist_bot/node_modules/@cloudflare/workers-types/oldest/index.ts +++ /dev/null @@ -1,2992 +0,0 @@ -/*! ***************************************************************************** -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 -export declare class DOMException extends Error { - constructor(message?: string, name?: string); - readonly message: string; - readonly name: string; - readonly code: number; - readonly stack: any; - 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; -} -export type WorkerGlobalScopeEventMap = { - fetch: FetchEvent; - scheduled: ScheduledEvent; - unhandledrejection: PromiseRejectionEvent; - rejectionhandled: PromiseRejectionEvent; -}; -export declare abstract class WorkerGlobalScope extends EventTarget { - EventTarget: typeof EventTarget; -} -export interface Console { - "assert"(condition?: boolean, ...data: any[]): void; - clear(): void; - count(label?: string): void; - countReset(label?: string): void; - debug(...data: any[]): void; - dir(item?: any, options?: any): void; - dirxml(...data: any[]): void; - error(...data: any[]): void; - group(...data: any[]): void; - groupCollapsed(...data: any[]): void; - groupEnd(): void; - info(...data: any[]): void; - log(...data: any[]): void; - table(tabularData?: any, properties?: string[]): void; - time(label?: string): void; - timeEnd(label?: string): void; - timeLog(label?: string, ...data: any[]): void; - timeStamp(label?: string): void; - trace(...data: any[]): void; - warn(...data: any[]): void; -} -export declare const console: Console; -export type BufferSource = ArrayBufferView | ArrayBuffer; -export 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; - type Imports = Record; - type ExportValue = Function | Global | Memory | Table; - type Exports = Record; - 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; - function validate(bytes: BufferSource): boolean; -} -/** This ServiceWorker API interface represents the global execution context of a service worker. */ -export 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( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args - ): number; - clearTimeout(timeoutId: number | null): void; - setInterval(callback: (...args: any[]) => void, msDelay?: number): number; - setInterval( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args - ): number; - clearInterval(timeoutId: number | null): void; - queueMicrotask(task: Function): void; - structuredClone(value: T, options?: StructuredSerializeOptions): T; - fetch( - input: RequestInfo, - init?: RequestInit - ): Promise; - self: ServiceWorkerGlobalScope; - crypto: Crypto; - caches: CacheStorage; - scheduler: Scheduler; - Event: typeof Event; - ExtendableEvent: typeof ExtendableEvent; - PromiseRejectionEvent: typeof PromiseRejectionEvent; - FetchEvent: typeof FetchEvent; - TraceEvent: typeof TraceEvent; - 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; - 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; - AbortController: typeof AbortController; - AbortSignal: typeof AbortSignal; - TextDecoder: typeof TextDecoder; - TextEncoder: typeof TextEncoder; - 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; -} -export declare function addEventListener< - Type extends keyof WorkerGlobalScopeEventMap ->( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetAddEventListenerOptions | boolean -): void; -export declare function removeEventListener< - Type extends keyof WorkerGlobalScopeEventMap ->( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetEventListenerOptions | boolean -): void; -/** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */ -export declare function dispatchEvent( - event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap] -): boolean; -export declare function btoa(data: string): string; -export declare function atob(data: string): string; -export declare function setTimeout( - callback: (...args: any[]) => void, - msDelay?: number -): number; -export declare function setTimeout( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args -): number; -export declare function clearTimeout(timeoutId: number | null): void; -export declare function setInterval( - callback: (...args: any[]) => void, - msDelay?: number -): number; -export declare function setInterval( - callback: (...args: Args) => void, - msDelay?: number, - ...args: Args -): number; -export declare function clearInterval(timeoutId: number | null): void; -export declare function queueMicrotask(task: Function): void; -export declare function structuredClone( - value: T, - options?: StructuredSerializeOptions -): T; -export declare function fetch( - input: RequestInfo, - init?: RequestInit -): Promise; -export declare const self: ServiceWorkerGlobalScope; -export declare const crypto: Crypto; -export declare const caches: CacheStorage; -export declare const scheduler: Scheduler; -export interface TestController {} -export interface ExecutionContext { - waitUntil(promise: Promise): void; - passThroughOnException(): void; -} -export type ExportedHandlerFetchHandler< - Env = unknown, - CfHostMetadata = unknown -> = ( - request: Request>, - env: Env, - ctx: ExecutionContext -) => Response | Promise; -export type ExportedHandlerTraceHandler = ( - traces: TraceItem[], - env: Env, - ctx: ExecutionContext -) => void | Promise; -export type ExportedHandlerScheduledHandler = ( - controller: ScheduledController, - env: Env, - ctx: ExecutionContext -) => void | Promise; -export type ExportedHandlerQueueHandler = ( - batch: MessageBatch, - env: Env, - ctx: ExecutionContext -) => void | Promise; -export type ExportedHandlerTestHandler = ( - controller: TestController, - env: Env, - ctx: ExecutionContext -) => void | Promise; -export interface ExportedHandler< - Env = unknown, - QueueMessage = unknown, - CfHostMetadata = unknown -> { - fetch?: ExportedHandlerFetchHandler; - trace?: ExportedHandlerTraceHandler; - scheduled?: ExportedHandlerScheduledHandler; - test?: ExportedHandlerTestHandler; - queue?: ExportedHandlerQueueHandler; -} -export interface StructuredSerializeOptions { - transfer?: any[]; -} -export declare abstract class PromiseRejectionEvent extends Event { - readonly promise: Promise; - readonly reason: any; -} -export interface DurableObject { - fetch(request: Request): Response | Promise; - alarm?(): void | Promise; -} -export interface DurableObjectStub extends Fetcher { - readonly id: DurableObjectId; - readonly name?: string; -} -export interface DurableObjectId { - toString(): string; - equals(other: DurableObjectId): boolean; - readonly name?: string; -} -export interface DurableObjectNamespace { - newUniqueId( - options?: DurableObjectNamespaceNewUniqueIdOptions - ): DurableObjectId; - idFromName(name: string): DurableObjectId; - idFromString(id: string): DurableObjectId; - get( - id: DurableObjectId, - options?: DurableObjectNamespaceGetDurableObjectOptions - ): DurableObjectStub; - jurisdiction(jurisdiction: string): DurableObjectNamespace; -} -export interface DurableObjectNamespaceNewUniqueIdOptions { - jurisdiction?: string; -} -export interface DurableObjectNamespaceGetDurableObjectOptions { - locationHint?: string; -} -export interface DurableObjectState { - waitUntil(promise: Promise): void; - readonly id: DurableObjectId; - readonly storage: DurableObjectStorage; - blockConcurrencyWhile(callback: () => Promise): Promise; -} -export interface DurableObjectTransaction { - get( - key: string, - options?: DurableObjectGetOptions - ): Promise; - get( - keys: string[], - options?: DurableObjectGetOptions - ): Promise>; - list( - options?: DurableObjectListOptions - ): Promise>; - put( - key: string, - value: T, - options?: DurableObjectPutOptions - ): Promise; - put( - entries: Record, - options?: DurableObjectPutOptions - ): Promise; - delete(key: string, options?: DurableObjectPutOptions): Promise; - delete(keys: string[], options?: DurableObjectPutOptions): Promise; - rollback(): void; - getAlarm(options?: DurableObjectGetAlarmOptions): Promise; - setAlarm( - scheduledTime: number | Date, - options?: DurableObjectSetAlarmOptions - ): Promise; - deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise; -} -export interface DurableObjectStorage { - get( - key: string, - options?: DurableObjectGetOptions - ): Promise; - get( - keys: string[], - options?: DurableObjectGetOptions - ): Promise>; - list( - options?: DurableObjectListOptions - ): Promise>; - put( - key: string, - value: T, - options?: DurableObjectPutOptions - ): Promise; - put( - entries: Record, - options?: DurableObjectPutOptions - ): Promise; - delete(key: string, options?: DurableObjectPutOptions): Promise; - delete(keys: string[], options?: DurableObjectPutOptions): Promise; - deleteAll(options?: DurableObjectPutOptions): Promise; - transaction( - closure: (txn: DurableObjectTransaction) => Promise - ): Promise; - getAlarm(options?: DurableObjectGetAlarmOptions): Promise; - setAlarm( - scheduledTime: number | Date, - options?: DurableObjectSetAlarmOptions - ): Promise; - deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise; - sync(): Promise; -} -export interface DurableObjectListOptions { - start?: string; - startAfter?: string; - end?: string; - prefix?: string; - reverse?: boolean; - limit?: number; - allowConcurrency?: boolean; - noCache?: boolean; -} -export interface DurableObjectGetOptions { - allowConcurrency?: boolean; - noCache?: boolean; -} -export interface DurableObjectGetAlarmOptions { - allowConcurrency?: boolean; -} -export interface DurableObjectPutOptions { - allowConcurrency?: boolean; - allowUnconfirmed?: boolean; - noCache?: boolean; -} -export interface DurableObjectSetAlarmOptions { - allowConcurrency?: boolean; - allowUnconfirmed?: boolean; -} -export interface AnalyticsEngineDataset { - writeDataPoint(event?: AnalyticsEngineDataPoint): void; -} -export interface AnalyticsEngineDataPoint { - indexes?: ((ArrayBuffer | string) | null)[]; - doubles?: number[]; - blobs?: ((ArrayBuffer | string) | null)[]; -} -export declare class Event { - constructor(type: string, init?: EventInit); - /** Returns the type of event, e.g. "click", "hashchange", or "submit". */ - readonly type: string; - /** Returns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE. */ - readonly eventPhase: number; - /** Returns true or false depending on how event was initialized. True if event invokes listeners past a ShadowRoot node that is the root of its target, and false otherwise. */ - readonly composed: boolean; - /** Returns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise. */ - readonly bubbles: boolean; - /** Returns true or false depending on how event was initialized. Its return value does not always carry meaning, but true can indicate that part of the operation during which event was dispatched, can be canceled by invoking the preventDefault() method. */ - readonly cancelable: boolean; - /** Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise. */ - readonly defaultPrevented: boolean; - /** @deprecated */ - readonly returnValue: boolean; - /** Returns the object whose event listener's callback is currently being invoked. */ - readonly currentTarget?: EventTarget; - /** @deprecated */ - readonly srcElement?: EventTarget; - /** Returns the event's timestamp as the number of milliseconds measured relative to the time origin. */ - readonly timeStamp: number; - /** Returns true if event was dispatched by the user agent, and false otherwise. */ - readonly isTrusted: boolean; - cancelBubble: boolean; - stopImmediatePropagation(): void; - preventDefault(): void; - stopPropagation(): void; - composedPath(): EventTarget[]; - static readonly NONE: number; - static readonly CAPTURING_PHASE: number; - static readonly AT_TARGET: number; - static readonly BUBBLING_PHASE: number; -} -export interface EventInit { - bubbles?: boolean; - cancelable?: boolean; - composed?: boolean; -} -export type EventListener = ( - event: EventType -) => void; -export interface EventListenerObject { - handleEvent(event: EventType): void; -} -export type EventListenerOrEventListenerObject< - EventType extends Event = Event -> = EventListener | EventListenerObject; -export declare class EventTarget< - EventMap extends Record = Record -> { - constructor(); - addEventListener( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetAddEventListenerOptions | boolean - ): void; - removeEventListener( - type: Type, - handler: EventListenerOrEventListenerObject, - options?: EventTargetEventListenerOptions | boolean - ): void; - dispatchEvent(event: EventMap[keyof EventMap]): boolean; -} -export interface EventTargetEventListenerOptions { - capture?: boolean; -} -export interface EventTargetAddEventListenerOptions { - capture?: boolean; - passive?: boolean; - once?: boolean; - signal?: AbortSignal; -} -export interface EventTargetHandlerObject { - handleEvent: (event: Event) => any | undefined; -} -export declare class AbortController { - constructor(); - /** Returns the AbortSignal object associated with this object. */ - readonly signal: AbortSignal; - abort(reason?: any): void; -} -export declare abstract class AbortSignal extends EventTarget { - static abort(reason?: any): AbortSignal; - static timeout(delay: number): AbortSignal; - /** Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. */ - readonly aborted: boolean; - readonly reason: any; - throwIfAborted(): void; -} -export interface Scheduler { - wait(delay: number, maybeOptions?: SchedulerWaitOptions): Promise; -} -export interface SchedulerWaitOptions { - signal?: AbortSignal; -} -export declare abstract class ExtendableEvent extends Event { - waitUntil(promise: Promise): void; -} -export declare class Blob { - constructor( - bits?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[], - options?: BlobOptions - ); - readonly size: number; - readonly type: string; - slice(start?: number, end?: number, type?: string): Blob; - arrayBuffer(): Promise; - text(): Promise; - stream(): ReadableStream; -} -export interface BlobOptions { - type?: string; -} -export declare class File extends Blob { - constructor( - bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined, - name: string, - options?: FileOptions - ); - readonly name: string; - readonly lastModified: number; -} -export interface FileOptions { - type?: string; - lastModified?: number; -} -export declare abstract class CacheStorage { - open(cacheName: string): Promise; - readonly default: Cache; -} -export declare abstract class Cache { - delete(request: RequestInfo, options?: CacheQueryOptions): Promise; - match( - request: RequestInfo, - options?: CacheQueryOptions - ): Promise; - put(request: RequestInfo, response: Response): Promise; -} -export interface CacheQueryOptions { - ignoreMethod?: boolean; -} -export declare abstract class Crypto { - /** Available only in secure contexts. */ - readonly subtle: SubtleCrypto; - getRandomValues< - T extends - | Int8Array - | Uint8Array - | Int16Array - | Uint16Array - | Int32Array - | Uint32Array - | BigInt64Array - | BigUint64Array - >(buffer: T): T; - randomUUID(): string; - DigestStream: typeof DigestStream; -} -export declare abstract class SubtleCrypto { - encrypt( - algorithm: string | SubtleCryptoEncryptAlgorithm, - key: CryptoKey, - plainText: ArrayBuffer | ArrayBufferView - ): Promise; - decrypt( - algorithm: string | SubtleCryptoEncryptAlgorithm, - key: CryptoKey, - cipherText: ArrayBuffer | ArrayBufferView - ): Promise; - sign( - algorithm: string | SubtleCryptoSignAlgorithm, - key: CryptoKey, - data: ArrayBuffer | ArrayBufferView - ): Promise; - verify( - algorithm: string | SubtleCryptoSignAlgorithm, - key: CryptoKey, - signature: ArrayBuffer | ArrayBufferView, - data: ArrayBuffer | ArrayBufferView - ): Promise; - digest( - algorithm: string | SubtleCryptoHashAlgorithm, - data: ArrayBuffer | ArrayBufferView - ): Promise; - generateKey( - algorithm: string | SubtleCryptoGenerateKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - deriveKey( - algorithm: string | SubtleCryptoDeriveKeyAlgorithm, - baseKey: CryptoKey, - derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - deriveBits( - algorithm: string | SubtleCryptoDeriveKeyAlgorithm, - baseKey: CryptoKey, - length: number | null - ): Promise; - importKey( - format: string, - keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey, - algorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - exportKey(format: string, key: CryptoKey): Promise; - wrapKey( - format: string, - key: CryptoKey, - wrappingKey: CryptoKey, - wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm - ): Promise; - unwrapKey( - format: string, - wrappedKey: ArrayBuffer | ArrayBufferView, - unwrappingKey: CryptoKey, - unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm, - unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, - extractable: boolean, - keyUsages: string[] - ): Promise; - timingSafeEqual( - a: ArrayBuffer | ArrayBufferView, - b: ArrayBuffer | ArrayBufferView - ): boolean; -} -export declare abstract class CryptoKey { - readonly type: string; - readonly extractable: boolean; - readonly algorithm: - | CryptoKeyKeyAlgorithm - | CryptoKeyAesKeyAlgorithm - | CryptoKeyHmacKeyAlgorithm - | CryptoKeyRsaKeyAlgorithm - | CryptoKeyEllipticKeyAlgorithm - | CryptoKeyArbitraryKeyAlgorithm; - readonly usages: string[]; -} -export interface CryptoKeyPair { - publicKey: CryptoKey; - privateKey: CryptoKey; -} -export 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; -} -export interface RsaOtherPrimesInfo { - r?: string; - d?: string; - t?: string; -} -export interface SubtleCryptoDeriveKeyAlgorithm { - name: string; - salt?: ArrayBuffer; - iterations?: number; - hash?: string | SubtleCryptoHashAlgorithm; - $public?: CryptoKey; - info?: ArrayBuffer; -} -export interface SubtleCryptoEncryptAlgorithm { - name: string; - iv?: ArrayBuffer; - additionalData?: ArrayBuffer; - tagLength?: number; - counter?: ArrayBuffer; - length?: number; - label?: ArrayBuffer; -} -export interface SubtleCryptoGenerateKeyAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - modulusLength?: number; - publicExponent?: ArrayBuffer; - length?: number; - namedCurve?: string; -} -export interface SubtleCryptoHashAlgorithm { - name: string; -} -export interface SubtleCryptoImportKeyAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - length?: number; - namedCurve?: string; - compressed?: boolean; -} -export interface SubtleCryptoSignAlgorithm { - name: string; - hash?: string | SubtleCryptoHashAlgorithm; - dataLength?: number; - saltLength?: number; -} -export interface CryptoKeyKeyAlgorithm { - name: string; -} -export interface CryptoKeyAesKeyAlgorithm { - name: string; - length: number; -} -export interface CryptoKeyHmacKeyAlgorithm { - name: string; - hash: CryptoKeyKeyAlgorithm; - length: number; -} -export interface CryptoKeyRsaKeyAlgorithm { - name: string; - modulusLength: number; - publicExponent: ArrayBuffer; - hash?: CryptoKeyKeyAlgorithm; -} -export interface CryptoKeyEllipticKeyAlgorithm { - name: string; - namedCurve: string; -} -export interface CryptoKeyArbitraryKeyAlgorithm { - name: string; - hash?: CryptoKeyKeyAlgorithm; - namedCurve?: string; - length?: number; -} -export declare class DigestStream extends WritableStream< - ArrayBuffer | ArrayBufferView -> { - constructor(algorithm: string | SubtleCryptoHashAlgorithm); - readonly digest: Promise; -} -export declare class TextDecoder { - constructor(decoder?: string, options?: TextDecoderConstructorOptions); - decode( - input?: ArrayBuffer | ArrayBufferView, - options?: TextDecoderDecodeOptions - ): string; - readonly encoding: string; - readonly fatal: boolean; - readonly ignoreBOM: boolean; -} -export declare class TextEncoder { - constructor(); - encode(input?: string): Uint8Array; - encodeInto(input: string, buffer: Uint8Array): TextEncoderEncodeIntoResult; - readonly encoding: string; -} -export interface TextDecoderConstructorOptions { - fatal: boolean; - ignoreBOM: boolean; -} -export interface TextDecoderDecodeOptions { - stream: boolean; -} -export interface TextEncoderEncodeIntoResult { - read: number; - written: number; -} -export declare class FormData { - constructor(); - append(name: string, value: string): void; - append(name: string, value: Blob, filename?: string): void; - delete(name: string): void; - get(name: string): string | null; - getAll(name: string): string[]; - has(name: string): boolean; - set(name: string, value: string): void; - set(name: string, value: Blob, filename?: string): void; - entries(): IterableIterator<[key: string, value: string]>; - keys(): IterableIterator; - values(): IterableIterator; - forEach( - callback: ( - this: This, - value: string, - key: string, - parent: FormData - ) => void, - thisArg?: This - ): void; - [Symbol.iterator](): IterableIterator<[key: string, value: string]>; -} -export interface ContentOptions { - html?: boolean; -} -export declare class HTMLRewriter { - constructor(); - on( - selector: string, - handlers: HTMLRewriterElementContentHandlers - ): HTMLRewriter; - onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter; - transform(response: Response): Response; -} -export interface HTMLRewriterElementContentHandlers { - element?(element: Element): void | Promise; - comments?(comment: Comment): void | Promise; - text?(element: Text): void | Promise; -} -export interface HTMLRewriterDocumentContentHandlers { - doctype?(doctype: Doctype): void | Promise; - comments?(comment: Comment): void | Promise; - text?(text: Text): void | Promise; - end?(end: DocumentEnd): void | Promise; -} -export interface Doctype { - readonly name: string | null; - readonly publicId: string | null; - readonly systemId: string | null; -} -export interface Element { - tagName: string; - readonly attributes: IterableIterator; - 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, options?: ContentOptions): Element; - after(content: string, options?: ContentOptions): Element; - prepend(content: string, options?: ContentOptions): Element; - append(content: string, options?: ContentOptions): Element; - replace(content: string, options?: ContentOptions): Element; - remove(): Element; - removeAndKeepContent(): Element; - setInnerContent(content: string, options?: ContentOptions): Element; - onEndTag(handler: (tag: EndTag) => void | Promise): void; -} -export interface EndTag { - name: string; - before(content: string, options?: ContentOptions): EndTag; - after(content: string, options?: ContentOptions): EndTag; - remove(): EndTag; -} -export 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; -} -export interface Text { - readonly text: string; - readonly lastInTextNode: boolean; - readonly removed: boolean; - before(content: string, options?: ContentOptions): Text; - after(content: string, options?: ContentOptions): Text; - replace(content: string, options?: ContentOptions): Text; - remove(): Text; -} -export interface DocumentEnd { - append(content: string, options?: ContentOptions): DocumentEnd; -} -export declare abstract class FetchEvent extends ExtendableEvent { - readonly request: Request; - respondWith(promise: Response | Promise): void; - passThroughOnException(): void; -} -export type HeadersInit = - | Headers - | Iterable> - | Record; -export declare class Headers { - constructor(init?: HeadersInit); - get(name: string): string | null; - getAll(name: string): string[]; - has(name: string): boolean; - set(name: string, value: string): void; - append(name: string, value: string): void; - delete(name: string): void; - forEach( - callback: (this: This, value: string, key: string, parent: Headers) => void, - thisArg?: This - ): void; - entries(): IterableIterator<[key: string, value: string]>; - keys(): IterableIterator; - values(): IterableIterator; - [Symbol.iterator](): IterableIterator<[key: string, value: string]>; -} -export type BodyInit = - | ReadableStream - | string - | ArrayBuffer - | ArrayBufferView - | Blob - | URLSearchParams - | FormData; -export declare abstract class Body { - readonly body: ReadableStream | null; - readonly bodyUsed: boolean; - arrayBuffer(): Promise; - text(): Promise; - json(): Promise; - formData(): Promise; - blob(): Promise; -} -export declare class Response extends Body { - constructor(body?: BodyInit | null, init?: ResponseInit); - static redirect(url: string, status?: number): Response; - static json(any: any, maybeInit?: ResponseInit | Response): Response; - clone(): Response; - readonly status: number; - readonly statusText: string; - readonly headers: Headers; - readonly ok: boolean; - readonly redirected: boolean; - readonly url: string; - readonly webSocket: WebSocket | null; - readonly cf?: any; -} -export interface ResponseInit { - status?: number; - statusText?: string; - headers?: HeadersInit; - cf?: any; - webSocket?: WebSocket | null; - encodeBody?: "automatic" | "manual"; -} -export type RequestInfo< - CfHostMetadata = unknown, - Cf = CfProperties -> = Request | string | URL; -export declare class Request< - CfHostMetadata = unknown, - Cf = CfProperties -> extends Body { - constructor(input: RequestInfo, init?: RequestInit); - clone(): Request; - /** Returns request's HTTP method, which is "GET" by default. */ - readonly method: string; - /** Returns the URL of request as a string. */ - readonly url: string; - /** Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the "Host" header. */ - readonly headers: Headers; - /** Returns the redirect mode associated with request, which is a string indicating how redirects for the request will be handled during fetching. A request will follow redirects by default. */ - readonly redirect: string; - readonly fetcher: Fetcher | null; - /** Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler. */ - readonly signal: AbortSignal; - readonly cf?: Cf; - /** Returns request's subresource integrity metadata, which is a cryptographic hash of the resource being fetched. Its value consists of multiple hashes separated by whitespace. [SRI] */ - readonly integrity: string; - /** Returns a boolean indicating whether or not request can outlive the global in which it was created. */ - readonly keepalive: boolean; -} -export interface RequestInit { - /** 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 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; -} -export declare abstract class Fetcher { - fetch(input: RequestInfo, init?: RequestInit): Promise; -} -export interface FetcherPutOptions { - expiration?: number; - expirationTtl?: number; -} -export interface KVNamespaceListKey { - name: Key; - expiration?: number; - metadata?: Metadata; -} -export type KVNamespaceListResult = - | { - list_complete: false; - keys: KVNamespaceListKey[]; - cursor: string; - } - | { - list_complete: true; - keys: KVNamespaceListKey[]; - }; -export interface KVNamespace { - get( - key: Key, - options?: Partial> - ): Promise; - get(key: Key, type: "text"): Promise; - get( - key: Key, - type: "json" - ): Promise; - get(key: Key, type: "arrayBuffer"): Promise; - get(key: Key, type: "stream"): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"text"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"json"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"arrayBuffer"> - ): Promise; - get( - key: Key, - options?: KVNamespaceGetOptions<"stream"> - ): Promise; - list( - options?: KVNamespaceListOptions - ): Promise>; - put( - key: Key, - value: string | ArrayBuffer | ArrayBufferView | ReadableStream, - options?: KVNamespacePutOptions - ): Promise; - getWithMetadata( - key: Key, - options?: Partial> - ): Promise>; - getWithMetadata( - key: Key, - type: "text" - ): Promise>; - getWithMetadata( - key: Key, - type: "json" - ): Promise>; - getWithMetadata( - key: Key, - type: "arrayBuffer" - ): Promise>; - getWithMetadata( - key: Key, - type: "stream" - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"text"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"json"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"arrayBuffer"> - ): Promise>; - getWithMetadata( - key: Key, - options: KVNamespaceGetOptions<"stream"> - ): Promise>; - delete(key: Key): Promise; -} -export interface KVNamespaceListOptions { - limit?: number; - prefix?: string | null; - cursor?: string | null; -} -export interface KVNamespaceGetOptions { - type: Type; - cacheTtl?: number; -} -export interface KVNamespacePutOptions { - expiration?: number; - expirationTtl?: number; - metadata?: any | null; -} -export interface KVNamespaceGetWithMetadataResult { - value: Value | null; - metadata: Metadata | null; -} -export interface R2Error extends Error { - readonly name: string; - readonly code: number; - readonly message: string; - readonly action: string; - readonly stack: any; -} -export interface R2ListOptions { - limit?: number; - prefix?: string; - cursor?: string; - delimiter?: string; - startAfter?: string; -} -export declare abstract class R2Bucket { - head(key: string): Promise; - get( - key: string, - options: R2GetOptions & { - onlyIf: R2Conditional | Headers; - } - ): Promise; - get(key: string, options?: R2GetOptions): Promise; - put( - key: string, - value: - | ReadableStream - | ArrayBuffer - | ArrayBufferView - | string - | null - | Blob, - options?: R2PutOptions - ): Promise; - put( - key: string, - value: - | ReadableStream - | ArrayBuffer - | ArrayBufferView - | string - | null - | Blob, - options?: R2PutOptions & { - onlyIf: R2Conditional | Headers; - } - ): Promise; - createMultipartUpload( - key: string, - options?: R2MultipartOptions - ): Promise; - resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload; - delete(keys: string | string[]): Promise; - list(options?: R2ListOptions): Promise; -} -export interface R2MultipartUpload { - readonly key: string; - readonly uploadId: string; - uploadPart( - partNumber: number, - value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob - ): Promise; - abort(): Promise; - complete(uploadedParts: R2UploadedPart[]): Promise; -} -export interface R2UploadedPart { - partNumber: number; - etag: string; -} -export 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; - readonly range?: R2Range; - writeHttpMetadata(headers: Headers): void; -} -export interface R2ObjectBody extends R2Object { - get body(): ReadableStream; - get bodyUsed(): boolean; - arrayBuffer(): Promise; - text(): Promise; - json(): Promise; - blob(): Promise; -} -export type R2Range = - | { - offset: number; - length?: number; - } - | { - offset?: number; - length: number; - } - | { - suffix: number; - }; -export interface R2Conditional { - etagMatches?: string; - etagDoesNotMatch?: string; - uploadedBefore?: Date; - uploadedAfter?: Date; - secondsGranularity?: boolean; -} -export interface R2GetOptions { - onlyIf?: R2Conditional | Headers; - range?: R2Range | Headers; -} -export interface R2PutOptions { - onlyIf?: R2Conditional | Headers; - httpMetadata?: R2HTTPMetadata | Headers; - customMetadata?: Record; - md5?: ArrayBuffer | string; - sha1?: ArrayBuffer | string; - sha256?: ArrayBuffer | string; - sha384?: ArrayBuffer | string; - sha512?: ArrayBuffer | string; -} -export interface R2MultipartOptions { - httpMetadata?: R2HTTPMetadata | Headers; - customMetadata?: Record; -} -export interface R2Checksums { - readonly md5?: ArrayBuffer; - readonly sha1?: ArrayBuffer; - readonly sha256?: ArrayBuffer; - readonly sha384?: ArrayBuffer; - readonly sha512?: ArrayBuffer; - toJSON(): R2StringChecksums; -} -export interface R2StringChecksums { - md5?: string; - sha1?: string; - sha256?: string; - sha384?: string; - sha512?: string; -} -export interface R2HTTPMetadata { - contentType?: string; - contentLanguage?: string; - contentDisposition?: string; - contentEncoding?: string; - cacheControl?: string; - cacheExpiry?: Date; -} -export interface R2Objects { - objects: R2Object[]; - truncated: boolean; - cursor?: string; - delimitedPrefixes: string[]; -} -export declare abstract class ScheduledEvent extends ExtendableEvent { - readonly scheduledTime: number; - readonly cron: string; - noRetry(): void; -} -export interface ScheduledController { - readonly scheduledTime: number; - readonly cron: string; - noRetry(): void; -} -export interface QueuingStrategy { - highWaterMark?: number | bigint; - size?: (chunk: T) => number | bigint; -} -export interface UnderlyingSink { - type?: string; - start?: (controller: WritableStreamDefaultController) => void | Promise; - write?: ( - chunk: W, - controller: WritableStreamDefaultController - ) => void | Promise; - abort?: (reason: any) => void | Promise; - close?: () => void | Promise; -} -export interface UnderlyingByteSource { - type: "bytes"; - autoAllocateChunkSize?: number; - start?: (controller: ReadableByteStreamController) => void | Promise; - pull?: (controller: ReadableByteStreamController) => void | Promise; - cancel?: (reason: any) => void | Promise; -} -export interface UnderlyingSource { - type?: "" | undefined; - start?: ( - controller: ReadableStreamDefaultController - ) => void | Promise; - pull?: ( - controller: ReadableStreamDefaultController - ) => void | Promise; - cancel?: (reason: any) => void | Promise; -} -export interface Transformer { - readableType?: string; - writableType?: string; - start?: ( - controller: TransformStreamDefaultController - ) => void | Promise; - transform?: ( - chunk: I, - controller: TransformStreamDefaultController - ) => void | Promise; - flush?: ( - controller: TransformStreamDefaultController - ) => void | Promise; -} -export interface StreamPipeOptions { - /** - * 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; - preventAbort?: boolean; - preventCancel?: boolean; - signal?: AbortSignal; -} -export type ReadableStreamReadResult = - | { - done: false; - value: R; - } - | { - done: true; - value?: undefined; - }; -/** This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object. */ -export interface ReadableStream { - readonly locked: boolean; - cancel(reason?: any): Promise; - getReader(): ReadableStreamDefaultReader; - getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader; - pipeThrough( - transform: ReadableWritablePair, - options?: StreamPipeOptions - ): ReadableStream; - pipeTo( - destination: WritableStream, - options?: StreamPipeOptions - ): Promise; - tee(): [ReadableStream, ReadableStream]; - values(options?: ReadableStreamValuesOptions): AsyncIterableIterator; - [Symbol.asyncIterator]( - options?: ReadableStreamValuesOptions - ): AsyncIterableIterator; -} -export declare const ReadableStream: { - prototype: ReadableStream; - new ( - underlyingSource: UnderlyingByteSource, - strategy?: QueuingStrategy - ): ReadableStream; - new ( - underlyingSource?: UnderlyingSource, - strategy?: QueuingStrategy - ): ReadableStream; -}; -export declare class ReadableStreamDefaultReader { - constructor(stream: ReadableStream); - readonly closed: Promise; - cancel(reason?: any): Promise; - read(): Promise>; - releaseLock(): void; -} -export declare class ReadableStreamBYOBReader { - constructor(stream: ReadableStream); - readonly closed: Promise; - cancel(reason?: any): Promise; - read( - view: T - ): Promise>; - releaseLock(): void; - readAtLeast( - minElements: number, - view: T - ): Promise>; -} -export interface ReadableStreamGetReaderOptions { - mode: "byob"; -} -export interface ReadableStreamBYOBRequest { - readonly view: Uint8Array | null; - respond(bytesWritten: number): void; - respondWithNewView(view: ArrayBuffer | ArrayBufferView): void; - readonly atLeast: number | null; -} -export interface ReadableStreamDefaultController { - readonly desiredSize: number | null; - close(): void; - enqueue(chunk?: R): void; - error(reason: any): void; -} -export interface ReadableByteStreamController { - readonly byobRequest: ReadableStreamBYOBRequest | null; - readonly desiredSize: number | null; - close(): void; - enqueue(chunk: ArrayBuffer | ArrayBufferView): void; - error(reason: any): void; -} -/** This Streams API interface represents a controller allowing control of a WritableStream's state. When constructing a WritableStream, the underlying sink is given a corresponding WritableStreamDefaultController instance to manipulate. */ -export interface WritableStreamDefaultController { - readonly signal: AbortSignal; - error(reason?: any): void; -} -export interface TransformStreamDefaultController { - get desiredSize(): number | null; - enqueue(chunk?: O): void; - error(reason: any): void; - terminate(): void; -} -export interface ReadableWritablePair { - /** - * 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; - readable: ReadableStream; -} -export declare class WritableStream { - constructor( - underlyingSink?: UnderlyingSink, - queuingStrategy?: QueuingStrategy - ); - readonly locked: boolean; - abort(reason?: any): Promise; - close(): Promise; - getWriter(): WritableStreamDefaultWriter; -} -export declare class WritableStreamDefaultWriter { - constructor(stream: WritableStream); - readonly closed: Promise; - readonly ready: Promise; - readonly desiredSize: number | null; - abort(reason?: any): Promise; - close(): Promise; - write(chunk?: W): Promise; - releaseLock(): void; -} -export declare class TransformStream { - constructor( - transformer?: Transformer, - writableStrategy?: QueuingStrategy, - readableStrategy?: QueuingStrategy - ); - readonly readable: ReadableStream; - readonly writable: WritableStream; -} -export declare class FixedLengthStream extends IdentityTransformStream { - constructor(expectedLength: number | bigint); -} -export declare class IdentityTransformStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(); -} -export interface ReadableStreamValuesOptions { - preventCancel?: boolean; -} -export declare class CompressionStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(format: "gzip" | "deflate" | "deflate-raw"); -} -export declare class DecompressionStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - Uint8Array -> { - constructor(format: "gzip" | "deflate" | "deflate-raw"); -} -export declare class TextEncoderStream extends TransformStream< - string, - Uint8Array -> { - constructor(); -} -export declare class TextDecoderStream extends TransformStream< - ArrayBuffer | ArrayBufferView, - string -> { - constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit); -} -export interface TextDecoderStreamTextDecoderStreamInit { - fatal?: boolean; -} -export declare class ByteLengthQueuingStrategy - implements QueuingStrategy -{ - constructor(init: QueuingStrategyInit); - get highWaterMark(): number; - get size(): (chunk?: any) => number; -} -export declare class CountQueuingStrategy implements QueuingStrategy { - constructor(init: QueuingStrategyInit); - get highWaterMark(): number; - get size(): (chunk?: any) => number; -} -export 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; -} -export declare abstract class TraceEvent extends ExtendableEvent { - readonly traces: TraceItem[]; -} -export interface TraceItem { - readonly event: - | ( - | TraceItemFetchEventInfo - | TraceItemScheduledEventInfo - | TraceItemAlarmEventInfo - | TraceItemQueueEventInfo - | TraceItemEmailEventInfo - | TraceItemCustomEventInfo - ) - | null; - readonly eventTimestamp: number | null; - readonly logs: TraceLog[]; - readonly exceptions: TraceException[]; - readonly scriptName: string | null; - readonly dispatchNamespace?: string; - readonly scriptTags?: string[]; - readonly outcome: string; -} -export interface TraceItemAlarmEventInfo { - readonly scheduledTime: Date; -} -export interface TraceItemCustomEventInfo {} -export interface TraceItemScheduledEventInfo { - readonly scheduledTime: number; - readonly cron: string; -} -export interface TraceItemQueueEventInfo { - readonly queue: string; - readonly batchSize: number; -} -export interface TraceItemEmailEventInfo { - readonly mailFrom: string; - readonly rcptTo: string; - readonly rawSize: number; -} -export interface TraceItemFetchEventInfo { - readonly response?: TraceItemFetchEventInfoResponse; - readonly request: TraceItemFetchEventInfoRequest; -} -export interface TraceItemFetchEventInfoRequest { - readonly cf?: any; - readonly headers: Record; - readonly method: string; - readonly url: string; - getUnredacted(): TraceItemFetchEventInfoRequest; -} -export interface TraceItemFetchEventInfoResponse { - readonly status: number; -} -export interface TraceLog { - readonly timestamp: number; - readonly level: string; - readonly message: any; -} -export interface TraceException { - readonly timestamp: number; - readonly message: string; - readonly name: string; -} -export interface TraceMetrics { - readonly cpuTime: number; - readonly wallTime: number; -} -export interface UnsafeTraceMetrics { - fromTrace(item: TraceItem): TraceMetrics; -} -export declare class URL { - constructor(url: string | URL, base?: string | URL); - href: string; - readonly origin: string; - protocol: string; - username: string; - password: string; - host: string; - hostname: string; - port: string; - pathname: string; - search: string; - readonly searchParams: URLSearchParams; - hash: string; - toString(): string; - toJSON(): string; -} -export declare class URLSearchParams { - constructor( - init?: - | URLSearchParams - | string - | Record - | [key: string, value: string][] - ); - get size(): number; - append(name: string, value: string): void; - delete(name: string): void; - get(name: string): string | null; - getAll(name: string): string[]; - has(name: string): boolean; - set(name: string, value: string): void; - sort(): void; - entries(): IterableIterator<[key: string, value: string]>; - keys(): IterableIterator; - values(): IterableIterator; - forEach( - callback: ( - this: This, - value: string, - key: string, - parent: URLSearchParams - ) => void, - thisArg?: This - ): void; - toString(): string; - [Symbol.iterator](): IterableIterator<[key: string, value: string]>; -} -export declare class URLPattern { - constructor(input?: string | URLPatternURLPatternInit, baseURL?: string); - get protocol(): string; - get username(): string; - get password(): string; - get hostname(): string; - get port(): string; - get pathname(): string; - get search(): string; - get hash(): string; - test(input?: string | URLPatternURLPatternInit, baseURL?: string): boolean; - exec( - input?: string | URLPatternURLPatternInit, - baseURL?: string - ): URLPatternURLPatternResult | null; -} -export interface URLPatternURLPatternInit { - protocol?: string; - username?: string; - password?: string; - hostname?: string; - port?: string; - pathname?: string; - search?: string; - hash?: string; - baseURL?: string; -} -export interface URLPatternURLPatternComponentResult { - input: string; - groups: Record; -} -export interface URLPatternURLPatternResult { - inputs: (string | URLPatternURLPatternInit)[]; - protocol: URLPatternURLPatternComponentResult; - username: URLPatternURLPatternComponentResult; - password: URLPatternURLPatternComponentResult; - hostname: URLPatternURLPatternComponentResult; - port: URLPatternURLPatternComponentResult; - pathname: URLPatternURLPatternComponentResult; - search: URLPatternURLPatternComponentResult; - hash: URLPatternURLPatternComponentResult; -} -export declare class CloseEvent extends Event { - constructor(type: string, initializer: CloseEventInit); - /** Returns the WebSocket connection close code provided by the server. */ - readonly code: number; - /** Returns the WebSocket connection close reason provided by the server. */ - readonly reason: string; - /** Returns true if the connection closed cleanly; false otherwise. */ - readonly wasClean: boolean; -} -export interface CloseEventInit { - code?: number; - reason?: string; - wasClean?: boolean; -} -export declare class MessageEvent extends Event { - constructor(type: string, initializer: MessageEventInit); - readonly data: ArrayBuffer | string; -} -export interface MessageEventInit { - data: ArrayBuffer | string; -} -/** Events providing information related to errors in scripts or in files. */ -export interface ErrorEvent extends Event { - readonly filename: string; - readonly message: string; - readonly lineno: number; - readonly colno: number; - readonly error: any; -} -export type WebSocketEventMap = { - close: CloseEvent; - message: MessageEvent; - open: Event; - error: ErrorEvent; -}; -export declare class WebSocket extends EventTarget { - constructor(url: string, protocols?: string[] | string); - accept(): void; - send(message: (ArrayBuffer | ArrayBufferView) | string): void; - close(code?: number, reason?: string): void; - static readonly READY_STATE_CONNECTING: number; - static readonly READY_STATE_OPEN: number; - static readonly READY_STATE_CLOSING: number; - static readonly READY_STATE_CLOSED: number; - /** Returns the state of the WebSocket object's connection. It can have the values described below. */ - readonly readyState: number; - /** Returns the URL that was used to establish the WebSocket connection. */ - readonly url: string | null; - /** Returns the subprotocol selected by the server, if any. It can be used in conjunction with the array form of the constructor's second argument to perform subprotocol negotiation. */ - readonly protocol: string | null; - /** Returns the extensions selected by the server, if any. */ - readonly extensions: string | null; -} -export declare const WebSocketPair: { - new (): { - 0: WebSocket; - 1: WebSocket; - }; -}; -export interface BasicImageTransformations { - /** - * Maximum width in image pixels. The value must be an integer. - */ - width?: number; - /** - * Maximum height in image pixels. The value must be an integer. - */ - height?: number; - /** - * Resizing mode as a string. It affects interpretation of width and height - * options: - * - scale-down: Similar to contain, but the image is never enlarged. If - * the image is larger than given width or height, it will be resized. - * Otherwise its original size will be kept. - * - contain: Resizes to maximum size that fits within the given width and - * height. If only a single dimension is given (e.g. only width), the - * image will be shrunk or enlarged to exactly match that dimension. - * Aspect ratio is always preserved. - * - cover: Resizes (shrinks or enlarges) to fill the entire area of width - * and height. If the image has an aspect ratio different from the ratio - * of width and height, it will be cropped to fit. - * - crop: The image will be shrunk and cropped to fit within the area - * specified by width and height. The image will not be enlarged. For images - * smaller than the given dimensions it's the same as scale-down. For - * images larger than the given dimensions, it's the same as cover. - * See also trim. - * - pad: Resizes to the maximum size that fits within the given width and - * height, and then fills the remaining area with a background color - * (white by default). Use of this mode is not recommended, as the same - * effect can be more efficiently achieved with the contain mode and the - * CSS object-fit: contain property. - */ - fit?: "scale-down" | "contain" | "cover" | "crop" | "pad"; - /** - * When cropping with fit: "cover", this defines the side or point that should - * be left uncropped. The value is either a string - * "left", "right", "top", "bottom", "auto", or "center" (the default), - * or an object {x, y} containing focal point coordinates in the original - * image expressed as fractions ranging from 0.0 (top or left) to 1.0 - * (bottom or right), 0.5 being the center. {fit: "cover", gravity: "top"} will - * crop bottom or left and right sides as necessary, but won’t crop anything - * from the top. {fit: "cover", gravity: {x:0.5, y:0.2}} will crop each side to - * preserve as much as possible around a point at 20% of the height of the - * source image. - */ - gravity?: - | "left" - | "right" - | "top" - | "bottom" - | "center" - | "auto" - | BasicImageTransformationsGravityCoordinates; - /** - * Background color to add underneath the image. Applies only to images with - * transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…), - * hsl(…), etc.) - */ - background?: string; - /** - * Number of degrees (90, 180, 270) to rotate the image by. width and height - * options refer to axes after rotation. - */ - rotate?: 0 | 90 | 180 | 270 | 360; -} -export interface BasicImageTransformationsGravityCoordinates { - x: number; - y: number; -} -/** - * In addition to the properties you can set in the RequestInit dict - * that you pass as an argument to the Request constructor, you can - * set certain properties of a `cf` object to control how Cloudflare - * features are applied to that new Request. - * - * Note: Currently, these properties cannot be tested in the - * playground. - */ -export interface RequestInitCfProperties extends Record { - cacheEverything?: boolean; - /** - * A request's cache key is what determines if two requests are - * "the same" for caching purposes. If a request has the same cache key - * as some previous request, then we can serve the same cached response for - * both. (e.g. 'some-key') - * - * Only available for Enterprise customers. - */ - cacheKey?: string; - /** - * This allows you to append additional Cache-Tag response headers - * to the origin response without modifications to the origin server. - * This will allow for greater control over the Purge by Cache Tag feature - * utilizing changes only in the Workers process. - * - * Only available for Enterprise customers. - */ - cacheTags?: string[]; - /** - * Force response to be cached for a given number of seconds. (e.g. 300) - */ - cacheTtl?: number; - /** - * Force response to be cached for a given number of seconds based on the Origin status code. - * (e.g. { '200-299': 86400, '404': 1, '500-599': 0 }) - */ - cacheTtlByStatus?: Record; - scrapeShield?: boolean; - apps?: boolean; - image?: RequestInitCfPropertiesImage; - minify?: RequestInitCfPropertiesImageMinify; - mirage?: boolean; - polish?: "lossy" | "lossless" | "off"; - /** - * Redirects the request to an alternate origin server. You can use this, - * for example, to implement load balancing across several origins. - * (e.g.us-east.example.com) - * - * Note - For security reasons, the hostname set in resolveOverride must - * be proxied on the same Cloudflare zone of the incoming request. - * Otherwise, the setting is ignored. CNAME hosts are allowed, so to - * resolve to a host under a different domain or a DNS only domain first - * declare a CNAME record within your own zone’s DNS mapping to the - * external hostname, set proxy on Cloudflare, then set resolveOverride - * to point to that CNAME record. - */ - resolveOverride?: string; -} -export interface RequestInitCfPropertiesImageDraw - extends BasicImageTransformations { - /** - * Absolute URL of the image file to use for the drawing. It can be any of - * the supported file formats. For drawing of watermarks or non-rectangular - * overlays we recommend using PNG or WebP images. - */ - url: string; - /** - * Floating-point number between 0 (transparent) and 1 (opaque). - * For example, opacity: 0.5 makes overlay semitransparent. - */ - opacity?: number; - /** - * - If set to true, the overlay image will be tiled to cover the entire - * area. This is useful for stock-photo-like watermarks. - * - If set to "x", the overlay image will be tiled horizontally only - * (form a line). - * - If set to "y", the overlay image will be tiled vertically only - * (form a line). - */ - repeat?: true | "x" | "y"; - /** - * Position of the overlay image relative to a given edge. Each property is - * an offset in pixels. 0 aligns exactly to the edge. For example, left: 10 - * positions left side of the overlay 10 pixels from the left edge of the - * image it's drawn over. bottom: 0 aligns bottom of the overlay with bottom - * of the background image. - * - * Setting both left & right, or both top & bottom is an error. - * - * If no position is specified, the image will be centered. - */ - top?: number; - left?: number; - bottom?: number; - right?: number; -} -export interface RequestInitCfPropertiesImage - extends BasicImageTransformations { - /** - * Device Pixel Ratio. Default 1. Multiplier for width/height that makes it - * easier to specify higher-DPI sizes in . - */ - dpr?: number; - /** - * An object with four properties {left, top, right, bottom} that specify - * a number of pixels to cut off on each side. Allows removal of borders - * or cutting out a specific fragment of an image. Trimming is performed - * before resizing or rotation. Takes dpr into account. - */ - trim?: { - left?: number; - top?: number; - right?: number; - bottom?: number; - }; - /** - * Quality setting from 1-100 (useful values are in 60-90 range). Lower values - * make images look worse, but load faster. The default is 85. It applies only - * to JPEG and WebP images. It doesn’t have any effect on PNG. - */ - quality?: number; - /** - * Output format to generate. It can be: - * - avif: generate images in AVIF format. - * - webp: generate images in Google WebP format. Set quality to 100 to get - * the WebP-lossless format. - * - json: instead of generating an image, outputs information about the - * image, in JSON format. The JSON object will contain image size - * (before and after resizing), source image’s MIME type, file size, etc. - * - jpeg: generate images in JPEG format. - * - png: generate images in PNG format. - */ - format?: "avif" | "webp" | "json" | "jpeg" | "png"; - /** - * Whether to preserve animation frames from input files. Default is true. - * Setting it to false reduces animations to still images. This setting is - * recommended when enlarging images or processing arbitrary user content, - * because large GIF animations can weigh tens or even hundreds of megabytes. - * It is also useful to set anim:false when using format:"json" to get the - * response quicker without the number of frames. - */ - anim?: boolean; - /** - * What EXIF data should be preserved in the output image. Note that EXIF - * rotation and embedded color profiles are always applied ("baked in" into - * the image), and aren't affected by this option. Note that if the Polish - * feature is enabled, all metadata may have been removed already and this - * option may have no effect. - * - keep: Preserve most of EXIF metadata, including GPS location if there's - * any. - * - copyright: Only keep the copyright tag, and discard everything else. - * This is the default behavior for JPEG files. - * - none: Discard all invisible EXIF metadata. Currently WebP and PNG - * output formats always discard metadata. - */ - metadata?: "keep" | "copyright" | "none"; - /** - * Strength of sharpening filter to apply to the image. Floating-point - * number between 0 (no sharpening, default) and 10 (maximum). 1.0 is a - * recommended value for downscaled images. - */ - sharpen?: number; - /** - * Radius of a blur filter (approximate gaussian). Maximum supported radius - * is 250. - */ - blur?: number; - /** - * Overlays are drawn in the order they appear in the array (last array - * entry is the topmost layer). - */ - draw?: RequestInitCfPropertiesImageDraw[]; - /** - * Fetching image from authenticated origin. Setting this property will - * pass authentication headers (Authorization, Cookie, etc.) through to - * the origin. - */ - "origin-auth"?: "share-publicly"; - /** - * Adds a border around the image. The border is added after resizing. Border - * width takes dpr into account, and can be specified either using a single - * width property, or individually for each side. - */ - border?: - | { - color: string; - width: number; - } - | { - color: string; - top: number; - right: number; - bottom: number; - left: number; - }; - /** - * Increase brightness by a factor. A value of 1.0 equals no change, a value - * of 0.5 equals half brightness, and a value of 2.0 equals twice as bright. - * 0 is ignored. - */ - brightness?: number; - /** - * Increase contrast by a factor. A value of 1.0 equals no change, a value of - * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is - * ignored. - */ - contrast?: number; - /** - * Increase exposure by a factor. A value of 1.0 equals no change, a value of - * 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored. - */ - gamma?: number; - /** - * Slightly reduces latency on a cache miss by selecting a - * quickest-to-compress file format, at a cost of increased file size and - * lower image quality. It will usually override the format option and choose - * JPEG over WebP or AVIF. We do not recommend using this option, except in - * unusual circumstances like resizing uncacheable dynamically-generated - * images. - */ - compression?: "fast"; -} -export interface RequestInitCfPropertiesImageMinify { - javascript?: boolean; - css?: boolean; - html?: boolean; -} -/** - * Request metadata provided by Cloudflare's edge. - */ -export type IncomingRequestCfProperties = - IncomingRequestCfPropertiesBase & - IncomingRequestCfPropertiesBotManagementEnterprise & - IncomingRequestCfPropertiesCloudflareForSaaSEnterprise & - IncomingRequestCfPropertiesGeographicInformation & - IncomingRequestCfPropertiesCloudflareAccessOrApiShield; -export interface IncomingRequestCfPropertiesBase - extends Record { - /** - * [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request. - * - * @example 395747 - */ - asn: number; - /** - * The organization which owns the ASN of the incoming request. - * - * @example "Google Cloud" - */ - asOrganization: string; - /** - * The original value of the `Accept-Encoding` header if Cloudflare modified it. - * - * @example "gzip, deflate, br" - */ - clientAcceptEncoding?: string; - /** - * The number of milliseconds it took for the request to reach your worker. - * - * @example 22 - */ - clientTcpRtt?: number; - /** - * The three-letter [IATA](https://en.wikipedia.org/wiki/IATA_airport_code) - * airport code of the data center that the request hit. - * - * @example "DFW" - */ - colo: string; - /** - * Represents the upstream's response to a - * [TCP `keepalive` message](https://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html) - * from cloudflare. - * - * For workers with no upstream, this will always be `1`. - * - * @example 3 - */ - edgeRequestKeepAliveStatus: IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus; - /** - * The HTTP Protocol the request used. - * - * @example "HTTP/2" - */ - httpProtocol: string; - /** - * The browser-requested prioritization information in the request object. - * - * If no information was set, defaults to the empty string `""` - * - * @example "weight=192;exclusive=0;group=3;group-weight=127" - * @default "" - */ - requestPriority: string; - /** - * The TLS version of the connection to Cloudflare. - * In requests served over plaintext (without TLS), this property is the empty string `""`. - * - * @example "TLSv1.3" - */ - tlsVersion: string; - /** - * The cipher for the connection to Cloudflare. - * In requests served over plaintext (without TLS), this property is the empty string `""`. - * - * @example "AEAD-AES128-GCM-SHA256" - */ - tlsCipher: string; - /** - * Metadata containing the [`HELLO`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2) and [`FINISHED`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9) messages from this request's TLS handshake. - * - * If the incoming request was served over plaintext (without TLS) this field is undefined. - */ - tlsExportedAuthenticator?: IncomingRequestCfPropertiesExportedAuthenticatorMetadata; -} -export interface IncomingRequestCfPropertiesBotManagementBase { - /** - * Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot, - * represented as an integer percentage between `1` (almost certainly human) - * and `99` (almost certainly a bot). - * - * @example 54 - */ - score: number; - /** - * A boolean value that is true if the request comes from a good bot, like Google or Bing. - * Most customers choose to allow this traffic. For more details, see [Traffic from known bots](https://developers.cloudflare.com/firewall/known-issues-and-faq/#how-does-firewall-rules-handle-traffic-from-known-bots). - */ - verifiedBot: boolean; - /** - * A boolean value that is true if the request originates from a - * Cloudflare-verified proxy service. - */ - corporateProxy: boolean; - /** - * A boolean value that's true if the request matches [file extensions](https://developers.cloudflare.com/bots/reference/static-resources/) for many types of static resources. - */ - staticResource: boolean; - /** - * List of IDs that correlate to the Bot Management heuristic detections made on a request (you can have multiple heuristic detections on the same request). - */ - detectionIds: number[]; -} -export interface IncomingRequestCfPropertiesBotManagement { - /** - * Results of Cloudflare's Bot Management analysis - */ - botManagement: IncomingRequestCfPropertiesBotManagementBase; - /** - * Duplicate of `botManagement.score`. - * - * @deprecated - */ - clientTrustScore: number; -} -export interface IncomingRequestCfPropertiesBotManagementEnterprise - extends IncomingRequestCfPropertiesBotManagement { - /** - * Results of Cloudflare's Bot Management analysis - */ - botManagement: IncomingRequestCfPropertiesBotManagementBase & { - /** - * A [JA3 Fingerprint](https://developers.cloudflare.com/bots/concepts/ja3-fingerprint/) to help profile specific SSL/TLS clients - * across different destination IPs, Ports, and X509 certificates. - */ - ja3Hash: string; - }; -} -export interface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise< - HostMetadata -> { - /** - * Custom metadata set per-host in [Cloudflare for SaaS](https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/). - * - * This field is only present if you have Cloudflare for SaaS enabled on your account - * and you have followed the [required steps to enable it]((https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/domain-support/custom-metadata/)). - */ - hostMetadata: HostMetadata; -} -export interface IncomingRequestCfPropertiesCloudflareAccessOrApiShield { - /** - * Information about the client certificate presented to Cloudflare. - * - * This is populated when the incoming request is served over TLS using - * either Cloudflare Access or API Shield (mTLS) - * and the presented SSL certificate has a valid - * [Certificate Serial Number](https://ldapwiki.com/wiki/Certificate%20Serial%20Number) - * (i.e., not `null` or `""`). - * - * Otherwise, a set of placeholder values are used. - * - * The property `certPresented` will be set to `"1"` when - * the object is populated (i.e. the above conditions were met). - */ - tlsClientAuth: - | IncomingRequestCfPropertiesTLSClientAuth - | IncomingRequestCfPropertiesTLSClientAuthPlaceholder; -} -/** - * Metadata about the request's TLS handshake - */ -export interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata { - /** - * The client's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal - * - * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d" - */ - clientHandshake: string; - /** - * The server's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal - * - * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d" - */ - serverHandshake: string; - /** - * The client's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal - * - * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b" - */ - clientFinished: string; - /** - * The server's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal - * - * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b" - */ - serverFinished: string; -} -/** - * Geographic data about the request's origin. - */ -export interface IncomingRequestCfPropertiesGeographicInformation { - /** - * The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from. - * - * If your worker is [configured to accept TOR connections](https://support.cloudflare.com/hc/en-us/articles/203306930-Understanding-Cloudflare-Tor-support-and-Onion-Routing), this may also be `"T1"`, indicating a request that originated over TOR. - * - * If Cloudflare is unable to determine where the request originated this property is omitted. - * - * The country code `"T1"` is used for requests originating on TOR. - * - * @example "GB" - */ - country?: Iso3166Alpha2Code | "T1"; - /** - * If present, this property indicates that the request originated in the EU - * - * @example "1" - */ - isEUCountry?: "1"; - /** - * A two-letter code indicating the continent the request originated from. - * - * @example "AN" - */ - continent?: ContinentCode; - /** - * The city the request originated from - * - * @example "Austin" - */ - city?: string; - /** - * Postal code of the incoming request - * - * @example "78701" - */ - postalCode?: string; - /** - * Latitude of the incoming request - * - * @example "30.27130" - */ - latitude?: string; - /** - * Longitude of the incoming request - * - * @example "-97.74260" - */ - longitude?: string; - /** - * Timezone of the incoming request - * - * @example "America/Chicago" - */ - timezone?: string; - /** - * If known, the ISO 3166-2 name for the first level region associated with - * the IP address of the incoming request - * - * @example "Texas" - */ - region?: string; - /** - * If known, the ISO 3166-2 code for the first-level region associated with - * the IP address of the incoming request - * - * @example "TX" - */ - regionCode?: string; - /** - * Metro code (DMA) of the incoming request - * - * @example "635" - */ - metroCode?: string; -} -/** Data about the incoming request's TLS certificate */ -export interface IncomingRequestCfPropertiesTLSClientAuth { - /** Always `"1"`, indicating that the certificate was presented */ - certPresented: "1"; - /** - * Result of certificate verification. - * - * @example "FAILED:self signed certificate" - */ - certVerified: Exclude; - /** The presented certificate's revokation status. - * - * - A value of `"1"` indicates the certificate has been revoked - * - A value of `"0"` indicates the certificate has not been revoked - */ - certRevoked: "1" | "0"; - /** - * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) - * - * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certIssuerDN: string; - /** - * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) - * - * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certSubjectDN: string; - /** - * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted) - * - * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certIssuerDNRFC2253: string; - /** - * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted) - * - * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" - */ - certSubjectDNRFC2253: string; - /** The certificate issuer's distinguished name (legacy policies) */ - certIssuerDNLegacy: string; - /** The certificate subject's distinguished name (legacy policies) */ - certSubjectDNLegacy: string; - /** - * The certificate's serial number - * - * @example "00936EACBE07F201DF" - */ - certSerial: string; - /** - * The certificate issuer's serial number - * - * @example "2489002934BDFEA34" - */ - certIssuerSerial: string; - /** - * The certificate's Subject Key Identifier - * - * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4" - */ - certSKI: string; - /** - * The certificate issuer's Subject Key Identifier - * - * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4" - */ - certIssuerSKI: string; - /** - * The certificate's SHA-1 fingerprint - * - * @example "6b9109f323999e52259cda7373ff0b4d26bd232e" - */ - certFingerprintSHA1: string; - /** - * The certificate's SHA-256 fingerprint - * - * @example "acf77cf37b4156a2708e34c4eb755f9b5dbbe5ebb55adfec8f11493438d19e6ad3f157f81fa3b98278453d5652b0c1fd1d71e5695ae4d709803a4d3f39de9dea" - */ - certFingerprintSHA256: string; - /** - * The effective starting date of the certificate - * - * @example "Dec 22 19:39:00 2018 GMT" - */ - certNotBefore: string; - /** - * The effective expiration date of the certificate - * - * @example "Dec 22 19:39:00 2018 GMT" - */ - certNotAfter: string; -} -/** Placeholder values for TLS Client Authorization */ -export interface IncomingRequestCfPropertiesTLSClientAuthPlaceholder { - certPresented: "0"; - certVerified: "NONE"; - certRevoked: "0"; - certIssuerDN: ""; - certSubjectDN: ""; - certIssuerDNRFC2253: ""; - certSubjectDNRFC2253: ""; - certIssuerDNLegacy: ""; - certSubjectDNLegacy: ""; - certSerial: ""; - certIssuerSerial: ""; - certSKI: ""; - certIssuerSKI: ""; - certFingerprintSHA1: ""; - certFingerprintSHA256: ""; - certNotBefore: ""; - certNotAfter: ""; -} -/** Possible outcomes of TLS verification */ -export type CertVerificationStatus = - /** Authentication succeeded */ - | "SUCCESS" - /** No certificate was presented */ - | "NONE" - /** Failed because the certificate was self-signed */ - | "FAILED:self signed certificate" - /** Failed because the certificate failed a trust chain check */ - | "FAILED:unable to verify the first certificate" - /** Failed because the certificate not yet valid */ - | "FAILED:certificate is not yet valid" - /** Failed because the certificate is expired */ - | "FAILED:certificate has expired" - /** Failed for another unspecified reason */ - | "FAILED"; -/** - * An upstream endpoint's response to a TCP `keepalive` message from Cloudflare. - */ -export type IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus = - | 0 /** Unknown */ - | 1 /** no keepalives (not found) */ - | 2 /** no connection re-use, opening keepalive connection failed */ - | 3 /** no connection re-use, keepalive accepted and saved */ - | 4 /** connection re-use, refused by the origin server (`TCP FIN`) */ - | 5; /** connection re-use, accepted by the origin server */ -/** ISO 3166-1 Alpha-2 codes */ -export type Iso3166Alpha2Code = - | "AD" - | "AE" - | "AF" - | "AG" - | "AI" - | "AL" - | "AM" - | "AO" - | "AQ" - | "AR" - | "AS" - | "AT" - | "AU" - | "AW" - | "AX" - | "AZ" - | "BA" - | "BB" - | "BD" - | "BE" - | "BF" - | "BG" - | "BH" - | "BI" - | "BJ" - | "BL" - | "BM" - | "BN" - | "BO" - | "BQ" - | "BR" - | "BS" - | "BT" - | "BV" - | "BW" - | "BY" - | "BZ" - | "CA" - | "CC" - | "CD" - | "CF" - | "CG" - | "CH" - | "CI" - | "CK" - | "CL" - | "CM" - | "CN" - | "CO" - | "CR" - | "CU" - | "CV" - | "CW" - | "CX" - | "CY" - | "CZ" - | "DE" - | "DJ" - | "DK" - | "DM" - | "DO" - | "DZ" - | "EC" - | "EE" - | "EG" - | "EH" - | "ER" - | "ES" - | "ET" - | "FI" - | "FJ" - | "FK" - | "FM" - | "FO" - | "FR" - | "GA" - | "GB" - | "GD" - | "GE" - | "GF" - | "GG" - | "GH" - | "GI" - | "GL" - | "GM" - | "GN" - | "GP" - | "GQ" - | "GR" - | "GS" - | "GT" - | "GU" - | "GW" - | "GY" - | "HK" - | "HM" - | "HN" - | "HR" - | "HT" - | "HU" - | "ID" - | "IE" - | "IL" - | "IM" - | "IN" - | "IO" - | "IQ" - | "IR" - | "IS" - | "IT" - | "JE" - | "JM" - | "JO" - | "JP" - | "KE" - | "KG" - | "KH" - | "KI" - | "KM" - | "KN" - | "KP" - | "KR" - | "KW" - | "KY" - | "KZ" - | "LA" - | "LB" - | "LC" - | "LI" - | "LK" - | "LR" - | "LS" - | "LT" - | "LU" - | "LV" - | "LY" - | "MA" - | "MC" - | "MD" - | "ME" - | "MF" - | "MG" - | "MH" - | "MK" - | "ML" - | "MM" - | "MN" - | "MO" - | "MP" - | "MQ" - | "MR" - | "MS" - | "MT" - | "MU" - | "MV" - | "MW" - | "MX" - | "MY" - | "MZ" - | "NA" - | "NC" - | "NE" - | "NF" - | "NG" - | "NI" - | "NL" - | "NO" - | "NP" - | "NR" - | "NU" - | "NZ" - | "OM" - | "PA" - | "PE" - | "PF" - | "PG" - | "PH" - | "PK" - | "PL" - | "PM" - | "PN" - | "PR" - | "PS" - | "PT" - | "PW" - | "PY" - | "QA" - | "RE" - | "RO" - | "RS" - | "RU" - | "RW" - | "SA" - | "SB" - | "SC" - | "SD" - | "SE" - | "SG" - | "SH" - | "SI" - | "SJ" - | "SK" - | "SL" - | "SM" - | "SN" - | "SO" - | "SR" - | "SS" - | "ST" - | "SV" - | "SX" - | "SY" - | "SZ" - | "TC" - | "TD" - | "TF" - | "TG" - | "TH" - | "TJ" - | "TK" - | "TL" - | "TM" - | "TN" - | "TO" - | "TR" - | "TT" - | "TV" - | "TW" - | "TZ" - | "UA" - | "UG" - | "UM" - | "US" - | "UY" - | "UZ" - | "VA" - | "VC" - | "VE" - | "VG" - | "VI" - | "VN" - | "VU" - | "WF" - | "WS" - | "YE" - | "YT" - | "ZA" - | "ZM" - | "ZW"; -/** The 2-letter continent codes Cloudflare uses */ -export type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA"; -export type CfProperties = - | IncomingRequestCfProperties - | RequestInitCfProperties; -export interface D1Result { - results?: T[]; - success: boolean; - error?: string; - meta: any; -} -export declare abstract class D1Database { - prepare(query: string): D1PreparedStatement; - dump(): Promise; - batch(statements: D1PreparedStatement[]): Promise[]>; - exec(query: string): Promise>; -} -export declare abstract class D1PreparedStatement { - bind(...values: any[]): D1PreparedStatement; - first(colName?: string): Promise; - run(): Promise>; - all(): Promise>; - raw(): Promise; -} -/** - * A email message that is sent to a consumer Worker. - */ -export interface EmailMessage { - /** - * Envelope From attribute of the email message. - */ - readonly from: string; - /** - * Envelope To attribute of the email message. - */ - readonly to: string; - /** - * A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers). - */ - readonly headers: Headers; - /** - * Stream of the email message content. - */ - readonly raw: ReadableStream; - /** - * Size of the email message content. - */ - readonly rawSize: number; - /** - * Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason. - * @param reason The reject reason. - * @returns void - */ - setReject(reason: string): void; - /** - * Forward this email message to a verified destination address of the account. - * @param rcptTo Verified destination address. - * @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers). - * @returns A promise that resolves when the email message is forwarded. - */ - forward(rcptTo: string, headers?: Headers): Promise; -} -export declare abstract class EmailEvent extends ExtendableEvent { - readonly message: EmailMessage; -} -export type EmailExportedHandler = ( - message: EmailMessage, - env: Env, - ctx: ExecutionContext -) => void | Promise; -export type Params

= Record; -export type EventContext = { - request: Request; - functionPath: string; - waitUntil: (promise: Promise) => void; - passThroughOnException: () => void; - next: (input?: Request | string, init?: RequestInit) => Promise; - env: Env & { - ASSETS: { - fetch: typeof fetch; - }; - }; - params: Params

; - data: Data; -}; -export type PagesFunction< - Env = unknown, - Params extends string = any, - Data extends Record = Record -> = (context: EventContext) => Response | Promise; -export type EventPluginContext = { - request: Request; - functionPath: string; - waitUntil: (promise: Promise) => void; - passThroughOnException: () => void; - next: (input?: Request | string, init?: RequestInit) => Promise; - env: Env & { - ASSETS: { - fetch: typeof fetch; - }; - }; - params: Params

; - data: Data; - pluginArgs: PluginArgs; -}; -export type PagesPluginFunction< - Env = unknown, - Params extends string = any, - Data extends Record = Record, - PluginArgs = unknown -> = ( - context: EventPluginContext -) => Response | Promise; -// https://developers.cloudflare.com/pub-sub/ -// PubSubMessage represents an incoming PubSub message. -// The message includes metadata about the broker, the client, and the payload -// itself. -export interface PubSubMessage { - // Message ID - readonly mid: number; - // MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT - readonly broker: string; - // The MQTT topic the message was sent on. - readonly topic: string; - // The client ID of the client that published this message. - readonly clientId: string; - // The unique identifier (JWT ID) used by the client to authenticate, if token - // auth was used. - readonly jti?: string; - // A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker - // received the message from the client. - readonly receivedAt: number; - // An (optional) string with the MIME type of the payload, if set by the - // client. - readonly contentType: string; - // Set to 1 when the payload is a UTF-8 string - // https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063 - readonly payloadFormatIndicator: number; - // Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays. - // You can use payloadFormatIndicator to inspect this before decoding. - payload: string | Uint8Array; -} -// JsonWebKey extended by kid parameter -export interface JsonWebKeyWithKid extends JsonWebKey { - // Key Identifier of the JWK - readonly kid: string; -} -/** - * A message that is sent to a consumer Worker. - */ -export interface Message { - /** - * A unique, system-generated ID for the message. - */ - readonly id: string; - /** - * A timestamp when the message was sent. - */ - readonly timestamp: Date; - /** - * The body of the message. - */ - readonly body: Body; - /** - * Marks message to be retried. - */ - retry(): void; - /** - * Marks message acknowledged. - */ - ack(): void; -} -/** - * A batch of messages that are sent to a consumer Worker. - */ -export interface MessageBatch { - /** - * The name of the Queue that belongs to this batch. - */ - readonly queue: string; - /** - * An array of messages in the batch. Ordering of messages is not guaranteed. - */ - readonly messages: readonly Message[]; - /** - * Marks every message to be retried in the next batch. - */ - retryAll(): void; - /** - * Marks every message acknowledged in the batch. - */ - ackAll(): void; -} -/** - * A wrapper class used to structure message batches. - */ -export type MessageSendRequest = { - /** - * The body of the message. - */ - body: Body; -}; -/** - * A binding that allows a producer to send messages to a Queue. - */ -export interface Queue { - /** - * Sends a message to the Queue. - * @param message The message can be any type supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types), as long as its size is less than 128 KB. - * @returns A promise that resolves when the message is confirmed to be written to disk. - */ - send(message: Body): Promise; - /** - * Sends a batch of messages to the Queue. - * @param messages Each item in the input must be supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types). A batch can contain up to 100 messages, though items are limited to 128 KB each, and the total size of the array cannot exceed 256 KB. - * @returns A promise that resolves when the messages are confirmed to be written to disk. - */ - sendBatch(messages: Iterable>): Promise; -} diff --git a/packages/denylist_bot/node_modules/@cloudflare/workers-types/package.json b/packages/denylist_bot/node_modules/@cloudflare/workers-types/package.json deleted file mode 100644 index 10fb47a1f..000000000 --- a/packages/denylist_bot/node_modules/@cloudflare/workers-types/package.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "@cloudflare/workers-types", - "description": "TypeScript typings for Cloudflare Workers", - "repository": { - "type": "git", - "url": "https://github.com/cloudflare/workerd" - }, - "author": "Cloudflare Workers DevProd Team (https://workers.cloudflare.com)", - "license": "MIT OR Apache-2.0", - "version": "4.20230321.0" -} diff --git a/packages/denylist_bot/node_modules/buffer/AUTHORS.md b/packages/denylist_bot/node_modules/buffer/AUTHORS.md deleted file mode 100644 index 468aa1908..000000000 --- a/packages/denylist_bot/node_modules/buffer/AUTHORS.md +++ /dev/null @@ -1,73 +0,0 @@ -# Authors - -#### Ordered by first contribution. - -- Romain Beauxis (toots@rastageeks.org) -- Tobias Koppers (tobias.koppers@googlemail.com) -- Janus (ysangkok@gmail.com) -- Rainer Dreyer (rdrey1@gmail.com) -- Tõnis Tiigi (tonistiigi@gmail.com) -- James Halliday (mail@substack.net) -- Michael Williamson (mike@zwobble.org) -- elliottcable (github@elliottcable.name) -- rafael (rvalle@livelens.net) -- Andrew Kelley (superjoe30@gmail.com) -- Andreas Madsen (amwebdk@gmail.com) -- Mike Brevoort (mike.brevoort@pearson.com) -- Brian White (mscdex@mscdex.net) -- Feross Aboukhadijeh (feross@feross.org) -- Ruben Verborgh (ruben@verborgh.org) -- eliang (eliang.cs@gmail.com) -- Jesse Tane (jesse.tane@gmail.com) -- Alfonso Boza (alfonso@cloud.com) -- Mathias Buus (mathiasbuus@gmail.com) -- Devon Govett (devongovett@gmail.com) -- Daniel Cousens (github@dcousens.com) -- Joseph Dykstra (josephdykstra@gmail.com) -- Parsha Pourkhomami (parshap+git@gmail.com) -- Damjan Košir (damjan.kosir@gmail.com) -- daverayment (dave.rayment@gmail.com) -- kawanet (u-suke@kawa.net) -- Linus Unnebäck (linus@folkdatorn.se) -- Nolan Lawson (nolan.lawson@gmail.com) -- Calvin Metcalf (calvin.metcalf@gmail.com) -- Koki Takahashi (hakatasiloving@gmail.com) -- Guy Bedford (guybedford@gmail.com) -- Jan Schär (jscissr@gmail.com) -- RaulTsc (tomescu.raul@gmail.com) -- Matthieu Monsch (monsch@alum.mit.edu) -- Dan Ehrenberg (littledan@chromium.org) -- Kirill Fomichev (fanatid@ya.ru) -- Yusuke Kawasaki (u-suke@kawa.net) -- DC (dcposch@dcpos.ch) -- John-David Dalton (john.david.dalton@gmail.com) -- adventure-yunfei (adventure030@gmail.com) -- Emil Bay (github@tixz.dk) -- Sam Sudar (sudar.sam@gmail.com) -- Volker Mische (volker.mische@gmail.com) -- David Walton (support@geekstocks.com) -- Сковорода Никита Андреевич (chalkerx@gmail.com) -- greenkeeper[bot] (greenkeeper[bot]@users.noreply.github.com) -- ukstv (sergey.ukustov@machinomy.com) -- Renée Kooi (renee@kooi.me) -- ranbochen (ranbochen@qq.com) -- Vladimir Borovik (bobahbdb@gmail.com) -- greenkeeper[bot] (23040076+greenkeeper[bot]@users.noreply.github.com) -- kumavis (aaron@kumavis.me) -- Sergey Ukustov (sergey.ukustov@machinomy.com) -- Fei Liu (liu.feiwood@gmail.com) -- Blaine Bublitz (blaine.bublitz@gmail.com) -- clement (clement@seald.io) -- Koushik Dutta (koushd@gmail.com) -- Jordan Harband (ljharb@gmail.com) -- Niklas Mischkulnig (mischnic@users.noreply.github.com) -- Nikolai Vavilov (vvnicholas@gmail.com) -- Fedor Nezhivoi (gyzerok@users.noreply.github.com) -- shuse2 (shus.toda@gmail.com) -- Peter Newman (peternewman@users.noreply.github.com) -- mathmakgakpak (44949126+mathmakgakpak@users.noreply.github.com) -- jkkang (jkkang@smartauth.kr) -- Deklan Webster (deklanw@gmail.com) -- Martin Heidegger (martin.heidegger@gmail.com) - -#### Generated by bin/update-authors.sh. diff --git a/packages/denylist_bot/node_modules/buffer/LICENSE b/packages/denylist_bot/node_modules/buffer/LICENSE deleted file mode 100644 index d6bf75dcf..000000000 --- a/packages/denylist_bot/node_modules/buffer/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Feross Aboukhadijeh, and other contributors. - -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. diff --git a/packages/denylist_bot/node_modules/buffer/README.md b/packages/denylist_bot/node_modules/buffer/README.md deleted file mode 100644 index 451e23576..000000000 --- a/packages/denylist_bot/node_modules/buffer/README.md +++ /dev/null @@ -1,410 +0,0 @@ -# buffer [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url] - -[travis-image]: https://img.shields.io/travis/feross/buffer/master.svg -[travis-url]: https://travis-ci.org/feross/buffer -[npm-image]: https://img.shields.io/npm/v/buffer.svg -[npm-url]: https://npmjs.org/package/buffer -[downloads-image]: https://img.shields.io/npm/dm/buffer.svg -[downloads-url]: https://npmjs.org/package/buffer -[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg -[standard-url]: https://standardjs.com - -#### The buffer module from [node.js](https://nodejs.org/), for the browser. - -[![saucelabs][saucelabs-image]][saucelabs-url] - -[saucelabs-image]: https://saucelabs.com/browser-matrix/buffer.svg -[saucelabs-url]: https://saucelabs.com/u/buffer - -With [browserify](http://browserify.org), simply `require('buffer')` or use the `Buffer` global and you will get this module. - -The goal is to provide an API that is 100% identical to -[node's Buffer API](https://nodejs.org/api/buffer.html). Read the -[official docs](https://nodejs.org/api/buffer.html) for the full list of properties, -instance methods, and class methods that are supported. - -## features - -- Manipulate binary data like a boss, in all browsers! -- Super fast. Backed by Typed Arrays (`Uint8Array`/`ArrayBuffer`, not `Object`) -- Extremely small bundle size (**6.75KB minified + gzipped**, 51.9KB with comments) -- Excellent browser support (Chrome, Firefox, Edge, Safari 11+, iOS 11+, Android, etc.) -- Preserves Node API exactly, with one minor difference (see below) -- Square-bracket `buf[4]` notation works! -- Does not modify any browser prototypes or put anything on `window` -- Comprehensive test suite (including all buffer tests from node.js core) - -## install - -To use this module directly (without browserify), install it: - -```bash -npm install buffer -``` - -This module was previously called **native-buffer-browserify**, but please use **buffer** -from now on. - -If you do not use a bundler, you can use the [standalone script](https://bundle.run/buffer). - -## usage - -The module's API is identical to node's `Buffer` API. Read the -[official docs](https://nodejs.org/api/buffer.html) for the full list of properties, -instance methods, and class methods that are supported. - -As mentioned above, `require('buffer')` or use the `Buffer` global with -[browserify](http://browserify.org) and this module will automatically be included -in your bundle. Almost any npm module will work in the browser, even if it assumes that -the node `Buffer` API will be available. - -To depend on this module explicitly (without browserify), require it like this: - -```js -var Buffer = require('buffer/').Buffer // note: the trailing slash is important! -``` - -To require this module explicitly, use `require('buffer/')` which tells the node.js module -lookup algorithm (also used by browserify) to use the **npm module** named `buffer` -instead of the **node.js core** module named `buffer`! - - -## how does it work? - -The Buffer constructor returns instances of `Uint8Array` that have their prototype -changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of `Uint8Array`, -so the returned instances will have all the node `Buffer` methods and the -`Uint8Array` methods. Square bracket notation works as expected -- it returns a -single octet. - -The `Uint8Array` prototype remains unmodified. - - -## tracking the latest node api - -This module tracks the Buffer API in the latest (unstable) version of node.js. The Buffer -API is considered **stable** in the -[node stability index](https://nodejs.org/docs/latest/api/documentation.html#documentation_stability_index), -so it is unlikely that there will ever be breaking changes. -Nonetheless, when/if the Buffer API changes in node, this module's API will change -accordingly. - -## related packages - -- [`buffer-reverse`](https://www.npmjs.com/package/buffer-reverse) - Reverse a buffer -- [`buffer-xor`](https://www.npmjs.com/package/buffer-xor) - Bitwise xor a buffer -- [`is-buffer`](https://www.npmjs.com/package/is-buffer) - Determine if an object is a Buffer without including the whole `Buffer` package - -## conversion packages - -### convert typed array to buffer - -Use [`typedarray-to-buffer`](https://www.npmjs.com/package/typedarray-to-buffer) to convert any kind of typed array to a `Buffer`. Does not perform a copy, so it's super fast. - -### convert buffer to typed array - -`Buffer` is a subclass of `Uint8Array` (which is a typed array). So there is no need to explicitly convert to typed array. Just use the buffer as a `Uint8Array`. - -### convert blob to buffer - -Use [`blob-to-buffer`](https://www.npmjs.com/package/blob-to-buffer) to convert a `Blob` to a `Buffer`. - -### convert buffer to blob - -To convert a `Buffer` to a `Blob`, use the `Blob` constructor: - -```js -var blob = new Blob([ buffer ]) -``` - -Optionally, specify a mimetype: - -```js -var blob = new Blob([ buffer ], { type: 'text/html' }) -``` - -### convert arraybuffer to buffer - -To convert an `ArrayBuffer` to a `Buffer`, use the `Buffer.from` function. Does not perform a copy, so it's super fast. - -```js -var buffer = Buffer.from(arrayBuffer) -``` - -### convert buffer to arraybuffer - -To convert a `Buffer` to an `ArrayBuffer`, use the `.buffer` property (which is present on all `Uint8Array` objects): - -```js -var arrayBuffer = buffer.buffer.slice( - buffer.byteOffset, buffer.byteOffset + buffer.byteLength -) -``` - -Alternatively, use the [`to-arraybuffer`](https://www.npmjs.com/package/to-arraybuffer) module. - -## performance - -See perf tests in `/perf`. - -`BrowserBuffer` is the browser `buffer` module (this repo). `Uint8Array` is included as a -sanity check (since `BrowserBuffer` uses `Uint8Array` under the hood, `Uint8Array` will -always be at least a bit faster). Finally, `NodeBuffer` is the node.js buffer module, -which is included to compare against. - -NOTE: Performance has improved since these benchmarks were taken. PR welcome to update the README. - -### Chrome 38 - -| Method | Operations | Accuracy | Sampled | Fastest | -|:-------|:-----------|:---------|:--------|:-------:| -| BrowserBuffer#bracket-notation | 11,457,464 ops/sec | ±0.86% | 66 | ✓ | -| Uint8Array#bracket-notation | 10,824,332 ops/sec | ±0.74% | 65 | | -| | | | | -| BrowserBuffer#concat | 450,532 ops/sec | ±0.76% | 68 | | -| Uint8Array#concat | 1,368,911 ops/sec | ±1.50% | 62 | ✓ | -| | | | | -| BrowserBuffer#copy(16000) | 903,001 ops/sec | ±0.96% | 67 | | -| Uint8Array#copy(16000) | 1,422,441 ops/sec | ±1.04% | 66 | ✓ | -| | | | | -| BrowserBuffer#copy(16) | 11,431,358 ops/sec | ±0.46% | 69 | | -| Uint8Array#copy(16) | 13,944,163 ops/sec | ±1.12% | 68 | ✓ | -| | | | | -| BrowserBuffer#new(16000) | 106,329 ops/sec | ±6.70% | 44 | | -| Uint8Array#new(16000) | 131,001 ops/sec | ±2.85% | 31 | ✓ | -| | | | | -| BrowserBuffer#new(16) | 1,554,491 ops/sec | ±1.60% | 65 | | -| Uint8Array#new(16) | 6,623,930 ops/sec | ±1.66% | 65 | ✓ | -| | | | | -| BrowserBuffer#readDoubleBE | 112,830 ops/sec | ±0.51% | 69 | ✓ | -| DataView#getFloat64 | 93,500 ops/sec | ±0.57% | 68 | | -| | | | | -| BrowserBuffer#readFloatBE | 146,678 ops/sec | ±0.95% | 68 | ✓ | -| DataView#getFloat32 | 99,311 ops/sec | ±0.41% | 67 | | -| | | | | -| BrowserBuffer#readUInt32LE | 843,214 ops/sec | ±0.70% | 69 | ✓ | -| DataView#getUint32 | 103,024 ops/sec | ±0.64% | 67 | | -| | | | | -| BrowserBuffer#slice | 1,013,941 ops/sec | ±0.75% | 67 | | -| Uint8Array#subarray | 1,903,928 ops/sec | ±0.53% | 67 | ✓ | -| | | | | -| BrowserBuffer#writeFloatBE | 61,387 ops/sec | ±0.90% | 67 | | -| DataView#setFloat32 | 141,249 ops/sec | ±0.40% | 66 | ✓ | - - -### Firefox 33 - -| Method | Operations | Accuracy | Sampled | Fastest | -|:-------|:-----------|:---------|:--------|:-------:| -| BrowserBuffer#bracket-notation | 20,800,421 ops/sec | ±1.84% | 60 | | -| Uint8Array#bracket-notation | 20,826,235 ops/sec | ±2.02% | 61 | ✓ | -| | | | | -| BrowserBuffer#concat | 153,076 ops/sec | ±2.32% | 61 | | -| Uint8Array#concat | 1,255,674 ops/sec | ±8.65% | 52 | ✓ | -| | | | | -| BrowserBuffer#copy(16000) | 1,105,312 ops/sec | ±1.16% | 63 | | -| Uint8Array#copy(16000) | 1,615,911 ops/sec | ±0.55% | 66 | ✓ | -| | | | | -| BrowserBuffer#copy(16) | 16,357,599 ops/sec | ±0.73% | 68 | | -| Uint8Array#copy(16) | 31,436,281 ops/sec | ±1.05% | 68 | ✓ | -| | | | | -| BrowserBuffer#new(16000) | 52,995 ops/sec | ±6.01% | 35 | | -| Uint8Array#new(16000) | 87,686 ops/sec | ±5.68% | 45 | ✓ | -| | | | | -| BrowserBuffer#new(16) | 252,031 ops/sec | ±1.61% | 66 | | -| Uint8Array#new(16) | 8,477,026 ops/sec | ±0.49% | 68 | ✓ | -| | | | | -| BrowserBuffer#readDoubleBE | 99,871 ops/sec | ±0.41% | 69 | | -| DataView#getFloat64 | 285,663 ops/sec | ±0.70% | 68 | ✓ | -| | | | | -| BrowserBuffer#readFloatBE | 115,540 ops/sec | ±0.42% | 69 | | -| DataView#getFloat32 | 288,722 ops/sec | ±0.82% | 68 | ✓ | -| | | | | -| BrowserBuffer#readUInt32LE | 633,926 ops/sec | ±1.08% | 67 | ✓ | -| DataView#getUint32 | 294,808 ops/sec | ±0.79% | 64 | | -| | | | | -| BrowserBuffer#slice | 349,425 ops/sec | ±0.46% | 69 | | -| Uint8Array#subarray | 5,965,819 ops/sec | ±0.60% | 65 | ✓ | -| | | | | -| BrowserBuffer#writeFloatBE | 59,980 ops/sec | ±0.41% | 67 | | -| DataView#setFloat32 | 317,634 ops/sec | ±0.63% | 68 | ✓ | - -### Safari 8 - -| Method | Operations | Accuracy | Sampled | Fastest | -|:-------|:-----------|:---------|:--------|:-------:| -| BrowserBuffer#bracket-notation | 10,279,729 ops/sec | ±2.25% | 56 | ✓ | -| Uint8Array#bracket-notation | 10,030,767 ops/sec | ±2.23% | 59 | | -| | | | | -| BrowserBuffer#concat | 144,138 ops/sec | ±1.38% | 65 | | -| Uint8Array#concat | 4,950,764 ops/sec | ±1.70% | 63 | ✓ | -| | | | | -| BrowserBuffer#copy(16000) | 1,058,548 ops/sec | ±1.51% | 64 | | -| Uint8Array#copy(16000) | 1,409,666 ops/sec | ±1.17% | 65 | ✓ | -| | | | | -| BrowserBuffer#copy(16) | 6,282,529 ops/sec | ±1.88% | 58 | | -| Uint8Array#copy(16) | 11,907,128 ops/sec | ±2.87% | 58 | ✓ | -| | | | | -| BrowserBuffer#new(16000) | 101,663 ops/sec | ±3.89% | 57 | | -| Uint8Array#new(16000) | 22,050,818 ops/sec | ±6.51% | 46 | ✓ | -| | | | | -| BrowserBuffer#new(16) | 176,072 ops/sec | ±2.13% | 64 | | -| Uint8Array#new(16) | 24,385,731 ops/sec | ±5.01% | 51 | ✓ | -| | | | | -| BrowserBuffer#readDoubleBE | 41,341 ops/sec | ±1.06% | 67 | | -| DataView#getFloat64 | 322,280 ops/sec | ±0.84% | 68 | ✓ | -| | | | | -| BrowserBuffer#readFloatBE | 46,141 ops/sec | ±1.06% | 65 | | -| DataView#getFloat32 | 337,025 ops/sec | ±0.43% | 69 | ✓ | -| | | | | -| BrowserBuffer#readUInt32LE | 151,551 ops/sec | ±1.02% | 66 | | -| DataView#getUint32 | 308,278 ops/sec | ±0.94% | 67 | ✓ | -| | | | | -| BrowserBuffer#slice | 197,365 ops/sec | ±0.95% | 66 | | -| Uint8Array#subarray | 9,558,024 ops/sec | ±3.08% | 58 | ✓ | -| | | | | -| BrowserBuffer#writeFloatBE | 17,518 ops/sec | ±1.03% | 63 | | -| DataView#setFloat32 | 319,751 ops/sec | ±0.48% | 68 | ✓ | - - -### Node 0.11.14 - -| Method | Operations | Accuracy | Sampled | Fastest | -|:-------|:-----------|:---------|:--------|:-------:| -| BrowserBuffer#bracket-notation | 10,489,828 ops/sec | ±3.25% | 90 | | -| Uint8Array#bracket-notation | 10,534,884 ops/sec | ±0.81% | 92 | ✓ | -| NodeBuffer#bracket-notation | 10,389,910 ops/sec | ±0.97% | 87 | | -| | | | | -| BrowserBuffer#concat | 487,830 ops/sec | ±2.58% | 88 | | -| Uint8Array#concat | 1,814,327 ops/sec | ±1.28% | 88 | ✓ | -| NodeBuffer#concat | 1,636,523 ops/sec | ±1.88% | 73 | | -| | | | | -| BrowserBuffer#copy(16000) | 1,073,665 ops/sec | ±0.77% | 90 | | -| Uint8Array#copy(16000) | 1,348,517 ops/sec | ±0.84% | 89 | ✓ | -| NodeBuffer#copy(16000) | 1,289,533 ops/sec | ±0.82% | 93 | | -| | | | | -| BrowserBuffer#copy(16) | 12,782,706 ops/sec | ±0.74% | 85 | | -| Uint8Array#copy(16) | 14,180,427 ops/sec | ±0.93% | 92 | ✓ | -| NodeBuffer#copy(16) | 11,083,134 ops/sec | ±1.06% | 89 | | -| | | | | -| BrowserBuffer#new(16000) | 141,678 ops/sec | ±3.30% | 67 | | -| Uint8Array#new(16000) | 161,491 ops/sec | ±2.96% | 60 | | -| NodeBuffer#new(16000) | 292,699 ops/sec | ±3.20% | 55 | ✓ | -| | | | | -| BrowserBuffer#new(16) | 1,655,466 ops/sec | ±2.41% | 82 | | -| Uint8Array#new(16) | 14,399,926 ops/sec | ±0.91% | 94 | ✓ | -| NodeBuffer#new(16) | 3,894,696 ops/sec | ±0.88% | 92 | | -| | | | | -| BrowserBuffer#readDoubleBE | 109,582 ops/sec | ±0.75% | 93 | ✓ | -| DataView#getFloat64 | 91,235 ops/sec | ±0.81% | 90 | | -| NodeBuffer#readDoubleBE | 88,593 ops/sec | ±0.96% | 81 | | -| | | | | -| BrowserBuffer#readFloatBE | 139,854 ops/sec | ±1.03% | 85 | ✓ | -| DataView#getFloat32 | 98,744 ops/sec | ±0.80% | 89 | | -| NodeBuffer#readFloatBE | 92,769 ops/sec | ±0.94% | 93 | | -| | | | | -| BrowserBuffer#readUInt32LE | 710,861 ops/sec | ±0.82% | 92 | | -| DataView#getUint32 | 117,893 ops/sec | ±0.84% | 91 | | -| NodeBuffer#readUInt32LE | 851,412 ops/sec | ±0.72% | 93 | ✓ | -| | | | | -| BrowserBuffer#slice | 1,673,877 ops/sec | ±0.73% | 94 | | -| Uint8Array#subarray | 6,919,243 ops/sec | ±0.67% | 90 | ✓ | -| NodeBuffer#slice | 4,617,604 ops/sec | ±0.79% | 93 | | -| | | | | -| BrowserBuffer#writeFloatBE | 66,011 ops/sec | ±0.75% | 93 | | -| DataView#setFloat32 | 127,760 ops/sec | ±0.72% | 93 | ✓ | -| NodeBuffer#writeFloatBE | 103,352 ops/sec | ±0.83% | 93 | | - -### iojs 1.8.1 - -| Method | Operations | Accuracy | Sampled | Fastest | -|:-------|:-----------|:---------|:--------|:-------:| -| BrowserBuffer#bracket-notation | 10,990,488 ops/sec | ±1.11% | 91 | | -| Uint8Array#bracket-notation | 11,268,757 ops/sec | ±0.65% | 97 | | -| NodeBuffer#bracket-notation | 11,353,260 ops/sec | ±0.83% | 94 | ✓ | -| | | | | -| BrowserBuffer#concat | 378,954 ops/sec | ±0.74% | 94 | | -| Uint8Array#concat | 1,358,288 ops/sec | ±0.97% | 87 | | -| NodeBuffer#concat | 1,934,050 ops/sec | ±1.11% | 78 | ✓ | -| | | | | -| BrowserBuffer#copy(16000) | 894,538 ops/sec | ±0.56% | 84 | | -| Uint8Array#copy(16000) | 1,442,656 ops/sec | ±0.71% | 96 | | -| NodeBuffer#copy(16000) | 1,457,898 ops/sec | ±0.53% | 92 | ✓ | -| | | | | -| BrowserBuffer#copy(16) | 12,870,457 ops/sec | ±0.67% | 95 | | -| Uint8Array#copy(16) | 16,643,989 ops/sec | ±0.61% | 93 | ✓ | -| NodeBuffer#copy(16) | 14,885,848 ops/sec | ±0.74% | 94 | | -| | | | | -| BrowserBuffer#new(16000) | 109,264 ops/sec | ±4.21% | 63 | | -| Uint8Array#new(16000) | 138,916 ops/sec | ±1.87% | 61 | | -| NodeBuffer#new(16000) | 281,449 ops/sec | ±3.58% | 51 | ✓ | -| | | | | -| BrowserBuffer#new(16) | 1,362,935 ops/sec | ±0.56% | 99 | | -| Uint8Array#new(16) | 6,193,090 ops/sec | ±0.64% | 95 | ✓ | -| NodeBuffer#new(16) | 4,745,425 ops/sec | ±1.56% | 90 | | -| | | | | -| BrowserBuffer#readDoubleBE | 118,127 ops/sec | ±0.59% | 93 | ✓ | -| DataView#getFloat64 | 107,332 ops/sec | ±0.65% | 91 | | -| NodeBuffer#readDoubleBE | 116,274 ops/sec | ±0.94% | 95 | | -| | | | | -| BrowserBuffer#readFloatBE | 150,326 ops/sec | ±0.58% | 95 | ✓ | -| DataView#getFloat32 | 110,541 ops/sec | ±0.57% | 98 | | -| NodeBuffer#readFloatBE | 121,599 ops/sec | ±0.60% | 87 | | -| | | | | -| BrowserBuffer#readUInt32LE | 814,147 ops/sec | ±0.62% | 93 | | -| DataView#getUint32 | 137,592 ops/sec | ±0.64% | 90 | | -| NodeBuffer#readUInt32LE | 931,650 ops/sec | ±0.71% | 96 | ✓ | -| | | | | -| BrowserBuffer#slice | 878,590 ops/sec | ±0.68% | 93 | | -| Uint8Array#subarray | 2,843,308 ops/sec | ±1.02% | 90 | | -| NodeBuffer#slice | 4,998,316 ops/sec | ±0.68% | 90 | ✓ | -| | | | | -| BrowserBuffer#writeFloatBE | 65,927 ops/sec | ±0.74% | 93 | | -| DataView#setFloat32 | 139,823 ops/sec | ±0.97% | 89 | ✓ | -| NodeBuffer#writeFloatBE | 135,763 ops/sec | ±0.65% | 96 | | -| | | | | - -## Testing the project - -First, install the project: - - npm install - -Then, to run tests in Node.js, run: - - npm run test-node - -To test locally in a browser, you can run: - - npm run test-browser-es5-local # For ES5 browsers that don't support ES6 - npm run test-browser-es6-local # For ES6 compliant browsers - -This will print out a URL that you can then open in a browser to run the tests, using [airtap](https://www.npmjs.com/package/airtap). - -To run automated browser tests using Saucelabs, ensure that your `SAUCE_USERNAME` and `SAUCE_ACCESS_KEY` environment variables are set, then run: - - npm test - -This is what's run in Travis, to check against various browsers. The list of browsers is kept in the `bin/airtap-es5.yml` and `bin/airtap-es6.yml` files. - -## JavaScript Standard Style - -This module uses [JavaScript Standard Style](https://github.com/feross/standard). - -[![JavaScript Style Guide](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard) - -To test that the code conforms to the style, `npm install` and run: - - ./node_modules/.bin/standard - -## credit - -This was originally forked from [buffer-browserify](https://github.com/toots/buffer-browserify). - -## Security Policies and Procedures - -The `buffer` team and community take all security bugs in `buffer` seriously. Please see our [security policies and procedures](https://github.com/feross/security) document to learn how to report issues. - -## license - -MIT. Copyright (C) [Feross Aboukhadijeh](http://feross.org), and other contributors. Originally forked from an MIT-licensed module by Romain Beauxis. diff --git a/packages/denylist_bot/node_modules/buffer/index.d.ts b/packages/denylist_bot/node_modules/buffer/index.d.ts deleted file mode 100644 index 07096a2f7..000000000 --- a/packages/denylist_bot/node_modules/buffer/index.d.ts +++ /dev/null @@ -1,194 +0,0 @@ -export class Buffer extends Uint8Array { - length: number - write(string: string, offset?: number, length?: number, encoding?: string): number; - toString(encoding?: string, start?: number, end?: number): string; - toJSON(): { type: 'Buffer', data: any[] }; - equals(otherBuffer: Buffer): boolean; - compare(otherBuffer: Uint8Array, targetStart?: number, targetEnd?: number, sourceStart?: number, sourceEnd?: number): number; - copy(targetBuffer: Buffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): number; - slice(start?: number, end?: number): Buffer; - writeUIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; - writeUIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; - writeIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; - writeIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; - readUIntLE(offset: number, byteLength: number, noAssert?: boolean): number; - readUIntBE(offset: number, byteLength: number, noAssert?: boolean): number; - readIntLE(offset: number, byteLength: number, noAssert?: boolean): number; - readIntBE(offset: number, byteLength: number, noAssert?: boolean): number; - readUInt8(offset: number, noAssert?: boolean): number; - readUInt16LE(offset: number, noAssert?: boolean): number; - readUInt16BE(offset: number, noAssert?: boolean): number; - readUInt32LE(offset: number, noAssert?: boolean): number; - readUInt32BE(offset: number, noAssert?: boolean): number; - readBigUInt64LE(offset: number): BigInt; - readBigUInt64BE(offset: number): BigInt; - readInt8(offset: number, noAssert?: boolean): number; - readInt16LE(offset: number, noAssert?: boolean): number; - readInt16BE(offset: number, noAssert?: boolean): number; - readInt32LE(offset: number, noAssert?: boolean): number; - readInt32BE(offset: number, noAssert?: boolean): number; - readBigInt64LE(offset: number): BigInt; - readBigInt64BE(offset: number): BigInt; - readFloatLE(offset: number, noAssert?: boolean): number; - readFloatBE(offset: number, noAssert?: boolean): number; - readDoubleLE(offset: number, noAssert?: boolean): number; - readDoubleBE(offset: number, noAssert?: boolean): number; - reverse(): this; - swap16(): Buffer; - swap32(): Buffer; - swap64(): Buffer; - writeUInt8(value: number, offset: number, noAssert?: boolean): number; - writeUInt16LE(value: number, offset: number, noAssert?: boolean): number; - writeUInt16BE(value: number, offset: number, noAssert?: boolean): number; - writeUInt32LE(value: number, offset: number, noAssert?: boolean): number; - writeUInt32BE(value: number, offset: number, noAssert?: boolean): number; - writeBigUInt64LE(value: number, offset: number): BigInt; - writeBigUInt64BE(value: number, offset: number): BigInt; - writeInt8(value: number, offset: number, noAssert?: boolean): number; - writeInt16LE(value: number, offset: number, noAssert?: boolean): number; - writeInt16BE(value: number, offset: number, noAssert?: boolean): number; - writeInt32LE(value: number, offset: number, noAssert?: boolean): number; - writeInt32BE(value: number, offset: number, noAssert?: boolean): number; - writeBigInt64LE(value: number, offset: number): BigInt; - writeBigInt64BE(value: number, offset: number): BigInt; - writeFloatLE(value: number, offset: number, noAssert?: boolean): number; - writeFloatBE(value: number, offset: number, noAssert?: boolean): number; - writeDoubleLE(value: number, offset: number, noAssert?: boolean): number; - writeDoubleBE(value: number, offset: number, noAssert?: boolean): number; - fill(value: any, offset?: number, end?: number): this; - indexOf(value: string | number | Buffer, byteOffset?: number, encoding?: string): number; - lastIndexOf(value: string | number | Buffer, byteOffset?: number, encoding?: string): number; - includes(value: string | number | Buffer, byteOffset?: number, encoding?: string): boolean; - - /** - * Allocates a new buffer containing the given {str}. - * - * @param str String to store in buffer. - * @param encoding encoding to use, optional. Default is 'utf8' - */ - constructor (str: string, encoding?: string); - /** - * Allocates a new buffer of {size} octets. - * - * @param size count of octets to allocate. - */ - constructor (size: number); - /** - * Allocates a new buffer containing the given {array} of octets. - * - * @param array The octets to store. - */ - constructor (array: Uint8Array); - /** - * Produces a Buffer backed by the same allocated memory as - * the given {ArrayBuffer}. - * - * - * @param arrayBuffer The ArrayBuffer with which to share memory. - */ - constructor (arrayBuffer: ArrayBuffer); - /** - * Allocates a new buffer containing the given {array} of octets. - * - * @param array The octets to store. - */ - constructor (array: any[]); - /** - * Copies the passed {buffer} data onto a new {Buffer} instance. - * - * @param buffer The buffer to copy. - */ - constructor (buffer: Buffer); - prototype: Buffer; - /** - * Allocates a new Buffer using an {array} of octets. - * - * @param array - */ - static from(array: any[]): Buffer; - /** - * When passed a reference to the .buffer property of a TypedArray instance, - * the newly created Buffer will share the same allocated memory as the TypedArray. - * The optional {byteOffset} and {length} arguments specify a memory range - * within the {arrayBuffer} that will be shared by the Buffer. - * - * @param arrayBuffer The .buffer property of a TypedArray or a new ArrayBuffer() - * @param byteOffset - * @param length - */ - static from(arrayBuffer: ArrayBuffer, byteOffset?: number, length?: number): Buffer; - /** - * Copies the passed {buffer} data onto a new Buffer instance. - * - * @param buffer - */ - static from(buffer: Buffer | Uint8Array): Buffer; - /** - * Creates a new Buffer containing the given JavaScript string {str}. - * If provided, the {encoding} parameter identifies the character encoding. - * If not provided, {encoding} defaults to 'utf8'. - * - * @param str - */ - static from(str: string, encoding?: string): Buffer; - /** - * Returns true if {obj} is a Buffer - * - * @param obj object to test. - */ - static isBuffer(obj: any): obj is Buffer; - /** - * Returns true if {encoding} is a valid encoding argument. - * Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex' - * - * @param encoding string to test. - */ - static isEncoding(encoding: string): boolean; - /** - * Gives the actual byte length of a string. encoding defaults to 'utf8'. - * This is not the same as String.prototype.length since that returns the number of characters in a string. - * - * @param string string to test. - * @param encoding encoding used to evaluate (defaults to 'utf8') - */ - static byteLength(string: string, encoding?: string): number; - /** - * Returns a buffer which is the result of concatenating all the buffers in the list together. - * - * If the list has no items, or if the totalLength is 0, then it returns a zero-length buffer. - * If the list has exactly one item, then the first item of the list is returned. - * If the list has more than one item, then a new Buffer is created. - * - * @param list An array of Buffer objects to concatenate - * @param totalLength Total length of the buffers when concatenated. - * If totalLength is not provided, it is read from the buffers in the list. However, this adds an additional loop to the function, so it is faster to provide the length explicitly. - */ - static concat(list: Uint8Array[], totalLength?: number): Buffer; - /** - * The same as buf1.compare(buf2). - */ - static compare(buf1: Uint8Array, buf2: Uint8Array): number; - /** - * Allocates a new buffer of {size} octets. - * - * @param size count of octets to allocate. - * @param fill if specified, buffer will be initialized by calling buf.fill(fill). - * If parameter is omitted, buffer will be filled with zeros. - * @param encoding encoding used for call to buf.fill while initializing - */ - static alloc(size: number, fill?: string | Buffer | number, encoding?: string): Buffer; - /** - * Allocates a new buffer of {size} octets, leaving memory not initialized, so the contents - * of the newly created Buffer are unknown and may contain sensitive data. - * - * @param size count of octets to allocate - */ - static allocUnsafe(size: number): Buffer; - /** - * Allocates a new non-pooled buffer of {size} octets, leaving memory not initialized, so the contents - * of the newly created Buffer are unknown and may contain sensitive data. - * - * @param size count of octets to allocate - */ - static allocUnsafeSlow(size: number): Buffer; -} diff --git a/packages/denylist_bot/node_modules/buffer/index.js b/packages/denylist_bot/node_modules/buffer/index.js deleted file mode 100644 index 7a0e9c2a1..000000000 --- a/packages/denylist_bot/node_modules/buffer/index.js +++ /dev/null @@ -1,2106 +0,0 @@ -/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */ -/* eslint-disable no-proto */ - -'use strict' - -const base64 = require('base64-js') -const ieee754 = require('ieee754') -const customInspectSymbol = - (typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation - ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation - : null - -exports.Buffer = Buffer -exports.SlowBuffer = SlowBuffer -exports.INSPECT_MAX_BYTES = 50 - -const K_MAX_LENGTH = 0x7fffffff -exports.kMaxLength = K_MAX_LENGTH - -/** - * If `Buffer.TYPED_ARRAY_SUPPORT`: - * === true Use Uint8Array implementation (fastest) - * === false Print warning and recommend using `buffer` v4.x which has an Object - * implementation (most compatible, even IE6) - * - * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, - * Opera 11.6+, iOS 4.2+. - * - * We report that the browser does not support typed arrays if the are not subclassable - * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array` - * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support - * for __proto__ and has a buggy typed array implementation. - */ -Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport() - -if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' && - typeof console.error === 'function') { - console.error( - 'This browser lacks typed array (Uint8Array) support which is required by ' + - '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.' - ) -} - -function typedArraySupport () { - // Can typed array instances can be augmented? - try { - const arr = new Uint8Array(1) - const proto = { foo: function () { return 42 } } - Object.setPrototypeOf(proto, Uint8Array.prototype) - Object.setPrototypeOf(arr, proto) - return arr.foo() === 42 - } catch (e) { - return false - } -} - -Object.defineProperty(Buffer.prototype, 'parent', { - enumerable: true, - get: function () { - if (!Buffer.isBuffer(this)) return undefined - return this.buffer - } -}) - -Object.defineProperty(Buffer.prototype, 'offset', { - enumerable: true, - get: function () { - if (!Buffer.isBuffer(this)) return undefined - return this.byteOffset - } -}) - -function createBuffer (length) { - if (length > K_MAX_LENGTH) { - throw new RangeError('The value "' + length + '" is invalid for option "size"') - } - // Return an augmented `Uint8Array` instance - const buf = new Uint8Array(length) - Object.setPrototypeOf(buf, Buffer.prototype) - return buf -} - -/** - * The Buffer constructor returns instances of `Uint8Array` that have their - * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of - * `Uint8Array`, so the returned instances will have all the node `Buffer` methods - * and the `Uint8Array` methods. Square bracket notation works as expected -- it - * returns a single octet. - * - * The `Uint8Array` prototype remains unmodified. - */ - -function Buffer (arg, encodingOrOffset, length) { - // Common case. - if (typeof arg === 'number') { - if (typeof encodingOrOffset === 'string') { - throw new TypeError( - 'The "string" argument must be of type string. Received type number' - ) - } - return allocUnsafe(arg) - } - return from(arg, encodingOrOffset, length) -} - -Buffer.poolSize = 8192 // not used by this implementation - -function from (value, encodingOrOffset, length) { - if (typeof value === 'string') { - return fromString(value, encodingOrOffset) - } - - if (ArrayBuffer.isView(value)) { - return fromArrayView(value) - } - - if (value == null) { - throw new TypeError( - 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + - 'or Array-like Object. Received type ' + (typeof value) - ) - } - - if (isInstance(value, ArrayBuffer) || - (value && isInstance(value.buffer, ArrayBuffer))) { - return fromArrayBuffer(value, encodingOrOffset, length) - } - - if (typeof SharedArrayBuffer !== 'undefined' && - (isInstance(value, SharedArrayBuffer) || - (value && isInstance(value.buffer, SharedArrayBuffer)))) { - return fromArrayBuffer(value, encodingOrOffset, length) - } - - if (typeof value === 'number') { - throw new TypeError( - 'The "value" argument must not be of type number. Received type number' - ) - } - - const valueOf = value.valueOf && value.valueOf() - if (valueOf != null && valueOf !== value) { - return Buffer.from(valueOf, encodingOrOffset, length) - } - - const b = fromObject(value) - if (b) return b - - if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null && - typeof value[Symbol.toPrimitive] === 'function') { - return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length) - } - - throw new TypeError( - 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + - 'or Array-like Object. Received type ' + (typeof value) - ) -} - -/** - * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError - * if value is a number. - * Buffer.from(str[, encoding]) - * Buffer.from(array) - * Buffer.from(buffer) - * Buffer.from(arrayBuffer[, byteOffset[, length]]) - **/ -Buffer.from = function (value, encodingOrOffset, length) { - return from(value, encodingOrOffset, length) -} - -// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug: -// https://github.com/feross/buffer/pull/148 -Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype) -Object.setPrototypeOf(Buffer, Uint8Array) - -function assertSize (size) { - if (typeof size !== 'number') { - throw new TypeError('"size" argument must be of type number') - } else if (size < 0) { - throw new RangeError('The value "' + size + '" is invalid for option "size"') - } -} - -function alloc (size, fill, encoding) { - assertSize(size) - if (size <= 0) { - return createBuffer(size) - } - if (fill !== undefined) { - // Only pay attention to encoding if it's a string. This - // prevents accidentally sending in a number that would - // be interpreted as a start offset. - return typeof encoding === 'string' - ? createBuffer(size).fill(fill, encoding) - : createBuffer(size).fill(fill) - } - return createBuffer(size) -} - -/** - * Creates a new filled Buffer instance. - * alloc(size[, fill[, encoding]]) - **/ -Buffer.alloc = function (size, fill, encoding) { - return alloc(size, fill, encoding) -} - -function allocUnsafe (size) { - assertSize(size) - return createBuffer(size < 0 ? 0 : checked(size) | 0) -} - -/** - * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. - * */ -Buffer.allocUnsafe = function (size) { - return allocUnsafe(size) -} -/** - * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. - */ -Buffer.allocUnsafeSlow = function (size) { - return allocUnsafe(size) -} - -function fromString (string, encoding) { - if (typeof encoding !== 'string' || encoding === '') { - encoding = 'utf8' - } - - if (!Buffer.isEncoding(encoding)) { - throw new TypeError('Unknown encoding: ' + encoding) - } - - const length = byteLength(string, encoding) | 0 - let buf = createBuffer(length) - - const actual = buf.write(string, encoding) - - if (actual !== length) { - // Writing a hex string, for example, that contains invalid characters will - // cause everything after the first invalid character to be ignored. (e.g. - // 'abxxcd' will be treated as 'ab') - buf = buf.slice(0, actual) - } - - return buf -} - -function fromArrayLike (array) { - const length = array.length < 0 ? 0 : checked(array.length) | 0 - const buf = createBuffer(length) - for (let i = 0; i < length; i += 1) { - buf[i] = array[i] & 255 - } - return buf -} - -function fromArrayView (arrayView) { - if (isInstance(arrayView, Uint8Array)) { - const copy = new Uint8Array(arrayView) - return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength) - } - return fromArrayLike(arrayView) -} - -function fromArrayBuffer (array, byteOffset, length) { - if (byteOffset < 0 || array.byteLength < byteOffset) { - throw new RangeError('"offset" is outside of buffer bounds') - } - - if (array.byteLength < byteOffset + (length || 0)) { - throw new RangeError('"length" is outside of buffer bounds') - } - - let buf - if (byteOffset === undefined && length === undefined) { - buf = new Uint8Array(array) - } else if (length === undefined) { - buf = new Uint8Array(array, byteOffset) - } else { - buf = new Uint8Array(array, byteOffset, length) - } - - // Return an augmented `Uint8Array` instance - Object.setPrototypeOf(buf, Buffer.prototype) - - return buf -} - -function fromObject (obj) { - if (Buffer.isBuffer(obj)) { - const len = checked(obj.length) | 0 - const buf = createBuffer(len) - - if (buf.length === 0) { - return buf - } - - obj.copy(buf, 0, 0, len) - return buf - } - - if (obj.length !== undefined) { - if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) { - return createBuffer(0) - } - return fromArrayLike(obj) - } - - if (obj.type === 'Buffer' && Array.isArray(obj.data)) { - return fromArrayLike(obj.data) - } -} - -function checked (length) { - // Note: cannot use `length < K_MAX_LENGTH` here because that fails when - // length is NaN (which is otherwise coerced to zero.) - if (length >= K_MAX_LENGTH) { - throw new RangeError('Attempt to allocate Buffer larger than maximum ' + - 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes') - } - return length | 0 -} - -function SlowBuffer (length) { - if (+length != length) { // eslint-disable-line eqeqeq - length = 0 - } - return Buffer.alloc(+length) -} - -Buffer.isBuffer = function isBuffer (b) { - return b != null && b._isBuffer === true && - b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false -} - -Buffer.compare = function compare (a, b) { - if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength) - if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength) - if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { - throw new TypeError( - 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array' - ) - } - - if (a === b) return 0 - - let x = a.length - let y = b.length - - for (let i = 0, len = Math.min(x, y); i < len; ++i) { - if (a[i] !== b[i]) { - x = a[i] - y = b[i] - break - } - } - - if (x < y) return -1 - if (y < x) return 1 - return 0 -} - -Buffer.isEncoding = function isEncoding (encoding) { - switch (String(encoding).toLowerCase()) { - case 'hex': - case 'utf8': - case 'utf-8': - case 'ascii': - case 'latin1': - case 'binary': - case 'base64': - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return true - default: - return false - } -} - -Buffer.concat = function concat (list, length) { - if (!Array.isArray(list)) { - throw new TypeError('"list" argument must be an Array of Buffers') - } - - if (list.length === 0) { - return Buffer.alloc(0) - } - - let i - if (length === undefined) { - length = 0 - for (i = 0; i < list.length; ++i) { - length += list[i].length - } - } - - const buffer = Buffer.allocUnsafe(length) - let pos = 0 - for (i = 0; i < list.length; ++i) { - let buf = list[i] - if (isInstance(buf, Uint8Array)) { - if (pos + buf.length > buffer.length) { - if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf) - buf.copy(buffer, pos) - } else { - Uint8Array.prototype.set.call( - buffer, - buf, - pos - ) - } - } else if (!Buffer.isBuffer(buf)) { - throw new TypeError('"list" argument must be an Array of Buffers') - } else { - buf.copy(buffer, pos) - } - pos += buf.length - } - return buffer -} - -function byteLength (string, encoding) { - if (Buffer.isBuffer(string)) { - return string.length - } - if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) { - return string.byteLength - } - if (typeof string !== 'string') { - throw new TypeError( - 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' + - 'Received type ' + typeof string - ) - } - - const len = string.length - const mustMatch = (arguments.length > 2 && arguments[2] === true) - if (!mustMatch && len === 0) return 0 - - // Use a for loop to avoid recursion - let loweredCase = false - for (;;) { - switch (encoding) { - case 'ascii': - case 'latin1': - case 'binary': - return len - case 'utf8': - case 'utf-8': - return utf8ToBytes(string).length - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return len * 2 - case 'hex': - return len >>> 1 - case 'base64': - return base64ToBytes(string).length - default: - if (loweredCase) { - return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8 - } - encoding = ('' + encoding).toLowerCase() - loweredCase = true - } - } -} -Buffer.byteLength = byteLength - -function slowToString (encoding, start, end) { - let loweredCase = false - - // No need to verify that "this.length <= MAX_UINT32" since it's a read-only - // property of a typed array. - - // This behaves neither like String nor Uint8Array in that we set start/end - // to their upper/lower bounds if the value passed is out of range. - // undefined is handled specially as per ECMA-262 6th Edition, - // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. - if (start === undefined || start < 0) { - start = 0 - } - // Return early if start > this.length. Done here to prevent potential uint32 - // coercion fail below. - if (start > this.length) { - return '' - } - - if (end === undefined || end > this.length) { - end = this.length - } - - if (end <= 0) { - return '' - } - - // Force coercion to uint32. This will also coerce falsey/NaN values to 0. - end >>>= 0 - start >>>= 0 - - if (end <= start) { - return '' - } - - if (!encoding) encoding = 'utf8' - - while (true) { - switch (encoding) { - case 'hex': - return hexSlice(this, start, end) - - case 'utf8': - case 'utf-8': - return utf8Slice(this, start, end) - - case 'ascii': - return asciiSlice(this, start, end) - - case 'latin1': - case 'binary': - return latin1Slice(this, start, end) - - case 'base64': - return base64Slice(this, start, end) - - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return utf16leSlice(this, start, end) - - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) - encoding = (encoding + '').toLowerCase() - loweredCase = true - } - } -} - -// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package) -// to detect a Buffer instance. It's not possible to use `instanceof Buffer` -// reliably in a browserify context because there could be multiple different -// copies of the 'buffer' package in use. This method works even for Buffer -// instances that were created from another copy of the `buffer` package. -// See: https://github.com/feross/buffer/issues/154 -Buffer.prototype._isBuffer = true - -function swap (b, n, m) { - const i = b[n] - b[n] = b[m] - b[m] = i -} - -Buffer.prototype.swap16 = function swap16 () { - const len = this.length - if (len % 2 !== 0) { - throw new RangeError('Buffer size must be a multiple of 16-bits') - } - for (let i = 0; i < len; i += 2) { - swap(this, i, i + 1) - } - return this -} - -Buffer.prototype.swap32 = function swap32 () { - const len = this.length - if (len % 4 !== 0) { - throw new RangeError('Buffer size must be a multiple of 32-bits') - } - for (let i = 0; i < len; i += 4) { - swap(this, i, i + 3) - swap(this, i + 1, i + 2) - } - return this -} - -Buffer.prototype.swap64 = function swap64 () { - const len = this.length - if (len % 8 !== 0) { - throw new RangeError('Buffer size must be a multiple of 64-bits') - } - for (let i = 0; i < len; i += 8) { - swap(this, i, i + 7) - swap(this, i + 1, i + 6) - swap(this, i + 2, i + 5) - swap(this, i + 3, i + 4) - } - return this -} - -Buffer.prototype.toString = function toString () { - const length = this.length - if (length === 0) return '' - if (arguments.length === 0) return utf8Slice(this, 0, length) - return slowToString.apply(this, arguments) -} - -Buffer.prototype.toLocaleString = Buffer.prototype.toString - -Buffer.prototype.equals = function equals (b) { - if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer') - if (this === b) return true - return Buffer.compare(this, b) === 0 -} - -Buffer.prototype.inspect = function inspect () { - let str = '' - const max = exports.INSPECT_MAX_BYTES - str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim() - if (this.length > max) str += ' ... ' - return '' -} -if (customInspectSymbol) { - Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect -} - -Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { - if (isInstance(target, Uint8Array)) { - target = Buffer.from(target, target.offset, target.byteLength) - } - if (!Buffer.isBuffer(target)) { - throw new TypeError( - 'The "target" argument must be one of type Buffer or Uint8Array. ' + - 'Received type ' + (typeof target) - ) - } - - if (start === undefined) { - start = 0 - } - if (end === undefined) { - end = target ? target.length : 0 - } - if (thisStart === undefined) { - thisStart = 0 - } - if (thisEnd === undefined) { - thisEnd = this.length - } - - if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { - throw new RangeError('out of range index') - } - - if (thisStart >= thisEnd && start >= end) { - return 0 - } - if (thisStart >= thisEnd) { - return -1 - } - if (start >= end) { - return 1 - } - - start >>>= 0 - end >>>= 0 - thisStart >>>= 0 - thisEnd >>>= 0 - - if (this === target) return 0 - - let x = thisEnd - thisStart - let y = end - start - const len = Math.min(x, y) - - const thisCopy = this.slice(thisStart, thisEnd) - const targetCopy = target.slice(start, end) - - for (let i = 0; i < len; ++i) { - if (thisCopy[i] !== targetCopy[i]) { - x = thisCopy[i] - y = targetCopy[i] - break - } - } - - if (x < y) return -1 - if (y < x) return 1 - return 0 -} - -// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, -// OR the last index of `val` in `buffer` at offset <= `byteOffset`. -// -// Arguments: -// - buffer - a Buffer to search -// - val - a string, Buffer, or number -// - byteOffset - an index into `buffer`; will be clamped to an int32 -// - encoding - an optional encoding, relevant is val is a string -// - dir - true for indexOf, false for lastIndexOf -function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { - // Empty buffer means no match - if (buffer.length === 0) return -1 - - // Normalize byteOffset - if (typeof byteOffset === 'string') { - encoding = byteOffset - byteOffset = 0 - } else if (byteOffset > 0x7fffffff) { - byteOffset = 0x7fffffff - } else if (byteOffset < -0x80000000) { - byteOffset = -0x80000000 - } - byteOffset = +byteOffset // Coerce to Number. - if (numberIsNaN(byteOffset)) { - // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer - byteOffset = dir ? 0 : (buffer.length - 1) - } - - // Normalize byteOffset: negative offsets start from the end of the buffer - if (byteOffset < 0) byteOffset = buffer.length + byteOffset - if (byteOffset >= buffer.length) { - if (dir) return -1 - else byteOffset = buffer.length - 1 - } else if (byteOffset < 0) { - if (dir) byteOffset = 0 - else return -1 - } - - // Normalize val - if (typeof val === 'string') { - val = Buffer.from(val, encoding) - } - - // Finally, search either indexOf (if dir is true) or lastIndexOf - if (Buffer.isBuffer(val)) { - // Special case: looking for empty string/buffer always fails - if (val.length === 0) { - return -1 - } - return arrayIndexOf(buffer, val, byteOffset, encoding, dir) - } else if (typeof val === 'number') { - val = val & 0xFF // Search for a byte value [0-255] - if (typeof Uint8Array.prototype.indexOf === 'function') { - if (dir) { - return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset) - } else { - return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) - } - } - return arrayIndexOf(buffer, [val], byteOffset, encoding, dir) - } - - throw new TypeError('val must be string, number or Buffer') -} - -function arrayIndexOf (arr, val, byteOffset, encoding, dir) { - let indexSize = 1 - let arrLength = arr.length - let valLength = val.length - - if (encoding !== undefined) { - encoding = String(encoding).toLowerCase() - if (encoding === 'ucs2' || encoding === 'ucs-2' || - encoding === 'utf16le' || encoding === 'utf-16le') { - if (arr.length < 2 || val.length < 2) { - return -1 - } - indexSize = 2 - arrLength /= 2 - valLength /= 2 - byteOffset /= 2 - } - } - - function read (buf, i) { - if (indexSize === 1) { - return buf[i] - } else { - return buf.readUInt16BE(i * indexSize) - } - } - - let i - if (dir) { - let foundIndex = -1 - for (i = byteOffset; i < arrLength; i++) { - if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { - if (foundIndex === -1) foundIndex = i - if (i - foundIndex + 1 === valLength) return foundIndex * indexSize - } else { - if (foundIndex !== -1) i -= i - foundIndex - foundIndex = -1 - } - } - } else { - if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength - for (i = byteOffset; i >= 0; i--) { - let found = true - for (let j = 0; j < valLength; j++) { - if (read(arr, i + j) !== read(val, j)) { - found = false - break - } - } - if (found) return i - } - } - - return -1 -} - -Buffer.prototype.includes = function includes (val, byteOffset, encoding) { - return this.indexOf(val, byteOffset, encoding) !== -1 -} - -Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, true) -} - -Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, false) -} - -function hexWrite (buf, string, offset, length) { - offset = Number(offset) || 0 - const remaining = buf.length - offset - if (!length) { - length = remaining - } else { - length = Number(length) - if (length > remaining) { - length = remaining - } - } - - const strLen = string.length - - if (length > strLen / 2) { - length = strLen / 2 - } - let i - for (i = 0; i < length; ++i) { - const parsed = parseInt(string.substr(i * 2, 2), 16) - if (numberIsNaN(parsed)) return i - buf[offset + i] = parsed - } - return i -} - -function utf8Write (buf, string, offset, length) { - return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) -} - -function asciiWrite (buf, string, offset, length) { - return blitBuffer(asciiToBytes(string), buf, offset, length) -} - -function base64Write (buf, string, offset, length) { - return blitBuffer(base64ToBytes(string), buf, offset, length) -} - -function ucs2Write (buf, string, offset, length) { - return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) -} - -Buffer.prototype.write = function write (string, offset, length, encoding) { - // Buffer#write(string) - if (offset === undefined) { - encoding = 'utf8' - length = this.length - offset = 0 - // Buffer#write(string, encoding) - } else if (length === undefined && typeof offset === 'string') { - encoding = offset - length = this.length - offset = 0 - // Buffer#write(string, offset[, length][, encoding]) - } else if (isFinite(offset)) { - offset = offset >>> 0 - if (isFinite(length)) { - length = length >>> 0 - if (encoding === undefined) encoding = 'utf8' - } else { - encoding = length - length = undefined - } - } else { - throw new Error( - 'Buffer.write(string, encoding, offset[, length]) is no longer supported' - ) - } - - const remaining = this.length - offset - if (length === undefined || length > remaining) length = remaining - - if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { - throw new RangeError('Attempt to write outside buffer bounds') - } - - if (!encoding) encoding = 'utf8' - - let loweredCase = false - for (;;) { - switch (encoding) { - case 'hex': - return hexWrite(this, string, offset, length) - - case 'utf8': - case 'utf-8': - return utf8Write(this, string, offset, length) - - case 'ascii': - case 'latin1': - case 'binary': - return asciiWrite(this, string, offset, length) - - case 'base64': - // Warning: maxLength not taken into account in base64Write - return base64Write(this, string, offset, length) - - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return ucs2Write(this, string, offset, length) - - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) - encoding = ('' + encoding).toLowerCase() - loweredCase = true - } - } -} - -Buffer.prototype.toJSON = function toJSON () { - return { - type: 'Buffer', - data: Array.prototype.slice.call(this._arr || this, 0) - } -} - -function base64Slice (buf, start, end) { - if (start === 0 && end === buf.length) { - return base64.fromByteArray(buf) - } else { - return base64.fromByteArray(buf.slice(start, end)) - } -} - -function utf8Slice (buf, start, end) { - end = Math.min(buf.length, end) - const res = [] - - let i = start - while (i < end) { - const firstByte = buf[i] - let codePoint = null - let bytesPerSequence = (firstByte > 0xEF) - ? 4 - : (firstByte > 0xDF) - ? 3 - : (firstByte > 0xBF) - ? 2 - : 1 - - if (i + bytesPerSequence <= end) { - let secondByte, thirdByte, fourthByte, tempCodePoint - - switch (bytesPerSequence) { - case 1: - if (firstByte < 0x80) { - codePoint = firstByte - } - break - case 2: - secondByte = buf[i + 1] - if ((secondByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F) - if (tempCodePoint > 0x7F) { - codePoint = tempCodePoint - } - } - break - case 3: - secondByte = buf[i + 1] - thirdByte = buf[i + 2] - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F) - if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { - codePoint = tempCodePoint - } - } - break - case 4: - secondByte = buf[i + 1] - thirdByte = buf[i + 2] - fourthByte = buf[i + 3] - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F) - if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { - codePoint = tempCodePoint - } - } - } - } - - if (codePoint === null) { - // we did not generate a valid codePoint so insert a - // replacement char (U+FFFD) and advance only 1 byte - codePoint = 0xFFFD - bytesPerSequence = 1 - } else if (codePoint > 0xFFFF) { - // encode to utf16 (surrogate pair dance) - codePoint -= 0x10000 - res.push(codePoint >>> 10 & 0x3FF | 0xD800) - codePoint = 0xDC00 | codePoint & 0x3FF - } - - res.push(codePoint) - i += bytesPerSequence - } - - return decodeCodePointsArray(res) -} - -// Based on http://stackoverflow.com/a/22747272/680742, the browser with -// the lowest limit is Chrome, with 0x10000 args. -// We go 1 magnitude less, for safety -const MAX_ARGUMENTS_LENGTH = 0x1000 - -function decodeCodePointsArray (codePoints) { - const len = codePoints.length - if (len <= MAX_ARGUMENTS_LENGTH) { - return String.fromCharCode.apply(String, codePoints) // avoid extra slice() - } - - // Decode in chunks to avoid "call stack size exceeded". - let res = '' - let i = 0 - while (i < len) { - res += String.fromCharCode.apply( - String, - codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) - ) - } - return res -} - -function asciiSlice (buf, start, end) { - let ret = '' - end = Math.min(buf.length, end) - - for (let i = start; i < end; ++i) { - ret += String.fromCharCode(buf[i] & 0x7F) - } - return ret -} - -function latin1Slice (buf, start, end) { - let ret = '' - end = Math.min(buf.length, end) - - for (let i = start; i < end; ++i) { - ret += String.fromCharCode(buf[i]) - } - return ret -} - -function hexSlice (buf, start, end) { - const len = buf.length - - if (!start || start < 0) start = 0 - if (!end || end < 0 || end > len) end = len - - let out = '' - for (let i = start; i < end; ++i) { - out += hexSliceLookupTable[buf[i]] - } - return out -} - -function utf16leSlice (buf, start, end) { - const bytes = buf.slice(start, end) - let res = '' - // If bytes.length is odd, the last 8 bits must be ignored (same as node.js) - for (let i = 0; i < bytes.length - 1; i += 2) { - res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256)) - } - return res -} - -Buffer.prototype.slice = function slice (start, end) { - const len = this.length - start = ~~start - end = end === undefined ? len : ~~end - - if (start < 0) { - start += len - if (start < 0) start = 0 - } else if (start > len) { - start = len - } - - if (end < 0) { - end += len - if (end < 0) end = 0 - } else if (end > len) { - end = len - } - - if (end < start) end = start - - const newBuf = this.subarray(start, end) - // Return an augmented `Uint8Array` instance - Object.setPrototypeOf(newBuf, Buffer.prototype) - - return newBuf -} - -/* - * Need to make sure that buffer isn't trying to write out of bounds. - */ -function checkOffset (offset, ext, length) { - if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') - if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') -} - -Buffer.prototype.readUintLE = -Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - let val = this[offset] - let mul = 1 - let i = 0 - while (++i < byteLength && (mul *= 0x100)) { - val += this[offset + i] * mul - } - - return val -} - -Buffer.prototype.readUintBE = -Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) { - checkOffset(offset, byteLength, this.length) - } - - let val = this[offset + --byteLength] - let mul = 1 - while (byteLength > 0 && (mul *= 0x100)) { - val += this[offset + --byteLength] * mul - } - - return val -} - -Buffer.prototype.readUint8 = -Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 1, this.length) - return this[offset] -} - -Buffer.prototype.readUint16LE = -Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 2, this.length) - return this[offset] | (this[offset + 1] << 8) -} - -Buffer.prototype.readUint16BE = -Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 2, this.length) - return (this[offset] << 8) | this[offset + 1] -} - -Buffer.prototype.readUint32LE = -Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - - return ((this[offset]) | - (this[offset + 1] << 8) | - (this[offset + 2] << 16)) + - (this[offset + 3] * 0x1000000) -} - -Buffer.prototype.readUint32BE = -Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset] * 0x1000000) + - ((this[offset + 1] << 16) | - (this[offset + 2] << 8) | - this[offset + 3]) -} - -Buffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE (offset) { - offset = offset >>> 0 - validateNumber(offset, 'offset') - const first = this[offset] - const last = this[offset + 7] - if (first === undefined || last === undefined) { - boundsError(offset, this.length - 8) - } - - const lo = first + - this[++offset] * 2 ** 8 + - this[++offset] * 2 ** 16 + - this[++offset] * 2 ** 24 - - const hi = this[++offset] + - this[++offset] * 2 ** 8 + - this[++offset] * 2 ** 16 + - last * 2 ** 24 - - return BigInt(lo) + (BigInt(hi) << BigInt(32)) -}) - -Buffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE (offset) { - offset = offset >>> 0 - validateNumber(offset, 'offset') - const first = this[offset] - const last = this[offset + 7] - if (first === undefined || last === undefined) { - boundsError(offset, this.length - 8) - } - - const hi = first * 2 ** 24 + - this[++offset] * 2 ** 16 + - this[++offset] * 2 ** 8 + - this[++offset] - - const lo = this[++offset] * 2 ** 24 + - this[++offset] * 2 ** 16 + - this[++offset] * 2 ** 8 + - last - - return (BigInt(hi) << BigInt(32)) + BigInt(lo) -}) - -Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) { - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - let val = this[offset] - let mul = 1 - let i = 0 - while (++i < byteLength && (mul *= 0x100)) { - val += this[offset + i] * mul - } - mul *= 0x80 - - if (val >= mul) val -= Math.pow(2, 8 * byteLength) - - return val -} - -Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - let i = byteLength - let mul = 1 - let val = this[offset + --i] - while (i > 0 && (mul *= 0x100)) { - val += this[offset + --i] * mul - } - mul *= 0x80 - - if (val >= mul) val -= Math.pow(2, 8 * byteLength) - - return val -} - -Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 1, this.length) - if (!(this[offset] & 0x80)) return (this[offset]) - return ((0xff - this[offset] + 1) * -1) -} - -Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 2, this.length) - const val = this[offset] | (this[offset + 1] << 8) - return (val & 0x8000) ? val | 0xFFFF0000 : val -} - -Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 2, this.length) - const val = this[offset + 1] | (this[offset] << 8) - return (val & 0x8000) ? val | 0xFFFF0000 : val -} - -Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset]) | - (this[offset + 1] << 8) | - (this[offset + 2] << 16) | - (this[offset + 3] << 24) -} - -Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset] << 24) | - (this[offset + 1] << 16) | - (this[offset + 2] << 8) | - (this[offset + 3]) -} - -Buffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE (offset) { - offset = offset >>> 0 - validateNumber(offset, 'offset') - const first = this[offset] - const last = this[offset + 7] - if (first === undefined || last === undefined) { - boundsError(offset, this.length - 8) - } - - const val = this[offset + 4] + - this[offset + 5] * 2 ** 8 + - this[offset + 6] * 2 ** 16 + - (last << 24) // Overflow - - return (BigInt(val) << BigInt(32)) + - BigInt(first + - this[++offset] * 2 ** 8 + - this[++offset] * 2 ** 16 + - this[++offset] * 2 ** 24) -}) - -Buffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE (offset) { - offset = offset >>> 0 - validateNumber(offset, 'offset') - const first = this[offset] - const last = this[offset + 7] - if (first === undefined || last === undefined) { - boundsError(offset, this.length - 8) - } - - const val = (first << 24) + // Overflow - this[++offset] * 2 ** 16 + - this[++offset] * 2 ** 8 + - this[++offset] - - return (BigInt(val) << BigInt(32)) + - BigInt(this[++offset] * 2 ** 24 + - this[++offset] * 2 ** 16 + - this[++offset] * 2 ** 8 + - last) -}) - -Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - return ieee754.read(this, offset, true, 23, 4) -} - -Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - return ieee754.read(this, offset, false, 23, 4) -} - -Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 8, this.length) - return ieee754.read(this, offset, true, 52, 8) -} - -Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 8, this.length) - return ieee754.read(this, offset, false, 52, 8) -} - -function checkInt (buf, value, offset, ext, max, min) { - if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance') - if (value > max || value < min) throw new RangeError('"value" argument is out of bounds') - if (offset + ext > buf.length) throw new RangeError('Index out of range') -} - -Buffer.prototype.writeUintLE = -Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) { - value = +value - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) { - const maxBytes = Math.pow(2, 8 * byteLength) - 1 - checkInt(this, value, offset, byteLength, maxBytes, 0) - } - - let mul = 1 - let i = 0 - this[offset] = value & 0xFF - while (++i < byteLength && (mul *= 0x100)) { - this[offset + i] = (value / mul) & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeUintBE = -Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) { - value = +value - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) { - const maxBytes = Math.pow(2, 8 * byteLength) - 1 - checkInt(this, value, offset, byteLength, maxBytes, 0) - } - - let i = byteLength - 1 - let mul = 1 - this[offset + i] = value & 0xFF - while (--i >= 0 && (mul *= 0x100)) { - this[offset + i] = (value / mul) & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeUint8 = -Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0) - this[offset] = (value & 0xff) - return offset + 1 -} - -Buffer.prototype.writeUint16LE = -Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - return offset + 2 -} - -Buffer.prototype.writeUint16BE = -Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) - this[offset] = (value >>> 8) - this[offset + 1] = (value & 0xff) - return offset + 2 -} - -Buffer.prototype.writeUint32LE = -Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) - this[offset + 3] = (value >>> 24) - this[offset + 2] = (value >>> 16) - this[offset + 1] = (value >>> 8) - this[offset] = (value & 0xff) - return offset + 4 -} - -Buffer.prototype.writeUint32BE = -Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) - this[offset] = (value >>> 24) - this[offset + 1] = (value >>> 16) - this[offset + 2] = (value >>> 8) - this[offset + 3] = (value & 0xff) - return offset + 4 -} - -function wrtBigUInt64LE (buf, value, offset, min, max) { - checkIntBI(value, min, max, buf, offset, 7) - - let lo = Number(value & BigInt(0xffffffff)) - buf[offset++] = lo - lo = lo >> 8 - buf[offset++] = lo - lo = lo >> 8 - buf[offset++] = lo - lo = lo >> 8 - buf[offset++] = lo - let hi = Number(value >> BigInt(32) & BigInt(0xffffffff)) - buf[offset++] = hi - hi = hi >> 8 - buf[offset++] = hi - hi = hi >> 8 - buf[offset++] = hi - hi = hi >> 8 - buf[offset++] = hi - return offset -} - -function wrtBigUInt64BE (buf, value, offset, min, max) { - checkIntBI(value, min, max, buf, offset, 7) - - let lo = Number(value & BigInt(0xffffffff)) - buf[offset + 7] = lo - lo = lo >> 8 - buf[offset + 6] = lo - lo = lo >> 8 - buf[offset + 5] = lo - lo = lo >> 8 - buf[offset + 4] = lo - let hi = Number(value >> BigInt(32) & BigInt(0xffffffff)) - buf[offset + 3] = hi - hi = hi >> 8 - buf[offset + 2] = hi - hi = hi >> 8 - buf[offset + 1] = hi - hi = hi >> 8 - buf[offset] = hi - return offset + 8 -} - -Buffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE (value, offset = 0) { - return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff')) -}) - -Buffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) { - return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff')) -}) - -Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) { - const limit = Math.pow(2, (8 * byteLength) - 1) - - checkInt(this, value, offset, byteLength, limit - 1, -limit) - } - - let i = 0 - let mul = 1 - let sub = 0 - this[offset] = value & 0xFF - while (++i < byteLength && (mul *= 0x100)) { - if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { - sub = 1 - } - this[offset + i] = ((value / mul) >> 0) - sub & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) { - const limit = Math.pow(2, (8 * byteLength) - 1) - - checkInt(this, value, offset, byteLength, limit - 1, -limit) - } - - let i = byteLength - 1 - let mul = 1 - let sub = 0 - this[offset + i] = value & 0xFF - while (--i >= 0 && (mul *= 0x100)) { - if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { - sub = 1 - } - this[offset + i] = ((value / mul) >> 0) - sub & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80) - if (value < 0) value = 0xff + value + 1 - this[offset] = (value & 0xff) - return offset + 1 -} - -Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - return offset + 2 -} - -Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) - this[offset] = (value >>> 8) - this[offset + 1] = (value & 0xff) - return offset + 2 -} - -Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - this[offset + 2] = (value >>> 16) - this[offset + 3] = (value >>> 24) - return offset + 4 -} - -Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) - if (value < 0) value = 0xffffffff + value + 1 - this[offset] = (value >>> 24) - this[offset + 1] = (value >>> 16) - this[offset + 2] = (value >>> 8) - this[offset + 3] = (value & 0xff) - return offset + 4 -} - -Buffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) { - return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff')) -}) - -Buffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) { - return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff')) -}) - -function checkIEEE754 (buf, value, offset, ext, max, min) { - if (offset + ext > buf.length) throw new RangeError('Index out of range') - if (offset < 0) throw new RangeError('Index out of range') -} - -function writeFloat (buf, value, offset, littleEndian, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) { - checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38) - } - ieee754.write(buf, value, offset, littleEndian, 23, 4) - return offset + 4 -} - -Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { - return writeFloat(this, value, offset, true, noAssert) -} - -Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) { - return writeFloat(this, value, offset, false, noAssert) -} - -function writeDouble (buf, value, offset, littleEndian, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) { - checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308) - } - ieee754.write(buf, value, offset, littleEndian, 52, 8) - return offset + 8 -} - -Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { - return writeDouble(this, value, offset, true, noAssert) -} - -Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { - return writeDouble(this, value, offset, false, noAssert) -} - -// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) -Buffer.prototype.copy = function copy (target, targetStart, start, end) { - if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer') - if (!start) start = 0 - if (!end && end !== 0) end = this.length - if (targetStart >= target.length) targetStart = target.length - if (!targetStart) targetStart = 0 - if (end > 0 && end < start) end = start - - // Copy 0 bytes; we're done - if (end === start) return 0 - if (target.length === 0 || this.length === 0) return 0 - - // Fatal error conditions - if (targetStart < 0) { - throw new RangeError('targetStart out of bounds') - } - if (start < 0 || start >= this.length) throw new RangeError('Index out of range') - if (end < 0) throw new RangeError('sourceEnd out of bounds') - - // Are we oob? - if (end > this.length) end = this.length - if (target.length - targetStart < end - start) { - end = target.length - targetStart + start - } - - const len = end - start - - if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') { - // Use built-in when available, missing from IE11 - this.copyWithin(targetStart, start, end) - } else { - Uint8Array.prototype.set.call( - target, - this.subarray(start, end), - targetStart - ) - } - - return len -} - -// Usage: -// buffer.fill(number[, offset[, end]]) -// buffer.fill(buffer[, offset[, end]]) -// buffer.fill(string[, offset[, end]][, encoding]) -Buffer.prototype.fill = function fill (val, start, end, encoding) { - // Handle string cases: - if (typeof val === 'string') { - if (typeof start === 'string') { - encoding = start - start = 0 - end = this.length - } else if (typeof end === 'string') { - encoding = end - end = this.length - } - if (encoding !== undefined && typeof encoding !== 'string') { - throw new TypeError('encoding must be a string') - } - if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) { - throw new TypeError('Unknown encoding: ' + encoding) - } - if (val.length === 1) { - const code = val.charCodeAt(0) - if ((encoding === 'utf8' && code < 128) || - encoding === 'latin1') { - // Fast path: If `val` fits into a single byte, use that numeric value. - val = code - } - } - } else if (typeof val === 'number') { - val = val & 255 - } else if (typeof val === 'boolean') { - val = Number(val) - } - - // Invalid ranges are not set to a default, so can range check early. - if (start < 0 || this.length < start || this.length < end) { - throw new RangeError('Out of range index') - } - - if (end <= start) { - return this - } - - start = start >>> 0 - end = end === undefined ? this.length : end >>> 0 - - if (!val) val = 0 - - let i - if (typeof val === 'number') { - for (i = start; i < end; ++i) { - this[i] = val - } - } else { - const bytes = Buffer.isBuffer(val) - ? val - : Buffer.from(val, encoding) - const len = bytes.length - if (len === 0) { - throw new TypeError('The value "' + val + - '" is invalid for argument "value"') - } - for (i = 0; i < end - start; ++i) { - this[i + start] = bytes[i % len] - } - } - - return this -} - -// CUSTOM ERRORS -// ============= - -// Simplified versions from Node, changed for Buffer-only usage -const errors = {} -function E (sym, getMessage, Base) { - errors[sym] = class NodeError extends Base { - constructor () { - super() - - Object.defineProperty(this, 'message', { - value: getMessage.apply(this, arguments), - writable: true, - configurable: true - }) - - // Add the error code to the name to include it in the stack trace. - this.name = `${this.name} [${sym}]` - // Access the stack to generate the error message including the error code - // from the name. - this.stack // eslint-disable-line no-unused-expressions - // Reset the name to the actual name. - delete this.name - } - - get code () { - return sym - } - - set code (value) { - Object.defineProperty(this, 'code', { - configurable: true, - enumerable: true, - value, - writable: true - }) - } - - toString () { - return `${this.name} [${sym}]: ${this.message}` - } - } -} - -E('ERR_BUFFER_OUT_OF_BOUNDS', - function (name) { - if (name) { - return `${name} is outside of buffer bounds` - } - - return 'Attempt to access memory outside buffer bounds' - }, RangeError) -E('ERR_INVALID_ARG_TYPE', - function (name, actual) { - return `The "${name}" argument must be of type number. Received type ${typeof actual}` - }, TypeError) -E('ERR_OUT_OF_RANGE', - function (str, range, input) { - let msg = `The value of "${str}" is out of range.` - let received = input - if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) { - received = addNumericalSeparator(String(input)) - } else if (typeof input === 'bigint') { - received = String(input) - if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) { - received = addNumericalSeparator(received) - } - received += 'n' - } - msg += ` It must be ${range}. Received ${received}` - return msg - }, RangeError) - -function addNumericalSeparator (val) { - let res = '' - let i = val.length - const start = val[0] === '-' ? 1 : 0 - for (; i >= start + 4; i -= 3) { - res = `_${val.slice(i - 3, i)}${res}` - } - return `${val.slice(0, i)}${res}` -} - -// CHECK FUNCTIONS -// =============== - -function checkBounds (buf, offset, byteLength) { - validateNumber(offset, 'offset') - if (buf[offset] === undefined || buf[offset + byteLength] === undefined) { - boundsError(offset, buf.length - (byteLength + 1)) - } -} - -function checkIntBI (value, min, max, buf, offset, byteLength) { - if (value > max || value < min) { - const n = typeof min === 'bigint' ? 'n' : '' - let range - if (byteLength > 3) { - if (min === 0 || min === BigInt(0)) { - range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}` - } else { - range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` + - `${(byteLength + 1) * 8 - 1}${n}` - } - } else { - range = `>= ${min}${n} and <= ${max}${n}` - } - throw new errors.ERR_OUT_OF_RANGE('value', range, value) - } - checkBounds(buf, offset, byteLength) -} - -function validateNumber (value, name) { - if (typeof value !== 'number') { - throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value) - } -} - -function boundsError (value, length, type) { - if (Math.floor(value) !== value) { - validateNumber(value, type) - throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value) - } - - if (length < 0) { - throw new errors.ERR_BUFFER_OUT_OF_BOUNDS() - } - - throw new errors.ERR_OUT_OF_RANGE(type || 'offset', - `>= ${type ? 1 : 0} and <= ${length}`, - value) -} - -// HELPER FUNCTIONS -// ================ - -const INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g - -function base64clean (str) { - // Node takes equal signs as end of the Base64 encoding - str = str.split('=')[0] - // Node strips out invalid characters like \n and \t from the string, base64-js does not - str = str.trim().replace(INVALID_BASE64_RE, '') - // Node converts strings with length < 2 to '' - if (str.length < 2) return '' - // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not - while (str.length % 4 !== 0) { - str = str + '=' - } - return str -} - -function utf8ToBytes (string, units) { - units = units || Infinity - let codePoint - const length = string.length - let leadSurrogate = null - const bytes = [] - - for (let i = 0; i < length; ++i) { - codePoint = string.charCodeAt(i) - - // is surrogate component - if (codePoint > 0xD7FF && codePoint < 0xE000) { - // last char was a lead - if (!leadSurrogate) { - // no lead yet - if (codePoint > 0xDBFF) { - // unexpected trail - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - continue - } else if (i + 1 === length) { - // unpaired lead - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - continue - } - - // valid lead - leadSurrogate = codePoint - - continue - } - - // 2 leads in a row - if (codePoint < 0xDC00) { - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - leadSurrogate = codePoint - continue - } - - // valid surrogate pair - codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000 - } else if (leadSurrogate) { - // valid bmp char, but last char was a lead - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - } - - leadSurrogate = null - - // encode utf8 - if (codePoint < 0x80) { - if ((units -= 1) < 0) break - bytes.push(codePoint) - } else if (codePoint < 0x800) { - if ((units -= 2) < 0) break - bytes.push( - codePoint >> 0x6 | 0xC0, - codePoint & 0x3F | 0x80 - ) - } else if (codePoint < 0x10000) { - if ((units -= 3) < 0) break - bytes.push( - codePoint >> 0xC | 0xE0, - codePoint >> 0x6 & 0x3F | 0x80, - codePoint & 0x3F | 0x80 - ) - } else if (codePoint < 0x110000) { - if ((units -= 4) < 0) break - bytes.push( - codePoint >> 0x12 | 0xF0, - codePoint >> 0xC & 0x3F | 0x80, - codePoint >> 0x6 & 0x3F | 0x80, - codePoint & 0x3F | 0x80 - ) - } else { - throw new Error('Invalid code point') - } - } - - return bytes -} - -function asciiToBytes (str) { - const byteArray = [] - for (let i = 0; i < str.length; ++i) { - // Node's code seems to be doing this and not & 0x7F.. - byteArray.push(str.charCodeAt(i) & 0xFF) - } - return byteArray -} - -function utf16leToBytes (str, units) { - let c, hi, lo - const byteArray = [] - for (let i = 0; i < str.length; ++i) { - if ((units -= 2) < 0) break - - c = str.charCodeAt(i) - hi = c >> 8 - lo = c % 256 - byteArray.push(lo) - byteArray.push(hi) - } - - return byteArray -} - -function base64ToBytes (str) { - return base64.toByteArray(base64clean(str)) -} - -function blitBuffer (src, dst, offset, length) { - let i - for (i = 0; i < length; ++i) { - if ((i + offset >= dst.length) || (i >= src.length)) break - dst[i + offset] = src[i] - } - return i -} - -// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass -// the `instanceof` check but they should be treated as of that type. -// See: https://github.com/feross/buffer/issues/166 -function isInstance (obj, type) { - return obj instanceof type || - (obj != null && obj.constructor != null && obj.constructor.name != null && - obj.constructor.name === type.name) -} -function numberIsNaN (obj) { - // For IE11 support - return obj !== obj // eslint-disable-line no-self-compare -} - -// Create lookup table for `toString('hex')` -// See: https://github.com/feross/buffer/issues/219 -const hexSliceLookupTable = (function () { - const alphabet = '0123456789abcdef' - const table = new Array(256) - for (let i = 0; i < 16; ++i) { - const i16 = i * 16 - for (let j = 0; j < 16; ++j) { - table[i16 + j] = alphabet[i] + alphabet[j] - } - } - return table -})() - -// Return not function with Error if BigInt not supported -function defineBigIntMethod (fn) { - return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn -} - -function BufferBigIntNotDefined () { - throw new Error('BigInt not supported') -} diff --git a/packages/denylist_bot/node_modules/buffer/package.json b/packages/denylist_bot/node_modules/buffer/package.json deleted file mode 100644 index ca1ad9a70..000000000 --- a/packages/denylist_bot/node_modules/buffer/package.json +++ /dev/null @@ -1,93 +0,0 @@ -{ - "name": "buffer", - "description": "Node.js Buffer API, for the browser", - "version": "6.0.3", - "author": { - "name": "Feross Aboukhadijeh", - "email": "feross@feross.org", - "url": "https://feross.org" - }, - "bugs": { - "url": "https://github.com/feross/buffer/issues" - }, - "contributors": [ - "Romain Beauxis ", - "James Halliday " - ], - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - }, - "devDependencies": { - "airtap": "^3.0.0", - "benchmark": "^2.1.4", - "browserify": "^17.0.0", - "concat-stream": "^2.0.0", - "hyperquest": "^2.1.3", - "is-buffer": "^2.0.5", - "is-nan": "^1.3.0", - "split": "^1.0.1", - "standard": "*", - "tape": "^5.0.1", - "through2": "^4.0.2", - "uglify-js": "^3.11.5" - }, - "homepage": "https://github.com/feross/buffer", - "jspm": { - "map": { - "./index.js": { - "node": "@node/buffer" - } - } - }, - "keywords": [ - "arraybuffer", - "browser", - "browserify", - "buffer", - "compatible", - "dataview", - "uint8array" - ], - "license": "MIT", - "main": "index.js", - "types": "index.d.ts", - "repository": { - "type": "git", - "url": "git://github.com/feross/buffer.git" - }, - "scripts": { - "perf": "browserify --debug perf/bracket-notation.js > perf/bundle.js && open perf/index.html", - "perf-node": "node perf/bracket-notation.js && node perf/concat.js && node perf/copy-big.js && node perf/copy.js && node perf/new-big.js && node perf/new.js && node perf/readDoubleBE.js && node perf/readFloatBE.js && node perf/readUInt32LE.js && node perf/slice.js && node perf/writeFloatBE.js", - "size": "browserify -r ./ | uglifyjs -c -m | gzip | wc -c", - "test": "standard && node ./bin/test.js", - "test-browser-old": "airtap -- test/*.js", - "test-browser-old-local": "airtap --local -- test/*.js", - "test-browser-new": "airtap -- test/*.js test/node/*.js", - "test-browser-new-local": "airtap --local -- test/*.js test/node/*.js", - "test-node": "tape test/*.js test/node/*.js", - "update-authors": "./bin/update-authors.sh" - }, - "standard": { - "ignore": [ - "test/node/**/*.js", - "test/common.js", - "test/_polyfill.js", - "perf/**/*.js" - ] - }, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] -} diff --git a/packages/denylist_bot/node_modules/esbuild/LICENSE.md b/packages/denylist_bot/node_modules/esbuild/LICENSE.md deleted file mode 100644 index 2027e8dcf..000000000 --- a/packages/denylist_bot/node_modules/esbuild/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2020 Evan Wallace - -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. diff --git a/packages/denylist_bot/node_modules/esbuild/README.md b/packages/denylist_bot/node_modules/esbuild/README.md deleted file mode 100644 index 93863d198..000000000 --- a/packages/denylist_bot/node_modules/esbuild/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# esbuild - -This is a JavaScript bundler and minifier. See https://github.com/evanw/esbuild and the [JavaScript API documentation](https://esbuild.github.io/api/) for details. diff --git a/packages/denylist_bot/node_modules/esbuild/bin/esbuild b/packages/denylist_bot/node_modules/esbuild/bin/esbuild deleted file mode 100755 index bb23d5a21..000000000 --- a/packages/denylist_bot/node_modules/esbuild/bin/esbuild +++ /dev/null @@ -1,178 +0,0 @@ -#!/usr/bin/env node -"use strict"; -var __create = Object.create; -var __defProp = Object.defineProperty; -var __getOwnPropDesc = Object.getOwnPropertyDescriptor; -var __getOwnPropNames = Object.getOwnPropertyNames; -var __getProtoOf = Object.getPrototypeOf; -var __hasOwnProp = Object.prototype.hasOwnProperty; -var __copyProps = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key) && key !== except) - __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); - } - return to; -}; -var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( - isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, - mod -)); - -// lib/npm/node-platform.ts -var fs = require("fs"); -var os = require("os"); -var path = require("path"); -var ESBUILD_BINARY_PATH = process.env.ESBUILD_BINARY_PATH || ESBUILD_BINARY_PATH; -var knownWindowsPackages = { - "win32 arm64 LE": "esbuild-windows-arm64", - "win32 ia32 LE": "esbuild-windows-32", - "win32 x64 LE": "esbuild-windows-64" -}; -var knownUnixlikePackages = { - "android arm64 LE": "esbuild-android-arm64", - "darwin arm64 LE": "esbuild-darwin-arm64", - "darwin x64 LE": "esbuild-darwin-64", - "freebsd arm64 LE": "esbuild-freebsd-arm64", - "freebsd x64 LE": "esbuild-freebsd-64", - "linux arm LE": "esbuild-linux-arm", - "linux arm64 LE": "esbuild-linux-arm64", - "linux ia32 LE": "esbuild-linux-32", - "linux mips64el LE": "esbuild-linux-mips64le", - "linux ppc64 LE": "esbuild-linux-ppc64le", - "linux riscv64 LE": "esbuild-linux-riscv64", - "linux s390x BE": "esbuild-linux-s390x", - "linux x64 LE": "esbuild-linux-64", - "linux loong64 LE": "@esbuild/linux-loong64", - "netbsd x64 LE": "esbuild-netbsd-64", - "openbsd x64 LE": "esbuild-openbsd-64", - "sunos x64 LE": "esbuild-sunos-64" -}; -var knownWebAssemblyFallbackPackages = { - "android x64 LE": "esbuild-android-64" -}; -function pkgAndSubpathForCurrentPlatform() { - let pkg; - let subpath; - let isWASM2 = false; - let platformKey = `${process.platform} ${os.arch()} ${os.endianness()}`; - if (platformKey in knownWindowsPackages) { - pkg = knownWindowsPackages[platformKey]; - subpath = "esbuild.exe"; - } else if (platformKey in knownUnixlikePackages) { - pkg = knownUnixlikePackages[platformKey]; - subpath = "bin/esbuild"; - } else if (platformKey in knownWebAssemblyFallbackPackages) { - pkg = knownWebAssemblyFallbackPackages[platformKey]; - subpath = "bin/esbuild"; - isWASM2 = true; - } else { - throw new Error(`Unsupported platform: ${platformKey}`); - } - return { pkg, subpath, isWASM: isWASM2 }; -} -function pkgForSomeOtherPlatform() { - const libMainJS = require.resolve("esbuild"); - const nodeModulesDirectory = path.dirname(path.dirname(path.dirname(libMainJS))); - if (path.basename(nodeModulesDirectory) === "node_modules") { - for (const unixKey in knownUnixlikePackages) { - try { - const pkg = knownUnixlikePackages[unixKey]; - if (fs.existsSync(path.join(nodeModulesDirectory, pkg))) - return pkg; - } catch { - } - } - for (const windowsKey in knownWindowsPackages) { - try { - const pkg = knownWindowsPackages[windowsKey]; - if (fs.existsSync(path.join(nodeModulesDirectory, pkg))) - return pkg; - } catch { - } - } - } - return null; -} -function downloadedBinPath(pkg, subpath) { - const esbuildLibDir = path.dirname(require.resolve("esbuild")); - return path.join(esbuildLibDir, `downloaded-${pkg}-${path.basename(subpath)}`); -} -function generateBinPath() { - if (ESBUILD_BINARY_PATH) { - return { binPath: ESBUILD_BINARY_PATH, isWASM: false }; - } - const { pkg, subpath, isWASM: isWASM2 } = pkgAndSubpathForCurrentPlatform(); - let binPath2; - try { - binPath2 = require.resolve(`${pkg}/${subpath}`); - } catch (e) { - binPath2 = downloadedBinPath(pkg, subpath); - if (!fs.existsSync(binPath2)) { - try { - require.resolve(pkg); - } catch { - const otherPkg = pkgForSomeOtherPlatform(); - if (otherPkg) { - throw new Error(` -You installed esbuild on another platform than the one you're currently using. -This won't work because esbuild is written with native code and needs to -install a platform-specific binary executable. - -Specifically the "${otherPkg}" package is present but this platform -needs the "${pkg}" package instead. People often get into this -situation by installing esbuild on Windows or macOS and copying "node_modules" -into a Docker image that runs Linux, or by copying "node_modules" between -Windows and WSL environments. - -If you are installing with npm, you can try not copying the "node_modules" -directory when you copy the files over, and running "npm ci" or "npm install" -on the destination platform after the copy. Or you could consider using yarn -instead which has built-in support for installing a package on multiple -platforms simultaneously. - -If you are installing with yarn, you can try listing both this platform and the -other platform in your ".yarnrc.yml" file using the "supportedArchitectures" -feature: https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures -Keep in mind that this means multiple copies of esbuild will be present. - -Another alternative is to use the "esbuild-wasm" package instead, which works -the same way on all platforms. But it comes with a heavy performance cost and -can sometimes be 10x slower than the "esbuild" package, so you may also not -want to do that. -`); - } - throw new Error(`The package "${pkg}" could not be found, and is needed by esbuild. - -If you are installing esbuild with npm, make sure that you don't specify the -"--no-optional" flag. The "optionalDependencies" package.json feature is used -by esbuild to install the correct binary executable for your current platform.`); - } - throw e; - } - } - let isYarnPnP = false; - try { - require("pnpapi"); - isYarnPnP = true; - } catch (e) { - } - if (isYarnPnP) { - const esbuildLibDir = path.dirname(require.resolve("esbuild")); - const binTargetPath = path.join(esbuildLibDir, `pnpapi-${pkg}-${path.basename(subpath)}`); - if (!fs.existsSync(binTargetPath)) { - fs.copyFileSync(binPath2, binTargetPath); - fs.chmodSync(binTargetPath, 493); - } - return { binPath: binTargetPath, isWASM: isWASM2 }; - } - return { binPath: binPath2, isWASM: isWASM2 }; -} - -// lib/npm/node-shim.ts -var { binPath, isWASM } = generateBinPath(); -if (isWASM) { - require("child_process").execFileSync("node", [binPath].concat(process.argv.slice(2)), { stdio: "inherit" }); -} else { - require("child_process").execFileSync(binPath, process.argv.slice(2), { stdio: "inherit" }); -} diff --git a/packages/denylist_bot/node_modules/esbuild/install.js b/packages/denylist_bot/node_modules/esbuild/install.js deleted file mode 100644 index 859227459..000000000 --- a/packages/denylist_bot/node_modules/esbuild/install.js +++ /dev/null @@ -1,244 +0,0 @@ -"use strict"; -var __create = Object.create; -var __defProp = Object.defineProperty; -var __getOwnPropDesc = Object.getOwnPropertyDescriptor; -var __getOwnPropNames = Object.getOwnPropertyNames; -var __getProtoOf = Object.getPrototypeOf; -var __hasOwnProp = Object.prototype.hasOwnProperty; -var __copyProps = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key) && key !== except) - __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); - } - return to; -}; -var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( - isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, - mod -)); - -// lib/npm/node-platform.ts -var fs = require("fs"); -var os = require("os"); -var path = require("path"); -var ESBUILD_BINARY_PATH = process.env.ESBUILD_BINARY_PATH || ESBUILD_BINARY_PATH; -var knownWindowsPackages = { - "win32 arm64 LE": "esbuild-windows-arm64", - "win32 ia32 LE": "esbuild-windows-32", - "win32 x64 LE": "esbuild-windows-64" -}; -var knownUnixlikePackages = { - "android arm64 LE": "esbuild-android-arm64", - "darwin arm64 LE": "esbuild-darwin-arm64", - "darwin x64 LE": "esbuild-darwin-64", - "freebsd arm64 LE": "esbuild-freebsd-arm64", - "freebsd x64 LE": "esbuild-freebsd-64", - "linux arm LE": "esbuild-linux-arm", - "linux arm64 LE": "esbuild-linux-arm64", - "linux ia32 LE": "esbuild-linux-32", - "linux mips64el LE": "esbuild-linux-mips64le", - "linux ppc64 LE": "esbuild-linux-ppc64le", - "linux riscv64 LE": "esbuild-linux-riscv64", - "linux s390x BE": "esbuild-linux-s390x", - "linux x64 LE": "esbuild-linux-64", - "linux loong64 LE": "@esbuild/linux-loong64", - "netbsd x64 LE": "esbuild-netbsd-64", - "openbsd x64 LE": "esbuild-openbsd-64", - "sunos x64 LE": "esbuild-sunos-64" -}; -var knownWebAssemblyFallbackPackages = { - "android x64 LE": "esbuild-android-64" -}; -function pkgAndSubpathForCurrentPlatform() { - let pkg; - let subpath; - let isWASM = false; - let platformKey = `${process.platform} ${os.arch()} ${os.endianness()}`; - if (platformKey in knownWindowsPackages) { - pkg = knownWindowsPackages[platformKey]; - subpath = "esbuild.exe"; - } else if (platformKey in knownUnixlikePackages) { - pkg = knownUnixlikePackages[platformKey]; - subpath = "bin/esbuild"; - } else if (platformKey in knownWebAssemblyFallbackPackages) { - pkg = knownWebAssemblyFallbackPackages[platformKey]; - subpath = "bin/esbuild"; - isWASM = true; - } else { - throw new Error(`Unsupported platform: ${platformKey}`); - } - return { pkg, subpath, isWASM }; -} -function downloadedBinPath(pkg, subpath) { - const esbuildLibDir = path.dirname(require.resolve("esbuild")); - return path.join(esbuildLibDir, `downloaded-${pkg}-${path.basename(subpath)}`); -} - -// lib/npm/node-install.ts -var fs2 = require("fs"); -var os2 = require("os"); -var path2 = require("path"); -var zlib = require("zlib"); -var https = require("https"); -var child_process = require("child_process"); -var toPath = path2.join(__dirname, "bin", "esbuild"); -var isToPathJS = true; -function validateBinaryVersion(...command) { - command.push("--version"); - const stdout = child_process.execFileSync(command.shift(), command, { - stdio: "pipe" - }).toString().trim(); - if (stdout !== "0.14.54") { - throw new Error(`Expected ${JSON.stringify("0.14.54")} but got ${JSON.stringify(stdout)}`); - } -} -function isYarn() { - const { npm_config_user_agent } = process.env; - if (npm_config_user_agent) { - return /\byarn\//.test(npm_config_user_agent); - } - return false; -} -function fetch(url) { - return new Promise((resolve, reject) => { - https.get(url, (res) => { - if ((res.statusCode === 301 || res.statusCode === 302) && res.headers.location) - return fetch(res.headers.location).then(resolve, reject); - if (res.statusCode !== 200) - return reject(new Error(`Server responded with ${res.statusCode}`)); - let chunks = []; - res.on("data", (chunk) => chunks.push(chunk)); - res.on("end", () => resolve(Buffer.concat(chunks))); - }).on("error", reject); - }); -} -function extractFileFromTarGzip(buffer, subpath) { - try { - buffer = zlib.unzipSync(buffer); - } catch (err) { - throw new Error(`Invalid gzip data in archive: ${err && err.message || err}`); - } - let str = (i, n) => String.fromCharCode(...buffer.subarray(i, i + n)).replace(/\0.*$/, ""); - let offset = 0; - subpath = `package/${subpath}`; - while (offset < buffer.length) { - let name = str(offset, 100); - let size = parseInt(str(offset + 124, 12), 8); - offset += 512; - if (!isNaN(size)) { - if (name === subpath) - return buffer.subarray(offset, offset + size); - offset += size + 511 & ~511; - } - } - throw new Error(`Could not find ${JSON.stringify(subpath)} in archive`); -} -function installUsingNPM(pkg, subpath, binPath) { - const env = { ...process.env, npm_config_global: void 0 }; - const esbuildLibDir = path2.dirname(require.resolve("esbuild")); - const installDir = path2.join(esbuildLibDir, "npm-install"); - fs2.mkdirSync(installDir); - try { - fs2.writeFileSync(path2.join(installDir, "package.json"), "{}"); - child_process.execSync( - `npm install --loglevel=error --prefer-offline --no-audit --progress=false ${pkg}@${"0.14.54"}`, - { cwd: installDir, stdio: "pipe", env } - ); - const installedBinPath = path2.join(installDir, "node_modules", pkg, subpath); - fs2.renameSync(installedBinPath, binPath); - } finally { - try { - removeRecursive(installDir); - } catch { - } - } -} -function removeRecursive(dir) { - for (const entry of fs2.readdirSync(dir)) { - const entryPath = path2.join(dir, entry); - let stats; - try { - stats = fs2.lstatSync(entryPath); - } catch { - continue; - } - if (stats.isDirectory()) - removeRecursive(entryPath); - else - fs2.unlinkSync(entryPath); - } - fs2.rmdirSync(dir); -} -function applyManualBinaryPathOverride(overridePath) { - const pathString = JSON.stringify(overridePath); - fs2.writeFileSync(toPath, `#!/usr/bin/env node -require('child_process').execFileSync(${pathString}, process.argv.slice(2), { stdio: 'inherit' }); -`); - const libMain = path2.join(__dirname, "lib", "main.js"); - const code = fs2.readFileSync(libMain, "utf8"); - fs2.writeFileSync(libMain, `var ESBUILD_BINARY_PATH = ${pathString}; -${code}`); -} -function maybeOptimizePackage(binPath) { - if (os2.platform() !== "win32" && !isYarn()) { - const tempPath = path2.join(__dirname, "bin-esbuild"); - try { - fs2.linkSync(binPath, tempPath); - fs2.renameSync(tempPath, toPath); - isToPathJS = false; - fs2.unlinkSync(tempPath); - } catch { - } - } -} -async function downloadDirectlyFromNPM(pkg, subpath, binPath) { - const url = `https://registry.npmjs.org/${pkg}/-/${pkg}-${"0.14.54"}.tgz`; - console.error(`[esbuild] Trying to download ${JSON.stringify(url)}`); - try { - fs2.writeFileSync(binPath, extractFileFromTarGzip(await fetch(url), subpath)); - fs2.chmodSync(binPath, 493); - } catch (e) { - console.error(`[esbuild] Failed to download ${JSON.stringify(url)}: ${e && e.message || e}`); - throw e; - } -} -async function checkAndPreparePackage() { - if (ESBUILD_BINARY_PATH) { - applyManualBinaryPathOverride(ESBUILD_BINARY_PATH); - return; - } - const { pkg, subpath } = pkgAndSubpathForCurrentPlatform(); - let binPath; - try { - binPath = require.resolve(`${pkg}/${subpath}`); - } catch (e) { - console.error(`[esbuild] Failed to find package "${pkg}" on the file system - -This can happen if you use the "--no-optional" flag. The "optionalDependencies" -package.json feature is used by esbuild to install the correct binary executable -for your current platform. This install script will now attempt to work around -this. If that fails, you need to remove the "--no-optional" flag to use esbuild. -`); - binPath = downloadedBinPath(pkg, subpath); - try { - console.error(`[esbuild] Trying to install package "${pkg}" using npm`); - installUsingNPM(pkg, subpath, binPath); - } catch (e2) { - console.error(`[esbuild] Failed to install package "${pkg}" using npm: ${e2 && e2.message || e2}`); - try { - await downloadDirectlyFromNPM(pkg, subpath, binPath); - } catch (e3) { - throw new Error(`Failed to install package "${pkg}"`); - } - } - } - maybeOptimizePackage(binPath); -} -checkAndPreparePackage().then(() => { - if (isToPathJS) { - validateBinaryVersion("node", toPath); - } else { - validateBinaryVersion(toPath); - } -}); diff --git a/packages/denylist_bot/node_modules/esbuild/lib/main.d.ts b/packages/denylist_bot/node_modules/esbuild/lib/main.d.ts deleted file mode 100644 index e3d264b34..000000000 --- a/packages/denylist_bot/node_modules/esbuild/lib/main.d.ts +++ /dev/null @@ -1,602 +0,0 @@ -export type Platform = 'browser' | 'node' | 'neutral'; -export type Format = 'iife' | 'cjs' | 'esm'; -export type Loader = 'js' | 'jsx' | 'ts' | 'tsx' | 'css' | 'json' | 'text' | 'base64' | 'file' | 'dataurl' | 'binary' | 'copy' | 'default'; -export type LogLevel = 'verbose' | 'debug' | 'info' | 'warning' | 'error' | 'silent'; -export type Charset = 'ascii' | 'utf8'; -export type Drop = 'console' | 'debugger'; - -interface CommonOptions { - /** Documentation: https://esbuild.github.io/api/#sourcemap */ - sourcemap?: boolean | 'linked' | 'inline' | 'external' | 'both'; - /** Documentation: https://esbuild.github.io/api/#legal-comments */ - legalComments?: 'none' | 'inline' | 'eof' | 'linked' | 'external'; - /** Documentation: https://esbuild.github.io/api/#source-root */ - sourceRoot?: string; - /** Documentation: https://esbuild.github.io/api/#sources-content */ - sourcesContent?: boolean; - - /** Documentation: https://esbuild.github.io/api/#format */ - format?: Format; - /** Documentation: https://esbuild.github.io/api/#global-name */ - globalName?: string; - /** Documentation: https://esbuild.github.io/api/#target */ - target?: string | string[]; - /** Documentation: https://esbuild.github.io/api/#supported */ - supported?: Record; - /** Documentation: https://esbuild.github.io/api/#platform */ - platform?: Platform; - - /** Documentation: https://esbuild.github.io/api/#mangle-props */ - mangleProps?: RegExp; - /** Documentation: https://esbuild.github.io/api/#mangle-props */ - reserveProps?: RegExp; - /** Documentation: https://esbuild.github.io/api/#mangle-props */ - mangleQuoted?: boolean; - /** Documentation: https://esbuild.github.io/api/#mangle-props */ - mangleCache?: Record; - /** Documentation: https://esbuild.github.io/api/#drop */ - drop?: Drop[]; - /** Documentation: https://esbuild.github.io/api/#minify */ - minify?: boolean; - /** Documentation: https://esbuild.github.io/api/#minify */ - minifyWhitespace?: boolean; - /** Documentation: https://esbuild.github.io/api/#minify */ - minifyIdentifiers?: boolean; - /** Documentation: https://esbuild.github.io/api/#minify */ - minifySyntax?: boolean; - /** Documentation: https://esbuild.github.io/api/#charset */ - charset?: Charset; - /** Documentation: https://esbuild.github.io/api/#tree-shaking */ - treeShaking?: boolean; - /** Documentation: https://esbuild.github.io/api/#ignore-annotations */ - ignoreAnnotations?: boolean; - - /** Documentation: https://esbuild.github.io/api/#jsx */ - jsx?: 'transform' | 'preserve' | 'automatic'; - /** Documentation: https://esbuild.github.io/api/#jsx-factory */ - jsxFactory?: string; - /** Documentation: https://esbuild.github.io/api/#jsx-fragment */ - jsxFragment?: string; - /** Documentation: https://esbuild.github.io/api/#jsx-import-source */ - jsxImportSource?: string; - /** Documentation: https://esbuild.github.io/api/#jsx-development */ - jsxDev?: boolean; - - /** Documentation: https://esbuild.github.io/api/#define */ - define?: { [key: string]: string }; - /** Documentation: https://esbuild.github.io/api/#pure */ - pure?: string[]; - /** Documentation: https://esbuild.github.io/api/#keep-names */ - keepNames?: boolean; - - /** Documentation: https://esbuild.github.io/api/#color */ - color?: boolean; - /** Documentation: https://esbuild.github.io/api/#log-level */ - logLevel?: LogLevel; - /** Documentation: https://esbuild.github.io/api/#log-limit */ - logLimit?: number; - /** Documentation: https://esbuild.github.io/api/#log-override */ - logOverride?: Record; -} - -export interface BuildOptions extends CommonOptions { - /** Documentation: https://esbuild.github.io/api/#bundle */ - bundle?: boolean; - /** Documentation: https://esbuild.github.io/api/#splitting */ - splitting?: boolean; - /** Documentation: https://esbuild.github.io/api/#preserve-symlinks */ - preserveSymlinks?: boolean; - /** Documentation: https://esbuild.github.io/api/#outfile */ - outfile?: string; - /** Documentation: https://esbuild.github.io/api/#metafile */ - metafile?: boolean; - /** Documentation: https://esbuild.github.io/api/#outdir */ - outdir?: string; - /** Documentation: https://esbuild.github.io/api/#outbase */ - outbase?: string; - /** Documentation: https://esbuild.github.io/api/#external */ - external?: string[]; - /** Documentation: https://esbuild.github.io/api/#loader */ - loader?: { [ext: string]: Loader }; - /** Documentation: https://esbuild.github.io/api/#resolve-extensions */ - resolveExtensions?: string[]; - /** Documentation: https://esbuild.github.io/api/#main-fields */ - mainFields?: string[]; - /** Documentation: https://esbuild.github.io/api/#conditions */ - conditions?: string[]; - /** Documentation: https://esbuild.github.io/api/#write */ - write?: boolean; - /** Documentation: https://esbuild.github.io/api/#allow-overwrite */ - allowOverwrite?: boolean; - /** Documentation: https://esbuild.github.io/api/#tsconfig */ - tsconfig?: string; - /** Documentation: https://esbuild.github.io/api/#out-extension */ - outExtension?: { [ext: string]: string }; - /** Documentation: https://esbuild.github.io/api/#public-path */ - publicPath?: string; - /** Documentation: https://esbuild.github.io/api/#entry-names */ - entryNames?: string; - /** Documentation: https://esbuild.github.io/api/#chunk-names */ - chunkNames?: string; - /** Documentation: https://esbuild.github.io/api/#asset-names */ - assetNames?: string; - /** Documentation: https://esbuild.github.io/api/#inject */ - inject?: string[]; - /** Documentation: https://esbuild.github.io/api/#banner */ - banner?: { [type: string]: string }; - /** Documentation: https://esbuild.github.io/api/#footer */ - footer?: { [type: string]: string }; - /** Documentation: https://esbuild.github.io/api/#incremental */ - incremental?: boolean; - /** Documentation: https://esbuild.github.io/api/#entry-points */ - entryPoints?: string[] | Record; - /** Documentation: https://esbuild.github.io/api/#stdin */ - stdin?: StdinOptions; - /** Documentation: https://esbuild.github.io/plugins/ */ - plugins?: Plugin[]; - /** Documentation: https://esbuild.github.io/api/#working-directory */ - absWorkingDir?: string; - /** Documentation: https://esbuild.github.io/api/#node-paths */ - nodePaths?: string[]; // The "NODE_PATH" variable from Node.js - /** Documentation: https://esbuild.github.io/api/#watch */ - watch?: boolean | WatchMode; -} - -export interface WatchMode { - onRebuild?: (error: BuildFailure | null, result: BuildResult | null) => void; -} - -export interface StdinOptions { - contents: string | Uint8Array; - resolveDir?: string; - sourcefile?: string; - loader?: Loader; -} - -export interface Message { - id: string; - pluginName: string; - text: string; - location: Location | null; - notes: Note[]; - - /** - * Optional user-specified data that is passed through unmodified. You can - * use this to stash the original error, for example. - */ - detail: any; -} - -export interface Note { - text: string; - location: Location | null; -} - -export interface Location { - file: string; - namespace: string; - /** 1-based */ - line: number; - /** 0-based, in bytes */ - column: number; - /** in bytes */ - length: number; - lineText: string; - suggestion: string; -} - -export interface OutputFile { - path: string; - /** "text" as bytes */ - contents: Uint8Array; - /** "contents" as text */ - text: string; -} - -export interface BuildInvalidate { - (): Promise; - dispose(): void; -} - -export interface BuildIncremental extends BuildResult { - rebuild: BuildInvalidate; -} - -export interface BuildResult { - errors: Message[]; - warnings: Message[]; - /** Only when "write: false" */ - outputFiles?: OutputFile[]; - /** Only when "incremental: true" */ - rebuild?: BuildInvalidate; - /** Only when "watch: true" */ - stop?: () => void; - /** Only when "metafile: true" */ - metafile?: Metafile; - /** Only when "mangleCache" is present */ - mangleCache?: Record; -} - -export interface BuildFailure extends Error { - errors: Message[]; - warnings: Message[]; -} - -/** Documentation: https://esbuild.github.io/api/#serve-arguments */ -export interface ServeOptions { - port?: number; - host?: string; - servedir?: string; - onRequest?: (args: ServeOnRequestArgs) => void; -} - -export interface ServeOnRequestArgs { - remoteAddress: string; - method: string; - path: string; - status: number; - /** The time to generate the response, not to send it */ - timeInMS: number; -} - -/** Documentation: https://esbuild.github.io/api/#serve-return-values */ -export interface ServeResult { - port: number; - host: string; - wait: Promise; - stop: () => void; -} - -export interface TransformOptions extends CommonOptions { - tsconfigRaw?: string | { - compilerOptions?: { - jsxFactory?: string, - jsxFragmentFactory?: string, - useDefineForClassFields?: boolean, - importsNotUsedAsValues?: 'remove' | 'preserve' | 'error', - preserveValueImports?: boolean, - }, - }; - - sourcefile?: string; - loader?: Loader; - banner?: string; - footer?: string; -} - -export interface TransformResult { - code: string; - map: string; - warnings: Message[]; - /** Only when "mangleCache" is present */ - mangleCache?: Record; -} - -export interface TransformFailure extends Error { - errors: Message[]; - warnings: Message[]; -} - -export interface Plugin { - name: string; - setup: (build: PluginBuild) => (void | Promise); -} - -export interface PluginBuild { - initialOptions: BuildOptions; - resolve(path: string, options?: ResolveOptions): Promise; - - onStart(callback: () => - (OnStartResult | null | void | Promise)): void; - onEnd(callback: (result: BuildResult) => - (void | Promise)): void; - onResolve(options: OnResolveOptions, callback: (args: OnResolveArgs) => - (OnResolveResult | null | undefined | Promise)): void; - onLoad(options: OnLoadOptions, callback: (args: OnLoadArgs) => - (OnLoadResult | null | undefined | Promise)): void; - - // This is a full copy of the esbuild library in case you need it - esbuild: { - serve: typeof serve, - build: typeof build, - buildSync: typeof buildSync, - transform: typeof transform, - transformSync: typeof transformSync, - formatMessages: typeof formatMessages, - formatMessagesSync: typeof formatMessagesSync, - analyzeMetafile: typeof analyzeMetafile, - analyzeMetafileSync: typeof analyzeMetafileSync, - initialize: typeof initialize, - version: typeof version, - }; -} - -export interface ResolveOptions { - pluginName?: string; - importer?: string; - namespace?: string; - resolveDir?: string; - kind?: ImportKind; - pluginData?: any; -} - -export interface ResolveResult { - errors: Message[]; - warnings: Message[]; - - path: string; - external: boolean; - sideEffects: boolean; - namespace: string; - suffix: string; - pluginData: any; -} - -export interface OnStartResult { - errors?: PartialMessage[]; - warnings?: PartialMessage[]; -} - -export interface OnResolveOptions { - filter: RegExp; - namespace?: string; -} - -export interface OnResolveArgs { - path: string; - importer: string; - namespace: string; - resolveDir: string; - kind: ImportKind; - pluginData: any; -} - -export type ImportKind = - | 'entry-point' - - // JS - | 'import-statement' - | 'require-call' - | 'dynamic-import' - | 'require-resolve' - - // CSS - | 'import-rule' - | 'url-token' - -export interface OnResolveResult { - pluginName?: string; - - errors?: PartialMessage[]; - warnings?: PartialMessage[]; - - path?: string; - external?: boolean; - sideEffects?: boolean; - namespace?: string; - suffix?: string; - pluginData?: any; - - watchFiles?: string[]; - watchDirs?: string[]; -} - -export interface OnLoadOptions { - filter: RegExp; - namespace?: string; -} - -export interface OnLoadArgs { - path: string; - namespace: string; - suffix: string; - pluginData: any; -} - -export interface OnLoadResult { - pluginName?: string; - - errors?: PartialMessage[]; - warnings?: PartialMessage[]; - - contents?: string | Uint8Array; - resolveDir?: string; - loader?: Loader; - pluginData?: any; - - watchFiles?: string[]; - watchDirs?: string[]; -} - -export interface PartialMessage { - id?: string; - pluginName?: string; - text?: string; - location?: Partial | null; - notes?: PartialNote[]; - detail?: any; -} - -export interface PartialNote { - text?: string; - location?: Partial | null; -} - -export interface Metafile { - inputs: { - [path: string]: { - bytes: number - imports: { - path: string - kind: ImportKind - }[] - } - } - outputs: { - [path: string]: { - bytes: number - inputs: { - [path: string]: { - bytesInOutput: number - } - } - imports: { - path: string - kind: ImportKind - }[] - exports: string[] - entryPoint?: string - } - } -} - -export interface FormatMessagesOptions { - kind: 'error' | 'warning'; - color?: boolean; - terminalWidth?: number; -} - -export interface AnalyzeMetafileOptions { - color?: boolean; - verbose?: boolean; -} - -/** - * This function invokes the "esbuild" command-line tool for you. It returns a - * promise that either resolves with a "BuildResult" object or rejects with a - * "BuildFailure" object. - * - * - Works in node: yes - * - Works in browser: yes - * - * Documentation: https://esbuild.github.io/api/#build-api - */ -export declare function build(options: BuildOptions & { write: false }): Promise; -export declare function build(options: BuildOptions & { incremental: true, metafile: true }): Promise; -export declare function build(options: BuildOptions & { incremental: true }): Promise; -export declare function build(options: BuildOptions & { metafile: true }): Promise; -export declare function build(options: BuildOptions): Promise; - -/** - * This function is similar to "build" but it serves the resulting files over - * HTTP on a localhost address with the specified port. - * - * - Works in node: yes - * - Works in browser: no - * - * Documentation: https://esbuild.github.io/api/#serve - */ -export declare function serve(serveOptions: ServeOptions, buildOptions: BuildOptions): Promise; - -/** - * This function transforms a single JavaScript file. It can be used to minify - * JavaScript, convert TypeScript/JSX to JavaScript, or convert newer JavaScript - * to older JavaScript. It returns a promise that is either resolved with a - * "TransformResult" object or rejected with a "TransformFailure" object. - * - * - Works in node: yes - * - Works in browser: yes - * - * Documentation: https://esbuild.github.io/api/#transform-api - */ -export declare function transform(input: string | Uint8Array, options?: TransformOptions): Promise; - -/** - * Converts log messages to formatted message strings suitable for printing in - * the terminal. This allows you to reuse the built-in behavior of esbuild's - * log message formatter. This is a batch-oriented API for efficiency. - * - * - Works in node: yes - * - Works in browser: yes - */ -export declare function formatMessages(messages: PartialMessage[], options: FormatMessagesOptions): Promise; - -/** - * Pretty-prints an analysis of the metafile JSON to a string. This is just for - * convenience to be able to match esbuild's pretty-printing exactly. If you want - * to customize it, you can just inspect the data in the metafile yourself. - * - * - Works in node: yes - * - Works in browser: yes - * - * Documentation: https://esbuild.github.io/api/#analyze - */ -export declare function analyzeMetafile(metafile: Metafile | string, options?: AnalyzeMetafileOptions): Promise; - -/** - * A synchronous version of "build". - * - * - Works in node: yes - * - Works in browser: no - * - * Documentation: https://esbuild.github.io/api/#build-api - */ -export declare function buildSync(options: BuildOptions & { write: false }): BuildResult & { outputFiles: OutputFile[] }; -export declare function buildSync(options: BuildOptions): BuildResult; - -/** - * A synchronous version of "transform". - * - * - Works in node: yes - * - Works in browser: no - * - * Documentation: https://esbuild.github.io/api/#transform-api - */ -export declare function transformSync(input: string, options?: TransformOptions): TransformResult; - -/** - * A synchronous version of "formatMessages". - * - * - Works in node: yes - * - Works in browser: no - */ -export declare function formatMessagesSync(messages: PartialMessage[], options: FormatMessagesOptions): string[]; - -/** - * A synchronous version of "analyzeMetafile". - * - * - Works in node: yes - * - Works in browser: no - * - * Documentation: https://esbuild.github.io/api/#analyze - */ -export declare function analyzeMetafileSync(metafile: Metafile | string, options?: AnalyzeMetafileOptions): string; - -/** - * This configures the browser-based version of esbuild. It is necessary to - * call this first and wait for the returned promise to be resolved before - * making other API calls when using esbuild in the browser. - * - * - Works in node: yes - * - Works in browser: yes ("options" is required) - * - * Documentation: https://esbuild.github.io/api/#running-in-the-browser - */ -export declare function initialize(options: InitializeOptions): Promise; - -export interface InitializeOptions { - /** - * The URL of the "esbuild.wasm" file. This must be provided when running - * esbuild in the browser. - */ - wasmURL?: string - - /** - * The result of calling "new WebAssembly.Module(buffer)" where "buffer" - * is a typed array or ArrayBuffer containing the binary code of the - * "esbuild.wasm" file. - * - * You can use this as an alternative to "wasmURL" for environments where it's - * not possible to download the WebAssembly module. - */ - wasmModule?: WebAssembly.Module - - /** - * By default esbuild runs the WebAssembly-based browser API in a web worker - * to avoid blocking the UI thread. This can be disabled by setting "worker" - * to false. - */ - worker?: boolean -} - -export let version: string; diff --git a/packages/denylist_bot/node_modules/esbuild/lib/main.js b/packages/denylist_bot/node_modules/esbuild/lib/main.js deleted file mode 100644 index 35c555230..000000000 --- a/packages/denylist_bot/node_modules/esbuild/lib/main.js +++ /dev/null @@ -1,2332 +0,0 @@ -"use strict"; -var __create = Object.create; -var __defProp = Object.defineProperty; -var __getOwnPropDesc = Object.getOwnPropertyDescriptor; -var __getOwnPropNames = Object.getOwnPropertyNames; -var __getProtoOf = Object.getPrototypeOf; -var __hasOwnProp = Object.prototype.hasOwnProperty; -var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { get: all[name], enumerable: true }); -}; -var __copyProps = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key) && key !== except) - __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); - } - return to; -}; -var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( - isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, - mod -)); -var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); - -// lib/npm/node.ts -var node_exports = {}; -__export(node_exports, { - analyzeMetafile: () => analyzeMetafile, - analyzeMetafileSync: () => analyzeMetafileSync, - build: () => build, - buildSync: () => buildSync, - default: () => node_default, - formatMessages: () => formatMessages, - formatMessagesSync: () => formatMessagesSync, - initialize: () => initialize, - serve: () => serve, - transform: () => transform, - transformSync: () => transformSync, - version: () => version -}); -module.exports = __toCommonJS(node_exports); - -// lib/shared/stdio_protocol.ts -function encodePacket(packet) { - let visit = (value) => { - if (value === null) { - bb.write8(0); - } else if (typeof value === "boolean") { - bb.write8(1); - bb.write8(+value); - } else if (typeof value === "number") { - bb.write8(2); - bb.write32(value | 0); - } else if (typeof value === "string") { - bb.write8(3); - bb.write(encodeUTF8(value)); - } else if (value instanceof Uint8Array) { - bb.write8(4); - bb.write(value); - } else if (value instanceof Array) { - bb.write8(5); - bb.write32(value.length); - for (let item of value) { - visit(item); - } - } else { - let keys = Object.keys(value); - bb.write8(6); - bb.write32(keys.length); - for (let key of keys) { - bb.write(encodeUTF8(key)); - visit(value[key]); - } - } - }; - let bb = new ByteBuffer(); - bb.write32(0); - bb.write32(packet.id << 1 | +!packet.isRequest); - visit(packet.value); - writeUInt32LE(bb.buf, bb.len - 4, 0); - return bb.buf.subarray(0, bb.len); -} -function decodePacket(bytes) { - let visit = () => { - switch (bb.read8()) { - case 0: - return null; - case 1: - return !!bb.read8(); - case 2: - return bb.read32(); - case 3: - return decodeUTF8(bb.read()); - case 4: - return bb.read(); - case 5: { - let count = bb.read32(); - let value2 = []; - for (let i = 0; i < count; i++) { - value2.push(visit()); - } - return value2; - } - case 6: { - let count = bb.read32(); - let value2 = {}; - for (let i = 0; i < count; i++) { - value2[decodeUTF8(bb.read())] = visit(); - } - return value2; - } - default: - throw new Error("Invalid packet"); - } - }; - let bb = new ByteBuffer(bytes); - let id = bb.read32(); - let isRequest = (id & 1) === 0; - id >>>= 1; - let value = visit(); - if (bb.ptr !== bytes.length) { - throw new Error("Invalid packet"); - } - return { id, isRequest, value }; -} -var ByteBuffer = class { - constructor(buf = new Uint8Array(1024)) { - this.buf = buf; - this.len = 0; - this.ptr = 0; - } - _write(delta) { - if (this.len + delta > this.buf.length) { - let clone = new Uint8Array((this.len + delta) * 2); - clone.set(this.buf); - this.buf = clone; - } - this.len += delta; - return this.len - delta; - } - write8(value) { - let offset = this._write(1); - this.buf[offset] = value; - } - write32(value) { - let offset = this._write(4); - writeUInt32LE(this.buf, value, offset); - } - write(bytes) { - let offset = this._write(4 + bytes.length); - writeUInt32LE(this.buf, bytes.length, offset); - this.buf.set(bytes, offset + 4); - } - _read(delta) { - if (this.ptr + delta > this.buf.length) { - throw new Error("Invalid packet"); - } - this.ptr += delta; - return this.ptr - delta; - } - read8() { - return this.buf[this._read(1)]; - } - read32() { - return readUInt32LE(this.buf, this._read(4)); - } - read() { - let length = this.read32(); - let bytes = new Uint8Array(length); - let ptr = this._read(bytes.length); - bytes.set(this.buf.subarray(ptr, ptr + length)); - return bytes; - } -}; -var encodeUTF8; -var decodeUTF8; -if (typeof TextEncoder !== "undefined" && typeof TextDecoder !== "undefined") { - let encoder = new TextEncoder(); - let decoder = new TextDecoder(); - encodeUTF8 = (text) => encoder.encode(text); - decodeUTF8 = (bytes) => decoder.decode(bytes); -} else if (typeof Buffer !== "undefined") { - encodeUTF8 = (text) => { - let buffer = Buffer.from(text); - if (!(buffer instanceof Uint8Array)) { - buffer = new Uint8Array(buffer); - } - return buffer; - }; - decodeUTF8 = (bytes) => { - let { buffer, byteOffset, byteLength } = bytes; - return Buffer.from(buffer, byteOffset, byteLength).toString(); - }; -} else { - throw new Error("No UTF-8 codec found"); -} -function readUInt32LE(buffer, offset) { - return buffer[offset++] | buffer[offset++] << 8 | buffer[offset++] << 16 | buffer[offset++] << 24; -} -function writeUInt32LE(buffer, value, offset) { - buffer[offset++] = value; - buffer[offset++] = value >> 8; - buffer[offset++] = value >> 16; - buffer[offset++] = value >> 24; -} - -// lib/shared/common.ts -function validateTarget(target) { - target += ""; - if (target.indexOf(",") >= 0) - throw new Error(`Invalid target: ${target}`); - return target; -} -var canBeAnything = () => null; -var mustBeBoolean = (value) => typeof value === "boolean" ? null : "a boolean"; -var mustBeBooleanOrObject = (value) => typeof value === "boolean" || typeof value === "object" && !Array.isArray(value) ? null : "a boolean or an object"; -var mustBeString = (value) => typeof value === "string" ? null : "a string"; -var mustBeRegExp = (value) => value instanceof RegExp ? null : "a RegExp object"; -var mustBeInteger = (value) => typeof value === "number" && value === (value | 0) ? null : "an integer"; -var mustBeFunction = (value) => typeof value === "function" ? null : "a function"; -var mustBeArray = (value) => Array.isArray(value) ? null : "an array"; -var mustBeObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value) ? null : "an object"; -var mustBeWebAssemblyModule = (value) => value instanceof WebAssembly.Module ? null : "a WebAssembly.Module"; -var mustBeArrayOrRecord = (value) => typeof value === "object" && value !== null ? null : "an array or an object"; -var mustBeObjectOrNull = (value) => typeof value === "object" && !Array.isArray(value) ? null : "an object or null"; -var mustBeStringOrBoolean = (value) => typeof value === "string" || typeof value === "boolean" ? null : "a string or a boolean"; -var mustBeStringOrObject = (value) => typeof value === "string" || typeof value === "object" && value !== null && !Array.isArray(value) ? null : "a string or an object"; -var mustBeStringOrArray = (value) => typeof value === "string" || Array.isArray(value) ? null : "a string or an array"; -var mustBeStringOrUint8Array = (value) => typeof value === "string" || value instanceof Uint8Array ? null : "a string or a Uint8Array"; -function getFlag(object, keys, key, mustBeFn) { - let value = object[key]; - keys[key + ""] = true; - if (value === void 0) - return void 0; - let mustBe = mustBeFn(value); - if (mustBe !== null) - throw new Error(`"${key}" must be ${mustBe}`); - return value; -} -function checkForInvalidFlags(object, keys, where) { - for (let key in object) { - if (!(key in keys)) { - throw new Error(`Invalid option ${where}: "${key}"`); - } - } -} -function validateInitializeOptions(options) { - let keys = /* @__PURE__ */ Object.create(null); - let wasmURL = getFlag(options, keys, "wasmURL", mustBeString); - let wasmModule = getFlag(options, keys, "wasmModule", mustBeWebAssemblyModule); - let worker = getFlag(options, keys, "worker", mustBeBoolean); - checkForInvalidFlags(options, keys, "in initialize() call"); - return { - wasmURL, - wasmModule, - worker - }; -} -function validateMangleCache(mangleCache) { - let validated; - if (mangleCache !== void 0) { - validated = /* @__PURE__ */ Object.create(null); - for (let key of Object.keys(mangleCache)) { - let value = mangleCache[key]; - if (typeof value === "string" || value === false) { - validated[key] = value; - } else { - throw new Error(`Expected ${JSON.stringify(key)} in mangle cache to map to either a string or false`); - } - } - } - return validated; -} -function pushLogFlags(flags, options, keys, isTTY2, logLevelDefault) { - let color = getFlag(options, keys, "color", mustBeBoolean); - let logLevel = getFlag(options, keys, "logLevel", mustBeString); - let logLimit = getFlag(options, keys, "logLimit", mustBeInteger); - if (color !== void 0) - flags.push(`--color=${color}`); - else if (isTTY2) - flags.push(`--color=true`); - flags.push(`--log-level=${logLevel || logLevelDefault}`); - flags.push(`--log-limit=${logLimit || 0}`); -} -function pushCommonFlags(flags, options, keys) { - let legalComments = getFlag(options, keys, "legalComments", mustBeString); - let sourceRoot = getFlag(options, keys, "sourceRoot", mustBeString); - let sourcesContent = getFlag(options, keys, "sourcesContent", mustBeBoolean); - let target = getFlag(options, keys, "target", mustBeStringOrArray); - let format = getFlag(options, keys, "format", mustBeString); - let globalName = getFlag(options, keys, "globalName", mustBeString); - let mangleProps = getFlag(options, keys, "mangleProps", mustBeRegExp); - let reserveProps = getFlag(options, keys, "reserveProps", mustBeRegExp); - let mangleQuoted = getFlag(options, keys, "mangleQuoted", mustBeBoolean); - let minify = getFlag(options, keys, "minify", mustBeBoolean); - let minifySyntax = getFlag(options, keys, "minifySyntax", mustBeBoolean); - let minifyWhitespace = getFlag(options, keys, "minifyWhitespace", mustBeBoolean); - let minifyIdentifiers = getFlag(options, keys, "minifyIdentifiers", mustBeBoolean); - let drop = getFlag(options, keys, "drop", mustBeArray); - let charset = getFlag(options, keys, "charset", mustBeString); - let treeShaking = getFlag(options, keys, "treeShaking", mustBeBoolean); - let ignoreAnnotations = getFlag(options, keys, "ignoreAnnotations", mustBeBoolean); - let jsx = getFlag(options, keys, "jsx", mustBeString); - let jsxFactory = getFlag(options, keys, "jsxFactory", mustBeString); - let jsxFragment = getFlag(options, keys, "jsxFragment", mustBeString); - let jsxImportSource = getFlag(options, keys, "jsxImportSource", mustBeString); - let jsxDev = getFlag(options, keys, "jsxDev", mustBeBoolean); - let define = getFlag(options, keys, "define", mustBeObject); - let logOverride = getFlag(options, keys, "logOverride", mustBeObject); - let supported = getFlag(options, keys, "supported", mustBeObject); - let pure = getFlag(options, keys, "pure", mustBeArray); - let keepNames = getFlag(options, keys, "keepNames", mustBeBoolean); - let platform = getFlag(options, keys, "platform", mustBeString); - if (legalComments) - flags.push(`--legal-comments=${legalComments}`); - if (sourceRoot !== void 0) - flags.push(`--source-root=${sourceRoot}`); - if (sourcesContent !== void 0) - flags.push(`--sources-content=${sourcesContent}`); - if (target) { - if (Array.isArray(target)) - flags.push(`--target=${Array.from(target).map(validateTarget).join(",")}`); - else - flags.push(`--target=${validateTarget(target)}`); - } - if (format) - flags.push(`--format=${format}`); - if (globalName) - flags.push(`--global-name=${globalName}`); - if (platform) - flags.push(`--platform=${platform}`); - if (minify) - flags.push("--minify"); - if (minifySyntax) - flags.push("--minify-syntax"); - if (minifyWhitespace) - flags.push("--minify-whitespace"); - if (minifyIdentifiers) - flags.push("--minify-identifiers"); - if (charset) - flags.push(`--charset=${charset}`); - if (treeShaking !== void 0) - flags.push(`--tree-shaking=${treeShaking}`); - if (ignoreAnnotations) - flags.push(`--ignore-annotations`); - if (drop) - for (let what of drop) - flags.push(`--drop:${what}`); - if (mangleProps) - flags.push(`--mangle-props=${mangleProps.source}`); - if (reserveProps) - flags.push(`--reserve-props=${reserveProps.source}`); - if (mangleQuoted !== void 0) - flags.push(`--mangle-quoted=${mangleQuoted}`); - if (jsx) - flags.push(`--jsx=${jsx}`); - if (jsxFactory) - flags.push(`--jsx-factory=${jsxFactory}`); - if (jsxFragment) - flags.push(`--jsx-fragment=${jsxFragment}`); - if (jsxImportSource) - flags.push(`--jsx-import-source=${jsxImportSource}`); - if (jsxDev) - flags.push(`--jsx-dev`); - if (define) { - for (let key in define) { - if (key.indexOf("=") >= 0) - throw new Error(`Invalid define: ${key}`); - flags.push(`--define:${key}=${define[key]}`); - } - } - if (logOverride) { - for (let key in logOverride) { - if (key.indexOf("=") >= 0) - throw new Error(`Invalid log override: ${key}`); - flags.push(`--log-override:${key}=${logOverride[key]}`); - } - } - if (supported) { - for (let key in supported) { - if (key.indexOf("=") >= 0) - throw new Error(`Invalid supported: ${key}`); - flags.push(`--supported:${key}=${supported[key]}`); - } - } - if (pure) - for (let fn of pure) - flags.push(`--pure:${fn}`); - if (keepNames) - flags.push(`--keep-names`); -} -function flagsForBuildOptions(callName, options, isTTY2, logLevelDefault, writeDefault) { - var _a2; - let flags = []; - let entries = []; - let keys = /* @__PURE__ */ Object.create(null); - let stdinContents = null; - let stdinResolveDir = null; - let watchMode = null; - pushLogFlags(flags, options, keys, isTTY2, logLevelDefault); - pushCommonFlags(flags, options, keys); - let sourcemap = getFlag(options, keys, "sourcemap", mustBeStringOrBoolean); - let bundle = getFlag(options, keys, "bundle", mustBeBoolean); - let watch = getFlag(options, keys, "watch", mustBeBooleanOrObject); - let splitting = getFlag(options, keys, "splitting", mustBeBoolean); - let preserveSymlinks = getFlag(options, keys, "preserveSymlinks", mustBeBoolean); - let metafile = getFlag(options, keys, "metafile", mustBeBoolean); - let outfile = getFlag(options, keys, "outfile", mustBeString); - let outdir = getFlag(options, keys, "outdir", mustBeString); - let outbase = getFlag(options, keys, "outbase", mustBeString); - let tsconfig = getFlag(options, keys, "tsconfig", mustBeString); - let resolveExtensions = getFlag(options, keys, "resolveExtensions", mustBeArray); - let nodePathsInput = getFlag(options, keys, "nodePaths", mustBeArray); - let mainFields = getFlag(options, keys, "mainFields", mustBeArray); - let conditions = getFlag(options, keys, "conditions", mustBeArray); - let external = getFlag(options, keys, "external", mustBeArray); - let loader = getFlag(options, keys, "loader", mustBeObject); - let outExtension = getFlag(options, keys, "outExtension", mustBeObject); - let publicPath = getFlag(options, keys, "publicPath", mustBeString); - let entryNames = getFlag(options, keys, "entryNames", mustBeString); - let chunkNames = getFlag(options, keys, "chunkNames", mustBeString); - let assetNames = getFlag(options, keys, "assetNames", mustBeString); - let inject = getFlag(options, keys, "inject", mustBeArray); - let banner = getFlag(options, keys, "banner", mustBeObject); - let footer = getFlag(options, keys, "footer", mustBeObject); - let entryPoints = getFlag(options, keys, "entryPoints", mustBeArrayOrRecord); - let absWorkingDir = getFlag(options, keys, "absWorkingDir", mustBeString); - let stdin = getFlag(options, keys, "stdin", mustBeObject); - let write = (_a2 = getFlag(options, keys, "write", mustBeBoolean)) != null ? _a2 : writeDefault; - let allowOverwrite = getFlag(options, keys, "allowOverwrite", mustBeBoolean); - let incremental = getFlag(options, keys, "incremental", mustBeBoolean) === true; - let mangleCache = getFlag(options, keys, "mangleCache", mustBeObject); - keys.plugins = true; - checkForInvalidFlags(options, keys, `in ${callName}() call`); - if (sourcemap) - flags.push(`--sourcemap${sourcemap === true ? "" : `=${sourcemap}`}`); - if (bundle) - flags.push("--bundle"); - if (allowOverwrite) - flags.push("--allow-overwrite"); - if (watch) { - flags.push("--watch"); - if (typeof watch === "boolean") { - watchMode = {}; - } else { - let watchKeys = /* @__PURE__ */ Object.create(null); - let onRebuild = getFlag(watch, watchKeys, "onRebuild", mustBeFunction); - checkForInvalidFlags(watch, watchKeys, `on "watch" in ${callName}() call`); - watchMode = { onRebuild }; - } - } - if (splitting) - flags.push("--splitting"); - if (preserveSymlinks) - flags.push("--preserve-symlinks"); - if (metafile) - flags.push(`--metafile`); - if (outfile) - flags.push(`--outfile=${outfile}`); - if (outdir) - flags.push(`--outdir=${outdir}`); - if (outbase) - flags.push(`--outbase=${outbase}`); - if (tsconfig) - flags.push(`--tsconfig=${tsconfig}`); - if (resolveExtensions) { - let values = []; - for (let value of resolveExtensions) { - value += ""; - if (value.indexOf(",") >= 0) - throw new Error(`Invalid resolve extension: ${value}`); - values.push(value); - } - flags.push(`--resolve-extensions=${values.join(",")}`); - } - if (publicPath) - flags.push(`--public-path=${publicPath}`); - if (entryNames) - flags.push(`--entry-names=${entryNames}`); - if (chunkNames) - flags.push(`--chunk-names=${chunkNames}`); - if (assetNames) - flags.push(`--asset-names=${assetNames}`); - if (mainFields) { - let values = []; - for (let value of mainFields) { - value += ""; - if (value.indexOf(",") >= 0) - throw new Error(`Invalid main field: ${value}`); - values.push(value); - } - flags.push(`--main-fields=${values.join(",")}`); - } - if (conditions) { - let values = []; - for (let value of conditions) { - value += ""; - if (value.indexOf(",") >= 0) - throw new Error(`Invalid condition: ${value}`); - values.push(value); - } - flags.push(`--conditions=${values.join(",")}`); - } - if (external) - for (let name of external) - flags.push(`--external:${name}`); - if (banner) { - for (let type in banner) { - if (type.indexOf("=") >= 0) - throw new Error(`Invalid banner file type: ${type}`); - flags.push(`--banner:${type}=${banner[type]}`); - } - } - if (footer) { - for (let type in footer) { - if (type.indexOf("=") >= 0) - throw new Error(`Invalid footer file type: ${type}`); - flags.push(`--footer:${type}=${footer[type]}`); - } - } - if (inject) - for (let path3 of inject) - flags.push(`--inject:${path3}`); - if (loader) { - for (let ext in loader) { - if (ext.indexOf("=") >= 0) - throw new Error(`Invalid loader extension: ${ext}`); - flags.push(`--loader:${ext}=${loader[ext]}`); - } - } - if (outExtension) { - for (let ext in outExtension) { - if (ext.indexOf("=") >= 0) - throw new Error(`Invalid out extension: ${ext}`); - flags.push(`--out-extension:${ext}=${outExtension[ext]}`); - } - } - if (entryPoints) { - if (Array.isArray(entryPoints)) { - for (let entryPoint of entryPoints) { - entries.push(["", entryPoint + ""]); - } - } else { - for (let [key, value] of Object.entries(entryPoints)) { - entries.push([key + "", value + ""]); - } - } - } - if (stdin) { - let stdinKeys = /* @__PURE__ */ Object.create(null); - let contents = getFlag(stdin, stdinKeys, "contents", mustBeStringOrUint8Array); - let resolveDir = getFlag(stdin, stdinKeys, "resolveDir", mustBeString); - let sourcefile = getFlag(stdin, stdinKeys, "sourcefile", mustBeString); - let loader2 = getFlag(stdin, stdinKeys, "loader", mustBeString); - checkForInvalidFlags(stdin, stdinKeys, 'in "stdin" object'); - if (sourcefile) - flags.push(`--sourcefile=${sourcefile}`); - if (loader2) - flags.push(`--loader=${loader2}`); - if (resolveDir) - stdinResolveDir = resolveDir + ""; - if (typeof contents === "string") - stdinContents = encodeUTF8(contents); - else if (contents instanceof Uint8Array) - stdinContents = contents; - } - let nodePaths = []; - if (nodePathsInput) { - for (let value of nodePathsInput) { - value += ""; - nodePaths.push(value); - } - } - return { - entries, - flags, - write, - stdinContents, - stdinResolveDir, - absWorkingDir, - incremental, - nodePaths, - watch: watchMode, - mangleCache: validateMangleCache(mangleCache) - }; -} -function flagsForTransformOptions(callName, options, isTTY2, logLevelDefault) { - let flags = []; - let keys = /* @__PURE__ */ Object.create(null); - pushLogFlags(flags, options, keys, isTTY2, logLevelDefault); - pushCommonFlags(flags, options, keys); - let sourcemap = getFlag(options, keys, "sourcemap", mustBeStringOrBoolean); - let tsconfigRaw = getFlag(options, keys, "tsconfigRaw", mustBeStringOrObject); - let sourcefile = getFlag(options, keys, "sourcefile", mustBeString); - let loader = getFlag(options, keys, "loader", mustBeString); - let banner = getFlag(options, keys, "banner", mustBeString); - let footer = getFlag(options, keys, "footer", mustBeString); - let mangleCache = getFlag(options, keys, "mangleCache", mustBeObject); - checkForInvalidFlags(options, keys, `in ${callName}() call`); - if (sourcemap) - flags.push(`--sourcemap=${sourcemap === true ? "external" : sourcemap}`); - if (tsconfigRaw) - flags.push(`--tsconfig-raw=${typeof tsconfigRaw === "string" ? tsconfigRaw : JSON.stringify(tsconfigRaw)}`); - if (sourcefile) - flags.push(`--sourcefile=${sourcefile}`); - if (loader) - flags.push(`--loader=${loader}`); - if (banner) - flags.push(`--banner=${banner}`); - if (footer) - flags.push(`--footer=${footer}`); - return { - flags, - mangleCache: validateMangleCache(mangleCache) - }; -} -function createChannel(streamIn) { - let responseCallbacks = /* @__PURE__ */ new Map(); - let pluginCallbacks = /* @__PURE__ */ new Map(); - let watchCallbacks = /* @__PURE__ */ new Map(); - let serveCallbacks = /* @__PURE__ */ new Map(); - let closeData = null; - let nextRequestID = 0; - let nextBuildKey = 0; - let stdout = new Uint8Array(16 * 1024); - let stdoutUsed = 0; - let readFromStdout = (chunk) => { - let limit = stdoutUsed + chunk.length; - if (limit > stdout.length) { - let swap = new Uint8Array(limit * 2); - swap.set(stdout); - stdout = swap; - } - stdout.set(chunk, stdoutUsed); - stdoutUsed += chunk.length; - let offset = 0; - while (offset + 4 <= stdoutUsed) { - let length = readUInt32LE(stdout, offset); - if (offset + 4 + length > stdoutUsed) { - break; - } - offset += 4; - handleIncomingPacket(stdout.subarray(offset, offset + length)); - offset += length; - } - if (offset > 0) { - stdout.copyWithin(0, offset, stdoutUsed); - stdoutUsed -= offset; - } - }; - let afterClose = (error) => { - closeData = { reason: error ? ": " + (error.message || error) : "" }; - const text = "The service was stopped" + closeData.reason; - for (let callback of responseCallbacks.values()) { - callback(text, null); - } - responseCallbacks.clear(); - for (let callbacks of serveCallbacks.values()) { - callbacks.onWait(text); - } - serveCallbacks.clear(); - for (let callback of watchCallbacks.values()) { - try { - callback(new Error(text), null); - } catch (e) { - console.error(e); - } - } - watchCallbacks.clear(); - }; - let sendRequest = (refs, value, callback) => { - if (closeData) - return callback("The service is no longer running" + closeData.reason, null); - let id = nextRequestID++; - responseCallbacks.set(id, (error, response) => { - try { - callback(error, response); - } finally { - if (refs) - refs.unref(); - } - }); - if (refs) - refs.ref(); - streamIn.writeToStdin(encodePacket({ id, isRequest: true, value })); - }; - let sendResponse = (id, value) => { - if (closeData) - throw new Error("The service is no longer running" + closeData.reason); - streamIn.writeToStdin(encodePacket({ id, isRequest: false, value })); - }; - let handleRequest = async (id, request) => { - try { - switch (request.command) { - case "ping": { - sendResponse(id, {}); - break; - } - case "on-start": { - let callback = pluginCallbacks.get(request.key); - if (!callback) - sendResponse(id, {}); - else - sendResponse(id, await callback(request)); - break; - } - case "on-resolve": { - let callback = pluginCallbacks.get(request.key); - if (!callback) - sendResponse(id, {}); - else - sendResponse(id, await callback(request)); - break; - } - case "on-load": { - let callback = pluginCallbacks.get(request.key); - if (!callback) - sendResponse(id, {}); - else - sendResponse(id, await callback(request)); - break; - } - case "serve-request": { - let callbacks = serveCallbacks.get(request.key); - if (callbacks && callbacks.onRequest) - callbacks.onRequest(request.args); - sendResponse(id, {}); - break; - } - case "serve-wait": { - let callbacks = serveCallbacks.get(request.key); - if (callbacks) - callbacks.onWait(request.error); - sendResponse(id, {}); - break; - } - case "watch-rebuild": { - let callback = watchCallbacks.get(request.key); - try { - if (callback) - callback(null, request.args); - } catch (err) { - console.error(err); - } - sendResponse(id, {}); - break; - } - default: - throw new Error(`Invalid command: ` + request.command); - } - } catch (e) { - sendResponse(id, { errors: [extractErrorMessageV8(e, streamIn, null, void 0, "")] }); - } - }; - let isFirstPacket = true; - let handleIncomingPacket = (bytes) => { - if (isFirstPacket) { - isFirstPacket = false; - let binaryVersion = String.fromCharCode(...bytes); - if (binaryVersion !== "0.14.54") { - throw new Error(`Cannot start service: Host version "${"0.14.54"}" does not match binary version ${JSON.stringify(binaryVersion)}`); - } - return; - } - let packet = decodePacket(bytes); - if (packet.isRequest) { - handleRequest(packet.id, packet.value); - } else { - let callback = responseCallbacks.get(packet.id); - responseCallbacks.delete(packet.id); - if (packet.value.error) - callback(packet.value.error, {}); - else - callback(null, packet.value); - } - }; - let handlePlugins = async (initialOptions, plugins, buildKey, stash, refs) => { - let onStartCallbacks = []; - let onEndCallbacks = []; - let onResolveCallbacks = {}; - let onLoadCallbacks = {}; - let nextCallbackID = 0; - let i = 0; - let requestPlugins = []; - let isSetupDone = false; - plugins = [...plugins]; - for (let item of plugins) { - let keys = {}; - if (typeof item !== "object") - throw new Error(`Plugin at index ${i} must be an object`); - const name = getFlag(item, keys, "name", mustBeString); - if (typeof name !== "string" || name === "") - throw new Error(`Plugin at index ${i} is missing a name`); - try { - let setup = getFlag(item, keys, "setup", mustBeFunction); - if (typeof setup !== "function") - throw new Error(`Plugin is missing a setup function`); - checkForInvalidFlags(item, keys, `on plugin ${JSON.stringify(name)}`); - let plugin = { - name, - onResolve: [], - onLoad: [] - }; - i++; - let resolve = (path3, options = {}) => { - if (!isSetupDone) - throw new Error('Cannot call "resolve" before plugin setup has completed'); - if (typeof path3 !== "string") - throw new Error(`The path to resolve must be a string`); - let keys2 = /* @__PURE__ */ Object.create(null); - let pluginName = getFlag(options, keys2, "pluginName", mustBeString); - let importer = getFlag(options, keys2, "importer", mustBeString); - let namespace = getFlag(options, keys2, "namespace", mustBeString); - let resolveDir = getFlag(options, keys2, "resolveDir", mustBeString); - let kind = getFlag(options, keys2, "kind", mustBeString); - let pluginData = getFlag(options, keys2, "pluginData", canBeAnything); - checkForInvalidFlags(options, keys2, "in resolve() call"); - return new Promise((resolve2, reject) => { - const request = { - command: "resolve", - path: path3, - key: buildKey, - pluginName: name - }; - if (pluginName != null) - request.pluginName = pluginName; - if (importer != null) - request.importer = importer; - if (namespace != null) - request.namespace = namespace; - if (resolveDir != null) - request.resolveDir = resolveDir; - if (kind != null) - request.kind = kind; - if (pluginData != null) - request.pluginData = stash.store(pluginData); - sendRequest(refs, request, (error, response) => { - if (error !== null) - reject(new Error(error)); - else - resolve2({ - errors: replaceDetailsInMessages(response.errors, stash), - warnings: replaceDetailsInMessages(response.warnings, stash), - path: response.path, - external: response.external, - sideEffects: response.sideEffects, - namespace: response.namespace, - suffix: response.suffix, - pluginData: stash.load(response.pluginData) - }); - }); - }); - }; - let promise = setup({ - initialOptions, - resolve, - onStart(callback2) { - let registeredText = `This error came from the "onStart" callback registered here:`; - let registeredNote = extractCallerV8(new Error(registeredText), streamIn, "onStart"); - onStartCallbacks.push({ name, callback: callback2, note: registeredNote }); - }, - onEnd(callback2) { - let registeredText = `This error came from the "onEnd" callback registered here:`; - let registeredNote = extractCallerV8(new Error(registeredText), streamIn, "onEnd"); - onEndCallbacks.push({ name, callback: callback2, note: registeredNote }); - }, - onResolve(options, callback2) { - let registeredText = `This error came from the "onResolve" callback registered here:`; - let registeredNote = extractCallerV8(new Error(registeredText), streamIn, "onResolve"); - let keys2 = {}; - let filter = getFlag(options, keys2, "filter", mustBeRegExp); - let namespace = getFlag(options, keys2, "namespace", mustBeString); - checkForInvalidFlags(options, keys2, `in onResolve() call for plugin ${JSON.stringify(name)}`); - if (filter == null) - throw new Error(`onResolve() call is missing a filter`); - let id = nextCallbackID++; - onResolveCallbacks[id] = { name, callback: callback2, note: registeredNote }; - plugin.onResolve.push({ id, filter: filter.source, namespace: namespace || "" }); - }, - onLoad(options, callback2) { - let registeredText = `This error came from the "onLoad" callback registered here:`; - let registeredNote = extractCallerV8(new Error(registeredText), streamIn, "onLoad"); - let keys2 = {}; - let filter = getFlag(options, keys2, "filter", mustBeRegExp); - let namespace = getFlag(options, keys2, "namespace", mustBeString); - checkForInvalidFlags(options, keys2, `in onLoad() call for plugin ${JSON.stringify(name)}`); - if (filter == null) - throw new Error(`onLoad() call is missing a filter`); - let id = nextCallbackID++; - onLoadCallbacks[id] = { name, callback: callback2, note: registeredNote }; - plugin.onLoad.push({ id, filter: filter.source, namespace: namespace || "" }); - }, - esbuild: streamIn.esbuild - }); - if (promise) - await promise; - requestPlugins.push(plugin); - } catch (e) { - return { ok: false, error: e, pluginName: name }; - } - } - const callback = async (request) => { - switch (request.command) { - case "on-start": { - let response = { errors: [], warnings: [] }; - await Promise.all(onStartCallbacks.map(async ({ name, callback: callback2, note }) => { - try { - let result = await callback2(); - if (result != null) { - if (typeof result !== "object") - throw new Error(`Expected onStart() callback in plugin ${JSON.stringify(name)} to return an object`); - let keys = {}; - let errors = getFlag(result, keys, "errors", mustBeArray); - let warnings = getFlag(result, keys, "warnings", mustBeArray); - checkForInvalidFlags(result, keys, `from onStart() callback in plugin ${JSON.stringify(name)}`); - if (errors != null) - response.errors.push(...sanitizeMessages(errors, "errors", stash, name)); - if (warnings != null) - response.warnings.push(...sanitizeMessages(warnings, "warnings", stash, name)); - } - } catch (e) { - response.errors.push(extractErrorMessageV8(e, streamIn, stash, note && note(), name)); - } - })); - return response; - } - case "on-resolve": { - let response = {}, name = "", callback2, note; - for (let id of request.ids) { - try { - ({ name, callback: callback2, note } = onResolveCallbacks[id]); - let result = await callback2({ - path: request.path, - importer: request.importer, - namespace: request.namespace, - resolveDir: request.resolveDir, - kind: request.kind, - pluginData: stash.load(request.pluginData) - }); - if (result != null) { - if (typeof result !== "object") - throw new Error(`Expected onResolve() callback in plugin ${JSON.stringify(name)} to return an object`); - let keys = {}; - let pluginName = getFlag(result, keys, "pluginName", mustBeString); - let path3 = getFlag(result, keys, "path", mustBeString); - let namespace = getFlag(result, keys, "namespace", mustBeString); - let suffix = getFlag(result, keys, "suffix", mustBeString); - let external = getFlag(result, keys, "external", mustBeBoolean); - let sideEffects = getFlag(result, keys, "sideEffects", mustBeBoolean); - let pluginData = getFlag(result, keys, "pluginData", canBeAnything); - let errors = getFlag(result, keys, "errors", mustBeArray); - let warnings = getFlag(result, keys, "warnings", mustBeArray); - let watchFiles = getFlag(result, keys, "watchFiles", mustBeArray); - let watchDirs = getFlag(result, keys, "watchDirs", mustBeArray); - checkForInvalidFlags(result, keys, `from onResolve() callback in plugin ${JSON.stringify(name)}`); - response.id = id; - if (pluginName != null) - response.pluginName = pluginName; - if (path3 != null) - response.path = path3; - if (namespace != null) - response.namespace = namespace; - if (suffix != null) - response.suffix = suffix; - if (external != null) - response.external = external; - if (sideEffects != null) - response.sideEffects = sideEffects; - if (pluginData != null) - response.pluginData = stash.store(pluginData); - if (errors != null) - response.errors = sanitizeMessages(errors, "errors", stash, name); - if (warnings != null) - response.warnings = sanitizeMessages(warnings, "warnings", stash, name); - if (watchFiles != null) - response.watchFiles = sanitizeStringArray(watchFiles, "watchFiles"); - if (watchDirs != null) - response.watchDirs = sanitizeStringArray(watchDirs, "watchDirs"); - break; - } - } catch (e) { - return { id, errors: [extractErrorMessageV8(e, streamIn, stash, note && note(), name)] }; - } - } - return response; - } - case "on-load": { - let response = {}, name = "", callback2, note; - for (let id of request.ids) { - try { - ({ name, callback: callback2, note } = onLoadCallbacks[id]); - let result = await callback2({ - path: request.path, - namespace: request.namespace, - suffix: request.suffix, - pluginData: stash.load(request.pluginData) - }); - if (result != null) { - if (typeof result !== "object") - throw new Error(`Expected onLoad() callback in plugin ${JSON.stringify(name)} to return an object`); - let keys = {}; - let pluginName = getFlag(result, keys, "pluginName", mustBeString); - let contents = getFlag(result, keys, "contents", mustBeStringOrUint8Array); - let resolveDir = getFlag(result, keys, "resolveDir", mustBeString); - let pluginData = getFlag(result, keys, "pluginData", canBeAnything); - let loader = getFlag(result, keys, "loader", mustBeString); - let errors = getFlag(result, keys, "errors", mustBeArray); - let warnings = getFlag(result, keys, "warnings", mustBeArray); - let watchFiles = getFlag(result, keys, "watchFiles", mustBeArray); - let watchDirs = getFlag(result, keys, "watchDirs", mustBeArray); - checkForInvalidFlags(result, keys, `from onLoad() callback in plugin ${JSON.stringify(name)}`); - response.id = id; - if (pluginName != null) - response.pluginName = pluginName; - if (contents instanceof Uint8Array) - response.contents = contents; - else if (contents != null) - response.contents = encodeUTF8(contents); - if (resolveDir != null) - response.resolveDir = resolveDir; - if (pluginData != null) - response.pluginData = stash.store(pluginData); - if (loader != null) - response.loader = loader; - if (errors != null) - response.errors = sanitizeMessages(errors, "errors", stash, name); - if (warnings != null) - response.warnings = sanitizeMessages(warnings, "warnings", stash, name); - if (watchFiles != null) - response.watchFiles = sanitizeStringArray(watchFiles, "watchFiles"); - if (watchDirs != null) - response.watchDirs = sanitizeStringArray(watchDirs, "watchDirs"); - break; - } - } catch (e) { - return { id, errors: [extractErrorMessageV8(e, streamIn, stash, note && note(), name)] }; - } - } - return response; - } - default: - throw new Error(`Invalid command: ` + request.command); - } - }; - let runOnEndCallbacks = (result, logPluginError, done) => done(); - if (onEndCallbacks.length > 0) { - runOnEndCallbacks = (result, logPluginError, done) => { - (async () => { - for (const { name, callback: callback2, note } of onEndCallbacks) { - try { - await callback2(result); - } catch (e) { - result.errors.push(await new Promise((resolve) => logPluginError(e, name, note && note(), resolve))); - } - } - })().then(done); - }; - } - isSetupDone = true; - let refCount = 0; - return { - ok: true, - requestPlugins, - runOnEndCallbacks, - pluginRefs: { - ref() { - if (++refCount === 1) - pluginCallbacks.set(buildKey, callback); - }, - unref() { - if (--refCount === 0) - pluginCallbacks.delete(buildKey); - } - } - }; - }; - let buildServeData = (refs, options, request, key) => { - let keys = {}; - let port = getFlag(options, keys, "port", mustBeInteger); - let host = getFlag(options, keys, "host", mustBeString); - let servedir = getFlag(options, keys, "servedir", mustBeString); - let onRequest = getFlag(options, keys, "onRequest", mustBeFunction); - let onWait; - let wait = new Promise((resolve, reject) => { - onWait = (error) => { - serveCallbacks.delete(key); - if (error !== null) - reject(new Error(error)); - else - resolve(); - }; - }); - request.serve = {}; - checkForInvalidFlags(options, keys, `in serve() call`); - if (port !== void 0) - request.serve.port = port; - if (host !== void 0) - request.serve.host = host; - if (servedir !== void 0) - request.serve.servedir = servedir; - serveCallbacks.set(key, { - onRequest, - onWait - }); - return { - wait, - stop() { - sendRequest(refs, { command: "serve-stop", key }, () => { - }); - } - }; - }; - const buildLogLevelDefault = "warning"; - const transformLogLevelDefault = "silent"; - let buildOrServe = (args) => { - let key = nextBuildKey++; - const details = createObjectStash(); - let plugins; - let { refs, options, isTTY: isTTY2, callback } = args; - if (typeof options === "object") { - let value = options.plugins; - if (value !== void 0) { - if (!Array.isArray(value)) - throw new Error(`"plugins" must be an array`); - plugins = value; - } - } - let logPluginError = (e, pluginName, note, done) => { - let flags = []; - try { - pushLogFlags(flags, options, {}, isTTY2, buildLogLevelDefault); - } catch { - } - const message = extractErrorMessageV8(e, streamIn, details, note, pluginName); - sendRequest(refs, { command: "error", flags, error: message }, () => { - message.detail = details.load(message.detail); - done(message); - }); - }; - let handleError = (e, pluginName) => { - logPluginError(e, pluginName, void 0, (error) => { - callback(failureErrorWithLog("Build failed", [error], []), null); - }); - }; - if (plugins && plugins.length > 0) { - if (streamIn.isSync) - return handleError(new Error("Cannot use plugins in synchronous API calls"), ""); - handlePlugins(options, plugins, key, details, refs).then( - (result) => { - if (!result.ok) { - handleError(result.error, result.pluginName); - } else { - try { - buildOrServeContinue({ - ...args, - key, - details, - logPluginError, - requestPlugins: result.requestPlugins, - runOnEndCallbacks: result.runOnEndCallbacks, - pluginRefs: result.pluginRefs - }); - } catch (e) { - handleError(e, ""); - } - } - }, - (e) => handleError(e, "") - ); - } else { - try { - buildOrServeContinue({ - ...args, - key, - details, - logPluginError, - requestPlugins: null, - runOnEndCallbacks: (result, logPluginError2, done) => done(), - pluginRefs: null - }); - } catch (e) { - handleError(e, ""); - } - } - }; - let buildOrServeContinue = ({ - callName, - refs: callerRefs, - serveOptions, - options, - isTTY: isTTY2, - defaultWD: defaultWD2, - callback, - key, - details, - logPluginError, - requestPlugins, - runOnEndCallbacks, - pluginRefs - }) => { - const refs = { - ref() { - if (pluginRefs) - pluginRefs.ref(); - if (callerRefs) - callerRefs.ref(); - }, - unref() { - if (pluginRefs) - pluginRefs.unref(); - if (callerRefs) - callerRefs.unref(); - } - }; - let writeDefault = !streamIn.isWriteUnavailable; - let { - entries, - flags, - write, - stdinContents, - stdinResolveDir, - absWorkingDir, - incremental, - nodePaths, - watch, - mangleCache - } = flagsForBuildOptions(callName, options, isTTY2, buildLogLevelDefault, writeDefault); - let request = { - command: "build", - key, - entries, - flags, - write, - stdinContents, - stdinResolveDir, - absWorkingDir: absWorkingDir || defaultWD2, - incremental, - nodePaths - }; - if (requestPlugins) - request.plugins = requestPlugins; - if (mangleCache) - request.mangleCache = mangleCache; - let serve2 = serveOptions && buildServeData(refs, serveOptions, request, key); - let rebuild; - let stop; - let copyResponseToResult = (response, result) => { - if (response.outputFiles) - result.outputFiles = response.outputFiles.map(convertOutputFiles); - if (response.metafile) - result.metafile = JSON.parse(response.metafile); - if (response.mangleCache) - result.mangleCache = response.mangleCache; - if (response.writeToStdout !== void 0) - console.log(decodeUTF8(response.writeToStdout).replace(/\n$/, "")); - }; - let buildResponseToResult = (response, callback2) => { - let result = { - errors: replaceDetailsInMessages(response.errors, details), - warnings: replaceDetailsInMessages(response.warnings, details) - }; - copyResponseToResult(response, result); - runOnEndCallbacks(result, logPluginError, () => { - if (result.errors.length > 0) { - return callback2(failureErrorWithLog("Build failed", result.errors, result.warnings), null); - } - if (response.rebuild) { - if (!rebuild) { - let isDisposed = false; - rebuild = () => new Promise((resolve, reject) => { - if (isDisposed || closeData) - throw new Error("Cannot rebuild"); - sendRequest( - refs, - { command: "rebuild", key }, - (error2, response2) => { - if (error2) { - const message = { id: "", pluginName: "", text: error2, location: null, notes: [], detail: void 0 }; - return callback2(failureErrorWithLog("Build failed", [message], []), null); - } - buildResponseToResult(response2, (error3, result3) => { - if (error3) - reject(error3); - else - resolve(result3); - }); - } - ); - }); - refs.ref(); - rebuild.dispose = () => { - if (isDisposed) - return; - isDisposed = true; - sendRequest(refs, { command: "rebuild-dispose", key }, () => { - }); - refs.unref(); - }; - } - result.rebuild = rebuild; - } - if (response.watch) { - if (!stop) { - let isStopped = false; - refs.ref(); - stop = () => { - if (isStopped) - return; - isStopped = true; - watchCallbacks.delete(key); - sendRequest(refs, { command: "watch-stop", key }, () => { - }); - refs.unref(); - }; - if (watch) { - watchCallbacks.set(key, (serviceStopError, watchResponse) => { - if (serviceStopError) { - if (watch.onRebuild) - watch.onRebuild(serviceStopError, null); - return; - } - let result2 = { - errors: replaceDetailsInMessages(watchResponse.errors, details), - warnings: replaceDetailsInMessages(watchResponse.warnings, details) - }; - copyResponseToResult(watchResponse, result2); - runOnEndCallbacks(result2, logPluginError, () => { - if (result2.errors.length > 0) { - if (watch.onRebuild) - watch.onRebuild(failureErrorWithLog("Build failed", result2.errors, result2.warnings), null); - return; - } - if (watchResponse.rebuildID !== void 0) - result2.rebuild = rebuild; - result2.stop = stop; - if (watch.onRebuild) - watch.onRebuild(null, result2); - }); - }); - } - } - result.stop = stop; - } - callback2(null, result); - }); - }; - if (write && streamIn.isWriteUnavailable) - throw new Error(`The "write" option is unavailable in this environment`); - if (incremental && streamIn.isSync) - throw new Error(`Cannot use "incremental" with a synchronous build`); - if (watch && streamIn.isSync) - throw new Error(`Cannot use "watch" with a synchronous build`); - sendRequest(refs, request, (error, response) => { - if (error) - return callback(new Error(error), null); - if (serve2) { - let serveResponse = response; - let isStopped = false; - refs.ref(); - let result = { - port: serveResponse.port, - host: serveResponse.host, - wait: serve2.wait, - stop() { - if (isStopped) - return; - isStopped = true; - serve2.stop(); - refs.unref(); - } - }; - refs.ref(); - serve2.wait.then(refs.unref, refs.unref); - return callback(null, result); - } - return buildResponseToResult(response, callback); - }); - }; - let transform2 = ({ callName, refs, input, options, isTTY: isTTY2, fs: fs3, callback }) => { - const details = createObjectStash(); - let start = (inputPath) => { - try { - if (typeof input !== "string" && !(input instanceof Uint8Array)) - throw new Error('The input to "transform" must be a string or a Uint8Array'); - let { - flags, - mangleCache - } = flagsForTransformOptions(callName, options, isTTY2, transformLogLevelDefault); - let request = { - command: "transform", - flags, - inputFS: inputPath !== null, - input: inputPath !== null ? encodeUTF8(inputPath) : typeof input === "string" ? encodeUTF8(input) : input - }; - if (mangleCache) - request.mangleCache = mangleCache; - sendRequest(refs, request, (error, response) => { - if (error) - return callback(new Error(error), null); - let errors = replaceDetailsInMessages(response.errors, details); - let warnings = replaceDetailsInMessages(response.warnings, details); - let outstanding = 1; - let next = () => { - if (--outstanding === 0) { - let result = { warnings, code: response.code, map: response.map }; - if (response.mangleCache) - result.mangleCache = response == null ? void 0 : response.mangleCache; - callback(null, result); - } - }; - if (errors.length > 0) - return callback(failureErrorWithLog("Transform failed", errors, warnings), null); - if (response.codeFS) { - outstanding++; - fs3.readFile(response.code, (err, contents) => { - if (err !== null) { - callback(err, null); - } else { - response.code = contents; - next(); - } - }); - } - if (response.mapFS) { - outstanding++; - fs3.readFile(response.map, (err, contents) => { - if (err !== null) { - callback(err, null); - } else { - response.map = contents; - next(); - } - }); - } - next(); - }); - } catch (e) { - let flags = []; - try { - pushLogFlags(flags, options, {}, isTTY2, transformLogLevelDefault); - } catch { - } - const error = extractErrorMessageV8(e, streamIn, details, void 0, ""); - sendRequest(refs, { command: "error", flags, error }, () => { - error.detail = details.load(error.detail); - callback(failureErrorWithLog("Transform failed", [error], []), null); - }); - } - }; - if ((typeof input === "string" || input instanceof Uint8Array) && input.length > 1024 * 1024) { - let next = start; - start = () => fs3.writeFile(input, next); - } - start(null); - }; - let formatMessages2 = ({ callName, refs, messages, options, callback }) => { - let result = sanitizeMessages(messages, "messages", null, ""); - if (!options) - throw new Error(`Missing second argument in ${callName}() call`); - let keys = {}; - let kind = getFlag(options, keys, "kind", mustBeString); - let color = getFlag(options, keys, "color", mustBeBoolean); - let terminalWidth = getFlag(options, keys, "terminalWidth", mustBeInteger); - checkForInvalidFlags(options, keys, `in ${callName}() call`); - if (kind === void 0) - throw new Error(`Missing "kind" in ${callName}() call`); - if (kind !== "error" && kind !== "warning") - throw new Error(`Expected "kind" to be "error" or "warning" in ${callName}() call`); - let request = { - command: "format-msgs", - messages: result, - isWarning: kind === "warning" - }; - if (color !== void 0) - request.color = color; - if (terminalWidth !== void 0) - request.terminalWidth = terminalWidth; - sendRequest(refs, request, (error, response) => { - if (error) - return callback(new Error(error), null); - callback(null, response.messages); - }); - }; - let analyzeMetafile2 = ({ callName, refs, metafile, options, callback }) => { - if (options === void 0) - options = {}; - let keys = {}; - let color = getFlag(options, keys, "color", mustBeBoolean); - let verbose = getFlag(options, keys, "verbose", mustBeBoolean); - checkForInvalidFlags(options, keys, `in ${callName}() call`); - let request = { - command: "analyze-metafile", - metafile - }; - if (color !== void 0) - request.color = color; - if (verbose !== void 0) - request.verbose = verbose; - sendRequest(refs, request, (error, response) => { - if (error) - return callback(new Error(error), null); - callback(null, response.result); - }); - }; - return { - readFromStdout, - afterClose, - service: { - buildOrServe, - transform: transform2, - formatMessages: formatMessages2, - analyzeMetafile: analyzeMetafile2 - } - }; -} -function createObjectStash() { - const map = /* @__PURE__ */ new Map(); - let nextID = 0; - return { - load(id) { - return map.get(id); - }, - store(value) { - if (value === void 0) - return -1; - const id = nextID++; - map.set(id, value); - return id; - } - }; -} -function extractCallerV8(e, streamIn, ident) { - let note; - let tried = false; - return () => { - if (tried) - return note; - tried = true; - try { - let lines = (e.stack + "").split("\n"); - lines.splice(1, 1); - let location = parseStackLinesV8(streamIn, lines, ident); - if (location) { - note = { text: e.message, location }; - return note; - } - } catch { - } - }; -} -function extractErrorMessageV8(e, streamIn, stash, note, pluginName) { - let text = "Internal error"; - let location = null; - try { - text = (e && e.message || e) + ""; - } catch { - } - try { - location = parseStackLinesV8(streamIn, (e.stack + "").split("\n"), ""); - } catch { - } - return { id: "", pluginName, text, location, notes: note ? [note] : [], detail: stash ? stash.store(e) : -1 }; -} -function parseStackLinesV8(streamIn, lines, ident) { - let at = " at "; - if (streamIn.readFileSync && !lines[0].startsWith(at) && lines[1].startsWith(at)) { - for (let i = 1; i < lines.length; i++) { - let line = lines[i]; - if (!line.startsWith(at)) - continue; - line = line.slice(at.length); - while (true) { - let match = /^(?:new |async )?\S+ \((.*)\)$/.exec(line); - if (match) { - line = match[1]; - continue; - } - match = /^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec(line); - if (match) { - line = match[1]; - continue; - } - match = /^(\S+):(\d+):(\d+)$/.exec(line); - if (match) { - let contents; - try { - contents = streamIn.readFileSync(match[1], "utf8"); - } catch { - break; - } - let lineText = contents.split(/\r\n|\r|\n|\u2028|\u2029/)[+match[2] - 1] || ""; - let column = +match[3] - 1; - let length = lineText.slice(column, column + ident.length) === ident ? ident.length : 0; - return { - file: match[1], - namespace: "file", - line: +match[2], - column: encodeUTF8(lineText.slice(0, column)).length, - length: encodeUTF8(lineText.slice(column, column + length)).length, - lineText: lineText + "\n" + lines.slice(1).join("\n"), - suggestion: "" - }; - } - break; - } - } - } - return null; -} -function failureErrorWithLog(text, errors, warnings) { - let limit = 5; - let summary = errors.length < 1 ? "" : ` with ${errors.length} error${errors.length < 2 ? "" : "s"}:` + errors.slice(0, limit + 1).map((e, i) => { - if (i === limit) - return "\n..."; - if (!e.location) - return ` -error: ${e.text}`; - let { file, line, column } = e.location; - let pluginText = e.pluginName ? `[plugin: ${e.pluginName}] ` : ""; - return ` -${file}:${line}:${column}: ERROR: ${pluginText}${e.text}`; - }).join(""); - let error = new Error(`${text}${summary}`); - error.errors = errors; - error.warnings = warnings; - return error; -} -function replaceDetailsInMessages(messages, stash) { - for (const message of messages) { - message.detail = stash.load(message.detail); - } - return messages; -} -function sanitizeLocation(location, where) { - if (location == null) - return null; - let keys = {}; - let file = getFlag(location, keys, "file", mustBeString); - let namespace = getFlag(location, keys, "namespace", mustBeString); - let line = getFlag(location, keys, "line", mustBeInteger); - let column = getFlag(location, keys, "column", mustBeInteger); - let length = getFlag(location, keys, "length", mustBeInteger); - let lineText = getFlag(location, keys, "lineText", mustBeString); - let suggestion = getFlag(location, keys, "suggestion", mustBeString); - checkForInvalidFlags(location, keys, where); - return { - file: file || "", - namespace: namespace || "", - line: line || 0, - column: column || 0, - length: length || 0, - lineText: lineText || "", - suggestion: suggestion || "" - }; -} -function sanitizeMessages(messages, property, stash, fallbackPluginName) { - let messagesClone = []; - let index = 0; - for (const message of messages) { - let keys = {}; - let id = getFlag(message, keys, "id", mustBeString); - let pluginName = getFlag(message, keys, "pluginName", mustBeString); - let text = getFlag(message, keys, "text", mustBeString); - let location = getFlag(message, keys, "location", mustBeObjectOrNull); - let notes = getFlag(message, keys, "notes", mustBeArray); - let detail = getFlag(message, keys, "detail", canBeAnything); - let where = `in element ${index} of "${property}"`; - checkForInvalidFlags(message, keys, where); - let notesClone = []; - if (notes) { - for (const note of notes) { - let noteKeys = {}; - let noteText = getFlag(note, noteKeys, "text", mustBeString); - let noteLocation = getFlag(note, noteKeys, "location", mustBeObjectOrNull); - checkForInvalidFlags(note, noteKeys, where); - notesClone.push({ - text: noteText || "", - location: sanitizeLocation(noteLocation, where) - }); - } - } - messagesClone.push({ - id: id || "", - pluginName: pluginName || fallbackPluginName, - text: text || "", - location: sanitizeLocation(location, where), - notes: notesClone, - detail: stash ? stash.store(detail) : -1 - }); - index++; - } - return messagesClone; -} -function sanitizeStringArray(values, property) { - const result = []; - for (const value of values) { - if (typeof value !== "string") - throw new Error(`${JSON.stringify(property)} must be an array of strings`); - result.push(value); - } - return result; -} -function convertOutputFiles({ path: path3, contents }) { - let text = null; - return { - path: path3, - contents, - get text() { - const binary = this.contents; - if (text === null || binary !== contents) { - contents = binary; - text = decodeUTF8(binary); - } - return text; - } - }; -} - -// lib/npm/node-platform.ts -var fs = require("fs"); -var os = require("os"); -var path = require("path"); -var ESBUILD_BINARY_PATH = process.env.ESBUILD_BINARY_PATH || ESBUILD_BINARY_PATH; -var knownWindowsPackages = { - "win32 arm64 LE": "esbuild-windows-arm64", - "win32 ia32 LE": "esbuild-windows-32", - "win32 x64 LE": "esbuild-windows-64" -}; -var knownUnixlikePackages = { - "android arm64 LE": "esbuild-android-arm64", - "darwin arm64 LE": "esbuild-darwin-arm64", - "darwin x64 LE": "esbuild-darwin-64", - "freebsd arm64 LE": "esbuild-freebsd-arm64", - "freebsd x64 LE": "esbuild-freebsd-64", - "linux arm LE": "esbuild-linux-arm", - "linux arm64 LE": "esbuild-linux-arm64", - "linux ia32 LE": "esbuild-linux-32", - "linux mips64el LE": "esbuild-linux-mips64le", - "linux ppc64 LE": "esbuild-linux-ppc64le", - "linux riscv64 LE": "esbuild-linux-riscv64", - "linux s390x BE": "esbuild-linux-s390x", - "linux x64 LE": "esbuild-linux-64", - "linux loong64 LE": "@esbuild/linux-loong64", - "netbsd x64 LE": "esbuild-netbsd-64", - "openbsd x64 LE": "esbuild-openbsd-64", - "sunos x64 LE": "esbuild-sunos-64" -}; -var knownWebAssemblyFallbackPackages = { - "android x64 LE": "esbuild-android-64" -}; -function pkgAndSubpathForCurrentPlatform() { - let pkg; - let subpath; - let isWASM = false; - let platformKey = `${process.platform} ${os.arch()} ${os.endianness()}`; - if (platformKey in knownWindowsPackages) { - pkg = knownWindowsPackages[platformKey]; - subpath = "esbuild.exe"; - } else if (platformKey in knownUnixlikePackages) { - pkg = knownUnixlikePackages[platformKey]; - subpath = "bin/esbuild"; - } else if (platformKey in knownWebAssemblyFallbackPackages) { - pkg = knownWebAssemblyFallbackPackages[platformKey]; - subpath = "bin/esbuild"; - isWASM = true; - } else { - throw new Error(`Unsupported platform: ${platformKey}`); - } - return { pkg, subpath, isWASM }; -} -function pkgForSomeOtherPlatform() { - const libMainJS = require.resolve("esbuild"); - const nodeModulesDirectory = path.dirname(path.dirname(path.dirname(libMainJS))); - if (path.basename(nodeModulesDirectory) === "node_modules") { - for (const unixKey in knownUnixlikePackages) { - try { - const pkg = knownUnixlikePackages[unixKey]; - if (fs.existsSync(path.join(nodeModulesDirectory, pkg))) - return pkg; - } catch { - } - } - for (const windowsKey in knownWindowsPackages) { - try { - const pkg = knownWindowsPackages[windowsKey]; - if (fs.existsSync(path.join(nodeModulesDirectory, pkg))) - return pkg; - } catch { - } - } - } - return null; -} -function downloadedBinPath(pkg, subpath) { - const esbuildLibDir = path.dirname(require.resolve("esbuild")); - return path.join(esbuildLibDir, `downloaded-${pkg}-${path.basename(subpath)}`); -} -function generateBinPath() { - if (ESBUILD_BINARY_PATH) { - return { binPath: ESBUILD_BINARY_PATH, isWASM: false }; - } - const { pkg, subpath, isWASM } = pkgAndSubpathForCurrentPlatform(); - let binPath; - try { - binPath = require.resolve(`${pkg}/${subpath}`); - } catch (e) { - binPath = downloadedBinPath(pkg, subpath); - if (!fs.existsSync(binPath)) { - try { - require.resolve(pkg); - } catch { - const otherPkg = pkgForSomeOtherPlatform(); - if (otherPkg) { - throw new Error(` -You installed esbuild on another platform than the one you're currently using. -This won't work because esbuild is written with native code and needs to -install a platform-specific binary executable. - -Specifically the "${otherPkg}" package is present but this platform -needs the "${pkg}" package instead. People often get into this -situation by installing esbuild on Windows or macOS and copying "node_modules" -into a Docker image that runs Linux, or by copying "node_modules" between -Windows and WSL environments. - -If you are installing with npm, you can try not copying the "node_modules" -directory when you copy the files over, and running "npm ci" or "npm install" -on the destination platform after the copy. Or you could consider using yarn -instead which has built-in support for installing a package on multiple -platforms simultaneously. - -If you are installing with yarn, you can try listing both this platform and the -other platform in your ".yarnrc.yml" file using the "supportedArchitectures" -feature: https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures -Keep in mind that this means multiple copies of esbuild will be present. - -Another alternative is to use the "esbuild-wasm" package instead, which works -the same way on all platforms. But it comes with a heavy performance cost and -can sometimes be 10x slower than the "esbuild" package, so you may also not -want to do that. -`); - } - throw new Error(`The package "${pkg}" could not be found, and is needed by esbuild. - -If you are installing esbuild with npm, make sure that you don't specify the -"--no-optional" flag. The "optionalDependencies" package.json feature is used -by esbuild to install the correct binary executable for your current platform.`); - } - throw e; - } - } - let isYarnPnP = false; - try { - require("pnpapi"); - isYarnPnP = true; - } catch (e) { - } - if (isYarnPnP) { - const esbuildLibDir = path.dirname(require.resolve("esbuild")); - const binTargetPath = path.join(esbuildLibDir, `pnpapi-${pkg}-${path.basename(subpath)}`); - if (!fs.existsSync(binTargetPath)) { - fs.copyFileSync(binPath, binTargetPath); - fs.chmodSync(binTargetPath, 493); - } - return { binPath: binTargetPath, isWASM }; - } - return { binPath, isWASM }; -} - -// lib/npm/node.ts -var child_process = require("child_process"); -var crypto = require("crypto"); -var path2 = require("path"); -var fs2 = require("fs"); -var os2 = require("os"); -var tty = require("tty"); -var worker_threads; -if (process.env.ESBUILD_WORKER_THREADS !== "0") { - try { - worker_threads = require("worker_threads"); - } catch { - } - let [major, minor] = process.versions.node.split("."); - if (+major < 12 || +major === 12 && +minor < 17 || +major === 13 && +minor < 13) { - worker_threads = void 0; - } -} -var _a; -var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.14.54"; -var esbuildCommandAndArgs = () => { - if ((!ESBUILD_BINARY_PATH || false) && (path2.basename(__filename) !== "main.js" || path2.basename(__dirname) !== "lib")) { - throw new Error( - `The esbuild JavaScript API cannot be bundled. Please mark the "esbuild" package as external so it's not included in the bundle. - -More information: The file containing the code for esbuild's JavaScript API (${__filename}) does not appear to be inside the esbuild package on the file system, which usually means that the esbuild package was bundled into another file. This is problematic because the API needs to run a binary executable inside the esbuild package which is located using a relative path from the API code to the executable. If the esbuild package is bundled, the relative path will be incorrect and the executable won't be found.` - ); - } - if (false) { - return ["node", [path2.join(__dirname, "..", "bin", "esbuild")]]; - } - const { binPath, isWASM } = generateBinPath(); - if (isWASM) { - return ["node", [binPath]]; - } else { - return [binPath, []]; - } -}; -var isTTY = () => tty.isatty(2); -var fsSync = { - readFile(tempFile, callback) { - try { - let contents = fs2.readFileSync(tempFile, "utf8"); - try { - fs2.unlinkSync(tempFile); - } catch { - } - callback(null, contents); - } catch (err) { - callback(err, null); - } - }, - writeFile(contents, callback) { - try { - let tempFile = randomFileName(); - fs2.writeFileSync(tempFile, contents); - callback(tempFile); - } catch { - callback(null); - } - } -}; -var fsAsync = { - readFile(tempFile, callback) { - try { - fs2.readFile(tempFile, "utf8", (err, contents) => { - try { - fs2.unlink(tempFile, () => callback(err, contents)); - } catch { - callback(err, contents); - } - }); - } catch (err) { - callback(err, null); - } - }, - writeFile(contents, callback) { - try { - let tempFile = randomFileName(); - fs2.writeFile(tempFile, contents, (err) => err !== null ? callback(null) : callback(tempFile)); - } catch { - callback(null); - } - } -}; -var version = "0.14.54"; -var build = (options) => ensureServiceIsRunning().build(options); -var serve = (serveOptions, buildOptions) => ensureServiceIsRunning().serve(serveOptions, buildOptions); -var transform = (input, options) => ensureServiceIsRunning().transform(input, options); -var formatMessages = (messages, options) => ensureServiceIsRunning().formatMessages(messages, options); -var analyzeMetafile = (messages, options) => ensureServiceIsRunning().analyzeMetafile(messages, options); -var buildSync = (options) => { - if (worker_threads && !isInternalWorkerThread) { - if (!workerThreadService) - workerThreadService = startWorkerThreadService(worker_threads); - return workerThreadService.buildSync(options); - } - let result; - runServiceSync((service) => service.buildOrServe({ - callName: "buildSync", - refs: null, - serveOptions: null, - options, - isTTY: isTTY(), - defaultWD, - callback: (err, res) => { - if (err) - throw err; - result = res; - } - })); - return result; -}; -var transformSync = (input, options) => { - if (worker_threads && !isInternalWorkerThread) { - if (!workerThreadService) - workerThreadService = startWorkerThreadService(worker_threads); - return workerThreadService.transformSync(input, options); - } - let result; - runServiceSync((service) => service.transform({ - callName: "transformSync", - refs: null, - input, - options: options || {}, - isTTY: isTTY(), - fs: fsSync, - callback: (err, res) => { - if (err) - throw err; - result = res; - } - })); - return result; -}; -var formatMessagesSync = (messages, options) => { - if (worker_threads && !isInternalWorkerThread) { - if (!workerThreadService) - workerThreadService = startWorkerThreadService(worker_threads); - return workerThreadService.formatMessagesSync(messages, options); - } - let result; - runServiceSync((service) => service.formatMessages({ - callName: "formatMessagesSync", - refs: null, - messages, - options, - callback: (err, res) => { - if (err) - throw err; - result = res; - } - })); - return result; -}; -var analyzeMetafileSync = (metafile, options) => { - if (worker_threads && !isInternalWorkerThread) { - if (!workerThreadService) - workerThreadService = startWorkerThreadService(worker_threads); - return workerThreadService.analyzeMetafileSync(metafile, options); - } - let result; - runServiceSync((service) => service.analyzeMetafile({ - callName: "analyzeMetafileSync", - refs: null, - metafile: typeof metafile === "string" ? metafile : JSON.stringify(metafile), - options, - callback: (err, res) => { - if (err) - throw err; - result = res; - } - })); - return result; -}; -var initializeWasCalled = false; -var initialize = (options) => { - options = validateInitializeOptions(options || {}); - if (options.wasmURL) - throw new Error(`The "wasmURL" option only works in the browser`); - if (options.wasmModule) - throw new Error(`The "wasmModule" option only works in the browser`); - if (options.worker) - throw new Error(`The "worker" option only works in the browser`); - if (initializeWasCalled) - throw new Error('Cannot call "initialize" more than once'); - ensureServiceIsRunning(); - initializeWasCalled = true; - return Promise.resolve(); -}; -var defaultWD = process.cwd(); -var longLivedService; -var ensureServiceIsRunning = () => { - if (longLivedService) - return longLivedService; - let [command, args] = esbuildCommandAndArgs(); - let child = child_process.spawn(command, args.concat(`--service=${"0.14.54"}`, "--ping"), { - windowsHide: true, - stdio: ["pipe", "pipe", "inherit"], - cwd: defaultWD - }); - let { readFromStdout, afterClose, service } = createChannel({ - writeToStdin(bytes) { - child.stdin.write(bytes, (err) => { - if (err) - afterClose(err); - }); - }, - readFileSync: fs2.readFileSync, - isSync: false, - isWriteUnavailable: false, - esbuild: node_exports - }); - child.stdin.on("error", afterClose); - child.on("error", afterClose); - const stdin = child.stdin; - const stdout = child.stdout; - stdout.on("data", readFromStdout); - stdout.on("end", afterClose); - let refCount = 0; - child.unref(); - if (stdin.unref) { - stdin.unref(); - } - if (stdout.unref) { - stdout.unref(); - } - const refs = { - ref() { - if (++refCount === 1) - child.ref(); - }, - unref() { - if (--refCount === 0) - child.unref(); - } - }; - longLivedService = { - build: (options) => { - return new Promise((resolve, reject) => { - service.buildOrServe({ - callName: "build", - refs, - serveOptions: null, - options, - isTTY: isTTY(), - defaultWD, - callback: (err, res) => err ? reject(err) : resolve(res) - }); - }); - }, - serve: (serveOptions, buildOptions) => { - if (serveOptions === null || typeof serveOptions !== "object") - throw new Error("The first argument must be an object"); - return new Promise((resolve, reject) => service.buildOrServe({ - callName: "serve", - refs, - serveOptions, - options: buildOptions, - isTTY: isTTY(), - defaultWD, - callback: (err, res) => err ? reject(err) : resolve(res) - })); - }, - transform: (input, options) => { - return new Promise((resolve, reject) => service.transform({ - callName: "transform", - refs, - input, - options: options || {}, - isTTY: isTTY(), - fs: fsAsync, - callback: (err, res) => err ? reject(err) : resolve(res) - })); - }, - formatMessages: (messages, options) => { - return new Promise((resolve, reject) => service.formatMessages({ - callName: "formatMessages", - refs, - messages, - options, - callback: (err, res) => err ? reject(err) : resolve(res) - })); - }, - analyzeMetafile: (metafile, options) => { - return new Promise((resolve, reject) => service.analyzeMetafile({ - callName: "analyzeMetafile", - refs, - metafile: typeof metafile === "string" ? metafile : JSON.stringify(metafile), - options, - callback: (err, res) => err ? reject(err) : resolve(res) - })); - } - }; - return longLivedService; -}; -var runServiceSync = (callback) => { - let [command, args] = esbuildCommandAndArgs(); - let stdin = new Uint8Array(); - let { readFromStdout, afterClose, service } = createChannel({ - writeToStdin(bytes) { - if (stdin.length !== 0) - throw new Error("Must run at most one command"); - stdin = bytes; - }, - isSync: true, - isWriteUnavailable: false, - esbuild: node_exports - }); - callback(service); - let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.14.54"}`), { - cwd: defaultWD, - windowsHide: true, - input: stdin, - maxBuffer: +process.env.ESBUILD_MAX_BUFFER || 16 * 1024 * 1024 - }); - readFromStdout(stdout); - afterClose(null); -}; -var randomFileName = () => { - return path2.join(os2.tmpdir(), `esbuild-${crypto.randomBytes(32).toString("hex")}`); -}; -var workerThreadService = null; -var startWorkerThreadService = (worker_threads2) => { - let { port1: mainPort, port2: workerPort } = new worker_threads2.MessageChannel(); - let worker = new worker_threads2.Worker(__filename, { - workerData: { workerPort, defaultWD, esbuildVersion: "0.14.54" }, - transferList: [workerPort], - execArgv: [] - }); - let nextID = 0; - let fakeBuildError = (text) => { - let error = new Error(`Build failed with 1 error: -error: ${text}`); - let errors = [{ id: "", pluginName: "", text, location: null, notes: [], detail: void 0 }]; - error.errors = errors; - error.warnings = []; - return error; - }; - let validateBuildSyncOptions = (options) => { - if (!options) - return; - let plugins = options.plugins; - let incremental = options.incremental; - let watch = options.watch; - if (plugins && plugins.length > 0) - throw fakeBuildError(`Cannot use plugins in synchronous API calls`); - if (incremental) - throw fakeBuildError(`Cannot use "incremental" with a synchronous build`); - if (watch) - throw fakeBuildError(`Cannot use "watch" with a synchronous build`); - }; - let applyProperties = (object, properties) => { - for (let key in properties) { - object[key] = properties[key]; - } - }; - let runCallSync = (command, args) => { - let id = nextID++; - let sharedBuffer = new SharedArrayBuffer(8); - let sharedBufferView = new Int32Array(sharedBuffer); - let msg = { sharedBuffer, id, command, args }; - worker.postMessage(msg); - let status = Atomics.wait(sharedBufferView, 0, 0); - if (status !== "ok" && status !== "not-equal") - throw new Error("Internal error: Atomics.wait() failed: " + status); - let { message: { id: id2, resolve, reject, properties } } = worker_threads2.receiveMessageOnPort(mainPort); - if (id !== id2) - throw new Error(`Internal error: Expected id ${id} but got id ${id2}`); - if (reject) { - applyProperties(reject, properties); - throw reject; - } - return resolve; - }; - worker.unref(); - return { - buildSync(options) { - validateBuildSyncOptions(options); - return runCallSync("build", [options]); - }, - transformSync(input, options) { - return runCallSync("transform", [input, options]); - }, - formatMessagesSync(messages, options) { - return runCallSync("formatMessages", [messages, options]); - }, - analyzeMetafileSync(metafile, options) { - return runCallSync("analyzeMetafile", [metafile, options]); - } - }; -}; -var startSyncServiceWorker = () => { - let workerPort = worker_threads.workerData.workerPort; - let parentPort = worker_threads.parentPort; - let extractProperties = (object) => { - let properties = {}; - if (object && typeof object === "object") { - for (let key in object) { - properties[key] = object[key]; - } - } - return properties; - }; - try { - let service = ensureServiceIsRunning(); - defaultWD = worker_threads.workerData.defaultWD; - parentPort.on("message", (msg) => { - (async () => { - let { sharedBuffer, id, command, args } = msg; - let sharedBufferView = new Int32Array(sharedBuffer); - try { - switch (command) { - case "build": - workerPort.postMessage({ id, resolve: await service.build(args[0]) }); - break; - case "transform": - workerPort.postMessage({ id, resolve: await service.transform(args[0], args[1]) }); - break; - case "formatMessages": - workerPort.postMessage({ id, resolve: await service.formatMessages(args[0], args[1]) }); - break; - case "analyzeMetafile": - workerPort.postMessage({ id, resolve: await service.analyzeMetafile(args[0], args[1]) }); - break; - default: - throw new Error(`Invalid command: ${command}`); - } - } catch (reject) { - workerPort.postMessage({ id, reject, properties: extractProperties(reject) }); - } - Atomics.add(sharedBufferView, 0, 1); - Atomics.notify(sharedBufferView, 0, Infinity); - })(); - }); - } catch (reject) { - parentPort.on("message", (msg) => { - let { sharedBuffer, id } = msg; - let sharedBufferView = new Int32Array(sharedBuffer); - workerPort.postMessage({ id, reject, properties: extractProperties(reject) }); - Atomics.add(sharedBufferView, 0, 1); - Atomics.notify(sharedBufferView, 0, Infinity); - }); - } -}; -if (isInternalWorkerThread) { - startSyncServiceWorker(); -} -var node_default = node_exports; -// Annotate the CommonJS export names for ESM import in node: -0 && (module.exports = { - analyzeMetafile, - analyzeMetafileSync, - build, - buildSync, - formatMessages, - formatMessagesSync, - initialize, - serve, - transform, - transformSync, - version -}); diff --git a/packages/denylist_bot/node_modules/esbuild/package.json b/packages/denylist_bot/node_modules/esbuild/package.json deleted file mode 100644 index 040732bfe..000000000 --- a/packages/denylist_bot/node_modules/esbuild/package.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "esbuild", - "version": "0.14.54", - "description": "An extremely fast JavaScript and CSS bundler and minifier.", - "repository": "https://github.com/evanw/esbuild", - "scripts": { - "postinstall": "node install.js" - }, - "main": "lib/main.js", - "types": "lib/main.d.ts", - "engines": { - "node": ">=12" - }, - "bin": { - "esbuild": "bin/esbuild" - }, - "optionalDependencies": { - "@esbuild/linux-loong64": "0.14.54", - "esbuild-android-64": "0.14.54", - "esbuild-android-arm64": "0.14.54", - "esbuild-darwin-64": "0.14.54", - "esbuild-darwin-arm64": "0.14.54", - "esbuild-freebsd-64": "0.14.54", - "esbuild-freebsd-arm64": "0.14.54", - "esbuild-linux-32": "0.14.54", - "esbuild-linux-64": "0.14.54", - "esbuild-linux-arm": "0.14.54", - "esbuild-linux-arm64": "0.14.54", - "esbuild-linux-mips64le": "0.14.54", - "esbuild-linux-ppc64le": "0.14.54", - "esbuild-linux-riscv64": "0.14.54", - "esbuild-linux-s390x": "0.14.54", - "esbuild-netbsd-64": "0.14.54", - "esbuild-openbsd-64": "0.14.54", - "esbuild-sunos-64": "0.14.54", - "esbuild-windows-32": "0.14.54", - "esbuild-windows-64": "0.14.54", - "esbuild-windows-arm64": "0.14.54" - }, - "license": "MIT" -} diff --git a/packages/denylist_bot/src/consumer.ts b/packages/denylist_bot/src/consumer.ts deleted file mode 100644 index 1ebd068ab..000000000 --- a/packages/denylist_bot/src/consumer.ts +++ /dev/null @@ -1,24 +0,0 @@ -import type { QueuedData } from "./utils"; -import type { Env } from "./env"; - -import { setupNear, viewFunction } from "./utils"; - -export const consumer = async (message: QueuedData, env: Env) => { - console.log("dummy"); -} - -// this function must perform a view call to contract to fetch -// accepted risk parameters -// there is currently no such view call in the contract. Mock -// values for now -const fetchRiskParams = async (): Promise => { - console.log("dummy") -} - -// this function must sign and send a denylist transaction -// to the contract -const sendBanTransaction = async (env: Env): Promise => { - const connection = await setupNear(env); - const account = await connection.account(env.ACCOUNT_ID); - // await account.functionCall(); -} \ No newline at end of file diff --git a/packages/denylist_bot/src/graphql.ts b/packages/denylist_bot/src/graphql.ts deleted file mode 100644 index b1ab3ad3b..000000000 --- a/packages/denylist_bot/src/graphql.ts +++ /dev/null @@ -1,65 +0,0 @@ -import Big from "big.js"; -import { Env } from "./env"; -import type { QueuedData } from "./utils"; - -const paginationSize = 100; - -type FeederState = string | null; - -type GraphqlResponse = { - hapioneEntries: QueuedData[] -} - -export class Pagination { - state: FeederState; - env: Env; - constructor(state: FeederState, env: Env) { - this.state = state; - this.env = env; - } - - async fetch(request: Request) { - const state = this.state || "0"; - const env = this.env; - - const query = ` - query GetHapioneEntries($lastViewed: BigInt!) { - hapioneEntries(where: {counter_gte: $lastViewed}, first: ${paginationSize}, orderBy: counter) { - counter - account - category - risk - } - } - `; - - const variables = { - lastViewed: state - } - - const response = await fetch(env.GRAPHQL_URL, { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ query, variables }), - }); - - const { data, errors } = (await response.json()) as { data: GraphqlResponse, errors: any }; - - // if error is thrown, exit execution - if (errors) throw new Error(JSON.stringify(errors)); - - // fetches items from response object - const parsedData = data.hapioneEntries; - - // sends all items collected in batch to queue - await env.QUEUE.sendBatch(parsedData as any[]); - - // updates state to new last read item - this.state = (new Big(state).plus(parsedData.length)).toFixed(0); - - // returns success response - return new Response("Success!"); - } -} \ No newline at end of file diff --git a/packages/denylist_bot/src/utils.ts b/packages/denylist_bot/src/utils.ts deleted file mode 100644 index 32a6ebf3f..000000000 --- a/packages/denylist_bot/src/utils.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { connect, keyStores, KeyPair, providers } from "near-api-js"; -import { Buffer } from "buffer"; -import Process from "process"; - -import type { Env } from "./env"; - -/* tslint:disable */ -globalThis.Buffer = Buffer; -globalThis.process = Process; -/* tslint:enable */ - -export type QueuedData = { - counter: string; - account: string; - category: string; - risk: string; -}; - -export const setupNear = async ({ - RPC_URL, - ACCOUNT_ID, - PRIVATE_KEY, - NEAR_NETWORK, -}: Env) => { - const myKeyStore = new keyStores.InMemoryKeyStore(); - - const keyPair = KeyPair.fromString(PRIVATE_KEY); - - await myKeyStore.setKey(NEAR_NETWORK, ACCOUNT_ID, keyPair); - - const connectionConfig = { - nodeUrl: RPC_URL, - networkId: NEAR_NETWORK, - }; - - return connect({ ...connectionConfig, keyStore: myKeyStore }); -}; - -export const viewFunction = async ( - nodeUrl: string, - contractId: string, - methodName: string, - args: any = {} -) => { - const provider = new providers.JsonRpcProvider({ url: nodeUrl }); - - const serializedArgs = Buffer.from(JSON.stringify(args)).toString("base64"); - - const res = (await provider.query({ - request_type: "call_function", - account_id: contractId, - method_name: methodName, - args_base64: serializedArgs, - finality: "optimistic", - })) as any; - - return JSON.parse(Buffer.from(res.result).toString()); -}; \ No newline at end of file diff --git a/packages/front/src/hooks/useEnv.tsx b/packages/front/src/hooks/useEnv.tsx index e82aa3c7f..6246f24d3 100644 --- a/packages/front/src/hooks/useEnv.tsx +++ b/packages/front/src/hooks/useEnv.tsx @@ -2,5 +2,5 @@ export const useEnv = (name: string) => { if (import.meta.env[import.meta.envPrefix + name]) return import.meta.env[import.meta.envPrefix + name]; if (import.meta.env[name]) return import.meta.env[name]; - alert(`Environment variable ${name} is not defined.`); + // alert(`Environment variable ${name} is not defined.`); }; diff --git a/yarn.lock b/yarn.lock index 452f84cb1..3d5e143a1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1033,6 +1033,11 @@ resolved "https://registry.yarnpkg.com/@cloudflare/workers-types/-/workers-types-4.20230307.0.tgz#58a20fe167a5c48e20edba8e1fbfe4231bcfa223" integrity sha512-Go968aDDcqONHQcUdgIiPRkPdT4QTzD0ecHJsI1u7ZiHPMOoZn+Dy7hYsdUJ5ldX9wTZDrICBM1rDKTRaDUitg== +"@cloudflare/workers-types@^4.20230321.0": + version "4.20230321.0" + resolved "https://registry.yarnpkg.com/@cloudflare/workers-types/-/workers-types-4.20230321.0.tgz#082c278ab614ad109f33c2f781e72ad3cd308877" + integrity sha512-zyRFz9AUS0tbg3/kJ+3zxvp9fl/O9yOJlChih/o86hhOqRMcZVbWefYAvFPidRvYUHM5YTG1wjU1bF9FFckRVg== + "@colors/colors@1.5.0": version "1.5.0" resolved "https://registry.yarnpkg.com/@colors/colors/-/colors-1.5.0.tgz#bb504579c1cae923e6576a4f5da43d25f97bdbd9" From dbcb1372259f201b789b5ea8d035103c07d1bf93 Mon Sep 17 00:00:00 2001 From: Mateus Santana <42101423+1Mateus@users.noreply.github.com> Date: Mon, 10 Apr 2023 11:40:52 -0300 Subject: [PATCH 04/13] Update package.json --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 8dcf59987..f526bea83 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "contract_libraries": "yarn workspace @near/contract_libraries", "subgraph": "yarn workspace @near/subgraph", "sdk": "yarn workspace hideyourcash-sdk", + "denylist": "yarn workspace denylist-bot", "relayer": "yarn workspace relayer" }, "engines": { From abc293f22d33a7b162248295fd360d6316e6da4c Mon Sep 17 00:00:00 2001 From: Mateus Santana <42101423+1Mateus@users.noreply.github.com> Date: Mon, 10 Apr 2023 21:25:46 -0300 Subject: [PATCH 05/13] feat(bot): wip --- .husky/pre-commit | 4 --- .../tests-ts/src/constants/merkle-tree.ts | 2 +- packages/denylist-bot/.env.example | 6 +++++ packages/denylist-bot/jest.config copy.js | 25 ------------------- packages/denylist-bot/jest.config.js | 5 +--- packages/denylist-bot/src/{utils => }/near.ts | 2 +- .../services/consumer.spec.ts} | 8 +++--- .../denylist-bot/src/services/consumer.ts | 2 +- packages/denylist-bot/src/services/request.ts | 6 ++--- packages/denylist-bot/test/tsconfig.json | 7 ------ 10 files changed, 17 insertions(+), 50 deletions(-) delete mode 100755 .husky/pre-commit delete mode 100644 packages/denylist-bot/jest.config copy.js rename packages/denylist-bot/src/{utils => }/near.ts (96%) rename packages/denylist-bot/{test/queue.test.ts => src/services/consumer.spec.ts} (89%) delete mode 100644 packages/denylist-bot/test/tsconfig.json diff --git a/.husky/pre-commit b/.husky/pre-commit deleted file mode 100755 index 5a182ef10..000000000 --- a/.husky/pre-commit +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env sh -. "$(dirname -- "$0")/_/husky.sh" - -yarn lint-staged diff --git a/packages/contracts/tests-ts/src/constants/merkle-tree.ts b/packages/contracts/tests-ts/src/constants/merkle-tree.ts index 875900e66..87d894b8c 100644 --- a/packages/contracts/tests-ts/src/constants/merkle-tree.ts +++ b/packages/contracts/tests-ts/src/constants/merkle-tree.ts @@ -18,7 +18,7 @@ export const FT_DECIMALS = "000000"; export const NEAR_DECIMALS = "000000000000000000000000"; -export const HAPI_ONE_TESTNET = "proxy.hapi-npo.testnet"; +export const HAPI_ONE_TESTNET = "dev-1681141193055-11311550135061"; export const Q = "21888242871839275222246405745257275088548364400416034343698204186575808495617"; diff --git a/packages/denylist-bot/.env.example b/packages/denylist-bot/.env.example index e69de29bb..2ccafe4fa 100644 --- a/packages/denylist-bot/.env.example +++ b/packages/denylist-bot/.env.example @@ -0,0 +1,6 @@ +GRAPHQL_URL="https://api.thegraph.com/subgraphs/name/hack-a-chain/hyc_mainnet" +RPC_URL="https://rpc.testnet.near.org/" +PRIVATE_KEY="" +ACCOUNT_ID="" +HYC_CONTRACT="" +NEAR_NETWORK="testnet" diff --git a/packages/denylist-bot/jest.config copy.js b/packages/denylist-bot/jest.config copy.js deleted file mode 100644 index 3a9152e21..000000000 --- a/packages/denylist-bot/jest.config copy.js +++ /dev/null @@ -1,25 +0,0 @@ -export default { - preset: "ts-jest/presets/default-esm", - globals: { - "ts-jest": { - tsconfig: "test/tsconfig.json", - useESM: true, - }, - }, - moduleNameMapper: { - "^@/(.*)$": "/src/$1", - "^(\\.{1,2}/.*)\\.js$": "$1", - }, - testEnvironment: "miniflare", - forceExit: true, - verbose: true, - detectOpenHandles: true, - clearMocks: true, - testEnvironmentOptions: { - // Miniflare doesn't yet support the `main` field in `wrangler.toml` so we - // need to explicitly tell it where our built worker is. We also need to - // explicitly mark it as an ES module. - scriptPath: "dist/index.mjs", - modules: true, - }, -}; diff --git a/packages/denylist-bot/jest.config.js b/packages/denylist-bot/jest.config.js index 3a9152e21..d2640b2c0 100644 --- a/packages/denylist-bot/jest.config.js +++ b/packages/denylist-bot/jest.config.js @@ -6,12 +6,9 @@ export default { useESM: true, }, }, - moduleNameMapper: { - "^@/(.*)$": "/src/$1", - "^(\\.{1,2}/.*)\\.js$": "$1", - }, testEnvironment: "miniflare", forceExit: true, + transform: {}, verbose: true, detectOpenHandles: true, clearMocks: true, diff --git a/packages/denylist-bot/src/utils/near.ts b/packages/denylist-bot/src/near.ts similarity index 96% rename from packages/denylist-bot/src/utils/near.ts rename to packages/denylist-bot/src/near.ts index a71bd15f3..a8b84ea11 100644 --- a/packages/denylist-bot/src/utils/near.ts +++ b/packages/denylist-bot/src/near.ts @@ -1,6 +1,6 @@ import Process from "process"; import { Buffer } from "buffer"; -import type { Env } from "../types/env"; +import type { Env } from "./types/env"; import { connect, keyStores, KeyPair, providers } from "near-api-js"; /* tslint:disable */ diff --git a/packages/denylist-bot/test/queue.test.ts b/packages/denylist-bot/src/services/consumer.spec.ts similarity index 89% rename from packages/denylist-bot/test/queue.test.ts rename to packages/denylist-bot/src/services/consumer.spec.ts index 3cd0ce1a8..26c492539 100644 --- a/packages/denylist-bot/test/queue.test.ts +++ b/packages/denylist-bot/src/services/consumer.spec.ts @@ -1,7 +1,7 @@ -import testnetSetup from "./test_setup.json"; -import { consumer } from "../src/services/consumer"; +import { consumer } from "./consumer"; +import testnetSetup from "../../test_setup.json"; +import { setupNear, viewFunction } from "../near"; import { describe, expect, jest, it, beforeAll } from '@jest/globals'; -import { setupNear, viewFunction } from "../src//utils/near"; const payload = { counter: '34', @@ -74,6 +74,6 @@ describe("Test all service actions", () => { }, ); - expect(inDenylist).toEqual(true); + expect(inDenylist).toEqual(false); }); }); diff --git a/packages/denylist-bot/src/services/consumer.ts b/packages/denylist-bot/src/services/consumer.ts index 54ab81d5a..7a1ad93a0 100644 --- a/packages/denylist-bot/src/services/consumer.ts +++ b/packages/denylist-bot/src/services/consumer.ts @@ -1,6 +1,6 @@ import type { Env } from "../types/env"; import { AttachedGas } from "../constants"; -import { setupNear, viewFunction } from "../utils/near"; +import { setupNear, viewFunction } from "../near"; import type { QueuedData } from "../types/pagination"; const riskMap: any = { diff --git a/packages/denylist-bot/src/services/request.ts b/packages/denylist-bot/src/services/request.ts index 04f67eea1..bff7c549e 100644 --- a/packages/denylist-bot/src/services/request.ts +++ b/packages/denylist-bot/src/services/request.ts @@ -1,7 +1,7 @@ -import { Env } from "@/types/env"; -import { getHapioneEntriesQuery } from "@/query"; -import { FeederState, FetchResponseInterface } from "@/types/pagination"; +import type { Env } from "../types/env"; +import { getHapioneEntriesQuery } from "../query"; +import type { FeederState, FetchResponseInterface } from "../types/pagination"; export const sendRequest = async (counter: FeederState, env: Env): Promise => { const response = await fetch(env.GRAPHQL_URL, { diff --git a/packages/denylist-bot/test/tsconfig.json b/packages/denylist-bot/test/tsconfig.json deleted file mode 100644 index f6923df30..000000000 --- a/packages/denylist-bot/test/tsconfig.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "../tsconfig.json", - "compilerOptions": { - "types": ["@cloudflare/workers-types", "jest", "../bindings"] - }, - "include": ["../src/**/*", "**/*"] -} From ce9a8bd0d7837a30425077f6aa28af98e9eb2017 Mon Sep 17 00:00:00 2001 From: Mateus Santana <42101423+1Mateus@users.noreply.github.com> Date: Tue, 11 Apr 2023 02:00:36 -0300 Subject: [PATCH 06/13] feat(denylist-bot): update setup --- .../tests-ts/src/actions/registry.ts | 34 +++++++++++- packages/contracts/tests-ts/src/index.ts | 18 ++++++- packages/denylist-bot/jest.config.js | 8 --- packages/denylist-bot/package.json | 3 +- packages/denylist-bot/src/constants.ts | 1 - packages/denylist-bot/src/dos/pagination.ts | 2 +- packages/denylist-bot/src/query.ts | 12 ----- .../denylist-bot/src/services/consumer.ts | 7 ++- packages/denylist-bot/src/services/request.ts | 2 +- .../denylist-bot/src/{near.ts => utils.ts} | 15 ++++++ .../consumer.test.ts} | 53 ++++++++++++------- packages/denylist-bot/test/tsconfig.json | 7 +++ 12 files changed, 110 insertions(+), 52 deletions(-) delete mode 100644 packages/denylist-bot/src/constants.ts delete mode 100644 packages/denylist-bot/src/query.ts rename packages/denylist-bot/src/{near.ts => utils.ts} (78%) rename packages/denylist-bot/{src/services/consumer.spec.ts => test/consumer.test.ts} (54%) create mode 100644 packages/denylist-bot/test/tsconfig.json diff --git a/packages/contracts/tests-ts/src/actions/registry.ts b/packages/contracts/tests-ts/src/actions/registry.ts index 66ce0c9a3..ab73d54c8 100644 --- a/packages/contracts/tests-ts/src/actions/registry.ts +++ b/packages/contracts/tests-ts/src/actions/registry.ts @@ -20,12 +20,44 @@ type Currency = account_id: string; }; +export const deployHapi = async ({ + account, + owner, +}: { + account: Account; + owner: Account; +}): Promise => { + const contractWasm = fs.readFileSync("./proxy_contract_release.wasm"); + + await account.deployContract(contractWasm); + + await account.functionCall({ + contractId: account.accountId, + methodName: "new", + args: { + owner_id: owner.accountId, + }, + gas: new BN("300000000000000"), + }); + + await owner.functionCall({ + contractId: account.accountId, + methodName: "create_reporter", + args: { + address: owner.accountId, + permission_level: 1, + }, + }); +}; + export const deployRegistry = async ({ account, owner, + hapi, }: { account: Account; owner: Account; + hapi: Account; }): Promise => { const contractWasm = fs.readFileSync("../out/registry.wasm"); @@ -36,7 +68,7 @@ export const deployRegistry = async ({ methodName: "new", args: { owner: owner.accountId, - authorizer: HAPI_ONE_TESTNET, + authorizer: hapi.accountId, // vec of tupples (category, max_risk_threshold) risk_params: RISK_PARAMS, // merkle tree params diff --git a/packages/contracts/tests-ts/src/index.ts b/packages/contracts/tests-ts/src/index.ts index 47b25d5b7..a3da35456 100644 --- a/packages/contracts/tests-ts/src/index.ts +++ b/packages/contracts/tests-ts/src/index.ts @@ -7,7 +7,7 @@ import { deployToken, sendDeposit } from "./actions/token"; import { createAccount } from "./actions/account"; import { getConnection } from "./actions/connection"; import { FT_DECIMALS } from "./constants"; -import { deployInstance, deployRegistry, addEntry } from "./actions/registry"; +import { deployInstance, deployRegistry, addEntry, deployHapi } from "./actions/registry"; import { addBalances, addStorage, registerUser } from "./actions/contracts"; import { buildCommitments } from "./prepare_commitments"; import { readInputs } from "./utils/file"; @@ -80,6 +80,13 @@ export async function setup(): Promise { accountId: `${random_prefix}sdk.testnet`, }); + const hapiOneAccount = await createAccount({ + creator, + config, + near, + accountId: `${random_prefix}hapione.testnet`, + }); + console.log("Deploying tokens and instances"); await deployToken({ @@ -87,9 +94,15 @@ export async function setup(): Promise { account: tokenContractAccount, }); + await deployHapi({ + owner, + account: hapiOneAccount, + }); + await deployRegistry({ owner, account: registryAccount, + hapi: hapiOneAccount, }); await deployInstance({ @@ -207,12 +220,13 @@ export async function setup(): Promise { account: proofInputs.sdk, tokenInstance: tokenInstanceAccount10.accountId, hyc_contract: registryAccount.accountId, + hapi_contract: hapiOneAccount.accountId, cache: output, }); fs.writeFileSync("../../sdk/test/test_setup.json", testSetup); fs.writeFileSync("../../relayer/test/test_setup.json", testSetup); - fs.writeFileSync("../../denylist-bot/test/test_setup.json", testSetup); + fs.writeFileSync("../../denylist-bot/test_setup.json", testSetup); if (isCI) { console.log("The code is running on a CI server"); diff --git a/packages/denylist-bot/jest.config.js b/packages/denylist-bot/jest.config.js index d2640b2c0..46e8bc4c3 100644 --- a/packages/denylist-bot/jest.config.js +++ b/packages/denylist-bot/jest.config.js @@ -6,17 +6,9 @@ export default { useESM: true, }, }, - testEnvironment: "miniflare", forceExit: true, transform: {}, verbose: true, detectOpenHandles: true, clearMocks: true, - testEnvironmentOptions: { - // Miniflare doesn't yet support the `main` field in `wrangler.toml` so we - // need to explicitly tell it where our built worker is. We also need to - // explicitly mark it as an ES module. - scriptPath: "dist/index.mjs", - modules: true, - }, }; diff --git a/packages/denylist-bot/package.json b/packages/denylist-bot/package.json index 6516ccf7d..e3a49b23b 100644 --- a/packages/denylist-bot/package.json +++ b/packages/denylist-bot/package.json @@ -1,7 +1,7 @@ { "name": "denylist-bot", "version": "1.0.0", - "description": "Production level relayer with cloudflare workers", + "description": "Production level CF Worker Bot", "type": "module", "module": "./dist/index.mjs", "scripts": { @@ -37,7 +37,6 @@ "@tsndr/cloudflare-worker-router": "^2.3.2", "big.js": "^6.2.1", "buffer": "^6.0.3", - "graphql-request": "^5.2.0", "near-api-js": "^1.1.0" } } diff --git a/packages/denylist-bot/src/constants.ts b/packages/denylist-bot/src/constants.ts deleted file mode 100644 index d3f690272..000000000 --- a/packages/denylist-bot/src/constants.ts +++ /dev/null @@ -1 +0,0 @@ -export const AttachedGas = "300000000000000"; diff --git a/packages/denylist-bot/src/dos/pagination.ts b/packages/denylist-bot/src/dos/pagination.ts index aeda07be5..ac1a468d3 100644 --- a/packages/denylist-bot/src/dos/pagination.ts +++ b/packages/denylist-bot/src/dos/pagination.ts @@ -1,6 +1,6 @@ import { Env } from "../types/env"; import { FeederState } from "../types/pagination"; -import { sendRequest } from "..//services/request"; +import { sendRequest } from "../services/request"; /** * The Durable Object diff --git a/packages/denylist-bot/src/query.ts b/packages/denylist-bot/src/query.ts deleted file mode 100644 index a1814c65a..000000000 --- a/packages/denylist-bot/src/query.ts +++ /dev/null @@ -1,12 +0,0 @@ -export const paginationSize = 100; - -export const getHapioneEntriesQuery = ` - query GetHapioneEntries($lastViewed: BigInt!) { - hapioneEntries(where: {counter_gt: $lastViewed}, first: ${paginationSize}, orderBy: counter) { - counter - account - category - risk - } - } -`; diff --git a/packages/denylist-bot/src/services/consumer.ts b/packages/denylist-bot/src/services/consumer.ts index 7a1ad93a0..d6e52dad5 100644 --- a/packages/denylist-bot/src/services/consumer.ts +++ b/packages/denylist-bot/src/services/consumer.ts @@ -1,7 +1,6 @@ import type { Env } from "../types/env"; -import { AttachedGas } from "../constants"; -import { setupNear, viewFunction } from "../near"; import type { QueuedData } from "../types/pagination"; +import { setupNear, viewFunction, AttachedGas } from "../utils"; const riskMap: any = { "Scam": 5, @@ -86,7 +85,7 @@ export const consumer = async (payload: QueuedData, env: Env) => { console.info(`The ${payload.account} account has been banned`); } catch (e) { - console.error(`Error to send the account: ${payload.account} to denylist`); - console.error(e); + console.warn(`Error to send the account: ${payload.account} to denylist`); + console.warn(e); } } diff --git a/packages/denylist-bot/src/services/request.ts b/packages/denylist-bot/src/services/request.ts index bff7c549e..eee9ffae3 100644 --- a/packages/denylist-bot/src/services/request.ts +++ b/packages/denylist-bot/src/services/request.ts @@ -1,6 +1,6 @@ import type { Env } from "../types/env"; -import { getHapioneEntriesQuery } from "../query"; +import { getHapioneEntriesQuery } from "../utils"; import type { FeederState, FetchResponseInterface } from "../types/pagination"; export const sendRequest = async (counter: FeederState, env: Env): Promise => { diff --git a/packages/denylist-bot/src/near.ts b/packages/denylist-bot/src/utils.ts similarity index 78% rename from packages/denylist-bot/src/near.ts rename to packages/denylist-bot/src/utils.ts index a8b84ea11..2fa2c13ba 100644 --- a/packages/denylist-bot/src/near.ts +++ b/packages/denylist-bot/src/utils.ts @@ -8,6 +8,8 @@ globalThis.Buffer = Buffer; globalThis.process = Process; /* tslint:enable */ +export const AttachedGas = "300000000000000"; + export const setupNear = async ({ RPC_URL, ACCOUNT_ID, @@ -48,3 +50,16 @@ export const viewFunction = async ( return JSON.parse(Buffer.from(res.result).toString()); }; + +export const paginationSize = 100; + +export const getHapioneEntriesQuery = ` + query GetHapioneEntries($lastViewed: BigInt!) { + hapioneEntries(where: {counter_gt: $lastViewed}, first: ${paginationSize}, orderBy: counter) { + counter + account + category + risk + } + } +`; diff --git a/packages/denylist-bot/src/services/consumer.spec.ts b/packages/denylist-bot/test/consumer.test.ts similarity index 54% rename from packages/denylist-bot/src/services/consumer.spec.ts rename to packages/denylist-bot/test/consumer.test.ts index 26c492539..465dd25a2 100644 --- a/packages/denylist-bot/src/services/consumer.spec.ts +++ b/packages/denylist-bot/test/consumer.test.ts @@ -1,11 +1,11 @@ -import { consumer } from "./consumer"; -import testnetSetup from "../../test_setup.json"; -import { setupNear, viewFunction } from "../near"; +import testnetSetup from "../test_setup.json"; +import { consumer } from "../src/services/consumer"; +import { setupNear, viewFunction } from "../src/utils"; import { describe, expect, jest, it, beforeAll } from '@jest/globals'; const payload = { counter: '34', - account: '3ae95aeeb5a4600264ecneko.testnet', + account: '19b5ee6a1586bc18144e0718d93e1cb05b8c752e15b73ee4200d5ee4e88ac3b1', category: 'Theft', risk: '7', }; @@ -14,8 +14,8 @@ const baseEnv = { NEAR_NETWORK: "testnet", HYC_CONTRACT: testnetSetup.hyc_contract, RPC_URL: "https://rpc.testnet.near.org", - ACCOUNT_ID: testnetSetup.account.account_id, - PRIVATE_KEY: testnetSetup.account.private_key, + ACCOUNT_ID: testnetSetup.owner.account_id, + PRIVATE_KEY: testnetSetup.owner.private_key, }; describe("Test all service actions", () => { @@ -36,7 +36,7 @@ describe("Test all service actions", () => { }); it("should return success - The account has been banned", async () => { - const inAllowlist = await viewFunction( + let inAllowlist = await viewFunction( baseEnv.RPC_URL, baseEnv.HYC_CONTRACT, 'view_is_in_allowlist', @@ -47,7 +47,7 @@ describe("Test all service actions", () => { expect(inAllowlist).toEqual(false); - account.functionCall({ + await account.functionCall({ contractId: baseEnv.HYC_CONTRACT, methodName: "allowlist", args: { @@ -57,23 +57,36 @@ describe("Test all service actions", () => { attachedDeposit: "480000000000000000000" as any, }); - expect(inAllowlist).toEqual(true); - try { + await account.functionCall({ + contractId: testnetSetup.hapi_contract, + methodName: "create_address", + args: { + address: payload.account, + category: "Theft", + risk: 10, + }, + gas: "300000000000000" as any, + }); + await consumer(payload, baseEnv as any); } catch (e) { console.warn(e); } - const inDenylist = await viewFunction( - baseEnv.RPC_URL, - baseEnv.HYC_CONTRACT, - 'view_is_in_allowlist', - { - account_id: payload.account, - }, - ); - - expect(inDenylist).toEqual(false); + try { + await account.functionCall({ + contractId: baseEnv.HYC_CONTRACT, + methodName: "allowlist", + args: { + account_id: payload.account, + }, + gas: "300000000000000" as any, + attachedDeposit: "480000000000000000000" as any, + }); + } catch (e: any) { + console.log(e.message); + expect(e.message).toContain("Account risk is too high"); + } }); }); diff --git a/packages/denylist-bot/test/tsconfig.json b/packages/denylist-bot/test/tsconfig.json new file mode 100644 index 000000000..f6923df30 --- /dev/null +++ b/packages/denylist-bot/test/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "types": ["@cloudflare/workers-types", "jest", "../bindings"] + }, + "include": ["../src/**/*", "**/*"] +} From 1b2d4c4d4886fd6e46d5cff2818cb5dfd43425f0 Mon Sep 17 00:00:00 2001 From: Mateus Santana <42101423+1Mateus@users.noreply.github.com> Date: Tue, 11 Apr 2023 02:06:18 -0300 Subject: [PATCH 07/13] feat(bot): update CI tests --- .github/workflows/CI.yml | 2 +- packages/relayer/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 3519dcfa2..2745a8aca 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -54,7 +54,7 @@ jobs: - name: Compile circuits run: yarn circuits circuit:setup:plonk - - name: Run test-ts setup and test SDK and Relayer + - name: Run test-ts setup and test SDK, Relayer and Denylist Bot env: CF_TOKEN: ${{ secrets.CF_API_TOKEN }} CF_IDENTIFIER: ${{ secrets.CF_IDENTIFIER }} diff --git a/packages/relayer/package.json b/packages/relayer/package.json index 55f18b85f..e4b6f6853 100644 --- a/packages/relayer/package.json +++ b/packages/relayer/package.json @@ -9,7 +9,7 @@ "dev": "miniflare --live-reload --debug --modules dist/index.mjs --env .env", "dev:remote": "wrangler dev", "test:only": "yarn build && node --experimental-vm-modules --no-warnings node_modules/.bin/jest --forceExit --detectOpenHandles", - "test": "(cd ../contracts && yarn tests:ts) && (cd ../sdk && yarn test:only) && yarn test:only --forceExit --detectOpenHandles", + "test": "(cd ../contracts && yarn tests:ts) && (cd ../sdk && yarn test:only) && (cd ../denylist-bot && yarn test:only) && yarn test:only --forceExit --detectOpenHandles", "types:check": "tsc && tsc -p test/tsconfig.json", "deploy": "yarn build && wrangler publish --keep-vars", "populate:envs": "cd scripts && tsc && node build/populateEnvs.js" From ff526aec6f28bd7b76cfbe02f1f4cd84ade3d294 Mon Sep 17 00:00:00 2001 From: Mateus Santana <42101423+1Mateus@users.noreply.github.com> Date: Tue, 11 Apr 2023 02:22:08 -0300 Subject: [PATCH 08/13] feat(denylist): update CI and prod deploy --- .github/workflows/prod_deploy.yml | 22 +++++++++++++- .../tests-ts/src/actions/registry.ts | 2 +- .../denylist-bot/scripts/src/populateEnvs.ts | 30 +++++-------------- packages/denylist-bot/scripts/src/secrets.ts | 3 +- packages/denylist-bot/wrangler.toml | 2 +- 5 files changed, 31 insertions(+), 28 deletions(-) diff --git a/.github/workflows/prod_deploy.yml b/.github/workflows/prod_deploy.yml index 16fa3d487..48e66704a 100644 --- a/.github/workflows/prod_deploy.yml +++ b/.github/workflows/prod_deploy.yml @@ -34,7 +34,7 @@ on: - main jobs: - relayer_deploy: + production_deploy: runs-on: ubuntu-latest steps: - name: Checkout @@ -97,6 +97,26 @@ jobs: command: publish --name prod-relayer --keep-vars workingDirectory: 'packages/relayer' + - name: Building Denylist Bot + run: yarn denylist build + + - name: Set Denylist Variables + env: + NEAR_NETWORK: ${{ env.VITE_NEAR_NETWORK }} + RPC_URL: ${{ env.VITE_NEAR_NODE_URL }} + HYC_CONTRACT: ${{ env.VITE_CONTRACT }} + GRAPHQL_URL: ${{ env.VITE_RELAYER_URL }} + CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }} + CF_IDENTIFIER: ${{ secrets.CF_IDENTIFIER }} + run: yarn denylist populate:envs + + - name: Publish Denylist Worker + uses: cloudflare/wrangler-action@2.0.0 + with: + apiToken: ${{ secrets.CF_API_TOKEN }} + command: publish --name hyc-denybot --keep-vars + workingDirectory: 'packages/denylist-bot' + - name: Compile circuits run: yarn circuits circuit:setup:plonk diff --git a/packages/contracts/tests-ts/src/actions/registry.ts b/packages/contracts/tests-ts/src/actions/registry.ts index ab73d54c8..11a0a51a5 100644 --- a/packages/contracts/tests-ts/src/actions/registry.ts +++ b/packages/contracts/tests-ts/src/actions/registry.ts @@ -27,7 +27,7 @@ export const deployHapi = async ({ account: Account; owner: Account; }): Promise => { - const contractWasm = fs.readFileSync("./proxy_contract_release.wasm"); + const contractWasm = fs.readFileSync("../tests-ts/proxy_contract_release.wasm"); await account.deployContract(contractWasm); diff --git a/packages/denylist-bot/scripts/src/populateEnvs.ts b/packages/denylist-bot/scripts/src/populateEnvs.ts index 0ad4678f9..b1d106bad 100644 --- a/packages/denylist-bot/scripts/src/populateEnvs.ts +++ b/packages/denylist-bot/scripts/src/populateEnvs.ts @@ -5,13 +5,10 @@ const { RPC_URL, PRIVATE_KEY, ACCOUNT_ID, - RELAYER_FEE, - RELAYER_URL, HYC_CONTRACT, - BASE_STORAGE_FEE, CF_API_TOKEN, CF_IDENTIFIER, - RELAYER_NAME + GRAPHQL_URL, } = process.env; if ( @@ -19,20 +16,17 @@ if ( !RPC_URL || !PRIVATE_KEY || !ACCOUNT_ID || - !RELAYER_FEE || - !RELAYER_URL || + !GRAPHQL_URL || !HYC_CONTRACT || - !BASE_STORAGE_FEE || !CF_API_TOKEN || - !CF_IDENTIFIER || - !RELAYER_NAME + !CF_IDENTIFIER ) { throw new Error("There are missing Envs that need to be set"); } -console.log(`Deploy secrets for script: ${RELAYER_NAME}`); +console.log(`Deploy secrets for script: denylist bot`); -deploySecrets(CF_API_TOKEN, RELAYER_NAME, CF_IDENTIFIER, [ +deploySecrets(CF_API_TOKEN, CF_IDENTIFIER, [ { name: "NEAR_NETWORK", text: NEAR_NETWORK, @@ -54,13 +48,8 @@ deploySecrets(CF_API_TOKEN, RELAYER_NAME, CF_IDENTIFIER, [ type: 'secret_text', }, { - name: "RELAYER_FEE", - text: RELAYER_FEE, - type: 'secret_text', - }, - { - name: "RELAYER_URL", - text: RELAYER_URL, + name: "GRAPHQL_URL", + text: GRAPHQL_URL, type: 'secret_text', }, { @@ -68,11 +57,6 @@ deploySecrets(CF_API_TOKEN, RELAYER_NAME, CF_IDENTIFIER, [ text: HYC_CONTRACT, type: 'secret_text', }, - { - name: "BASE_STORAGE_FEE", - text: BASE_STORAGE_FEE, - type: 'secret_text', - }, ]).then(res => { console.log('Deploy secrets res: ', res); }); diff --git a/packages/denylist-bot/scripts/src/secrets.ts b/packages/denylist-bot/scripts/src/secrets.ts index 05faadf4d..55935caef 100644 --- a/packages/denylist-bot/scripts/src/secrets.ts +++ b/packages/denylist-bot/scripts/src/secrets.ts @@ -20,11 +20,10 @@ export interface SecretInterface { export const deploySecrets = async ( apiToken = '', - scriptName = 'prod-relayer', accountIdentifier = '', secrets: SecretInterface[], ) => { - const url = `/accounts/${accountIdentifier}/workers/services/${scriptName}/environments/production/secrets`; + const url = `/accounts/${accountIdentifier}/workers/services/hyc-denybot/environments/production/secrets`; return await Promise.all(secrets.map(async (secret) => { const response = await performApiFetch( diff --git a/packages/denylist-bot/wrangler.toml b/packages/denylist-bot/wrangler.toml index b620437fd..6596650a1 100644 --- a/packages/denylist-bot/wrangler.toml +++ b/packages/denylist-bot/wrangler.toml @@ -1,5 +1,5 @@ node_compat = true -name = "prod-denybot" +name = "hyc-denybot" main = "dist/index.mjs" compatibility_date = "experimental" From f3dfa1aab94c5b2e8a12a84c64d390d42b1f6524 Mon Sep 17 00:00:00 2001 From: Mateus Santana <42101423+1Mateus@users.noreply.github.com> Date: Tue, 11 Apr 2023 02:33:35 -0300 Subject: [PATCH 09/13] fix: ci --- packages/contracts/proxy_contract_release.wasm | Bin 0 -> 136504 bytes .../contracts/tests-ts/src/actions/registry.ts | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100755 packages/contracts/proxy_contract_release.wasm diff --git a/packages/contracts/proxy_contract_release.wasm b/packages/contracts/proxy_contract_release.wasm new file mode 100755 index 0000000000000000000000000000000000000000..c47815cc4db2603cdab308e1bf53f8b4b4165560 GIT binary patch literal 136504 zcmeFa3!G&|b^p5`=X9U$eR^j1FyP3L>+ZuOX_SeR`!|3{%+&mSfS5=UlfO6j{|TUw zXk!qD(dhjk)4+g(qK--w5p`4)R4}L*QBfO3MMcF(;tLfO2`cLN9u>p={#I4(y-)X< z2MRI%KTN~fd)Ka7wQ9X;)vCu%jz8@m(j-aJucy^<>E`6PZ1d)HvwoA~^38UiZcfiQ zE<59lD>+Zanet zpK{u!6E`MZrS;?Eu}?km?_Oy-19{;2#J?-fyZ#woVCnV!~ z*?r2%r#yX=zb}v9wCVUKJ^92Fjy>VTQ=WF(Q$lk88OJ~M=_gXprl)T_+1E08%JC;Z zJk7H-?Pp29$d)bVU$Ly;&&oW>`u%=VmeXWT<3Ge8DUvdy z_;guh(`l9in;LutdAgzxuzl+4R7s!z(=5xgmCDY2QA|^G8b~X{zbr{8!oTS>Ur|i& z8~&xm3QCkK%Y^cYDy2-C??=X>QwnMhB>t7zzW2MIawOS`B1!j2L4to2PiX`HCH?8N zzaP1imE}rd-k&bW0Js$*PiMu7qEDf`AeEM@g6X0J)#;?zC&_ZqHY)WC{!Qn7GJBeK zgpnYD4gYc~6&8T(3q+^WQF2-&`=CHnkWTAydSB(SdZ9PCgn^QMGzmOE06L-OzuC?oSUB_Ra7GwW#;y*lXi{lEV52~YX^*Jl@Z9{q3G-&~ykQ|GV#{PC~L z9`}>%v+0@H+1Xdpuclv0zntEZelGow^c(5Fr~j6ICjCzKyzE8Ui?f$x@5|Obrvn#UqWbe){&Hg2Od-jg(%+59x?844-I(KB>%XVZx$iAQ5p8YbrD?2m) z&ul)wsB=;N{QR}~w)|!J1^G+!H|NjGUy#2zzcAmLKPP`l{`&k4`K9?~`FZ(s^Yin! zX%4e~X1Tjj1dSEW@}K2LA5_4=#wwMox)9yOIz`9XPa(AjWTdiI9S zUreP%mAKB~D2eW>&Y@XS0HK`oz>576Qq$S2qn{o?ZxhgBCaUeKcpU#32uI9)^W*9>g!fEC8RTkN~%0rgUOq_S*L05jmb%aP^oXB zwNi)uzZF1OD242ZSXS(F5=Bf^@?YOI+w=kcSUlQiR zx|*TAx>+;G4^i8z4%i4yL3JzLRnH~A+rNCxSytkp{IJ1TBxzQSZK$?hI@2w(^;H*4 zk_`!DrTx9R4Jmj1TyR#+Ro(Jzp|#=6*_koJpBh(*MXLIMLFaK(AhD|oXU4=jqf%0h zK{$a;Dcd>8qik*GaV`?Fg4pHN9^*gC%9$}$vr;9>*KGk0c$BH3>$r?n`4t5} z(iXum>+Dw~1+}$q@C0GprIt4cwuDN5 zBGDhaeWd;wLN5b>8K5lBqW`)>^NKRBR+&MH)RBHrUPY;mg;d0pvOgEd1Zfku&*90G zO3Y^Kf|k^2L5Zu7Uqp&!bq|w+o!L8ry=XDPesa$d>@~v#o6Q~~p|8nR6MgT=6^qnO zmWG(_phCmsLOGOn50mR9_aeD2**&@LIq3?d8IrDhhg|=3FOuuh-IFVd%H2@LSmZY* zT`#*A$@TjG^T_q`dy!nP-95Q}85AC&jXH>&0M#pX|@8bszB=Cj8`Ee34( zN$KGU<3q-DxrmjCvKr*LThCsYPs%r`G)|5PhwFPpl4{^*!2RHJ30O*Jdj(SUj|M9j zGxDZ*{E!6H16G&&O45gd_hPI+B?j8imDWkDY&6&cdQsXq`s-Rl@G6r-hr6z^mj>kY z(vCDe98llkiIWURL>j%?p<$?`E!S|V#{~qGvIbaODlR!qIwV`AyF;>B9(!};zZ;$q zAK$+g#glf?U=#VzsDymb{)}CE8vG&PV%vx@hDcK~Xh69C)#?(*BWbI&_+X0;h*KSk zsK{5o)#_p(*+H$iz<6;x=YIqyWeDe_QaHyJx=6|^)MyJ?Op#MJ6S(5J>v~1hfT?_o z@>nUKV^U+B#D;?|oihy;yonJ-5Ie9i-4!uwf;}e9Hvu3 zDx0IC8Ahd`ZBpSf!U$eIXx~wXCuy-;+JE|yf7Ya6+H1u^L+RMZS0 zlY=q_A>|iJ;rW<3cUO9=cYV2+y{QR{N}S-#B#FLB?RUzkr^US6)}LFbWE zWBq0A_qW;mPV>IopK84?zbp=`T&Lf!({=Oq2r%nUB83vHQwalI-pq4jDf8ZFBb!onnu>4kM@ zOLzq_<6q#J%Lt8iMa)6hIFRuqDyMFTVL0pN&w_a6hkcNwU0f{uQeez4RRqQy3=jL` zg$D`1M?-4#(`o?jqo=wJ5v;dvHM3{Uqyxr2KrZYDO`+l4NVYz0&!wprzgr?`6Ol5p zVB*GSI?$%wzQo%1=qXIot|5(yj-rHwOjsv-5`1j;5_|~gNzmQk(Zncg&PQRQS$j~X z(J*O`K|Nep1*pOnGRt=v8-YltsF}Ir%oa1rUXI8vABcFR7c#SqY10pNihnS(YSzAG zS_#o2m$?FMDSZ!b5^q@%l7E~VWbS@PBU5RWZE}P$Ia2LFw-4?(4xh}opPjFB?F^xD=7GO^?YMY64hVE8{ z*Ct8rDuNRkl1BrscnLFRo3qvoNXPd|kzWmLR0lk)FBeU_0*U?lgGZrgU2Ag6RU}A@ z4Oql%eU%COd}bVGZonXC>o@TD?7{ekVUQ; zbJmuHGXIgAOin6U3I7K zs*6iHxu!|#@G~;q4IWNVALkorx=0`43F8wpxF!OPi$LzL=9cA*0MJmYGZdF`mXqkc zv`Fi!Ya=IJCXA@&tBI<$uVzkqS28NUKh9jBgpy2Zrs!nQg~7PGYMEXW^6BD0#TGgw@UGf+%og+_M?HL*x4vORM zhL^wnw&X}q3%8F(XM1iO)h(*=%QsA(F__TgPc?DrU=pbQb#i1iSrNV;uO^Q?4Y?|6 zlXQ~}jzV84WagG4b7YN-G$)n*R^#QnB`@Y8_@ra1v2wxE=+x&0*3GzK@ZDN#iy!A% zw;2H9HZGPC6Zy#8<|>a)${OXy^t_fBa6g7tns+eaIXL#nsR_DeDA1|K<_0)6N1jGc z)^pWH)3W1^NYPKJQ|}l`-KHl9dC3r;XjHxkFl@!yh&|0! zL)jzK#>#gYgAkP_$!vtoMpw?T(!0SEP8SI}CcyMzcX^~)K}5#9h^SEXl!Hb2&^%all^>bid15+V!ZF5l#KTnW$S z9+W3DJwbJwA0s$b?{#LgN#g#sg9v!X=Hpw{?6~WR(&VliQGq$o=4C!&`}N;G=Z80Z zbu%ET;Hqqn9@0A{W7XJ2Rkr$}c@Lv$jMmI?n+F$kI++>hdhWhGU>;>!HFqzS@TN5k zgPG}FWLj-ZE52CoBI?lBm}#ZW6rRMhl7A|ng%s0c`k!{k*lC$b=`SK@Jl&9#|6-!6 z@DD8xzRiRb)=xrmZs!D%zHM7btjS2V=oj8yaxiqoHw3)g87Nt;fGG zTY$x&-e@tpvKZr4Cs>SbHU2kkLwwzk#;Pd@7tTR>joM9ZP`9MDwD&>zD%eX4HGk?Y zFfUiOI(C>aOcg)0O^2zXOwo-h-kstMNn~UU+vJHV3IW=#OH@!gGK339Cg&pGO`|h8 zGA$$1C}`7@vCLv_z{pr#S=ao##(Mo|h!&pmS|ngD$_O=o7i)^53r$y&26v-1)=;B- z!@MI*9LdB^cE=oHbMgjxbcL<+<?nEQsVyj+Tn#4C$he%p8LY{*~( zhN0#SyYb#f*KjCbZw-PhO~p2FNc{LH0%5p7a%;GNeDvjAr?pg7dGU9nfHYvXGuTl}@v0e-s6kYR-3jRLy#>IIfY z2RmuvYIYI}ML-J0P(Vt3lfqEy4-|&Nf3zSJ7AJ&BIu<6Gf}dt`oWvBrk{&rKUjzkCA@hG{)i#O@R|_GYX6q()+B^@PDcJZZi1A?;4TS4%DY zi~&6Kk|$PZe8Gltn6<=ZilF6M!o|gP4OrDZR11eglx{3iN!ge3TsAMgZo$-~kSt(H}cE+iN(it~9u3_06? z=ChHIP_#CrMd3LQNye*%()dV5&_~hA4z1LkD@J9~pfV}{Sxu8ufk})etW)fpWb4g{ z+Hkx4h%yz$`xv=Jn@qem3l=XZem&tOd5_93Wyhps@**<7)c~-uBes@Ta~m*LtG)m498_^mLDe$ z_Y%UB^;x%CpLMNK$a(|C8yG3cF@$2F`lwH_dKKRL>H)*BSXNgz*g)EY^^zpWHdc*o z9GM1tEgue#XC?V%{*)XI>bk(!;=-0eZFNkGCoHq|p@*^lMb^>LBf5GY8e zH0g%ofys;yz9<~Hxb#quk`(WirxM)xdm1y}oXJ7v6d#6KiVv$%OQ&GH=jEjfHU#un z>=FG}vgUde`si0nD@4u&1h{B9T&lUd#dMLr%6qoDr2@*GfxC}!-%Z@3F&XBtK;i~? zOqh-~j3!OJz7)dDBbu!4dL+#%i)yI~*V!0M1vzVLk`#{(BSc!Go^C(`dzvXwTj?0& zg35tX$B>p^3`%LQ$}gDZv0`BgY11gD!1{G}{y8$?Y57j;XnaJe!i3{yepGObo{A~? zC7!A^7Wr7L6_-MbNi|2^>f+zoO_xOmw*ngmTeBoD^Ie)-MO3Oc)6=Ch zGoec|Gii9v$h+*DOEx8x^vB?NqMDi;EUP9ZoIUR4OfSd%tfsh|nW~l{J%iHi{1}b2 zSmQE9eJtx>T0x2xRsT-`LiF+=nW6r-B{NkVG#oF^~V$YZW*P%G6ZQR3-waw$Sp0SKh_U^;*) z8)Dlk@iwIy3BWEvad&Q^q2*3L6V}BZjXFDJn33m=Nav^4iLI- z%tI(lSdgmaAUZw6_6E4Qn#`r2quipMmzwiy_rQ5hnbfREpikXFn?8`82&<=dp7eql`< zUsPGK43t=S-zh(QrfNB>MU%FFBXs(Z0pvu3xYi-czXjncAz&diaq&EayR@kd|lJ^AU-$C@p^>!0H9cJM9kAaew|6QvJZZd`av6 z1-fTXQZWg<$e#KZdd9Wb+~VtPH$?x^dH~O!JWOwO)DKV-_L1u}`Q{UQ^l5r)VVs`t z5`=um^=oFaizHhg=7TDT7@FgNy`S z<4+b5&D;J2--g?K8=lcrhM(5;l~rtek=|khqz&qLfy{`aoHHE^NpXxOwUpUo{AUWP z*Eg#wuARC1mh7GK>%Q6-$Ul_0(yq*=0&@5D~Arxw1@rd5avH=sfM?VR%PgVaBurVtif6d-Q{4^~LA4q9z$}%FaOz^WSeC_5 zr(ABKo}n@xGIcL_u$dnYX_p9g%}8OL4G*?=r%g|X2LKsp7Um|z%FHLG@#TV1Q7*dW~o(NhGp@aBM;3hm`)^T{h_%Q_feO&W&!drI(8b#UEfTE zbhS2aK4?HC`?~8Sj&v@5Pg)ZDXF#&ON(j@BeO|bVqN)fTs&ldPj)+k1Zb{+@^m*)i zZD!Y7`|S{|1>22vmyD?z4t9)x*GuY9gX|G%i#pI75+?G^Y^odeh0YfSK6_ec*A^z9 z@vz~HEy%J|%%M^U5_0FwF;5401JFv6E>?q12p?#B6SOpRD5PL9IHJc|3P-Y8z^J@D zVS}S4Ydd6xGWta?1ie;iWN*b6(GEE4LJ!Jq-0x&6qRJNK76*0#B^H&WH~Y!{C2dP3 z)*}z*+yn)4G%oF=mP4@GmBXdFjk?=GAf9K6pV$VVO22QdEHald)w*j z^;zme=29Cxr5B;jw+_k0P_;vK0&aLvgH4qM!0dj%5f;&Dl^;t`*Q!Atx8fRA3|Fc* zTPMM`ZOCyItPv$HM$v|34}H6!izhY8Pu-OU8r#&t;7%~+C~s>a=5knQ*bQmSj49kiq35a@b!L3VmiYhq6q;>&)}_zk zPMw?8sQx#UZ`r}$2rqv8U(AbBb}Os6J`m<@(NfjK9Tw6*H)kW-4LN#^mV4J$9!1dS zH>Qn4s*TG--IM$nd?u!2G%Ux}g)_?)-ey8KJV0l6sydJjvcpcca^olF9oXgAPrM;?H{R^5YQW> zfgY%LJ1URWNEw3pp^PH)ba|Ss(n3fJ9r@|gOaW9fX3WI;Rjjsb7>heROP8^zn?O_f zag7xQoN=J(cZ((9B$+|cf@^o-i=b(Ft!S_5b%Z#~#3^&#KOkA}X>qkJS!RtEwL_i( z=*unGyE!-5iCCDMN0%kpfEpB^)N*ms!#rDB&*l0lFEFg9bMetvX*$=(w&a5!VDnbx z$84~~Ghty!?t6E6zQWubU?G!tz#eK`a7E>utd~_#PI@^d3oRVayrww1g}vF3b~8w>|w@ zUCZ`KIAf^O9UJdWOcwpAWy{Oy72uq@|G0p56Wn^SEGXfa)P2EHrdlZG#1yJ@=QrGCevN14DL{Sz<=BAvjhg2Z|Ozx zY4U8niQZW@A2sep536W9t&qEyTY3;lMdqEwo84or3Q+nzc z{I)*ZFN2oLMB{ufUi={jSH@PJVOCxzmm@BpD4!F?2j<1b!Q0Skj`k?AO3R!Zv@wjKPmp6KGIuW$^GU<|=>LhH!)n>LFZKl)qF(=K2l~ zE7dAL&IFQb8yceRuB{&wL@hyR`?NQu%TZk6-v*br3;E!26K}T7$@r<-xN7TZ zxW^GTl=j^tOgZjtk3B7~5_sWQG7P|}U!?_R2C`yF2HvVR_7g199%!v&(WI59k2xPx z9g!zP9u!^>UE-opPnoxfl2F?M3Cc8yr{0bt5Mc_At>PeoE?!3%)5PLTzc#B^ZDWQ6 zko`{ez=CC0aR=R2i=uqkuMvQT64h2tmSV-tb0c!LTyLRMd)RBd_A#G})&=cLq|D`& zCgI3$Qe4L=$8m5uG}9oesboDu@)Yy?HEPlkS=+-HNYiGK+}dPSkLLVB(0VjCzDG#f z+~VecPrZi^VQD5Vj*Bv>dyT8uHhMH?o1=L9D~#qC>eQn-KbB)LtBthwVw_}>Vknww zdt&-MQ^E#;l6k3Tq!tN)OzNUh))1?|e6Mg(1{HCUF8rEYY(X+E%6igXCed{FE3(s< z^pxCNcD4|?`|NBLZrEx4n2=c1yGYGLGi^$3RhX0au~Tw0>^D=OW-R6}X+!+|$i2ef zrf2ze`P+iz`TN_hq}F45(K01<+UO#Y)fBnuYnVE|n~Hh>Ff<#gMK-dpeqPl3RK=OC zI6qT_!_l?!Mc$3^NX78DAIt{hZYvW^Un>k_v?V%$R(hY#-b6BV~N@p!)@QdD8t1XKye6<&KzY61;`czE7=CXi2`T=lV9EPXG(|BX3YG`dPQ!3VI)u3=g-4e)i{>im)otCV~q>K zs%?;rVr~_ES0#%h8)Vw;g##}Okl`$=4M3y3P$@H_qKDszE6a=((`jg5s|orGW1N>r>UJzy}nJpcl$(oAy z0-?nhaS0oWq4BfyLzXCS=2;dgM<-~iMl`jiQcP#y=%-iy+$!w^p=%aH7nimuv94{I zG&GKc0IXW9pH;(D=xA@1te>#6apVW1CZtd4bYRQh2Os)CqE;RRT6{@`!OR z5j0w-k}S&zG}5y4MkZ8Ui+44-6jW}JtFW`R zHNI}wLxkO7!|iHmfK@E^+ro;L3Lt)_0_%CB*R$CpY8B{s72qPC83^AnEpCWy=eBNo ztqyWrc+o8H{P?2Ara>W6_p%qtSa-bwh$Gp0>urYmEA7Y=dSRD>*WT2xV`Y(EDrVC~ zF)vnr%LJ8&HGZmJ@9M?Gi}U_IjRTm-7ia!`n)goQ+`mtouzYd$-=|GlTAcs) zY2t9^;tBwt*0;2{2EeCHSz25L;M0~_T3iR<)0SIWTnXUQd}uAM1@LLpmM^Xb@M$YB z3Bu-%u!>=)L%^0~9A)X3dXj~)CyPyns8(jD zdFm_!|4wIjy0Q4A6FVJy_5C{?HRyWriE|ke7bbl(9j}nM$@oquDroz@FJ}|;{rIE< z4BS+FvH|3>_$24tEssx{ZFXgR(mbP2nIRmxdYZh=g zY+8*erifF^0FOb||9D zV8FrwNTrUGGt978yyVQ#IG_JX!6pe#TV2mnzhjN_3n~Nx0CoPKhWyBa$n6WA>w8*( zKiF!M1-@B1dGD>dGSime%5%V!8R8Od7|OGt;Dd#~Hf6=25QsL)uJn{GBfg;a{OB2o zq{4buB%-^ML(rSbT;gu9S(KafTmB@p8Oc=(XU3(yI+Ths4^bIUS-q&^+_t^Fn$#hv zX@z#J5*Fo$1!+Kl{vkYas`EN7J?+^XtB9+z`=l~%O>$PRq3eymYO5xp5GSQ;SduUjQ$MMn*I z-72Eyp;c12x>amuj+hR$%9AJ&`Ltvb@=3KJpSi$vDWli!iCGJA1#NM5k&QJwAchSN zQoU%NMh3z}WNmU#G&p7+7FnBv_r}_^t z4v;`WTT z0154yklhScY8_>ykicP!d7R7iRtn?jMaQbp;%INJ(3uVftOcnq=*?Bn%o`X`WUJaF zhO)vAab#pbRhmyTq-E;jq-rcHQ|HUJ?3_((nlMK@XZFpS+BR|wDrU7ti;843P}K-N zv`JG=V3Tr4Lpn2IM}du0W;0c>=efruV2zi6%36qz-?EH`vaRS7`(zo%Ax`4vUxiI{ zZOhnGtlTV^44FteKr3errbTZCg*SC$bZO-a8lf^a_`ZzjBtytiu)WoVOVm*t537;c z&zVWPGcL-Ev@EbmRW+ft(`kjb)3(5Np#GRFnEG9?L$qW<2&l=RNGMIuIIM&Q)%I$< znt+FWtEl1~r*x{P`-tqH#5FQ*$gd9->~J`v(Fdv-{*U?TI zY<8o^_YlSl;KR@Aff-9v=7|#->{%hIP^Yi=I92147+{peCIXkxn2p z(-W8Z#*r%hY+T_RlO`8?RURdI3-x%mi_-{hp`N6M5sjO?R#5hosGUTjd)iM$!3NhF zqgd2DlUVe;=wFr)3elOysngL_YS9r(-OFHwW9gQM8OCCVH6v*wq+z*;piFNZ7Mx5C z@8z&6^f4ZMOAc(px9siSx7>UGa*3=FPZ}ClXmE?HF}U>vT^IaHVFgu03q0}0qr7B^ zM`@oRFpumAV5utSX|8N{-P~Qp7sMA0DuzD)Tl>jAbP>qFv1l?|9ueAWM{dXwh9l|-6qEoC z>xzWoTATWke>@zdX!RNrpnAgMz95Cg@9qmyVE^t5Qh57k`g>oH;=Ulo0x_rq+ z8;Zk@j?NPJReapXTVq646a2OUFou?EuV10%-{wiYXEu9ASeBjnCDG7;h9)eY2ku3&P7E)$bNUkLfbW&l!|7Dw8Et% zvC_RsnsywUujTGdQt5J%P~RqLxt-b1I>shxnd_2^)$dKxlp7<7CGbsB-;I;RM0Jx? zxE@K23!0=!H$f6p!A%mMfF_B)sY&X&f+UujHA&-+bJ;ZU+9Zv+DUz6YYLdEc8A+^j zZjw4~IZ3R-YLbu^l90$IDRa{#LEk1Rbt}SZ(?!D3-oZO084ve!QSN&CM#y%vMfzll z`{+=DB(YH+)Il?b=)v1s29Ql^ZPASe5LKac;?19|jcqgb1}%IU1@p9v3dkJynVH2# z+Ycr!SZ1j&h5<|Ab_!i@D!8zCl{8h$g~rUkjJM_2C3{KnsTR%{?M^V2oFaR8!bdIH zzBJBBAVvvRta;s_^?f^`-(4xPtnL@rnUO^ zEKAu1z#Zgv8ld=X7_@q#=^mh6G*MMjynUE#jhSOx%DA0nSd)!oWCPh$|A5AOvWffJ z1E_6=WcGB6o0;;OFfNsPw@H)N9dz!tUKmJ|H>Anc4d_D<>Y(*LcF;c`Mmq93DX;Vh zLKFW<$4R*d68tu{aI^Li+T7U@QP>4{cD7O21&pir0ApbohQvslx*_%i7tv6HP`=h= zFVe6PE|(T34%z&gUz9=^?F8{xT4C+b<;We|_nJ0>iwYs*^frS`AIgO|s#Nzdu@;Qt zr@sb;nR_2i;A`~dqTPu9b$TCpybBn6BJkE>7NqCDBMA^8gvID#%e37Kz6uvd!0+#)+=w-rZCoS>g4mlr7!apl26 z6bT-SSg8_RwQ$C)2nG2p${=HjIq$H2d|8CP*%lpCq^=^Bn!E#8{!(?b=G}ehA}Hz( zie4WAMn!y|W!Amg-uxcLsBpx`nA}bFnW=g&yN55-*jjAn%uwQ!r^oTijb=168o6->`4RE3?t#{rR1LnEAg^6QHBC9s}*;l4&cv*k9W!T=r~EBC`pi;0*ord!4*9F=fgE z;=ZRA%0zmxu@SzBYbDGBdMjuVu2pP;`ipm=H^#0=|U*lnwq4ys9~{PwFF$~Q;q*pG$Ca+9T+AE z;(jpPko-v58c4M^dAymLCxZ7MCm7TeG}s=^@$q zLQm*lWPSEf{BAxC#+Y{ce%l|8t5089vlgfCG(|q2+;^&7d&sR?UoomyFd6~bI|>4B zj>295f74z9U&O|?E*v8U)}722h$Sz>8V~wSH^YO+dZ`I}yaeV6wF#?>kskqwb_-7- zI=NyK9h0hQ^)o_pL_hQW%v_0I$57pkp~J;qT-PQiHioJSIsh2yz#=>K1UVX&x|$Pq zW2f-;qb3NO=x;0ePLb;LodICYy4{aY?28|ZgC$8 zu7WD+I_Rk7lg*$~_iRm;{x zXm+ZLzy5A_pC#4-m_wf>W;%+5)@O+!3JI;x5;IQpGXhGFpCzt~*=LDG+##r`&6F@@ z&@SU4$IlWcHou}N8av3&rJ6mkC@PeM@*Q{aYZf5+4MsBJIZS9&$S-6=2Dvl6X+;C| zEqky?%8wbfepl2mP~|^~L;e%OnIehhC0j_?pQ?*LhNPB{AY{nbmAu-CQ5Bv+)j4W) z_~f~VM!uIC$E$9!k}BP-pZL05*h)Jll(^`Q&k0SNs%e7g`2P6P#`ED+ zn@4S?L)=e|ybq!fPT?h1#A6rEUprw)_gYOv1+d$+P+Rs}X zX%PK|enJq&Bk2v}z4PVmhbH0yBF!ZSOYkW_BxL+4m3qA1Kblo;`l90ObhqETq+R)@ z0mmAr-Y~eMvN5PxTxM3D09c;Clg)LlRPdZtj_LoI~b2Qgx!| zwnF^v?!gM_r&oSfl9E{kKocW$TA3-7%@l%zM5~!YG`|tC4yU??3B@JZ+Po>A&tX>0 z`8wLXz{2W6g!6Xb)f3 zl~H9JZ`#6-!K09p6eZ@)BGCG*o9g!`ZDwM|`YPK%KdVo^X|aOP&J@9Kb&3YZzboG> zx=Q&B^Iph2ypDmL(?^m4mDx9x@(UT#(z-0)npOJ#FCGOJ%~S)L=r~S4^N2|BT5Z}9 zr)`hhp1l;RyMz0%m>aQB}o$HG4 zUEAJhX-cv|)6C%6o7<4eS{mh%q`W*^q}g!h>`W)JTgShdrNc^TcktNbwgk+_79Y*m`~dE z_8Ce;8jg<@gNSMNxZt$ojEA0^3|aY2<5;&gbH$(FEJGO+4lJO%Mk4`tT@rmiW4ZJ} zH@G%3nFbckpsr$7(s<);{`C|tUnlV^UYX`HNu$5QA%j=`piN#*T)k8r7rzI&Hw1rU z>WvWPm-2;;q4RQ0&XAtmup9H81VUx{41OetpiOs*6RZ>K!2uK$aX3`- zk5#&1^Iu$nWh#EwI-0fRw3{WtiZMt*w4-VB2AbJJ*&^nGg3X0Yu)}2*c{B>`~@ z8ZK9qTRi4;HJ$?2=ZM{e*?fz9BMUrquV&|{L~%rl1z&G$wB#zkqROt=a7OtYy+-fT zzeZnlE@|h|Wh@2EL}{1K$W|6}?fw|gAoq26cn~GKg1TtX))p*-gI8l5^K_75$YZ;O zvZuC2BGFO7bB8o%1kyZY5z^&(RzVh#h1WyKYPO>&`L?Pwmm`PmsQ2O%X*#xa)Jt1) zP*2_aSvczaibU84)ylVuvu4_7QZJ}FxHTaff#aT0rs~Lh=<@MPOd%9vC1)}ibH~ih zNJPfmtNmJ3PE6U~1|7EQaZ4)KGX*A&K6Q}j zR6IpCYT`hr^wi?REibLD&LIA6iLCKhDk3fOo(k9IAbpGy&RAX;R>$GBlR#?NK8#lBj9Im-S~jX4y|FOi+fUS_^t8=h3%h zMudzKii8o7NZscx^FHOztbbU+S^96hc0Q>jKQ;tryxJt;`1^6}enW|9z|Cqt5SzT^ z7cJ?}z|~j@L?Vh+Vj`+(^o%aJN>9dfyX6hwNWkklUE@&IZM#&dGw#lIss`+Ce!f#~ zm2jJy@%?B20Ato7He|SqfBC5jxe*W#V1A@)1Wul8Q}LjfdvV^Y7UeBB6$78Q2l`+f zaociP3+S_auT8+0&cU62s*fI|F0;>%Ndr3^bzAYi!`qGO0EMl(giP73LrJY~5BUamBUIK+rdqs*JP7r=`n%#&IO-`+;}g&F1G>G`6i_e+gc_I&_& zWub=5sF|KxX?Zv9pdZ5N=IGVnZ9T6dnZ9Iso?s2~^~6rxW;?iMCU;@rC{PdpK#H6^ z-{&k}petZYMuu{q6+oeG>IHLHhHqjU|YMzOf&O)U;~@ZAc2 z(&Am+bYe5=ftQH0Ji}pA#6UT3(E99Nwm#<+CWJU&uVyd)t9o?k9Nc5yozuxR95|B% zDo<9ua+|dnL)ueLF?mo_Jmwm7LmHaPJW)A~0?j9}V4rhZAof%>aTF)#PE{;a>{nAq zO^s#itA0iKldADk2a|s)i(XBfI)(ll9zd5jp^E4gdv=mjHR%xKaY|CoJ#%gV%!K=i zlRP)XFsd^{G$EdF8cakLV3ZTMfnjckKcY?&^2us42>FD>yPEJ%l3YW_60OlacLr#2 z>%k%w6C3@kb|z5NZuqjOxYo6+-`L_51t&ZRlRMCnP7Nlk^PixHhG7%c1RWY&Sj{0t zko|>5_MXx*Iwc@jEnd#FI=Y7xKHI2OzcHK)d*-Y}M=@b$jOEoeUOU?=Ri|!kV_RFe z3-=;5+Lp`Od10m~qBBYTpi)N%gN>J^{i_LoG!|#?6dy>3LhUUl$CmYIg}P#R<#R<2 z#(sz!km)*Lt8_0{w{g8H_rK)@%4l42C9OiSux7CGZ{VZ;k7u??s zM8$5c6xr!g8|R50?wcte=>Q+^W1FMx@#SLzl2_gM4lsw}e3A*n~o9#Xb5R^hyy%Nd}8uiH>2ay0(ZS z2$cwJ!#|O{8xf4AT1qt~-iBR&A)`~nOVGl`2sb1qDU$?*dI z+`$lj{gK)@lwnWFrRcdhBj+^a$}HFWH$O(%nCb$ACa`wOWkGV3dGQ3+pAWUG6WV2; z4k5Eq68!0fUTLku-1=5=({5Gk`!@P!Z3v2T1L}(3atT-hwT-0_Pq?Ug zm(Y93S{+ExT#bwp3=v&IK#DL*xm}fDVDJRw9urECAXscA@l|>kLE6)@CgvkT#vdA4 zH2Z=^>4(zgPc8A(rgd$Xy~2!OR=^Ls7;zLEW_W5zU@cJ={Xxq+u}eN z4?#PgpdplwSiE)%^m?Qst{ukVA}*SkdomXLSVEAsDl2fiulC(fgHK-AJb1qBTwQCSy3#Cb{Nk#57Uy z!P^S=9$D4 zmuOA|H~cjBfM>+WIVol|Q2z3R)_5}-nYlHjeb^AAf63^!l_{(mDF3DDFh-jSZyh>n zf{y<_OJbl16e!f(ita1#F_x(upLs? z5BcZX7Hh^hEw8au?kwt&6c4X!#r|96L43;vpA&d-#Aw}y@?gzi0#luY#CC@hPR8|n z!fF`8kTnNO*zX~THD=92yBasIcxVFIWcIjd59^vspAl7x^YyksS`W}W^=j1KhpGxk{rTMt7!Ol;L*5>Ll;_%#+# zu1=Tf6R1|2dBci<#$=%qJ9>+OfMx15*nFmf;&3EY`KUI_i>Nq<50QPbAR{#9Qb>w> zGiqq81c&~gvgXrBSfIc%kye${?g6ri-{;Yo;k$VHvV|Nq#@^`+LsjyLAApq~NZXlE z;eoqQt*EEt8#)!AG=M#?llHP;V~k!eIL)vJU`&-Mi7ZBCJ_+Id%sNEZ-oAI|KQH(Y zUGDCXTcePE?)`OJcyi;FB-UHI04h1-{0KM_+ahk5w*vBdo7V=DF1YFAAnHgNuU#Z_?3CBQ~r zXZnt}(6M+jH@4MY4hFX~HnnC>ms%$|9ML+Pw&*mi`@_aY>1g2S;m{ot!nsk@BsIhy#q8o6f|F@?&s)uxP09lUGU(scqmNr7kZP^>d9kIp7eHfX@Z(hmA* z@4>;JM1mj%HdRJ7;G&FwQI z+9@IN^}C#5Co^59v@xBv2+FT?8zmvCpAvuQtef^!N%4!c(MV$GwILKCG_Xem5)%p5 zZ1N>F^$_{6lq&~mH+~c*C=gwXw#)%3Yk-o&Q4@Rdz2cF$^uK#_%xdvkA%jpt;P9A9 z2*S=;72$6Cl3IWgYoRh=4_7ujR2ihG!|pWxF(E{NwV?-;d=GMsg3v*v%?1hZf*y~y z`^oe0)lT}ra7qFib`*O>0kzBCFcsup`FXY1`sW!FG}25!yybUjApH+1{eo(zzSkI`{e9WJGeZ zH-BEj_d~+-PIqj)H!)fCrP^&U%UMCK~xuAV_t-R%CeAvd@6x*_byxh*5AH9_ebDn{AyEX;^(&?D=g zlwxs!MU=7R@*5KDHdRtBlNv>pwEV0n2({B@ISF{&($DY540NX zV1Fu)z~qA&WDL!iVscy*x#LU{&YcL+uE$O>x2s3yJ2nf_VA8GHP{>gOm;&`f zFZv4jFl{s=LGA7AMW{oz>aw$%B5iY;K0HOF-ShbVd3KmsHD6n%SpXRu%dm zcWtE-_N6pi9mJtYZdqBU+x@s@TS??w!!37{PrV;*N`BbPDp<9Qze)Xn)avSfZu6rC z_g}5~s$R7ZHBDCcUp=t5)v}{k&&}*lfzDtx7~yHN(#*JAt*WMJ+#e>%)(z>|$H0^o z6?w;*CYp>=kgtb@lQx%EE!W%0YJX_8FLPRarvs>j)Zvdl=Qt_A3}|fD43>e+1Qkrq z%}iC}>V*#g5UT|EqMk0})dAHM$qYJ*YIU{WNr>wGnU>iP&T7J@DzqT3LwUjF^Pqy% zWwMLQgisPBP4QT4K0sM^60Zeau*M+8>baO;B2pFZhAS2@QrCuHfJj0P!u&T6rLQFC z9YZNJ&)qqca(@ESMOA<=f+2$8O;5}X7+#pVxM?tiLaA1+N#L2e=(^kG1(g@e23Qe9 z#m;r+I!j|%ei7GMAl@m)tSP$nV|7ud&mB^v($5-qtyzO!`9^_-7oei?=3u<)f{N-f zJUB)}cwE-Ni6|U^t_#$vB`8edWlTv#<+Ct!>bmQ#_(iIUWGoZqOypOV7swiEA;~%w z35yRwgp#n&eQrcaA}tDgEG;=97w0I13p<2kSaps@2)LlU{?o9CfCj8yrZ5K0pyFz) zCk!g+6TG#;?4ZurG3+`=AJs#U3){IfQEpdocN*^k+`9bdhEiXq5u;n@uGcjVY{V`d zXh;2`m{Eiu^j!X5>OI4J9d~+NzR%NE%cEA+-sEJ(qD!RT_e+Sre9K7! z(O3OwsJq36r(vdKS5r-&Pt&^BSv2edi22skK=0#j{Dj)%L(GbWU`x34HAzmS!iyQL zOc6G^9nI5q;T9yd2{!xw7Q=ZoL>$dbO|kC0C&VXKGQGtjBC)dJ&Mj8wVw&%0r@~VP zGQ{mHE@JMr@5GCbbkgzIp*ABVA?lG;v(yT;j-fR};-gm+&EZjB7vzf-AsZi^v5!Vo z_6d~1gxmfpD4{M%VG0gArcsOt?E6IOFf>P>I|Qu~ZroOLmd`K7h)bO?=2(>C4HY3-@c3 zm4yICC|k!QgV=_$d?dPn$81ELwk^hqaL86R*r&4&<%gZzfYY3;!!`Xe(pZzzR+ z;vbvHL=(UAO-Rd6M|x`#(a=UO;H1=CPH0ebMBb*0G|VC3Mx zzr;WO>BuGfFjY)wU-fc&&~Y!`Jh!Yjo~CIpotPxtf+29PBCXpcZOrN)NRvA5!B_?^ zQUntQzF;bBMVj&!BTJ&M!)I<#+S~_rCD9Ri8AVztc%zwna4W&q8unTVoQ}s*xK;wr zMdl`32}D^kH`PkuT)fOpv=VeGo*C`(t3s{HADo(}teZ)iJ-;(&aeLK~D0t=jncTSRh1YC88lUuzw=B?iJjiYTG}qX77)fBrH+;=C6O7~# z!vg>1NBvs~)=*Xi1wxv1tOK3Zi~7rX#*vueGOVO}$b_y~$0r{D2MC|(UeEM3o1pl&tbq58FesL0vC5n+lV#Aq54$YTPA|>rgHs$}xz5m2Ghppi4aG@AW<2x!pyl#VgBhm>g|pU?vNm0z zJ-uzBz>w8e%5%DoULq|?Fyko+HS^Qrx-9KQ-vj1{%4n$h9C!yhf=g>G17V^Uah^AR2h3%nn?t3USwtw4xC>vGUR4G zfDNOslzlPr($T%tM(0%fUuM(Ex#p^Ns8g=*1BNG$gml^er_#Z=c z4$TWOT=0V>?3N5^UVhV8=NCU1BrH)_{BVDJW~r~n7OJCuvncyHTfo`Q&Jfqr^1A}6 z*|y(Jyx`!Umah&m7xuCVZ9inw6jbqd$eh_Xd|?Z`Qi^gm<7(?xbGPeSe%tqrE@eJpbki0Zo4UKEv7AXmHrtbj!Io8*$>*p7R!W2!PmF|hW|_OA z0ct9oxll%d9}F1FrK~(2x%vWZjk>{ENYd&O!U+LLMS$8Ep_}#u-$Ne-69%!MWfSxe z9y1AJkvv~dU)}M;7P-3MNT;RFvI+|q5bZVKcEeD;2a~cpnrRf533(N5p$sq;4V1ao zQ&W^NeAPj&geVe_h8no55~vv*9!(r6^2D(rek=oXhor0Hor0Yv30aV>CpJF8qF5PV zsi^kk+EG5ji@-uzB;$tDCq($_k4hzE`uYSu;Xaqqx60t+llH`yC&(H7n(}JmAV}0l@7Ss>>9#j*d+yuLdC7%aH?xlvR!P2b=GZC9PPeP>fMp8g(zI>g4);Mc7P-P_nJWyp zO;PnDV15r$%Q7u0b&i!fA~CH=%U_7X2yI&4X?H;2{vu@(dAWaa>;C0d_#0_6a%*JN z10a-nPivzau*20#MU8(ei8e#lHHqRK0%dnP)};!_%F(~wmX7oWzZr{t~2#U`ze zR&0CIwM=%}Dt>D5%~JV*9|MUr?xlEO&=8M#tt8YPDr~a;Bx|VH8YK$+jB&>k)Y-ZL zh=wj{*Y$j9$G317M~U^YaUtD!c+z(nGg~&<1t?Z<7{XrqIY!JVrWZj0e8@(57@HG* zQotb0lo98&(RZsVKWrTup=un}I-<=Z(>kK9Z%4Gr!nWWnv!^)j?b}le>Xge_MI2}? z+-Sy0aqki0QND1v83B29dc5=tauEY^s?(CqjnN-gW`4aDO>6=#f!Iv1nJ7{xyNkW- zrpRuJ#4--136kC6jRH;AqfOH#mR;i>OJSjb6ajQfFT0vc^A;+~F0wBX)}Yh6 zxLwFDY+WL|StGlfki!EJ_W8s$Z4_EmBNLec7A$BF-(A?--9}fdJF%jpcN-nk>K;^4 z&AH6)8bfn;!MT(-Ew*X13&F=?|3=4xmj-*i+52E>m1Wp=G)vs`f3(QJS2-@CeA#pb@9Zc3OA4O*HWHrb3QB_nUQs zv{`x*u@&A}0MZ&9B`b(}XAtFGAuZ#epR{S-r2x0>!Of0)KiF7E<~(mJo%kT;g&>m7 zb^+QeW$TK|TJo@~@r5Eni^YK!dp*BQOyLlyUz+JuqI;7i$rvy;xKa=0=k(U-I(vBX z08swPmsL!89x&(b)I-R_2DE!X&Ilez&ei}QIji9D`GyoHAYjbgLW5L!dqhoB@lh() z3`+&TEb^r(6V2hfOMDZ{yF#l;w5I!(d{e3Aw>;p;N^89p{=T)nTayfgA~{TlTI8tF zPTU1cah4GPHIow)sGweI?+srQfyZjdhTb)n_^o!`{_IX#sB>2Xz;wr&?<^FPfn zI{MvU1vFsNQxGflX8xl|7TAQf(pqew&R^S*Z{ZY%qLbhk-~E8{YlK}=+|=q}@ods4 z-dI|O8!M%5>ht^`EwRIPmSstbUguMpyHV;plgUXp#}Dg`0bun#1Y|_Tg|`~NTLXBh z1|T`2kf(B1-Yit~fbA;3tcMu0CMOaH5mZiAW#?D-s@(I{;~Y58KUQ6}46;MycIYr0 zbqs1=w2N#=u)ZO47v4e*W>i(RtmzhkF}aucA8eM!FDI7GIoR7p+35upt@r&jT<6rs zW-(RM#e15{X+2*~D|2dh-8HV0k;)f|2AZ(c%R7bdOz!v$=pp_A!l$DPYq&j|Z523H zr$XpM{DV@rSSoPT3VVQIzABw(viHTby3?aJ5^v$4T`cpej~0lG)`kqPUvy`jjZ{n< zcQk)!me#v+c!3ta;C=AYp>TBa6$%#10;8Jmooosj}7UH@=C0KM$tL&XQuj z++J$>00Ktekck4@iLL`QC?Kv_t5}j`=lY_y6q{j*c&M5tn+pL_aEdYmQ1xZZrvfqd zCvhlb%c9|(4Oz5Q&{?!7D zxf#~>6c&`ygjTfuP^u+s96CNsAb)D~;zSPju1_AlZkqi5a^*h^~nI_ZS92NlZ~wKtB%2a-BFu(D)QfBV;rXMJvi<}nlqCTozp&5spe zgcFDq3|62vMluH7%H+MAJ`3Sa^xXC5{?)mFjSffq#JZo5wXO(X-zwQmv#bh`wv#v* zN)#xkYAD}yw!jzKet4kt$WG+U*4Qm#i%l_qGun*u3gzFQ5)Y)bdGC9U`TQ=xRhcl` zDXUEn`bpKrCkF%40PH0E&~G=J{;yPB457Z$;vI%5U?(OSqlhP1tR|DLsWbfb!VB+I zt=8*8K+qPK)O?WtZ3-{EeYhC``Mn4)6!*%w`*Yt}5Wf-GUwzy?x=HEiarb|l0N+){ z2#w+IjR4;l(!`WtID(L^m$qr=5cO&oeu_()vQ}*d| z*0))J0SFijA7JnYNHm#nLFD|PE@qoGwAgh}!FwvyMXx#>Zm`}GDE5jtGw{;#Y7sCg zp3s;m40sYulx;vZ&xZ}tJ|aT#?cYV(dty8|^NLvzz$U>pIOTt8Mqg z+vQ-J{Qfq>)p{9ib_xuG?t` zRnCm-Wxn3WymBU{pcBPT3D+lw>v7@wgm673T#vMCcP{*+o?JT%sbO4Oj>fgWDtC_{ zL9tsq!&|ElHE-vu>}p?Cju25~jFt?>?8sI^34)BObvg3R*2roLVMs)+ENa(v%jGrT zQR>VFI{*y;+IK`tRhbbDus8_nt;6WoJnb>|)aCX0681KDM1n4=NO8Q3`%xucgJg$M zyN`kqE?FEdZ5C`sFF7vQln5%O5)C)uUUP~;(p@d}asPu1vvckad${0x(x}_Ks`4U^ z?BkJA&)b6FnMOmU{qxPX3rwH7sr`;d^(f9bNuetg+XB&k5Oe!hd#hQkgqWQ#(C( ziY@`2fSFA!fr*lR#XZ|7SXUmZ7HI*?NhpF&zz$H*6Jtr0Ffcl2 z99cUvVHoNFV5bG|;KOL!n?{|4Yy7tq3>51Xbw(hk|1p3(7?#GntiH?b4jA65VMb1m zCX9Wl$uJPhhOFf914}m{OJ{WI>DVT=zMeGbdBdHpcQk!%QZWF|UH+)mpssZyS&|wJ z*%Rh*X5r;CfTvAhy0g6^Rzrv^BWMur0BRN?XJ88`<*MC`pk$20J>z+=V9Y5sgq)!W zFugos??hJRi`2*afvfp?kY|U9CK6dGeiXh(E>*xXECp+o`b@iF>1bw4KyuEhXxp~k zSR-2;TgNHPK*@$+NPC zB$&BiN`sjLu*~HFTzIdEY;9?ir3Hy-)h-(E`p<);XZRDVC8Pe2K98ey8*fx>+^#(g z2O+$WKlcje*Y{+b+?E{+^U2&F!D=kDgj~@+WG90$I0h&HtM{RWWPgJ!9br?sL0xyJ zg#~B2F%>x>{sW|{b4E3O`e6Lw+_Gqb&4yJkCi4lB`VC>4UA*DE;E`{}DGmx5-6)#h zmFje(iE^{<_Se9e_~kgTR)@YztN;+ewY-S&OO13;;`g2bDW zw22cD745VsoKkC~Fs}Yy5R~E&6tF`CwbUB*4f7xP?1Rs!I;Rghi)b3(7+J&1nyjN< z)|6fPQlE!G2o@7Jm;JAa8}~^xDIfF_Ps4}E9pSfdhT@@)7R5VvgW}Y|T(ct4big-B zaG8s`UiI%UvzWRnyt~=nb%x$8*x~*Zyu)6O551h%xeS83_4|UlZ1|;4VAjh8d$~Hk z)Lh$A(%d$d_cv$g<$)H%aohR&Yi)aoW^E6jXNzZ;2k{|vMR!Cix~8dB3L_9bww4mr zmaHRu+Gm?>n#t4$@&5z@!j@FaHpzW&hNBcPrW^zOD8HpwhYnzyuA2Xw6GrVW&`L4xNxnFF)h- zK`EImB|I`=a@DDYWos$U22Ycma)F-qRb7{N<)sR#r?ix3dKGCJCWE5VG_#K5bXAy` zM#iGlY0U)w$r5SQ?)yTqUvAiaG*Qt)JO83vXKlnZ5Lo0jTLO8eD_nJ>;}lJ|X4mv( zEevcZpl=^C7PMfpntBv!Z*Ar12ho?E?&>YatjU9AG+N4_m$Ulc)0eZ{8v1gs1liLW zbASNOi4?>1Ep|iSaGpdV`Z8{bE(9zy`f|*<=u13)34JH!T2JqazQ8?=!`fXmrIGHU zFJ`5oFD)ERUy+UfHCi(fVUq*8Kf@hnnqSR4c2cw=x82q}s!=TNmW zxRx}x#2R3p;+HGiW%do|MKI`cZ&Yr<7;nSap*5s< zj5Um#lxDG@iVf?|-LURCRd2)Q)1US14IjAZ z+S@y4Y?yz|C$?Xeovu1KSf||N%BOqrhU@k;==+!$^Hk->%xnXahO{5Ssebg~2O*SH z{gXV5P|(x{(`6$OHLVEmIh*<;!=UR&586N0pwU?QJE0Ka4!KL50n>38PB8UUOX2>o zXzGycYLs7jcH|tXGo|Bd2Fu;-(e`D7<>p!~*Lg6@Imv&fLgxYL z_ulDuW*C}M6wbY(f>LH+sA|F)ilQ_H6cvSG<^sc1rcjioVoB84h!rCmTP#tdCdO!N zM2Vu3Xe<$UTf`rK1xdq zR05ilBGg495q2DCaC01i)O@tT;buUFYo6(T$nEU+8oHuhht%t+0i4R{BpxF$Ye+kZ zo?9uL!C4%GhiABKMrLFg*Gn_wT{t?3%ed$vG&3CJh=qJUDBk7iYa8%1zeqKLCMg82 zno$0saEW}15Sh~w+T-kIH`F_pCqaedP^20z5T}n2E-)BUpbh2)X(G5$e&$OAmp*_` z&LV=NmE*%yXrfRyd39sXa*dFV})9a=k&Bqi~s|)cH0N4^D7toi|4^#ksypT zAz0cW<{>FY6sSEql1CGFBg4}_yg3~2Ca5!-ZZ`wdkIj z-Z3PNow`F9;|%-tpf4Fc1cTtD{`-^*7mtueU6zY%UJu z6+JY$KFHopuJd!r#al1p=jtgsshk@_@vgd`pBwK5%jp$xN|AImZl#W%vo-Qq=oiDI z;jh%&Te%<1;vhEeZ)V5#hClXU{QJcE8Y147Bo|nAAWG~L=Px706zHnCU;ht|DoZ{+ z?F7m4Lhx9_@?+xRinZ$FB(Lvcl0c3kl+`>U{elk6LF`>2>tOdJtB0k>Ll z)Sec6riL$Os4UG4$J_`7i@9#6Sl1{6ytghh$cAZ(&9)sO){p_O{E8!_krAw=?(7=t zgw!VBer=G0*8dklj`5zECJk;dw09)k3{%0QIhddO%tT2GHZ(2OX>gX&&nZ(*#z6`|z|6O>ngm zEHpIBHNvH&KiiOF+h%2#uht5!9&uuPp>)ZN{&knKh=n?byTDT5!3NVk8-8 z!Nv3m7F_h)jAw@H8UXfoUFMV)Phd*hi*<4#S26}BtavAnMDt4S`neV0L%zV z2FxT!+!FRlh~yE;#prsq#^o$r#ww4MFgNLqd9Q_UzL_pYHxbV}l(n{sZ4Y{wHXF7$ zg@dU(tw0<4`cOXS80WctB^DsZQJOTKaCg;%uYs+HrCn#_r2IjS#Jbl|UqbOkd%2m@Fjd>nD&9(MRp# z3}LTW#KbOLAs$frKFZH)?^&av@Fjik6B(DhUj8c9_oPl+>H2z$-K2}PT_@}&UDvOe zuKju%;^Vh1Sevv@BV*!S>AeE`gIs?58J4y&g2g72D@c>7E2XU=l@$5F@}LmLW4Dj= zoPb`+s0{DHyv0^?3qe(R+tbSn|0gT|uEEM*+<37yAiyIRODYZcNIY1R#?8EsYt0}3 z(s`d+*~>one{s#98ogl5<84RpKZ0#Mea#v=Hy$`Xi2A%f@T2UeZE!r?j!h0uTFmfSQ3Bt5q$R% zeD~36AMqk>3C&uFrlnMD!K6$zEof{?IpN1Vmct3dMm`C7yK*&MLtf_6SXfae+IJQZ z&5Y0-*D-tnTNkFJR9OCZatNXIu`EU?3!4azIC$@Q{dM>`zJqWHO?;W?(H0s;WBm)r zrB5x>1I)FPWIZ=Nr-UAK(8~#PD5VW0GihX+4(Wp7&^R2cY+kw2ARhXmd_tTi=!ayH zlna(k$$0=CrcpnnZzE+VLpWS`9GmRFa|z`pL;VP0o%7%IClpPF1`^6ohKdPc9Q0F` z5-LoFMiJ_i3>{3UC>g?Q!0Vh0jVIJ489Izm*JNlip>E00bVA*ep_zpCNQPz;+A|rN zL#RhGG>=fvWT=u*uViQuq29?*4WYe~p$0;GCqp=)d3}CxaUl>`xFJYKuj@XpL9ih1ZCu z@7;!{n@J!)zYK_Hh%Z0L#S~V?#^{Y98U4*v$q1$Z?>Kv#_nI+AKxNk&pHGd4mKvWa z3dztsH$^Ck{71;6Ic`3&l+m_b>O$+5ni|98;E?kFcT#p(JltjQHaD;<%^6+Rd z31f;i_RXY?G#861mQw-U+DH|loj=;Lo@Qd@jB=#FHl|I=8WFx-xw&IIO`0~dc5B+q z^-Y_`GlGGzrcE3bWz(@A&hw3wTK(BtQ}#*!mBk?p8SLYjoUK$e=jtXoJ zcIDTwF3#w!e`i}{Z9GRtb6f?mC7YPltCUC_zipzlB=Ve4+e3h6we^c6LdH!PqnMY! z)HfBHvi$0(OqP;m_`rC%Q$RIfxj9R^13MGi3BLg*8@rNsi(H4y6qm1ND)Y30T*1x= zKZb>+Lr`lAjKn}Nx$w%pl^#UFc{_wYq(lt7+YCwS-G(G}N&(i-WX4W_&q={ICk5Xe zH*2l+zzg9A!YTCWa814RU&%jcH}Iri1!)j9RTzj;fq|xhpa4(9`ZE#ZI_$9s9^E;x zi+46~=`6drOxZ?3&V#j!%i*Sz?BbmRHDZB<3WKY85tBPfC-u=aX7NJvZFx|V5s_IO zqmzbPUQKR+NL_bu!YFkV!&hu3xqKZ(W^r>AbAj7^60rpshzm%l@_o!f$U)Q7GL)3i&Rcv4uzbieKMg$}_kmrD(j|HhkRu_YIX5LG| zE(LzB0SGrsdW4-?C>Qu0W{Rl8vWQ~}70gsbXDirS^kW$vC}aku2RsX#~kw#iO!{n>lB#;s#SJ8A5=J28MBwUr`0oCyPSXKi+;fnZTn!b zY?qD1dg{J0GuBJ@%~`SDbb7DwSnz4D*xmtu=;&@u;f}kvK)#o;=EelEkWEYh%*%;} z3uw2VB}I7j0c9pJlSSX)>aB~((?`=H!|l_-{Od+uQ9e;Js_rA&>?+PAv6ISz&v>Eww7JMM+?cbpKoxn$9PQ7tPHrbP zG8T|$ldKaUD4K+lF-4&}xiJx}P7o}#nyo0bD;O@07n=1WtuwkkgW$51w<3nEO>3Rn z6GQY+YT<+exKgH+RX56-*%#|FR`x>H+gyO%71(o(4qFnENFG~3@U;4BAUBQ~?%rDG z7Dzvq$&K}s_EhaHjU=J!Kx^48=_Dk=XvW6aJqu$pBM^3jA#ycDaes&iB&`X3+7A(P z=)XBcecB9BoHm0f;CH(rYHf@Aq9H;$$dttZDZj6*pM5c^xIJ|R6C=CBiP7~dj#8R` zR%_6^D1!~?ThERF^j|VNAc_A?(6^l(UjTZ(+$Z|r8=k)i^qijT&km~`2lRcA3Ag~g zarHse?|>%BdhoSrQaaW%4=v~m1FVPkSge;{B>`c5p$L<(9<~O#ND?MEN;>Gfv?oll zwuH%TN0_=yaxp$8MaNFAyF0?vM;vx>yeJ?{DbS1awjxZ1KYeBJ<4cz*j~|2i^r^4t zz}~WkvSx>bFeuga)|Ym6joqYcSLbfh zwQKEHO~*ifbIH&5AxlzSU-AoF$O44ogO2fLBgH9M`aPQ9(rF8M~R*2=t@tKC-8x{pJO?iladzDeO->o>c>JMDKx zRnl(h)p|VIwCW2b@%&)1Meis&DT>Ra88b5+jSadd#7maXm_F(HH(PRjx!C8EST-K( ztTdKekXM8f=`zur>JwTr#13+h1(A(ddKs}ru?4tFGsYn|tc4fjgEm9LtHxL&tBPRb z4U(2}Tgxq@Yl<@VT9!;`MM*t{8l@CL{*j&}kbg3*)KdT|l~^5>HR5{36wksHnr9xR z29@ZP%8DUeOO~}-FR*T5$zoS9ldae#xf$h^?7Y?`SVo4_5C`bqenBQ(^7dBbM}*`< z6BCdhVx(2mi*^5!N+5W_n${XZaXwBOLOG5oYjHobg~fb-gpm#xeSe*yQg3$7)P|Pu znl7s|1HCG{=re5c^ttDvDz!USn0iKmDpjg|HoI2zZ1%0NV{E2*gX+{iU}x|Zg0@8V zglNa7etnOoBUafO=R-q$e~Ch}R>k>9heJa{-aIHtYF|k%c7Kk2zzKnEC1;>xBEoJu zS-bW@XJ*{IUvA$QwRyjGZOBis(k94hm!QZ`u-YcbXqUj&LFHlpRkZB8XWn3Bn%rPB z2zx3HWAro1*0_1M#`DiYeV%jLNWO-J;_GNx-rS(0>SG3-$TY73-q8s98`rSlwYbEW zj%&QzZ(!;8R8cJo!{5nT1xzwv@7|>v`NbL(3(Zca#aW5E`DNcdEuMcyTyE>}g4OXt z-8%_fXQ3r4SiREatSSS3GGwkMGcP)?jCFAf{aEy(nX8FiNhS?Zr_)xJ343z1%O=*f zEaW-bJLPRO4Hyz~7FV;)|JHc+8S!o?uvyEZHFbj~)pVzs zIjhkT8u$A>=oWQDq`Yf_T7xAmXjjDAEn2qb^s?`s<#&9~)$txQgIko0@t$pa-Al2( zSCY$Co$7P1_Kk_}wX!U<5|83+v&rcEryQ`E>HpxmLpZ~O2W^#|#L(q<`s}h%DNh0w z@gCM28v&+r?1DL9B+uKf5I-RfmH6hB-sxnA6%cnO7FF#@ra&78%|=mCJ^1*Z~8d2WklBh@0_T z74MV%C~r`CGYdMi z*oMxac$v*}Uzy(enj%r%X0BX?pEzG3UxfmO6suwdWo$z?#)?e08`?0p5XuGt&R$8; znJbTDG(&7p#QlTr8?L1G7HJzFyQFLz3Xdx=b+2LvDCfEWtZw8ZkCi#^I}N*F@~hi< z(DrSuV#FBUH8BCTPjbP$NwhuJ%c}!dq@Rd-878XV1bXDnrz&=k_lfR-9vP_p zj+6RMNw1yFZ93FepGAd0WpEfk(QkaQcK5G5bEp88&F$t?f}ql1@6|o&m3o0f`o>nV zf%5v&R2_YpBw}m}+&x!8PJ6C$d#`f$S_R$f=|WQWTIu#! z8Otftx8jBW;8NGJu)7B|DocR^gGQKQ*u^YFlvk-tk8YvR$Yeod7eX4r0myY@!X`7h z)B@0^fYh;GhUy7_D3)lckGK_z$E<>CLaUDB44J5TpmS;n+oZ6V2(h-Lqme(QyQ{ZM zG3icJBvY@u`c3>QI^TVj%A?k3Sy*jGm?>Mia<HmgV}%49m?oEEnb?mMb%ZVY&I1<(fPJ%Qd-tmP-o^%QXp- zELSO_Wh_(9@Xa0Y3o|UiqM=i;XozR)>@PT(=uRGN7g)&r4i_SgKa_AyQMV}L-1w=oJV!OoKZg`Kx# zV$3JvKW`eEW7#pVn|k5D#=q>=nP))|F{B!%ShKYJr8g!lSwqskYRw@{(+@5dy%yQ zwNH?f2)atpC(kvfL4ZVvqFPz|p3#^ESX9fsE`N{{tgQ2`gS7R8CcW0xcKt4`f`>CS zxq_9ono3V}Fii=Pk!`z41YK(-F z2_O_p!lEEti=;{-k+;PFI}nc)v#o86*3EkHZmSn8!z{bPODY5Gf{QrO&5=<0K}W96 zH?qFqB@+Aj2rx3g?WAoNu81MykE8r}Nin53;6q=}jhNYtuM-`Clq(X;pKciZ4RBDk+C(%CMwg!nHWTt9)Bs$j6|niz4OjEEE|_q#bUt`2 ze;tZb>6h9}0-|Y>tuIwovUD)9Ih~{)*^u}I@Qywl^2fd2E8xAGEJH8gTxo|)6Y$uqLATEv{J>s}a zE)l|T$PeS@v??PeBfAdLabnCk;|eE#RBspltHs{)qH>*45;*+2*aAdlRkjYV& zTM-Ba=HOtflgV;|@i7Ob>KHC&vN;q{pQ#EdwkXCp>GOM8+~a7k+n9mYunbPF0}*Nh(Y>vG!Ud|-R!w> zE{{dBg0U1d;6NM2a)Q;Xg&nW$S1TeRhp#!ZY6Mmsk%AP!;St*MV*HrAzi2ve45it7 zV~W$7gwKJRgK@fX%hu?~0ZwmIrJL-9e(BjN9a63Dr28IHsgmVzVDhSDvk0b0T%ui^ zrg}&fz)SMeQy%;g0IC7_<;QE_j%OJJCaw>#n;n4+wC$sORt+dM@GzBRSriDGwFWGb zoMSY=GzPdtk}C%{6umIi(I+cN7}3ZGi6I;-AwVu( z>yQ}{aIsP@d}$!h4*kt!0CgTHr_M^f0kz2#PU$Q!u@oHu7SA*im!>7?or8Oic)0>b zIiv|34Z3Q0rJjdmoZw`4Z0) zbQ$&LEn!K0C@0W+u@U@FTZpCtOI zE2$pDWYCbigj13!>iGciXd9K7|?;pEC!6o>G&N33xt0mNfp8!9g0ecCKb))!7-w%p{#Zn9T_wu zUWtUEFTrL@3BUB9xN3gdOj95*@r}^q)R~ zBJu3ro;2avy_JAXJW1xO5x2P*7BsrMd+Tj5WwuX2@1grD@f5K$>o891Ougxi+F}YI zb(<;_(Ib|tA(kwUIS-dW?{=jYWoL0}k7(s7)7z61Q!!c$K*-3`t%w;%ib0M$#u=rj z{^7kwgiCqiXt`o;(UFn<-0~27xXE-b#%E0E^tb4*K2uRd(8Xk=92|Qf@uoTl-NTsM z!+Y8X27$d&z%)X!I*{o?-p4p1?hmFu;FdBB{?Q6`C9Hk+F*32o*Ef<9Te>i2<^k<| z&E{zH!Rbwkjb_8eV7~r6-`oc|MbS->l>9Ah^5t*fES4(%iR8RlXK{NFFh)f}KoT(= zLn>6THoHKeH4)Hvcz@L}+vCF}127&ckr&K{gSoLzDdqNp3Qqsb9&tsa9tCFs@+>8S zW6yOOv_)nFP?}){i_Yr|I+bm{`_-o(KjWomzPIM6^j5t2?Y080r@HM|kou*aR<1_V zAkVahS!$-WdhMDgi%wzhtyFUWlfE#=P0-*bXx#o4poP-R7sTHmyPC zNPE#k$_y6LVeb>$ZG9F?B#xU8DDyo<%|v}!O2;7Uqj#a;801f-74T=q2Vib?Kft?I zO9zlkx;HA)4hPnv-M9(j!d8p1qIZUSv*ye8F4IBI5(~rjc;jsElJppc9ex|cWb4au zrV{*sHPdrIxomHg`Jm<7c8L85P$Dhj1voJ=S{svIAz(nW6xv}+pT{E&na$0I!NF9e z!bgM`nJ3MT!_1SgYOHw@XhxBWBHgS2JcL~{-qKW<(NsM|G1MYtK@?v$($`yEo4~?f*XvskgKIwWrBUAKl2)IY@@bhNTfsaKRq^LR z3NFDE5Zm_Q5_TQ)gaWwr6cBzUrGF>-<4_6<)3~vVKyUV;xeTXP6pVA)7pnLc8qfky zVHJFra6ohDM)g;smsJ@eMv{O`Zu%6yfbTbM0+#!wZ3N#m@k7MR9p8TGs(;s z4vhZ^Q~QVl$H+b`6!XkmgoNsN)XPEKp+-#XZnWq*u_~I7!`jn$B~*mn6*{t) z%+=<=&jM3FOCm?zUyPbW>x#UI+N_i97D%s}&wyZc<9%9Ls921&YZO+2Va;`--wT2N zMg){kh8{RRnrR|x7lZej*svKA5$t$qkki9Rg@#9X&-((4_(rPX)*DMq#Cy&p2$>0$ zobG($hBY<9 z%B?S{DQ<=&R-oEjuhQC#WGz!G>V~AmsTzO@!ZH6%K`;8nu%Kx=t7D?R_^4P_crCILX(d$N5kf!^KIB-$(BNAwxef@#yq;es7H6 zw#2o>9m&TwNJeb-^xn+i!VD<|SRJDN7EQ|Wo?ND54fAgBLQOGjNXE52C;-26n#4c9 zz?>uF1vna&h08)N4~0QC?}=sJmSse761RV<=|Q14<)l|QGV&_-GN||q3WHNyb!Tbu zwo%hUj-XVI)qTanAhuoOn{S<5VFtwbi_lYNhQ6tiiTBnGCXr`fZ&0G(wHM-BG5o{b zJoQH%>^%p=bv}cUtui9vkOLH&Jvo@#EoJ(qBQv!IP1FOQJ4eVh&pRJ+gcC5#e}q$P zIZM6n?6C7d;cA>ZSA)rG*M`xQWfeVT*h7{r%?^{+UFS;x%kUm-T~Yy}&=blad@ygB zUbaFWz*Wr>S}-7TKJ)Lv977xihc@T1yDv*dU}?Qn{DVNVe|VEDwx}A^V7`XA)igyY z9^?F7@xLq-7@!{^nRU(=YcWfr3~wXl7%>lzor6LfC{FzTQr&%9(0V;nuq_1G5`^oT zBv%UfBf@D(fa-r0h$N2E0MCt9O@7Wo-cv=6GtblkIwR zTBi&ES$HW2ms;}0Fc!Tl=ptBfxMgotbM@y0@>lMfbq)bWNH~gB7wb^rhjZ z#1o&KA$2kGW+9p{GlKm*nh|kXS&%M{_7Qe(IGjE=O3MsyGPITQNj@%=L*R>y>|*-stmThQmRsjL0P9@jp*wRcd5`26Dn3rD2k_;#de$ z%jhuZd+yJhFdoCQhL&bC`;<5gLntrAk@> z2oj=}Cb&Qw2Hmb;b++12Vv5 zcvuN!NTX2w(NMFCjT@%SxcNQ?ZkHORwC@rz8GUF6;}A}c0|-lV(U+KkF?(69>KbAXp%hV= zL~B5QzwY+M>(v^l1L?%NvKcmRAoE@pSj0*v;G=G4^p33EF*DgbGyZ>Oc2Hv;Ylg9m@Rltt1PfHq-O72^rR-WX%_R?HFIyPd7GBzw@O3x1P*77jPW%}{xipLn* zuk57Od!NN5-v@+W?|izicdCq=DIy^HO5)S}Hc8a$Z9s$#5SmiZ(%IZ-5gim4nC_~f zz$J~^r%csZ(Z{orr&UQLKM*Nk6I4|z0;G&3agNiMX@Qew&DYw@R5c6J9@v2fA+npn zL7vd!A;1;E%6|C`O{M?kH+_On@g|x59-qz^$TRsPOmlO{07YQOwQC`c(OD7`*)lOu zBB+lv`sRCYJo#UK8&Ce1-{h`uHhBl<13;$ybMMm%pe{EOqD-Qme^Sa zt4$>ATzW|9gB&*=qBZ_U>o;v})#W`>KH%mTn70EH6uGKQ}|_0fgUYzbokO zY4%=XhQfL$JQheB$8w!K;cDwcUMreUd(F4#RHpqFol>zur4>MgjHvok05J?8q|(DE z8RQ-BxcU+evmj_t`>ISsv~CHpN7VMmG#1WoIJXrQL}X}#Ve4%Ns&%`l5}=zgZ`03Q z4|lHJ^|M`H9D1B@xe+rCeU2Ogqi2LuN~)BI1dBqlFmgQIF<kS9N<9+;7$=XN|67RM>+|6@b)Kk~WrFB_E-riomhT-UJ+?~IY?U0@T^ zbefyiBJipVZepp?3v-MkLU^n)E|xn73S!K0t~tL31pxX@XaP=x8S+LHYlDYKizJVL z5cx z>MRgg1XNX?Rjmu5;IK#y{)1vK*}lO!g6|X!H7Y}OU?nGb1QjFx!(r6{v}!>UOr&vY zF_E@4S`;8F=rf~cQIJjDKtVE!jNK0cB>u_s#Xv}D@k|PjrREH82aKIhyU=&z+@de4 zh57!PfWg6VG4;dvmj!$acF^QyFNLmTEp7DV`LYC{nxzdUu8!WBRYb?{#0Wde6xP?O zsoz1Ok0a&7AOI@@TD9q8u3XL_9!tGlr|igH!lSt__D)%wQR5XYm6Ikr3mFB=yR+K& z59NyF3~8l;k8kD(Iw1oV7F=kk1DNCl#~T@-2p~QWM^rJeh;#spj^9~WbofrN=;%c{ zEa-L`n#o^Itx-K zo3n2K7cdgKWxGytzVPJF7oPn2!jnH=NU8av7U}F9+alYMv_iDx*L=}1({R=snpV-n zLxEQ^@mAm<8LL;)r7uT~_R}siSvSfrT*#voflL;CF_RBb?;{-`NS3tn+tEjpYQ4n# zq5*L0+>{TL#P=~*cSfeov+u=kMJSn2CW ze8(*`WOxZ7M06s8{W=!m`B1f}W7y_Tx&nz?+bDs{ zwmw;I#FU#EP1fnDfEUz&qE95+qR@aA(OLUg^%5Z-7SVh4T1t_!Z>qA3Cll}9_5 z`cne5B;gRc2veF_`~y;D#Ir1=63O&cBHBJm={j`{l?dJps6;ZYO2oKQvFbo)p;5tT zgLLj?$;6avaKI$U^)kJ)OlOil^7I1dOsgW1P%L-nFf9R0_Owo*1Zjalut$Ve<<(Ss z#Yk5Gg4CkSI{z~kj*KN?rgd}2=eaJ<-qi-1lKk4v2~kaECewDO4xANj&RIMWO-$Gn zV-!jZqX4FswF9pmc>^)LRdLP|S!4pD`e2E**jH&}M!Pzc5mNbXM$vie%+U2B&I}pR zJg}-w&V-IFxJm@ERi>B_;p<6ins3U}v4{rbSmpGNpdiDSX*~~V z4OMG|P@3&X5=lYfy%1C(HIt)09Cp)P&=Q!9adcK;7$KIMu#-sXjG5+W){0&bzC+ab z_BN;7n~?Gia`IzNm?g^~$DGmV7*me0o<Xfs>613T zwh83!mmF48mxq;RxEbA!L1Yb5h))7eWWpFnt5mw@L_cZ`q)Z=3z)~d%Sz6bwl6a|- zz*JLGrYVV_(CRHg2$*Ebz$KWNo*NHt3ze{e3WQq|GDA!Rd^RgRvKR{&q|6Pc*|P`< z8i75FK-%DoqTAO-Ax(o@y^b*_Ws>*1l?2uxHI4Cbs4L{XYp7|ab(qmI&3n_t1THkc z&khy%p2W645if2kiqn#!cxK>!O`+;eNc!Xqt|Nxgjqxy7)VsjrG~xWln5Ye`+%VmI#gPR9zod~oxUloa zg3kX#cT|Oc)18h)bw(UE0=6DevaG1OamFU4bHhJYOowN~>Bb($ z&Ri16+^w5U$Bj++X3nA2vBC<5Q?6f1E5W!L<5@%Ejp6sN`nStp5 z#sN!)Ur{g(V0X8+jGFB_`ifwJJPhwHX+hN95q^ z#gol3LZ0djdFzaiyDzhRKf>++s9=<@qp4;u7K?CY2)!d*;jtVq7(p=x3c%yT&EEPS zBl1YTA&-`uhtdwMo=7A`RVH2v;3V7HaPi(nlz2b08t}r&wLsw(h-Cg7Rb&6a4%doi zI;SkHuI`v#^b!Di&u6lZ?F*DNWM0hs@EQqW!Tw8jDJNSl+6V zo))X~0yY6lx(7k3t^U$fFgiNpb9OCUL7{_JEP&6<(1VPno6M9MgVpUvTB}FvjXx~ zGLKvDVd1{@-UI!dChqPRiOWondF|}x#olYt^r)+DBoEcp&YzB2{5)_;b@$3unvb3*=aw=~?m7aJ(O)COikW@TZ_f;)zpsW!7{AETf8BWFNn zaa(CiX0t?QRSD!!e<)kplG!YgSsmB_navWJ)lNppY?i4iNoJYT6r?Z4XHwxN+}lKs zfPDaSOGUFi<_ktyOGPzzd@33?TOZ-t& z(Q>4zn1PYmd#P-JW?C9$lPalEc2GYgUrVE`m8nS;!;fxMq*qs1>qcW`Y-!YmeR|2OivlcE0ibspPSWNIB*30mYcNUy#I4e+WIXt z>D)BjXW+sX_bo~fa*U^i(8lc08{IDPC!m*x7E!4oQnZHiLrH2jVabg*Y)G z7Aod}_STQvgBKcbx;#>Zb$gdfV1MBnksSW>j9KYeBn_%m1qLJ9mJXh&bZ#pBoUdHE zCUNm%+iTZu+AeV%F9iLyo3LoiFNdQQZ6UW)uo&kPOE1x< zm*HhjQtx00kTBozN^x@J$uM5=_$&irm@}N(W7{B6vhDJi%VQpQF}5u3_-i1C8!AH+ zP!sEn1brHX5N?$c3PfzNi{h)IP&_Iw$Vv42I1Kq&jvytO;@o`XeF!RtcPy5ifI+s} zYVJiXBrI&ah;a$T38*J6P%?yxi8@?No-vf&n_auwJ&O)WXCcZ85HuYsnQVG?o2Ija z?aP`j5iQwt&J{^-dQR)6=TsZ88PCHnYFgM^y7?$1`9M8GAdR`ON7$4p zf!ocEYt-5D2kwM~eHH`pt|G5K%FH-|Rg}lpS)EqTd1`*zc6gR&@JudJ($h?2SGpM} zRi;Wg*3Aeehyh>^s>5pA9*rNhc(-8_SK9Al2s zNCIx#ezF`-^^;RtzFI#yc;d_YX_2zyewq!xEb7$H?Ej&Df;?b~S|Ozn1{OE_h~Cz% z-e`BVUqC1X_>KO-9Di)(5}m2i8tGu&IAriqiEjbva)orc8VWZbfy$zFvf#C$=yKl?7sA7>A2+DB3;l+S??uR*5&$M@hYN}#V?)K2OElm5BZ=ml zBSDDpX@2x}d8GUD<=WJ_A4WYEi!f*oXbWG%D#lgpjYN`ZbBc$Km59+$L+LTQ%H)W5 z7APUgBH@#bwcaU4F%u!w=41?35NU^dPzmWh*i!Ov54d2;A<2n;kefPtK>N)y`&p6L z?Cn7lVc1+iLwriY(!t-wt>pxCMEW*}3AR~qAlqAOl|<4oI80$ui!u zoY|F~l~k=kAk7QNAvrVoS2#sKyk4 zoEs7s)@$-w1*kHk_Y47^9HaL%%MICu7JL4-EiJ${6GUEY6O%6MYh#y$f8&>I0;Kl? zcdcjqBy1T4xHfvNvts6C+Gh&au0TC%SKvJJq|ITo&6D<|PB%}ID-R=8F*7q*9RO$B zpNP@X=A`LpwQMuGQXlsW2+SOV-=XA_g*2t)Q)(&s0yNVeHSnG)2bwC?Ih_Y&19Z+0 zyxSU59Ru#YU`b>_Nl|}G#hmrSuLGV%N$^-e^-lt-UlLGSSG5Ba$jvOt;!|^U%^xj9 z;8chFz;4GnZS+6UjQq+YYR6F{YR6GcZr41~m@R@tQNSh~=!xb=MqoYlu3X1^??7T6 z)tZ7CMH)?#R2n%iajdZyN(%mGL~zO!_9v+U>6z8?(GUjg#5$R?)QanbnJuv>gpZvx zQsHuv4D&3`a{)NYvlGWx&*%?azDJ51EgI$g7)RY8;+W%2R1HblJtMKoh@K$;k3u*^ zu`)4JyHt&)G;%}Kc}Gn~7=l1%i?!xqZ&)WCR}vobezh?HvrVhp$Wex@fFF=-so=~Z zfRwJTQ?*g0=9$J}L2|Hs+hauv?6D$whR=;)cCbB2VvJhO$|D+#khk8nJQyX?Es5T?JML-LmvlQK@Nk00H#r0gfQwy1A${h_ zz!`>{; zfeD4>Jitsq?$^j$M-jO^S&Z~E0NSvZE0Sr4$mE}nZkj_bVS;is+O@r z8xH$ZDp4BQdM}{&Q!Z8xmCNRHV>m_>u1Hjj*q> z8eB^glg&(blhfQBgYy-e&UtuWspTUfkN<^+)3pv31sz1C6S7G3ElU-WYnPN_*W2HB z-f_w}nN|lv%L0M=ig>7TM27=$8dny}Lzj0-w3fNfZS|@f5JZh@56(Dv&xM-3@1G40 zE*|1I2RV!mqY4qoL6oeiwh7xN@jtTdlAtT=Fj$Hh0GYpoX z&JcOwL@+rOsphQRS6~PjX$>Q8RS3$B*3A|D^HU(Uqcy=IA=G2~fK6t-;sp&^>|wY5~<4PJ(spjm#qIV?8VA(RUo>TOm z!qK0GcC*xEuEzpOoW?A_&cTf|=3D2Laj-*_&bhUWr(0G*bJrXmcY3>Y*H^&q6AG_3 zvKf}oFdx2%M^1Mmt9V>9E19Mb$wkfHGgKHp(2ANxyYSjuFPj2iS=?j*MU*N=g(YL@aDp)-D5}@da$GlyS&pe5FgX`ww~PvfzsV6m5GKQ(^Fpz5~K6_LT|m zgUU#L&fv%vbS`n602ot>fJdP?QJGrNf$f~(s=XYf$&+J6#$zn~4jX|NF3L$zR%mCJWC#pkT$4Rd$~*qqerPwv zL}WoG4VxdXHt3WLUe!9d(FCLa{z)i=u(|d@C;I+RLPJ`b8i&->SCrQbsVHw;SU;pO zv9PMCxpBpirpAgP3#*zJwagz}QC~Z#BvDZ@V(946mGeg@Dn<<*Hl!|5-Z-eKvU*VI z;F7^5CV54DO--VrxvIXdi8AY}TN>upmNyJ;Y$~s5N;I}4T54*l>Y5Xcb>%f~qOq~Q zag3W#I8o`g)HNo`D;AZ{uSvKS^_7Wl-Y#mYOw3)}R9`o!WN`7|(ZfvBDiburahyw? zB4-x&i5ZTwUs`xN;W**)=H^6gL$ljl?>4o}Z*DBFXm*zY1-E`_qH#e@{j#(?Plv!E z!s)-X{NSTh0!*css>=V;1*In!~va1X+Nra^GrWcY7{2NRAr zgCh%sD|KMX@dM{H&uN@fH)p||`E%yXiJvf}v8AcGV#v^nQ56-#N{0;{Hgf)`1tTkm zmk+BLHnMnFVp#d8kqd?<<`1nHURpk~bVyCr{Kj$+xuU)?VQ`=dR2x!WS>C|CX$Y0n zCK}6|En?hETaTv=#ay}mmCqftaPqjKTnd-F%iplI*Z$&bYgh}(;-n=v!c})Xbit;XUc1stfn_i(yF?J0`&4ok#huPzD2_exigt- zXvn;24Qkn#F)ek=8p|8{518lD&T@C&)cU%_Ja=h%O-sV0S08nC;ws`2jwsxjD=6!z zL=))QwyZjL-h{@+psaK}(|9W!lr20gE-o%99$GxCxU_h9@rdG)#iNQxmlT(jlngBy zR#I9ryktbl$dXYdqlXp`Eg3p==&+%sLx&F?F?8h6QA0-$D;`$DkPls)AV*lt7-b zq)|JAGFs}Y>*|-)(VE7p^15bf8R#}Ig6zBHTy^!q3(@CFKW__n(KeDM+aA2z$UDu& zZw~E_d4wP*h~G!~$54J4`Y2kUS+Ris-{FEoJLAgh>Hs-~Q~~9a5^i&tAae;$+Hi6(`iGuHevCgfG15Lp>QWX{T^xW`}yyK^gTOB zzbEMrD{rWp-dMkU#Ta*zKN%VljRxBxf;EYyi5lmHoFdaUNjfkK)7gyNB17-5q703F zS~=6|;LYkPxSVKo>l@wjmgYtEjaAJn+*%ldNG0#9n%vq1@s(*=kF9TUYvEq*d~lu_ z+ECvJ50a2UqZZUR*4lgs8xZU?@)FFLs=CU=@-Z&$xrp}l;y!LsRZXQgzojWLqrA?F zTr-VGh4419s*X5j^|<;LiB}5}Rn0ROB^ERvRbJOrU%QN1H>0Awc6@nbbzP!)Mxt?P zRYhV-)$&B+Bm}gIs^)2p3(M=OPBM(`(DK^(NNo$fnNz0C99Py@U!75iOk0fQk6tzql*kd;S={$zAVX<}O$ zDP^U@VZEPsikW_HU1FK5JazlS9xEymNcEL~w5h6jf-jd@rtQK2D-!;sbr+S>;>Lx@ zhIP$NgC~|(Nt9xurc+_V>)i#7^|kKdGp0=)+zMSx0e+X~ClYn(h~u}+&YZcHj&$6_ zASEN;oS2)W7#$~0wKBy~M5wGxYNY_T#qfF4Ucc~`hRUx{c)Dkyg1@Suyi_E%8yd#idB}25& zGBn82w4FSAb(m&YGEGh=o2Dn}^wWG74NebhJ*T*Ve%ifx?!(oW%jFWD2I~o}GsP4C zll4S;-QV_lVl#b6Ur*4~%+8yl5O!Yi4f~+<02vI5z0=*N#(yY9RX; z^g%w8xpn^C>XU-}KlSqm;p+)&T)#P-mL(E%5&P;Z43LJW0jXQJB4;LL|A-1C^9A9a ztg(c{>EY6}@Ls$ZoebXZO<1%u2*(JE_V(w}Pwkf+a{$+YT;FbA(D}>-*=vUl)r@$R zK1pY!_I2gbFKztV(MPQv10FD#=k)Lp!iuZuUSxDoB|H!18pb7fq^BKDcm&sf!aqim zUq8X?+vXoRd$i^ssw%fxy0>(b1K@e}O(|D|;-f5J(lS$EydwN(n z7KHPdr0MS!*8BgMZZ@%cN~H8Q`Fj>QQz-X2gb~rEfa!b%yc_n?NkB9|D-4O}q9aY=0ko*WUY$wfAG~ee8Mme%2%Q zzW5V!U%PIw=kVLwrNZ3TJ%5S0C!Ty#cX#f_a2fYEmmW4!_iNVos^vcRjSa=ua6iA# zru&}bUb^2$)%oL`wXcp`@rXCh+4#cg$CNG|=WL$3u=b&w$2o^wFmLF>Yx-1c5ajKA;?Q?j1^VD0#i5C8LH;X!wgzw62uSBzW!_V^3J{RbX!wmV^X zWauwGymjV;@VcGbm%RAB38!@FJLIqXKR6-w{9pe4YRQKa-acpJ=wrV#U}C@9bIyAI z+_@9?tjoOn?t3npxZ$@Gy+)seW!BM5y#BC^6yhteR@Rg zJsEXZZyPds{68PwzWuF=$=z@N=iVo7zjSi%4Gq_|?EUoQ3(6OqS=AVs^3kW?eJe6; z)Re|g&U<~+{JJTJem1)BSD#-qrRPbTe>dR%=cinC>6nSlw-ijRylVT+o6jzrddOoh zKX>ooWmEG<|L~luf8R3ohH)?d>y*7-n|i_eXIrlM@gCFe{^g{uXHT9yt#h}+cb~iM zlxcfh*7=4ly?;LK_+5Y4`oJ~sOuOuX(_j0=gxK^oL-v1Z-%DmqpZnPdN4~$~`_p@0 zIpU)3e|m8G{P7u|T;Bbo=_k+1{CVj31CFen^+@MGFQ0eh<^xKP?s>`jBTpLs(9N&h z_uC_D9-93`bPwmK$NoO}*FWf8derEj-do!kuR7|nV+Z7Rs=n%|y$Hz~( z@%4D=x&!AFPkQQy8;6$9S^1LptHaj(aL(~Zb$PqjE051v(R9S`8=i1ZIA;2vvZm}T zJ)w5{4-b3wki{o#`soRSZdtJLgqB`+k2+@UvnO;Ze=VzaWA2GJubk3ve8$)lpL=QE zpjnyCCvNHT%jGv^{p7?o$NY7VS%_|6GEetgdA zx%=Na=KVMJymRi~=jK+w^73EjzW0kKCLHsJz2|*+)KzC6ece&>?%4m#!M993liAUK z%rWu%=Y=mhcHPq9|Csm4j{1F{eR#j}4?lZi@b{YLlrLZP-TQ}czM%ZMIp+-=H|Eju z{L(xB^~~na%FlGRp0w_SlKDSz)?N0-U5WY6I&bXi6Tf2qI`{p#Gd|in|GGEd9(m)? z%!;S4d1Jy+YsOSOboy=87oFEoF?8V-6PMq4ZN<*9WwVcd^~H*-77h5<@PS2@k3Rg* z=5Zs(S1!M^_^56ZR#YDS>U|52z4*4u5&0ut{n!1kSB^Vx+zTzY_DFPVnmP5E7p5lO zeeA=cb%&moc=OYe?unlFB+8esKJM3j|CTr;dfq3`JriG$|J2WZzU8cA7Myp=-0iy- zpS$4G+kf@9SLQ#wVAPe1-@fFtj~ARVKJ$%L_YPe6?BV;|_Ja@07k+Q=caQtol8YC< z)9;4A_bJ@6ubCg2>XV-7xo*dhnFs!QT?mxp(Sf(omG8P)|$`%wD{N62UOOd_(b@h)x!^oj#&N3{xzrO|KO1m z?mD67caM#_{ND2~talglNkC_{48=g97_z&*-U2Xou-+%aySXSM6je~~ux#^&~%NFi<<*37#)U7$?vrGQE z;kvq4%KyD8mhn>Ez*YDCZT)LS^-DKYA26o(g!=WTW!;@K|D^guy7XHzVb$&RTlT1Z z^5PBK>(|WLy!O6FdNw>gdezohy{0#eJ8Q%EcieRiGjDpN`+fs{+3?o-(ktql-f!sq zvh&csH}13K=x$!gkPBxosXq3C&+q;D50!=G%7&RyAb?$mJ8lS_}^TKw9Grc-7% zX54>yP1Dxq$KpSK_3EaKqgLGf`t0YL&ba=Vi}!jz+T3mP$1g8w@tS*_)I95{-?udX z=+fW4eafLXH&^U>c<3GZe{Mebfu=PtPwU0p{&;I!EmW8z!MibYsZFw+f+0>m+ z-_`Q>$Gg4udF1Vu=XOrMl~1TIJ?A?cXZM*gbLo(&oB#I4!tX8pRryJaUwP<(rQKJZ zbIpM-{&VSZ8-|>{^y&V~8czFc(9Fo(W%~`ie?zzV7cIMe^}CN;HfHm(IY0Vq>DWm- zmwozhQEc;jLzmz4&zS?p{AA(s>xyr>^Q?=mT)yzc!yAUL{QdIK$8)xn_0C>#>agZD zU0*wRMajk+hfFSLTye)IBCtH1AAwj{>Dis9{aD@gunDU`K3$741ee8=_mjGkne^6 z5;^_kiRT`8+AHJlJ$dq|&+dp;e{k~LtdoB9)am_Jetc$+iDfq&yYk;NpRWF1&iN}x z9q`DbH|K3y`Phd|_Z(gD>B>+3e*S`6rVm+l&?UVdtiG^fRo)@7+q0Hkx@z({1LkaA z|J176|8?2u&-aR~-q7Nlb@29)t0NaVHy!bE?dsQ#AA9(;o32^?$HuLDy*~5#)#sm= zvAy>J1#9ko@zlB_$CRxZaQ;4zzp;7gnqkei9NhQhTh?sc{LbnB-16r&-+bMK?xh3& z3uBu=K15&B(%2+}c}-O*U$-dY~ zu->Pl>T7GuYp^b0(~;eCA#NM2^%tTPLRpYjh-`Ez6AT5A)>zW&Yf|O9{pYk`r7j+% zTgk)$?g9zg?lO!m3AX`_f+{F?ZSKG{idH}#E5>cbZKy}HfoH*dS%_Mi)saS-NrJ@o zRS>fMOR7$c6)+j9k~tz7nl}*heWN>X)x365C!|GXaoINRtkE{pL={fdlUWEywrWsl)5yGuFu z5cdEY%_|xbt&G*YTSpq%CobeJ8&2!A@)Joj5cB?a(n^K zi}yq+Uie-`M^3083Y!@!v@V zk>qs_u(o*=OCra~H$8}#-d1G?k;TLbhvi8(o@Z1%4*s6bbe%9 zDATqCT_^FP?N%Q~sW_yqBTi-d^~godxs*8Zi&ts0?v`n}&RxXI)|V6u@GROyocP4k z+=bt`Y~scM*EWpVo%bs7@^K5^%O6!bv3bNf2U@>?;N5(j8WOnk>D^v!-bvzsw>zVV zR~rVp_=@n%v`v;Blw%opD!!6*s2r2&{zF=5++1;bGnzO&XRY5DQiAd2Kx{!ian@0% zY&Y*R5VB#lpopEwU9i@;N%x!{4)oDG$ag634&#zOdJ@;+T+*{DpDx+xj^sLu>ucyZ zo#_KL5*lmY*o!Y!rFEXH$MnyT+YjT>8V z_C!-^?fF)6X|At#kr)>SqJ&DQE640ed~JE%3W+e)SQ_h_ng&%Sa%MoUqjmxsiaPh`jfpNUPrI9QOm{?Pt6t4<3F%1*7?vj>zW@sS$HYF0(a?PY0 zJSEG+F|Mh(zOj5^!firfn^=aYQNlebfeEdu7C<3h23?S?EqJ!h2?(p|l0@Zlnuedx zviinqob(9bq*Gaw-W+_j8`M4AjH(dOjp@{i=lv6d7Y=rtR@4e6K&`%EfH>`-dig@7 zb%@MCTWMNVORX&kqnY*Cz@>VHJW||byc{{wf~j#^R^Ngr;(P;O+;MQOYUM!EG+!=A zb#6mdLn7!^CB6iKvwT=?)0y*VZAHCcea7b=j#Tmr?xw&0s^x zeD6_fF?XB~Nh^6Nx7hN7z?r(Kxzf-XlbQ8gf8NW-VipBUj;^r2kwdZ z+X1Y{Ou3~-P-8Ckq7W@Kcr8cM>231H4rg8w;L{Jh19K|vZk}y5#cRJos1ZtZowL*&I zHMQWL*3`71rN+oZ!pl9lH2);a=vg*BJ!=i2_y3cZ{BI>A1a+uRh1CYhYigHhj@qMV zU7fh}PHFe!LcB2R7uo!jR&!Reo61z2);3D7GPO?A+|)WdI;hC`47uP9uB}|Z;ku3M z8m>#Y)^U|XoBk)S>6HH+uEAV=xT0L24lZ)u<@yuXZ@KR0`We@iTxW5u;Hu`D%{7$k z-}K|pT#s}8n(J<^o4KywTE|t*bpqFPu7kNsxq5O54uX-!Krq!M*ee{sQSSwN!Bg-H z?s^}LonR}x3C2m~Y7CT5S1>Mmuk!U?c@$Qi8pj}QfP0z5>A7iGkyF8S6xTSeQm!~x zXRb`H9YcW?*Ppqb=X#v$L9RQwZs59@YaQ28u6bNDxh8RWT%))KamBf!T)Rq&oPTot znd?QaC%7Kqx}EDvt_!(}xlZRgiK~Tc5!Za$8OWy2)Q9cSYiA!lq^Cui-&mpaa$Kgx6-zx*JYW9I5+?ps;(xD+t9AmXfD2L~Qh5^^4X zC+e&pzKj~`|8d4Xq;i~7-oNGaV~?*pYHU+5C2fNbBk(nH?R-j%`(>$~?!Imsk(kvxc45>t7 zua`ec`(djb%=)6){f=Ag3>;l#^cgL*-{4a_pG6W^)wML4)T}T4^h>`WeM5~+9;9U; zc3(CP8C3%E8J$U@$Hw>=8)xACRhZ`ByCmk2T6M%}y^UXwQn>mNUP_ z_sbMYPw{5YoiXXqx#K4tI%(z%@&x%$^79AbhX@OwgYc(3OI{Ab|K?fqEC`1{^kHe? zJi>x~@IKlmoZlu~&?a2iCVT{8$(})Z3Bu|1FCpA7?fp{1>Fqs@u-d2JD-(Jh5_!7U zUmp5w%T9$KfAsRl_T1TU^R~~PHQ{O7?)&wQJC^PG__J*$oc~<4_x=S(|GM*z?IwKi zjy31s+IQ=@19!Y@!lzw6tEB&&BcGYL<3kg^`?uHMdfqKdt}NfN!-StW`)~U!i*I=Q z=a}%U{qDWs zoYSXXeB93UCVczW>V3`%L)fB_)Yj``-TKr#m;9@GWaj-umck z-@UBct}P~o1QJXrsBP8 zj7HOOZoGB#IinJPy8V8`wH)WA#Lc~akn`ASFPItQIG69er0mnZPuTPivvPBs*?;YQ z{lKaz7Z!xX#T@7Da~pb9{w?&!{X;b-eE72WFTd=^wbzt|noaoh>Q#50ygc_Gb3!Xk zcv+8^S6sb)=3UD|>rD9J-&}G0g=ZXp#)YACO!$x!F5di`8N)Z<5?XJ~#4lmB_#9+#dH ze%6G?6!*Pk+ua*qyCS^JgfG7H^*J+s_u`E|4{tZ&gU8=+?Tag~_-t$VT@x-Ef9(yE zColcgJK+yaxYvfUKY#xRH=msq*%y0M{^+B~coTkc*(>+f zJ#g_moiZkyaED?}JKnpH-6AbU=DBgK-CwnewrhP7gnz=bXnqjBsZIFiHerokdiq=2 zgn#OXcgyS#bS-Cf4|e;PxCbBXjwpe(ChNbgO?l!;lHr42nm=)6)ly8t=xK}&kOV;= z#FxYegYX`N%hJMQ+q^&2f8V~%F)?B!03Cs_BDG86D>$qMb#J5W-O4i(e$v1Yy0eTrXf*gJ%v*)8;j%cp72q%mray_)!?xodxGIzb6Wt@nruS=12g> z<8o!Ddlq!GSG81)Zl~|fmlm}w156{z?ScBSc}J?t#eFcz&`H1+BG^*|EE4?Y!(Cp# zGb?~H#|qf5hC?sF-@?cUZ(uC|un=(4WW#UL3(wnNEy1n~cn8gNJv8>}U{@OK0#Z^k zw3&hQS_olD!F4hqxERc0xPy4udm6a!gbSE&)1NL(a8`6>2#DB zd}Q=8JdEZgaKrM7>xNrn*K#F8$$&sxp{;N#&WuqV4AysUSf7D}ngjUQen%VJVQ_nv zf!WFb#pwt}TL;^et#8_KQ-3A7z5Ep9|dhudX1zp8>v1DEs=+B8-ke zSv?>`;zq>pgE-qWai)%~vUA{59R~^^JF05zr65IUgU<0vTH<%;M&{C4r&3-+0yRz%sjuE0~`Sj&9tGB zFgObOjqJbw+SunNN;-vuFS%h5gO`#vhwkS`wcO@xmLlOrSJ ztPcd^vmo6wB7O_>V>XWorq912-WrHExLmF|ex<)bACv9hllrXxHFMl)po8u2orjS1 zm!Qm>2R?lr%vX|iLnnJk1#2?+MzGGu_PPKzWQw7;kAsl$IuSzFPlGsEnH_%h9@ETg zL1&c$zuzD8;p<}a7|m&%SCZP$D*qk6Muz1l zm)*5$%@dxwTUV`K@A$xComzSITbFx6VER~2;) zjdPn?+tzH@1t7J$3lV(bH#!K3jS3s%_hk96k2R;Mw=eAA8}A zffIujRnzL~=QcgCcHO~eo;~{KfmhDh>=6x(Uw(CMSYLGKhvzKu9i5KYrWN<>+u!s2 zVS7Yed}&$Lv|DF4&b_DS569j*{r=ErUo7cb*S+-7WS4u#{%4QAGI-|PdZkkO+I3QUNZA!H@RIC*Vbtp2Ch)6KV0+sT_Bp^#TUnRzfbs`ob z)M`43WD-Pef>rg>*s)F8BD!#_{wm*lfJ6(u-;sLJE=S5?YM8oEP=siqUQFjpl?=rvwlwWZPIvRCF8|BDV^^fwna*ATP8`cCRp{=w0C2aDg4)u@NT|9 z#Fj`|Ka$w3>TgG@ygtn9=hS~}Cb_b&F--rXq`%H9kp)B%@}yEp6}nAvWHzmr^_7th z#V%J;{Xt>RHZ_7~^;6&3WKrdLeS3)S3lV8)0;H~?`VkUCtY%Jt1Mm>VyeMKxlCc86 ziEE)D$c97tF}5%ijw5iC*}=z3@hAx`q<7%`!#8=t{v(Ruy?zC=I4 zm$f1KHU5TNMQTbxQPs3{Tekdm`KpH>ed4J@_Z<{OIj68_*5@Zr(Xhyz+*x%!yZ7yX z;g<8E_dl?9%k|F4`eN0z*0#oHo{e#cl41&r$jSHa-1W}8a_;&KJ4L0SsC~h@hisiq zM=xKQJ@2324%f_le3Q$a;;h}gwf}e9cI8z@JX;+uzZ7JN;Y*W=FU#@Idq{xDjd@^5>J$62U z#PFy%k51*?R1sydSWBU*oI|{Pv`AI4x*~U+d7S8y6kqa;sp(RhJv!MD79m$b0h7&9 zq9T+_De_X&#G*8zfLDa+0^&mmudkXHS1u{~_PL2ACPgrh@d`>#294048{b-^mdi?M zNldv^W3CVt{mW7%mXuZG5{sk=`J&>>i4qHlV-~XBY+kvkeW^)*`N7Kh<~~n|eckTf zvi|3K^TjmUC?qSTijyDHd!V6hD$N&d#jHzg{95XJJ57G#l5d<9#R?WG`Bpzb@8Hcu z7DFCtE|a^*>t8Be(&F&ayV+2vlcV(eeP!g{iPrGG>UcrWPp9)m321R9iKf_B9B=dT z$agZW_iy@Fsg+crc%^M}WugA!cmdH`J|-LcEE%*_ou%me@?y;yRE7~D=#Q^_huVml z{E9XSFutrR&4bE0rNk=VOf?p0$&oCORTlNv$0~iokIL|XEN^0_FCfN8jF3ju?tqN*`CpfhNTkQ()X`% zg7aRsXFhYuU8OKns9|2AezOn%KaSf9v^XKX8g3Q_aXF>Cd}l{U#Q*pQA^#Y7Zd7F ze$rpBahL0dP|s{wq={T6Ob;>qp>mTaJOs6YG{qRvn^0U#gUKt)D3T%>gb$xi#!G3D zNXrEPDuL7#6&#Da44g`kMZwVs<9v`(6oZsTahSkSpAhFE0}8`-kYSJ;a7#!e3XVes z0ILF|6VL-z!h?ttvB{5>kpzWe7I)x$pf6ZTEGkD7EItvE&~$`FRhoyeY!WMQ4B$g3 z*Mgu#-h`55)J~BAMByk*NeG2sCc*-;BH%rV#c}XgjFBiIY?2XtJJ3>`h<-^ZmXSc- z1112qBEyI!LBYrqpG7?o=aCbBdR&7_B9aG*07$$N#*YzXMj|Va;DKTey_CR_HKYX5XRtIiM?6K_yMVH z1R9m+WQ4zfmWLjJ)z;ozrtSH1m>t^#j zdqRShgAXc)CeZ2do^#;{SlEDFuOwkHjy^)TTza#FEXd9yD`2(xG4icwE5H;|;DESD J => { - const contractWasm = fs.readFileSync("../tests-ts/proxy_contract_release.wasm"); + const contractWasm = fs.readFileSync("../proxy_contract_release.wasm"); await account.deployContract(contractWasm); From db716964a9874069f9e0bdeb030c518b555eda34 Mon Sep 17 00:00:00 2001 From: Mateus Santana <42101423+1Mateus@users.noreply.github.com> Date: Wed, 12 Apr 2023 10:24:18 -0300 Subject: [PATCH 10/13] revert(front): alert for not defined vars --- packages/front/src/hooks/useEnv.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/front/src/hooks/useEnv.tsx b/packages/front/src/hooks/useEnv.tsx index 6246f24d3..e82aa3c7f 100644 --- a/packages/front/src/hooks/useEnv.tsx +++ b/packages/front/src/hooks/useEnv.tsx @@ -2,5 +2,5 @@ export const useEnv = (name: string) => { if (import.meta.env[import.meta.envPrefix + name]) return import.meta.env[import.meta.envPrefix + name]; if (import.meta.env[name]) return import.meta.env[name]; - // alert(`Environment variable ${name} is not defined.`); + alert(`Environment variable ${name} is not defined.`); }; From d477283af448c75f590a439b54aab42325d09bc6 Mon Sep 17 00:00:00 2001 From: Mateus Santana <42101423+1Mateus@users.noreply.github.com> Date: Wed, 12 Apr 2023 18:06:07 -0300 Subject: [PATCH 11/13] feat(front): requested changes --- packages/contracts/tests-ts/src/actions/registry.ts | 1 - .../contracts/tests-ts/src/constants/merkle-tree.ts | 2 -- packages/denylist-bot/src/dos/pagination.ts | 8 +++++++- packages/denylist-bot/src/services/consumer.ts | 10 +++++----- packages/denylist-bot/src/utils.ts | 6 ++++-- packages/denylist-bot/test/consumer.test.ts | 12 ++++++------ 6 files changed, 22 insertions(+), 17 deletions(-) diff --git a/packages/contracts/tests-ts/src/actions/registry.ts b/packages/contracts/tests-ts/src/actions/registry.ts index ca4407464..5e45fee19 100644 --- a/packages/contracts/tests-ts/src/actions/registry.ts +++ b/packages/contracts/tests-ts/src/actions/registry.ts @@ -5,7 +5,6 @@ import { TREE_HEIGHT, ZERO_VALUE, PROTOCOL_FEE, - HAPI_ONE_TESTNET, RISK_PARAMS, Q, QF, diff --git a/packages/contracts/tests-ts/src/constants/merkle-tree.ts b/packages/contracts/tests-ts/src/constants/merkle-tree.ts index 87d894b8c..1fdd2aff3 100644 --- a/packages/contracts/tests-ts/src/constants/merkle-tree.ts +++ b/packages/contracts/tests-ts/src/constants/merkle-tree.ts @@ -18,8 +18,6 @@ export const FT_DECIMALS = "000000"; export const NEAR_DECIMALS = "000000000000000000000000"; -export const HAPI_ONE_TESTNET = "dev-1681141193055-11311550135061"; - export const Q = "21888242871839275222246405745257275088548364400416034343698204186575808495617"; diff --git a/packages/denylist-bot/src/dos/pagination.ts b/packages/denylist-bot/src/dos/pagination.ts index ac1a468d3..0614564b9 100644 --- a/packages/denylist-bot/src/dos/pagination.ts +++ b/packages/denylist-bot/src/dos/pagination.ts @@ -66,7 +66,13 @@ export class Pagination { await this.env.QUEUE.sendBatch(hapioneEntries.map(value => ({ body: value})) as any); - await this.updateCurrentCounter(hapioneEntries.at(-1)?.counter); + const lastEntry = hapioneEntries.at(-1); + + const nextIndexOf = lastEntry + ? +lastEntry.counter + 1 + '' + : '0'; + + await this.updateCurrentCounter(nextIndexOf); return new Response("Success!"); } diff --git a/packages/denylist-bot/src/services/consumer.ts b/packages/denylist-bot/src/services/consumer.ts index d6e52dad5..7786337d5 100644 --- a/packages/denylist-bot/src/services/consumer.ts +++ b/packages/denylist-bot/src/services/consumer.ts @@ -1,6 +1,6 @@ import type { Env } from "../types/env"; import type { QueuedData } from "../types/pagination"; -import { setupNear, viewFunction, AttachedGas } from "../utils"; +import { setupNear, viewFunction, attachedGas, denylistDeposit } from "../utils"; const riskMap: any = { "Scam": 5, @@ -41,8 +41,8 @@ const sendBanTransaction = async (payload: QueuedData, env: Env): Promise args: { account_id: payload.account, }, - gas: AttachedGas as any, - attachedDeposit: "320000000000000000000" as any, + gas: attachedGas, + attachedDeposit: denylistDeposit, }); } @@ -72,8 +72,8 @@ export const consumer = async (payload: QueuedData, env: Env) => { const maxRiskScore = await fetchRiskParams(payload.category); - if (Number(payload.risk) < maxRiskScore) { - console.info(`The ${payload.account} account not is over the max risk`); + if (Number(payload.risk) <= maxRiskScore) { + console.info(`The ${payload.account} account is not over the max risk`); return } diff --git a/packages/denylist-bot/src/utils.ts b/packages/denylist-bot/src/utils.ts index 2fa2c13ba..f9fd05c7c 100644 --- a/packages/denylist-bot/src/utils.ts +++ b/packages/denylist-bot/src/utils.ts @@ -8,7 +8,9 @@ globalThis.Buffer = Buffer; globalThis.process = Process; /* tslint:enable */ -export const AttachedGas = "300000000000000"; +export const attachedGas = "300000000000000" as any; +export const denylistDeposit = "320000000000000000000" as any; +export const allowlistDeposit = "480000000000000000000" as any; export const setupNear = async ({ RPC_URL, @@ -55,7 +57,7 @@ export const paginationSize = 100; export const getHapioneEntriesQuery = ` query GetHapioneEntries($lastViewed: BigInt!) { - hapioneEntries(where: {counter_gt: $lastViewed}, first: ${paginationSize}, orderBy: counter) { + hapioneEntries(where: {counter_gte: $lastViewed}, first: ${paginationSize}, orderBy: counter) { counter account category diff --git a/packages/denylist-bot/test/consumer.test.ts b/packages/denylist-bot/test/consumer.test.ts index 465dd25a2..de48eed74 100644 --- a/packages/denylist-bot/test/consumer.test.ts +++ b/packages/denylist-bot/test/consumer.test.ts @@ -1,6 +1,6 @@ import testnetSetup from "../test_setup.json"; import { consumer } from "../src/services/consumer"; -import { setupNear, viewFunction } from "../src/utils"; +import { allowlistDeposit, attachedGas, setupNear, viewFunction } from "../src/utils"; import { describe, expect, jest, it, beforeAll } from '@jest/globals'; const payload = { @@ -53,8 +53,8 @@ describe("Test all service actions", () => { args: { account_id: payload.account, }, - gas: "300000000000000" as any, - attachedDeposit: "480000000000000000000" as any, + gas: attachedGas, + attachedDeposit: allowlistDeposit, }); try { @@ -66,7 +66,7 @@ describe("Test all service actions", () => { category: "Theft", risk: 10, }, - gas: "300000000000000" as any, + gas: attachedGas, }); await consumer(payload, baseEnv as any); @@ -81,8 +81,8 @@ describe("Test all service actions", () => { args: { account_id: payload.account, }, - gas: "300000000000000" as any, - attachedDeposit: "480000000000000000000" as any, + gas: attachedGas, + attachedDeposit: allowlistDeposit, }); } catch (e: any) { console.log(e.message); From 8bc6b207026cd0cfb23dc42255fb87360fdcb517 Mon Sep 17 00:00:00 2001 From: Mateus Santana <42101423+1Mateus@users.noreply.github.com> Date: Wed, 12 Apr 2023 23:19:34 -0300 Subject: [PATCH 12/13] feat(denybot): get risk map from contract --- packages/denylist-bot/src/services/consumer.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/denylist-bot/src/services/consumer.ts b/packages/denylist-bot/src/services/consumer.ts index 7786337d5..701c542d8 100644 --- a/packages/denylist-bot/src/services/consumer.ts +++ b/packages/denylist-bot/src/services/consumer.ts @@ -20,7 +20,13 @@ const riskMap: any = { * @param category The risk category * @returns Returns the max risk accepted by the contract */ -const fetchRiskParams = async (category: string): Promise => { +const fetchRiskParams = async (category: string, env: Env): Promise => { + const riskMap = await viewFunction( + env.RPC_URL, + env.HYC_CONTRACT, + 'view_risk_params', + ); + return riskMap[category]; } @@ -70,7 +76,7 @@ export const consumer = async (payload: QueuedData, env: Env) => { return } - const maxRiskScore = await fetchRiskParams(payload.category); + const maxRiskScore = await fetchRiskParams(payload.category, env); if (Number(payload.risk) <= maxRiskScore) { console.info(`The ${payload.account} account is not over the max risk`); From 56c47d0440b2838e572f82da293929de15f271eb Mon Sep 17 00:00:00 2001 From: Mateus Santana <42101423+1Mateus@users.noreply.github.com> Date: Thu, 13 Apr 2023 08:52:34 -0300 Subject: [PATCH 13/13] fix: build --- packages/denylist-bot/src/services/consumer.ts | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/packages/denylist-bot/src/services/consumer.ts b/packages/denylist-bot/src/services/consumer.ts index 701c542d8..b9deab8cb 100644 --- a/packages/denylist-bot/src/services/consumer.ts +++ b/packages/denylist-bot/src/services/consumer.ts @@ -2,18 +2,6 @@ import type { Env } from "../types/env"; import type { QueuedData } from "../types/pagination"; import { setupNear, viewFunction, attachedGas, denylistDeposit } from "../utils"; -const riskMap: any = { - "Scam": 5, - "Theft": 5, - "Sanctions": 5, - "ChildAbuse": 5, - "Ransomware": 5, - "Counterfeit": 5, - "DarknetService": 5, - "TerroristFinancing": 5, - "IllicitOrganization": 5, -}; - /** fetchRiskParams * This function must perform a view call to contract to fetch * there is currently no such view call in the contract. Mock