clone

push a directory of html from the terminal and get a four-character url back. a deno cli on cloudflare

fix: make Worker type checks portable

Dami committed 6b2bcd0
Generate only stable binding declarations and source runtime APIs from the published Workers types so Linux CI and local development compare the same file.
commit
6b2bcd0fd5358397865cdc20208aba21234b9478
parent
484bfc3ef81d908d90d1450eef7782c8e0805416
author
Dami <dami.etoile@gmail.com>
4 files changed, +7 -14702
Mworker/package-lock.json5+-
Mworker/package.json5+-
Mworker/tsconfig.json2+-
Mworker/worker-configuration.d.ts14697+------------------------------
M worker/package-lock.json +2 -3
M worker/package.json +3 -2
M worker/tsconfig.json +1 -1
M worker/worker-configuration.d.ts +1 -14696
@@ -1,6 +1,5 @@
11 /* eslint-disable */2-// Generated by Wrangler by running `wrangler types` (hash: 990c104e67727cf0d631159dadc2a132)3-// Runtime types generated with workerd@1.20260708.1 2026-07-11 nodejs_compat2+// Generated by Wrangler by running `wrangler types --include-runtime=false` (hash: 990c104e67727cf0d631159dadc2a132)43 interface __BaseEnv_Env {54 CONTENT: R2Bucket;65 DB: D1Database;
@@ -27,14697 +26,3 @@ type StringifyValues<EnvType extends Record<string, unknown>> = {
2726 declare namespace NodeJS {2827 interface ProcessEnv extends StringifyValues<Pick<Cloudflare.Env, "ALERT_EMAIL_TO" | "ALERT_EMAIL_FROM" | "NZIP_TOKEN" | "PUBLIC_BASE">> {}2928 }30-31-// Begin runtime types32-/*! *****************************************************************************33-Copyright (c) Cloudflare. All rights reserved.34-Copyright (c) Microsoft Corporation. All rights reserved.35-36-Licensed under the Apache License, Version 2.0 (the "License"); you may not use37-this file except in compliance with the License. You may obtain a copy of the38-License at http://www.apache.org/licenses/LICENSE-2.039-THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY40-KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED41-WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,42-MERCHANTABLITY OR NON-INFRINGEMENT.43-See the Apache Version 2.0 License for specific language governing permissions44-and limitations under the License.45-***************************************************************************** */46-/* eslint-disable */47-// noinspection JSUnusedGlobalSymbols48-declare var onmessage: never;49-/**50- * The **`DOMException`** interface represents an abnormal event (called an **exception**) that occurs as a result of calling a method or accessing a property of a web API.51- *52- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException)53- */54-declare class DOMException extends Error {55- constructor(message?: string, name?: string);56- /**57- * The **`message`** read-only property of the a message or description associated with the given error name.58- *59- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message)60- */61- readonly message: string;62- /**63- * The **`name`** read-only property of the one of the strings associated with an error name.64- *65- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name)66- */67- readonly name: string;68- /**69- * The **`code`** read-only property of the DOMException interface returns one of the legacy error code constants, or `0` if none match.70- * @deprecated71- *72- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code)73- */74- readonly code: number;75- static readonly INDEX_SIZE_ERR: number;76- static readonly DOMSTRING_SIZE_ERR: number;77- static readonly HIERARCHY_REQUEST_ERR: number;78- static readonly WRONG_DOCUMENT_ERR: number;79- static readonly INVALID_CHARACTER_ERR: number;80- static readonly NO_DATA_ALLOWED_ERR: number;81- static readonly NO_MODIFICATION_ALLOWED_ERR: number;82- static readonly NOT_FOUND_ERR: number;83- static readonly NOT_SUPPORTED_ERR: number;84- static readonly INUSE_ATTRIBUTE_ERR: number;85- static readonly INVALID_STATE_ERR: number;86- static readonly SYNTAX_ERR: number;87- static readonly INVALID_MODIFICATION_ERR: number;88- static readonly NAMESPACE_ERR: number;89- static readonly INVALID_ACCESS_ERR: number;90- static readonly VALIDATION_ERR: number;91- static readonly TYPE_MISMATCH_ERR: number;92- static readonly SECURITY_ERR: number;93- static readonly NETWORK_ERR: number;94- static readonly ABORT_ERR: number;95- static readonly URL_MISMATCH_ERR: number;96- static readonly QUOTA_EXCEEDED_ERR: number;97- static readonly TIMEOUT_ERR: number;98- static readonly INVALID_NODE_TYPE_ERR: number;99- static readonly DATA_CLONE_ERR: number;100- get stack(): any;101- set stack(value: any);102-}103-type WorkerGlobalScopeEventMap = {104- fetch: FetchEvent;105- scheduled: ScheduledEvent;106- queue: QueueEvent;107- unhandledrejection: PromiseRejectionEvent;108- rejectionhandled: PromiseRejectionEvent;109-};110-declare abstract class WorkerGlobalScope extends EventTarget<WorkerGlobalScopeEventMap> {111- EventTarget: typeof EventTarget;112-}113-/* The **`console`** object provides access to the debugging console (e.g., the Web console in Firefox). *114- * The **`console`** object provides access to the debugging console (e.g., the Web console in Firefox).115- *116- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console)117- */118-interface Console {119- "assert"(condition?: boolean, ...data: any[]): void;120- /**121- * The **`console.clear()`** static method clears the console if possible.122- *123- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/clear_static)124- */125- clear(): void;126- /**127- * The **`console.count()`** static method logs the number of times that this particular call to `count()` has been called.128- *129- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/count_static)130- */131- count(label?: string): void;132- /**133- * The **`console.countReset()`** static method resets counter used with console/count_static.134- *135- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/countReset_static)136- */137- countReset(label?: string): void;138- /**139- * The **`console.debug()`** static method outputs a message to the console at the 'debug' log level.140- *141- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/debug_static)142- */143- debug(...data: any[]): void;144- /**145- * The **`console.dir()`** static method displays a list of the properties of the specified JavaScript object.146- *147- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dir_static)148- */149- dir(item?: any, options?: any): void;150- /**151- * The **`console.dirxml()`** static method displays an interactive tree of the descendant elements of the specified XML/HTML element.152- *153- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dirxml_static)154- */155- dirxml(...data: any[]): void;156- /**157- * The **`console.error()`** static method outputs a message to the console at the 'error' log level.158- *159- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/error_static)160- */161- error(...data: any[]): void;162- /**163- * The **`console.group()`** static method creates a new inline group in the Web console log, causing any subsequent console messages to be indented by an additional level, until console/groupEnd_static is called.164- *165- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/group_static)166- */167- group(...data: any[]): void;168- /**169- * The **`console.groupCollapsed()`** static method creates a new inline group in the console.170- *171- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupCollapsed_static)172- */173- groupCollapsed(...data: any[]): void;174- /**175- * The **`console.groupEnd()`** static method exits the current inline group in the console.176- *177- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupEnd_static)178- */179- groupEnd(): void;180- /**181- * The **`console.info()`** static method outputs a message to the console at the 'info' log level.182- *183- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/info_static)184- */185- info(...data: any[]): void;186- /**187- * The **`console.log()`** static method outputs a message to the console.188- *189- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/log_static)190- */191- log(...data: any[]): void;192- /**193- * The **`console.table()`** static method displays tabular data as a table.194- *195- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/table_static)196- */197- table(tabularData?: any, properties?: string[]): void;198- /**199- * The **`console.time()`** static method starts a timer you can use to track how long an operation takes.200- *201- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/time_static)202- */203- time(label?: string): void;204- /**205- * The **`console.timeEnd()`** static method stops a timer that was previously started by calling console/time_static.206- *207- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeEnd_static)208- */209- timeEnd(label?: string): void;210- /**211- * The **`console.timeLog()`** static method logs the current value of a timer that was previously started by calling console/time_static.212- *213- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeLog_static)214- */215- timeLog(label?: string, ...data: any[]): void;216- timeStamp(label?: string): void;217- /**218- * The **`console.trace()`** static method outputs a stack trace to the console.219- *220- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/trace_static)221- */222- trace(...data: any[]): void;223- /**224- * The **`console.warn()`** static method outputs a warning message to the console at the 'warning' log level.225- *226- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/warn_static)227- */228- warn(...data: any[]): void;229-}230-declare const console: Console;231-type BufferSource = ArrayBufferView | ArrayBuffer;232-type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array;233-declare namespace WebAssembly {234- class CompileError extends Error {235- constructor(message?: string);236- }237- class RuntimeError extends Error {238- constructor(message?: string);239- }240- type ValueType = "anyfunc" | "externref" | "f32" | "f64" | "i32" | "i64" | "v128";241- interface GlobalDescriptor {242- value: ValueType;243- mutable?: boolean;244- }245- class Global {246- constructor(descriptor: GlobalDescriptor, value?: any);247- value: any;248- valueOf(): any;249- }250- type ImportValue = ExportValue | number;251- type ModuleImports = Record<string, ImportValue>;252- type Imports = Record<string, ModuleImports>;253- type ExportValue = Function | Global | Memory | Table;254- type Exports = Record<string, ExportValue>;255- class Instance {256- constructor(module: Module, imports?: Imports);257- readonly exports: Exports;258- }259- interface MemoryDescriptor {260- initial: number;261- maximum?: number;262- shared?: boolean;263- }264- class Memory {265- constructor(descriptor: MemoryDescriptor);266- readonly buffer: ArrayBuffer;267- grow(delta: number): number;268- }269- type ImportExportKind = "function" | "global" | "memory" | "table";270- interface ModuleExportDescriptor {271- kind: ImportExportKind;272- name: string;273- }274- interface ModuleImportDescriptor {275- kind: ImportExportKind;276- module: string;277- name: string;278- }279- abstract class Module {280- static customSections(module: Module, sectionName: string): ArrayBuffer[];281- static exports(module: Module): ModuleExportDescriptor[];282- static imports(module: Module): ModuleImportDescriptor[];283- }284- type TableKind = "anyfunc" | "externref";285- interface TableDescriptor {286- element: TableKind;287- initial: number;288- maximum?: number;289- }290- class Table {291- constructor(descriptor: TableDescriptor, value?: any);292- readonly length: number;293- get(index: number): any;294- grow(delta: number, value?: any): number;295- set(index: number, value?: any): void;296- }297- function instantiate(module: Module, imports?: Imports): Promise<Instance>;298- function validate(bytes: BufferSource): boolean;299-}300-/**301- * The **`ServiceWorkerGlobalScope`** interface of the Service Worker API represents the global execution context of a service worker.302- * Available only in secure contexts.303- *304- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorkerGlobalScope)305- */306-interface ServiceWorkerGlobalScope extends WorkerGlobalScope {307- DOMException: typeof DOMException;308- WorkerGlobalScope: typeof WorkerGlobalScope;309- btoa(data: string): string;310- atob(data: string): string;311- setTimeout(callback: (...args: any[]) => void, msDelay?: number): number;312- setTimeout<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;313- clearTimeout(timeoutId: number | null): void;314- setInterval(callback: (...args: any[]) => void, msDelay?: number): number;315- setInterval<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;316- clearInterval(timeoutId: number | null): void;317- queueMicrotask(task: Function): void;318- structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;319- reportError(error: any): void;320- fetch(input: RequestInfo | URL, init?: RequestInit<RequestInitCfProperties>): Promise<Response>;321- self: ServiceWorkerGlobalScope;322- crypto: Crypto;323- caches: CacheStorage;324- scheduler: Scheduler;325- performance: Performance;326- Cloudflare: Cloudflare;327- readonly origin: string;328- Event: typeof Event;329- ExtendableEvent: typeof ExtendableEvent;330- CustomEvent: typeof CustomEvent;331- PromiseRejectionEvent: typeof PromiseRejectionEvent;332- FetchEvent: typeof FetchEvent;333- TailEvent: typeof TailEvent;334- TraceEvent: typeof TailEvent;335- ScheduledEvent: typeof ScheduledEvent;336- MessageEvent: typeof MessageEvent;337- CloseEvent: typeof CloseEvent;338- ReadableStreamDefaultReader: typeof ReadableStreamDefaultReader;339- ReadableStreamBYOBReader: typeof ReadableStreamBYOBReader;340- ReadableStream: typeof ReadableStream;341- WritableStream: typeof WritableStream;342- WritableStreamDefaultWriter: typeof WritableStreamDefaultWriter;343- TransformStream: typeof TransformStream;344- ByteLengthQueuingStrategy: typeof ByteLengthQueuingStrategy;345- CountQueuingStrategy: typeof CountQueuingStrategy;346- ErrorEvent: typeof ErrorEvent;347- MessageChannel: typeof MessageChannel;348- MessagePort: typeof MessagePort;349- EventSource: typeof EventSource;350- ReadableStreamBYOBRequest: typeof ReadableStreamBYOBRequest;351- ReadableStreamDefaultController: typeof ReadableStreamDefaultController;352- ReadableByteStreamController: typeof ReadableByteStreamController;353- WritableStreamDefaultController: typeof WritableStreamDefaultController;354- TransformStreamDefaultController: typeof TransformStreamDefaultController;355- CompressionStream: typeof CompressionStream;356- DecompressionStream: typeof DecompressionStream;357- TextEncoderStream: typeof TextEncoderStream;358- TextDecoderStream: typeof TextDecoderStream;359- Headers: typeof Headers;360- Body: typeof Body;361- Request: typeof Request;362- Response: typeof Response;363- WebSocket: typeof WebSocket;364- WebSocketPair: typeof WebSocketPair;365- WebSocketRequestResponsePair: typeof WebSocketRequestResponsePair;366- AbortController: typeof AbortController;367- AbortSignal: typeof AbortSignal;368- TextDecoder: typeof TextDecoder;369- TextEncoder: typeof TextEncoder;370- navigator: Navigator;371- Navigator: typeof Navigator;372- URL: typeof URL;373- URLSearchParams: typeof URLSearchParams;374- URLPattern: typeof URLPattern;375- Blob: typeof Blob;376- File: typeof File;377- FormData: typeof FormData;378- Crypto: typeof Crypto;379- SubtleCrypto: typeof SubtleCrypto;380- CryptoKey: typeof CryptoKey;381- CacheStorage: typeof CacheStorage;382- Cache: typeof Cache;383- FixedLengthStream: typeof FixedLengthStream;384- IdentityTransformStream: typeof IdentityTransformStream;385- HTMLRewriter: typeof HTMLRewriter;386-}387-declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetAddEventListenerOptions | boolean): void;388-declare function removeEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetEventListenerOptions | boolean): void;389-/**390- * The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.391- *392- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)393- */394-declare function dispatchEvent(event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap]): boolean;395-/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/btoa) */396-declare function btoa(data: string): string;397-/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/atob) */398-declare function atob(data: string): string;399-/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setTimeout) */400-declare function setTimeout(callback: (...args: any[]) => void, msDelay?: number): number;401-/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setTimeout) */402-declare function setTimeout<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;403-/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/clearTimeout) */404-declare function clearTimeout(timeoutId: number | null): void;405-/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setInterval) */406-declare function setInterval(callback: (...args: any[]) => void, msDelay?: number): number;407-/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setInterval) */408-declare function setInterval<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;409-/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/clearInterval) */410-declare function clearInterval(timeoutId: number | null): void;411-/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/queueMicrotask) */412-declare function queueMicrotask(task: Function): void;413-/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/structuredClone) */414-declare function structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;415-/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/reportError) */416-declare function reportError(error: any): void;417-/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/fetch) */418-declare function fetch(input: RequestInfo | URL, init?: RequestInit<RequestInitCfProperties>): Promise<Response>;419-declare const self: ServiceWorkerGlobalScope;420-/**421-* The Web Crypto API provides a set of low-level functions for common cryptographic tasks.422-* The Workers runtime implements the full surface of this API, but with some differences in423-* the [supported algorithms](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/#supported-algorithms)424-* compared to those implemented in most browsers.425-*426-* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/)427-*/428-declare const crypto: Crypto;429-/**430-* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache.431-*432-* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/)433-*/434-declare const caches: CacheStorage;435-declare const scheduler: Scheduler;436-/**437-* The Workers runtime supports a subset of the Performance API, used to measure timing and performance,438-* as well as timing of subrequests and other operations.439-*440-* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)441-*/442-declare const performance: Performance;443-declare const Cloudflare: Cloudflare;444-declare const origin: string;445-declare const navigator: Navigator;446-interface TestController {447-}448-interface ExecutionContext<Props = unknown> {449- waitUntil(promise: Promise<any>): void;450- passThroughOnException(): void;451- readonly exports: Cloudflare.Exports;452- readonly props: Props;453- cache?: CacheContext;454- readonly access?: CloudflareAccessContext;455- tracing: Tracing;456-}457-type ExportedHandlerFetchHandler<Env = unknown, CfHostMetadata = unknown, Props = unknown> = (request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>, env: Env, ctx: ExecutionContext<Props>) => Response | Promise<Response>;458-type ExportedHandlerConnectHandler<Env = unknown, Props = unknown> = (socket: Socket, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;459-type ExportedHandlerTailHandler<Env = unknown, Props = unknown> = (events: TraceItem[], env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;460-type ExportedHandlerTraceHandler<Env = unknown, Props = unknown> = (traces: TraceItem[], env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;461-type ExportedHandlerTailStreamHandler<Env = unknown, Props = unknown> = (event: TailStream.TailEvent<TailStream.Onset>, env: Env, ctx: ExecutionContext<Props>) => TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;462-type ExportedHandlerScheduledHandler<Env = unknown, Props = unknown> = (controller: ScheduledController, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;463-type ExportedHandlerQueueHandler<Env = unknown, Message = unknown, Props = unknown> = (batch: MessageBatch<Message>, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;464-type ExportedHandlerTestHandler<Env = unknown, Props = unknown> = (controller: TestController, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;465-interface ExportedHandler<Env = unknown, QueueHandlerMessage = unknown, CfHostMetadata = unknown, Props = unknown> {466- fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata, Props>;467- connect?: ExportedHandlerConnectHandler<Env, Props>;468- tail?: ExportedHandlerTailHandler<Env, Props>;469- trace?: ExportedHandlerTraceHandler<Env, Props>;470- tailStream?: ExportedHandlerTailStreamHandler<Env, Props>;471- scheduled?: ExportedHandlerScheduledHandler<Env, Props>;472- test?: ExportedHandlerTestHandler<Env, Props>;473- email?: EmailExportedHandler<Env, Props>;474- queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage, Props>;475-}476-interface StructuredSerializeOptions {477- transfer?: any[];478-}479-declare abstract class Navigator {480- sendBeacon(url: string, body?: BodyInit): boolean;481- readonly userAgent: string;482- readonly hardwareConcurrency: number;483- readonly platform: string;484- readonly language: string;485- readonly languages: string[];486-}487-interface AlarmInvocationInfo {488- readonly isRetry: boolean;489- readonly retryCount: number;490- readonly scheduledTime: number;491-}492-interface Cloudflare {493- readonly compatibilityFlags: Record<string, boolean>;494-}495-interface CachePurgeError {496- code: number;497- message: string;498-}499-interface CachePurgeResult {500- success: boolean;501- errors: CachePurgeError[];502-}503-interface CachePurgeOptions {504- tags?: string[];505- pathPrefixes?: string[];506- purgeEverything?: boolean;507-}508-interface CacheContext {509- purge(options: CachePurgeOptions): Promise<CachePurgeResult>;510-}511-interface CloudflareAccessContext {512- readonly aud: string;513- getIdentity(): Promise<CloudflareAccessIdentity | undefined>;514-}515-declare abstract class ColoLocalActorNamespace {516- get(actorId: string): Fetcher;517-}518-interface DurableObject {519- fetch(request: Request): Response | Promise<Response>;520- connect?(socket: Socket): void | Promise<void>;521- alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;522- webSocketMessage?(ws: WebSocket, message: string | ArrayBuffer): void | Promise<void>;523- webSocketClose?(ws: WebSocket, code: number, reason: string, wasClean: boolean): void | Promise<void>;524- webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;525-}526-type DurableObjectStub<T extends Rpc.DurableObjectBranded | undefined = undefined> = Fetcher<T, "alarm" | "connect" | "webSocketMessage" | "webSocketClose" | "webSocketError"> & {527- readonly id: DurableObjectId;528- readonly name?: string;529-};530-interface DurableObjectId {531- toString(): string;532- equals(other: DurableObjectId): boolean;533- readonly name?: string;534- readonly jurisdiction?: string;535-}536-declare abstract class DurableObjectNamespace<T extends Rpc.DurableObjectBranded | undefined = undefined> {537- newUniqueId(options?: DurableObjectNamespaceNewUniqueIdOptions): DurableObjectId;538- idFromName(name: string): DurableObjectId;539- idFromString(id: string): DurableObjectId;540- get(id: DurableObjectId, options?: DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStub<T>;541- getByName(name: string, options?: DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStub<T>;542- jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace<T>;543-}544-type DurableObjectJurisdiction = "eu" | "fedramp" | "fedramp-high" | "us";545-interface DurableObjectNamespaceNewUniqueIdOptions {546- jurisdiction?: DurableObjectJurisdiction;547-}548-type DurableObjectLocationHint = "wnam" | "enam" | "sam" | "weur" | "eeur" | "apac" | "apac-ne" | "apac-se" | "oc" | "afr" | "me";549-type DurableObjectRoutingMode = "primary-only";550-interface DurableObjectNamespaceGetDurableObjectOptions {551- locationHint?: DurableObjectLocationHint;552- routingMode?: DurableObjectRoutingMode;553-}554-interface DurableObjectClass<_T extends Rpc.DurableObjectBranded | undefined = undefined> {555-}556-interface DurableObjectState<Props = unknown> {557- waitUntil(promise: Promise<any>): void;558- readonly exports: Cloudflare.Exports;559- readonly props: Props;560- readonly id: DurableObjectId;561- readonly storage: DurableObjectStorage;562- container?: Container;563- facets: DurableObjectFacets;564- blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;565- acceptWebSocket(ws: WebSocket, tags?: string[]): void;566- getWebSockets(tag?: string): WebSocket[];567- setWebSocketAutoResponse(maybeReqResp?: WebSocketRequestResponsePair): void;568- getWebSocketAutoResponse(): WebSocketRequestResponsePair | null;569- getWebSocketAutoResponseTimestamp(ws: WebSocket): Date | null;570- setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;571- getHibernatableWebSocketEventTimeout(): number | null;572- getTags(ws: WebSocket): string[];573- abort(reason?: string): void;574-}575-interface DurableObjectTransaction {576- get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T | undefined>;577- get<T = unknown>(keys: string[], options?: DurableObjectGetOptions): Promise<Map<string, T>>;578- list<T = unknown>(options?: DurableObjectListOptions): Promise<Map<string, T>>;579- put<T>(key: string, value: T, options?: DurableObjectPutOptions): Promise<void>;580- put<T>(entries: Record<string, T>, options?: DurableObjectPutOptions): Promise<void>;581- delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;582- delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;583- rollback(): void;584- getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;585- setAlarm(scheduledTime: number | Date, options?: DurableObjectSetAlarmOptions): Promise<void>;586- deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;587-}588-interface DurableObjectStorage {589- get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T | undefined>;590- get<T = unknown>(keys: string[], options?: DurableObjectGetOptions): Promise<Map<string, T>>;591- list<T = unknown>(options?: DurableObjectListOptions): Promise<Map<string, T>>;592- put<T>(key: string, value: T, options?: DurableObjectPutOptions): Promise<void>;593- put<T>(entries: Record<string, T>, options?: DurableObjectPutOptions): Promise<void>;594- delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;595- delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;596- deleteAll(options?: DurableObjectPutOptions): Promise<void>;597- transaction<T>(closure: (txn: DurableObjectTransaction) => Promise<T>): Promise<T>;598- getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;599- setAlarm(scheduledTime: number | Date, options?: DurableObjectSetAlarmOptions): Promise<void>;600- deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;601- sync(): Promise<void>;602- sql: SqlStorage;603- kv: SyncKvStorage;604- transactionSync<T>(closure: () => T): T;605- getCurrentBookmark(): Promise<string>;606- getBookmarkForTime(timestamp: number | Date): Promise<string>;607- onNextSessionRestoreBookmark(bookmark: string): Promise<string>;608-}609-interface DurableObjectListOptions {610- start?: string;611- startAfter?: string;612- end?: string;613- prefix?: string;614- reverse?: boolean;615- limit?: number;616- allowConcurrency?: boolean;617- noCache?: boolean;618-}619-interface DurableObjectGetOptions {620- allowConcurrency?: boolean;621- noCache?: boolean;622-}623-interface DurableObjectGetAlarmOptions {624- allowConcurrency?: boolean;625-}626-interface DurableObjectPutOptions {627- allowConcurrency?: boolean;628- allowUnconfirmed?: boolean;629- noCache?: boolean;630-}631-interface DurableObjectSetAlarmOptions {632- allowConcurrency?: boolean;633- allowUnconfirmed?: boolean;634-}635-declare class WebSocketRequestResponsePair {636- constructor(request: string, response: string);637- get request(): string;638- get response(): string;639-}640-interface DurableObjectFacets {641- get<T extends Rpc.DurableObjectBranded | undefined = undefined>(name: string, getStartupOptions: () => FacetStartupOptions<T> | Promise<FacetStartupOptions<T>>): Fetcher<T>;642- abort(name: string, reason: any): void;643- delete(name: string): void;644- clone(src: string, dst: string): void;645-}646-interface FacetStartupOptions<T extends Rpc.DurableObjectBranded | undefined = undefined> {647- id?: DurableObjectId | string;648- class: DurableObjectClass<T>;649-}650-interface AnalyticsEngineDataset {651- writeDataPoint(event?: AnalyticsEngineDataPoint): void;652-}653-interface AnalyticsEngineDataPoint {654- indexes?: ((ArrayBuffer | string) | null)[];655- doubles?: number[];656- blobs?: ((ArrayBuffer | string) | null)[];657-}658-/**659- * The **`Event`** interface represents an event which takes place on an `EventTarget`.660- *661- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event)662- */663-declare class Event {664- constructor(type: string, init?: EventInit);665- /**666- * The **`type`** read-only property of the Event interface returns a string containing the event's type.667- *668- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/type)669- */670- get type(): string;671- /**672- * The **`eventPhase`** read-only property of the being evaluated.673- *674- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/eventPhase)675- */676- get eventPhase(): number;677- /**678- * The read-only **`composed`** property of the or not the event will propagate across the shadow DOM boundary into the standard DOM.679- *680- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composed)681- */682- get composed(): boolean;683- /**684- * The **`bubbles`** read-only property of the Event interface indicates whether the event bubbles up through the DOM tree or not.685- *686- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/bubbles)687- */688- get bubbles(): boolean;689- /**690- * The **`cancelable`** read-only property of the Event interface indicates whether the event can be canceled, and therefore prevented as if the event never happened.691- *692- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelable)693- */694- get cancelable(): boolean;695- /**696- * The **`defaultPrevented`** read-only property of the Event interface returns a boolean value indicating whether or not the call to Event.preventDefault() canceled the event.697- *698- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/defaultPrevented)699- */700- get defaultPrevented(): boolean;701- /**702- * The Event property **`returnValue`** indicates whether the default action for this event has been prevented or not.703- * @deprecated704- *705- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/returnValue)706- */707- get returnValue(): boolean;708- /**709- * The **`currentTarget`** read-only property of the Event interface identifies the element to which the event handler has been attached.710- *711- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/currentTarget)712- */713- get currentTarget(): EventTarget | undefined;714- /**715- * The read-only **`target`** property of the dispatched.716- *717- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/target)718- */719- get target(): EventTarget | undefined;720- /**721- * The deprecated **`Event.srcElement`** is an alias for the Event.target property.722- * @deprecated723- *724- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/srcElement)725- */726- get srcElement(): EventTarget | undefined;727- /**728- * The **`timeStamp`** read-only property of the Event interface returns the time (in milliseconds) at which the event was created.729- *730- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/timeStamp)731- */732- get timeStamp(): number;733- /**734- * The **`isTrusted`** read-only property of the when the event was generated by the user agent (including via user actions and programmatic methods such as HTMLElement.focus()), and `false` when the event was dispatched via The only exception is the `click` event, which initializes the `isTrusted` property to `false` in user agents.735- *736- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/isTrusted)737- */738- get isTrusted(): boolean;739- /**740- * The **`cancelBubble`** property of the Event interface is deprecated.741- * @deprecated742- *743- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)744- */745- get cancelBubble(): boolean;746- /**747- * The **`cancelBubble`** property of the Event interface is deprecated.748- * @deprecated749- *750- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)751- */752- set cancelBubble(value: boolean);753- /**754- * The **`stopImmediatePropagation()`** method of the If several listeners are attached to the same element for the same event type, they are called in the order in which they were added.755- *756- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopImmediatePropagation)757- */758- stopImmediatePropagation(): void;759- /**760- * The **`preventDefault()`** method of the Event interface tells the user agent that if the event does not get explicitly handled, its default action should not be taken as it normally would be.761- *762- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/preventDefault)763- */764- preventDefault(): void;765- /**766- * The **`stopPropagation()`** method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.767- *768- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopPropagation)769- */770- stopPropagation(): void;771- /**772- * The **`composedPath()`** method of the Event interface returns the event's path which is an array of the objects on which listeners will be invoked.773- *774- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composedPath)775- */776- composedPath(): EventTarget[];777- static readonly NONE: number;778- static readonly CAPTURING_PHASE: number;779- static readonly AT_TARGET: number;780- static readonly BUBBLING_PHASE: number;781-}782-interface EventInit {783- bubbles?: boolean;784- cancelable?: boolean;785- composed?: boolean;786-}787-type EventListener<EventType extends Event = Event> = (event: EventType) => void;788-interface EventListenerObject<EventType extends Event = Event> {789- handleEvent(event: EventType): void;790-}791-type EventListenerOrEventListenerObject<EventType extends Event = Event> = EventListener<EventType> | EventListenerObject<EventType>;792-/**793- * The **`EventTarget`** interface is implemented by objects that can receive events and may have listeners for them.794- *795- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget)796- */797-declare class EventTarget<EventMap extends Record<string, Event> = Record<string, Event>> {798- constructor();799- /**800- * The **`addEventListener()`** method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.801- *802- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)803- */804- addEventListener<Type extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[Type]>, options?: EventTargetAddEventListenerOptions | boolean): void;805- /**806- * The **`removeEventListener()`** method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.807- *808- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)809- */810- removeEventListener<Type extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[Type]>, options?: EventTargetEventListenerOptions | boolean): void;811- /**812- * The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.813- *814- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)815- */816- dispatchEvent(event: EventMap[keyof EventMap]): boolean;817-}818-interface EventTargetEventListenerOptions {819- capture?: boolean;820-}821-interface EventTargetAddEventListenerOptions {822- capture?: boolean;823- passive?: boolean;824- once?: boolean;825- signal?: AbortSignal;826-}827-interface EventTargetHandlerObject {828- handleEvent: (event: Event) => any | undefined;829-}830-/**831- * The **`AbortController`** interface represents a controller object that allows you to abort one or more Web requests as and when desired.832- *833- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController)834- */835-declare class AbortController {836- constructor();837- /**838- * The **`signal`** read-only property of the AbortController interface returns an AbortSignal object instance, which can be used to communicate with/abort an asynchronous operation as desired.839- *840- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/signal)841- */842- get signal(): AbortSignal;843- /**844- * The **`abort()`** method of the AbortController interface aborts an asynchronous operation before it has completed.845- *846- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/abort)847- */848- abort(reason?: any): void;849-}850-/**851- * The **`AbortSignal`** interface represents a signal object that allows you to communicate with an asynchronous operation (such as a fetch request) and abort it if required via an AbortController object.852- *853- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal)854- */855-declare abstract class AbortSignal extends EventTarget {856- /**857- * The **`AbortSignal.abort()`** static method returns an AbortSignal that is already set as aborted (and which does not trigger an AbortSignal/abort_event event).858- *859- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_static)860- */861- static abort(reason?: any): AbortSignal;862- /**863- * The **`AbortSignal.timeout()`** static method returns an AbortSignal that will automatically abort after a specified time.864- *865- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/timeout_static)866- */867- static timeout(delay: number): AbortSignal;868- /**869- * The **`AbortSignal.any()`** static method takes an iterable of abort signals and returns an AbortSignal.870- *871- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/any_static)872- */873- static any(signals: AbortSignal[]): AbortSignal;874- /**875- * The **`aborted`** read-only property returns a value that indicates whether the asynchronous operations the signal is communicating with are aborted (`true`) or not (`false`).876- *877- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/aborted)878- */879- get aborted(): boolean;880- /**881- * The **`reason`** read-only property returns a JavaScript value that indicates the abort reason.882- *883- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/reason)884- */885- get reason(): any;886- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */887- get onabort(): any | null;888- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */889- set onabort(value: any | null);890- /**891- * The **`throwIfAborted()`** method throws the signal's abort AbortSignal.reason if the signal has been aborted; otherwise it does nothing.892- *893- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/throwIfAborted)894- */895- throwIfAborted(): void;896-}897-interface Scheduler {898- wait(delay: number, maybeOptions?: SchedulerWaitOptions): Promise<void>;899-}900-interface SchedulerWaitOptions {901- signal?: AbortSignal;902-}903-/**904- * The **`ExtendableEvent`** interface extends the lifetime of the `install` and `activate` events dispatched on the global scope as part of the service worker lifecycle.905- *906- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent)907- */908-declare abstract class ExtendableEvent extends Event {909- /**910- * The **`ExtendableEvent.waitUntil()`** method tells the event dispatcher that work is ongoing.911- *912- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent/waitUntil)913- */914- waitUntil(promise: Promise<any>): void;915-}916-/**917- * The **`CustomEvent`** interface represents events initialized by an application for any purpose.918- *919- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent)920- */921-declare class CustomEvent<T = any> extends Event {922- constructor(type: string, init?: CustomEventCustomEventInit);923- /**924- * The read-only **`detail`** property of the CustomEvent interface returns any data passed when initializing the event.925- *926- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent/detail)927- */928- get detail(): T;929-}930-interface CustomEventCustomEventInit {931- bubbles?: boolean;932- cancelable?: boolean;933- composed?: boolean;934- detail?: any;935-}936-/**937- * The **`Blob`** interface represents a blob, which is a file-like object of immutable, raw data; they can be read as text or binary data, or converted into a ReadableStream so its methods can be used for processing the data.938- *939- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob)940- */941-declare class Blob {942- constructor(bits?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[], options?: BlobOptions);943- /**944- * The **`size`** read-only property of the Blob interface returns the size of the Blob or File in bytes.945- *946- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size)947- */948- get size(): number;949- /**950- * The **`type`** read-only property of the Blob interface returns the MIME type of the file.951- *952- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type)953- */954- get type(): string;955- /**956- * The **`slice()`** method of the Blob interface creates and returns a new `Blob` object which contains data from a subset of the blob on which it's called.957- *958- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice)959- */960- slice(start?: number, end?: number, type?: string): Blob;961- /**962- * The **`arrayBuffer()`** method of the Blob interface returns a Promise that resolves with the contents of the blob as binary data contained in an ArrayBuffer.963- *964- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/arrayBuffer)965- */966- arrayBuffer(): Promise<ArrayBuffer>;967- /**968- * The **`bytes()`** method of the Blob interface returns a Promise that resolves with a Uint8Array containing the contents of the blob as an array of bytes.969- *970- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/bytes)971- */972- bytes(): Promise<Uint8Array>;973- /**974- * The **`text()`** method of the string containing the contents of the blob, interpreted as UTF-8.975- *976- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text)977- */978- text(): Promise<string>;979- /**980- * The **`stream()`** method of the Blob interface returns a ReadableStream which upon reading returns the data contained within the `Blob`.981- *982- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/stream)983- */984- stream(): ReadableStream;985-}986-interface BlobOptions {987- type?: string;988-}989-/**990- * The **`File`** interface provides information about files and allows JavaScript in a web page to access their content.991- *992- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File)993- */994-declare class File extends Blob {995- constructor(bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined, name: string, options?: FileOptions);996- /**997- * The **`name`** read-only property of the File interface returns the name of the file represented by a File object.998- *999- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name)1000- */1001- get name(): string;1002- /**1003- * The **`lastModified`** read-only property of the File interface provides the last modified date of the file as the number of milliseconds since the Unix epoch (January 1, 1970 at midnight).1004- *1005- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified)1006- */1007- get lastModified(): number;1008-}1009-interface FileOptions {1010- type?: string;1011- lastModified?: number;1012-}1013-/**1014-* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache.1015-*1016-* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/)1017-*/1018-declare abstract class CacheStorage {1019- /**1020- * The **`open()`** method of the the Cache object matching the `cacheName`.1021- *1022- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/open)1023- */1024- open(cacheName: string): Promise<Cache>;1025- readonly default: Cache;1026-}1027-/**1028-* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache.1029-*1030-* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/)1031-*/1032-declare abstract class Cache {1033- /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#delete) */1034- delete(request: RequestInfo | URL, options?: CacheQueryOptions): Promise<boolean>;1035- /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#match) */1036- match(request: RequestInfo | URL, options?: CacheQueryOptions): Promise<Response | undefined>;1037- /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#put) */1038- put(request: RequestInfo | URL, response: Response): Promise<void>;1039-}1040-interface CacheQueryOptions {1041- ignoreMethod?: boolean;1042-}1043-/**1044-* The Web Crypto API provides a set of low-level functions for common cryptographic tasks.1045-* The Workers runtime implements the full surface of this API, but with some differences in1046-* the [supported algorithms](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/#supported-algorithms)1047-* compared to those implemented in most browsers.1048-*1049-* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/)1050-*/1051-declare abstract class Crypto {1052- /**1053- * The **`Crypto.subtle`** read-only property returns a cryptographic operations.1054- * Available only in secure contexts.1055- *1056- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/subtle)1057- */1058- get subtle(): SubtleCrypto;1059- /**1060- * The **`Crypto.getRandomValues()`** method lets you get cryptographically strong random values.1061- *1062- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues)1063- */1064- getRandomValues<T extends Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | BigInt64Array | BigUint64Array>(buffer: T): T;1065- /**1066- * The **`randomUUID()`** method of the Crypto interface is used to generate a v4 UUID using a cryptographically secure random number generator.1067- * Available only in secure contexts.1068- *1069- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/randomUUID)1070- */1071- randomUUID(): string;1072- DigestStream: typeof DigestStream;1073-}1074-/**1075- * The **`SubtleCrypto`** interface of the Web Crypto API provides a number of low-level cryptographic functions.1076- * Available only in secure contexts.1077- *1078- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto)1079- */1080-declare abstract class SubtleCrypto {1081- /**1082- * The **`encrypt()`** method of the SubtleCrypto interface encrypts data.1083- *1084- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/encrypt)1085- */1086- encrypt(algorithm: string | SubtleCryptoEncryptAlgorithm, key: CryptoKey, plainText: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;1087- /**1088- * The **`decrypt()`** method of the SubtleCrypto interface decrypts some encrypted data.1089- *1090- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/decrypt)1091- */1092- decrypt(algorithm: string | SubtleCryptoEncryptAlgorithm, key: CryptoKey, cipherText: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;1093- /**1094- * The **`sign()`** method of the SubtleCrypto interface generates a digital signature.1095- *1096- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/sign)1097- */1098- sign(algorithm: string | SubtleCryptoSignAlgorithm, key: CryptoKey, data: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;1099- /**1100- * The **`verify()`** method of the SubtleCrypto interface verifies a digital signature.1101- *1102- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/verify)1103- */1104- verify(algorithm: string | SubtleCryptoSignAlgorithm, key: CryptoKey, signature: ArrayBuffer | ArrayBufferView, data: ArrayBuffer | ArrayBufferView): Promise<boolean>;1105- /**1106- * The **`digest()`** method of the SubtleCrypto interface generates a _digest_ of the given data, using the specified hash function.1107- *1108- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/digest)1109- */1110- digest(algorithm: string | SubtleCryptoHashAlgorithm, data: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;1111- /**1112- * The **`generateKey()`** method of the SubtleCrypto interface is used to generate a new key (for symmetric algorithms) or key pair (for public-key algorithms).1113- *1114- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/generateKey)1115- */1116- generateKey(algorithm: string | SubtleCryptoGenerateKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey | CryptoKeyPair>;1117- /**1118- * The **`deriveKey()`** method of the SubtleCrypto interface can be used to derive a secret key from a master key.1119- *1120- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveKey)1121- */1122- deriveKey(algorithm: string | SubtleCryptoDeriveKeyAlgorithm, baseKey: CryptoKey, derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;1123- /**1124- * The **`deriveBits()`** method of the key.1125- *1126- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveBits)1127- */1128- deriveBits(algorithm: string | SubtleCryptoDeriveKeyAlgorithm, baseKey: CryptoKey, length?: number | null): Promise<ArrayBuffer>;1129- /**1130- * The **`importKey()`** method of the SubtleCrypto interface imports a key: that is, it takes as input a key in an external, portable format and gives you a CryptoKey object that you can use in the Web Crypto API.1131- *1132- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/importKey)1133- */1134- importKey(format: string, keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey, algorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;1135- /**1136- * The **`exportKey()`** method of the SubtleCrypto interface exports a key: that is, it takes as input a CryptoKey object and gives you the key in an external, portable format.1137- *1138- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/exportKey)1139- */1140- exportKey(format: string, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;1141- /**1142- * The **`wrapKey()`** method of the SubtleCrypto interface 'wraps' a key.1143- *1144- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/wrapKey)1145- */1146- wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm): Promise<ArrayBuffer>;1147- /**1148- * The **`unwrapKey()`** method of the SubtleCrypto interface 'unwraps' a key.1149- *1150- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/unwrapKey)1151- */1152- unwrapKey(format: string, wrappedKey: ArrayBuffer | ArrayBufferView, unwrappingKey: CryptoKey, unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm, unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;1153- timingSafeEqual(a: ArrayBuffer | ArrayBufferView, b: ArrayBuffer | ArrayBufferView): boolean;1154-}1155-/**1156- * The **`CryptoKey`** interface of the Web Crypto API represents a cryptographic key obtained from one of the SubtleCrypto methods SubtleCrypto.generateKey, SubtleCrypto.deriveKey, SubtleCrypto.importKey, or SubtleCrypto.unwrapKey.1157- * Available only in secure contexts.1158- *1159- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey)1160- */1161-declare abstract class CryptoKey {1162- /**1163- * The read-only **`type`** property of the CryptoKey interface indicates which kind of key is represented by the object.1164- *1165- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/type)1166- */1167- readonly type: string;1168- /**1169- * The read-only **`extractable`** property of the CryptoKey interface indicates whether or not the key may be extracted using `SubtleCrypto.exportKey()` or `SubtleCrypto.wrapKey()`.1170- *1171- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/extractable)1172- */1173- readonly extractable: boolean;1174- /**1175- * The read-only **`algorithm`** property of the CryptoKey interface returns an object describing the algorithm for which this key can be used, and any associated extra parameters.1176- *1177- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/algorithm)1178- */1179- readonly algorithm: CryptoKeyKeyAlgorithm | CryptoKeyAesKeyAlgorithm | CryptoKeyHmacKeyAlgorithm | CryptoKeyRsaKeyAlgorithm | CryptoKeyEllipticKeyAlgorithm | CryptoKeyArbitraryKeyAlgorithm;1180- /**1181- * The read-only **`usages`** property of the CryptoKey interface indicates what can be done with the key.1182- *1183- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/usages)1184- */1185- readonly usages: string[];1186-}1187-interface CryptoKeyPair {1188- publicKey: CryptoKey;1189- privateKey: CryptoKey;1190-}1191-interface JsonWebKey {1192- kty: string;1193- use?: string;1194- key_ops?: string[];1195- alg?: string;1196- ext?: boolean;1197- crv?: string;1198- x?: string;1199- y?: string;1200- d?: string;1201- n?: string;1202- e?: string;1203- p?: string;1204- q?: string;1205- dp?: string;1206- dq?: string;1207- qi?: string;1208- oth?: RsaOtherPrimesInfo[];1209- k?: string;1210-}1211-interface RsaOtherPrimesInfo {1212- r?: string;1213- d?: string;1214- t?: string;1215-}1216-interface SubtleCryptoDeriveKeyAlgorithm {1217- name: string;1218- salt?: (ArrayBuffer | ArrayBufferView);1219- iterations?: number;1220- hash?: (string | SubtleCryptoHashAlgorithm);1221- $public?: CryptoKey;1222- info?: (ArrayBuffer | ArrayBufferView);1223-}1224-interface SubtleCryptoEncryptAlgorithm {1225- name: string;1226- iv?: (ArrayBuffer | ArrayBufferView);1227- additionalData?: (ArrayBuffer | ArrayBufferView);1228- tagLength?: number;1229- counter?: (ArrayBuffer | ArrayBufferView);1230- length?: number;1231- label?: (ArrayBuffer | ArrayBufferView);1232-}1233-interface SubtleCryptoGenerateKeyAlgorithm {1234- name: string;1235- hash?: (string | SubtleCryptoHashAlgorithm);1236- modulusLength?: number;1237- publicExponent?: (ArrayBuffer | ArrayBufferView);1238- length?: number;1239- namedCurve?: string;1240-}1241-interface SubtleCryptoHashAlgorithm {1242- name: string;1243-}1244-interface SubtleCryptoImportKeyAlgorithm {1245- name: string;1246- hash?: (string | SubtleCryptoHashAlgorithm);1247- length?: number;1248- namedCurve?: string;1249- compressed?: boolean;1250-}1251-interface SubtleCryptoSignAlgorithm {1252- name: string;1253- hash?: (string | SubtleCryptoHashAlgorithm);1254- dataLength?: number;1255- saltLength?: number;1256-}1257-interface CryptoKeyKeyAlgorithm {1258- name: string;1259-}1260-interface CryptoKeyAesKeyAlgorithm {1261- name: string;1262- length: number;1263-}1264-interface CryptoKeyHmacKeyAlgorithm {1265- name: string;1266- hash: CryptoKeyKeyAlgorithm;1267- length: number;1268-}1269-interface CryptoKeyRsaKeyAlgorithm {1270- name: string;1271- modulusLength: number;1272- publicExponent: ArrayBuffer | ArrayBufferView;1273- hash?: CryptoKeyKeyAlgorithm;1274-}1275-interface CryptoKeyEllipticKeyAlgorithm {1276- name: string;1277- namedCurve: string;1278-}1279-interface CryptoKeyArbitraryKeyAlgorithm {1280- name: string;1281- hash?: CryptoKeyKeyAlgorithm;1282- namedCurve?: string;1283- length?: number;1284-}1285-declare class DigestStream extends WritableStream<ArrayBuffer | ArrayBufferView> {1286- constructor(algorithm: string | SubtleCryptoHashAlgorithm);1287- readonly digest: Promise<ArrayBuffer>;1288- get bytesWritten(): number | bigint;1289-}1290-/**1291- * The **`TextDecoder`** interface represents a decoder for a specific text encoding, such as `UTF-8`, `ISO-8859-2`, `KOI8-R`, `GBK`, etc.1292- *1293- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder)1294- */1295-declare class TextDecoder {1296- constructor(label?: string, options?: TextDecoderConstructorOptions);1297- /**1298- * The **`TextDecoder.decode()`** method returns a string containing text decoded from the buffer passed as a parameter.1299- *1300- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder/decode)1301- */1302- decode(input?: (ArrayBuffer | ArrayBufferView), options?: TextDecoderDecodeOptions): string;1303- get encoding(): string;1304- get fatal(): boolean;1305- get ignoreBOM(): boolean;1306-}1307-/**1308- * The **`TextEncoder`** interface takes a stream of code points as input and emits a stream of UTF-8 bytes.1309- *1310- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder)1311- */1312-declare class TextEncoder {1313- constructor();1314- /**1315- * The **`TextEncoder.encode()`** method takes a string as input, and returns a Global_Objects/Uint8Array containing the text given in parameters encoded with the specific method for that TextEncoder object.1316- *1317- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encode)1318- */1319- encode(input?: string): Uint8Array;1320- /**1321- * The **`TextEncoder.encodeInto()`** method takes a string to encode and a destination Uint8Array to put resulting UTF-8 encoded text into, and returns a dictionary object indicating the progress of the encoding.1322- *1323- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encodeInto)1324- */1325- encodeInto(input: string, buffer: Uint8Array): TextEncoderEncodeIntoResult;1326- get encoding(): string;1327-}1328-interface TextDecoderConstructorOptions {1329- fatal: boolean;1330- ignoreBOM: boolean;1331-}1332-interface TextDecoderDecodeOptions {1333- stream: boolean;1334-}1335-interface TextEncoderEncodeIntoResult {1336- read: number;1337- written: number;1338-}1339-/**1340- * The **`ErrorEvent`** interface represents events providing information related to errors in scripts or in files.1341- *1342- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent)1343- */1344-declare class ErrorEvent extends Event {1345- constructor(type: string, init?: ErrorEventErrorEventInit);1346- /**1347- * The **`filename`** read-only property of the ErrorEvent interface returns a string containing the name of the script file in which the error occurred.1348- *1349- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/filename)1350- */1351- get filename(): string;1352- /**1353- * The **`message`** read-only property of the ErrorEvent interface returns a string containing a human-readable error message describing the problem.1354- *1355- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/message)1356- */1357- get message(): string;1358- /**1359- * The **`lineno`** read-only property of the ErrorEvent interface returns an integer containing the line number of the script file on which the error occurred.1360- *1361- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/lineno)1362- */1363- get lineno(): number;1364- /**1365- * The **`colno`** read-only property of the ErrorEvent interface returns an integer containing the column number of the script file on which the error occurred.1366- *1367- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/colno)1368- */1369- get colno(): number;1370- /**1371- * The **`error`** read-only property of the ErrorEvent interface returns a JavaScript value, such as an Error or DOMException, representing the error associated with this event.1372- *1373- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/error)1374- */1375- get error(): any;1376-}1377-interface ErrorEventErrorEventInit {1378- message?: string;1379- filename?: string;1380- lineno?: number;1381- colno?: number;1382- error?: any;1383-}1384-/**1385- * The **`MessageEvent`** interface represents a message received by a target object.1386- *1387- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent)1388- */1389-declare class MessageEvent extends Event {1390- constructor(type: string, initializer: MessageEventInit);1391- /**1392- * The **`data`** read-only property of the The data sent by the message emitter; this can be any data type, depending on what originated this event.1393- *1394- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/data)1395- */1396- readonly data: any;1397- /**1398- * The **`origin`** read-only property of the origin of the message emitter.1399- *1400- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/origin)1401- */1402- readonly origin: string | null;1403- /**1404- * The **`lastEventId`** read-only property of the unique ID for the event.1405- *1406- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/lastEventId)1407- */1408- readonly lastEventId: string;1409- /**1410- * The **`source`** read-only property of the a WindowProxy, MessagePort, or a `MessageEventSource` (which can be a WindowProxy, message emitter.1411- *1412- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/source)1413- */1414- readonly source: MessagePort | null;1415- /**1416- * The **`ports`** read-only property of the containing all MessagePort objects sent with the message, in order.1417- *1418- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/ports)1419- */1420- readonly ports: MessagePort[];1421-}1422-interface MessageEventInit {1423- data: ArrayBuffer | string;1424-}1425-/**1426- * The **`PromiseRejectionEvent`** interface represents events which are sent to the global script context when JavaScript Promises are rejected.1427- *1428- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent)1429- */1430-declare abstract class PromiseRejectionEvent extends Event {1431- /**1432- * The PromiseRejectionEvent interface's **`promise`** read-only property indicates the JavaScript rejected.1433- *1434- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/promise)1435- */1436- readonly promise: Promise<any>;1437- /**1438- * The PromiseRejectionEvent **`reason`** read-only property is any JavaScript value or Object which provides the reason passed into Promise.reject().1439- *1440- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/reason)1441- */1442- readonly reason: any;1443-}1444-/**1445- * The **`FormData`** interface provides a way to construct a set of key/value pairs representing form fields and their values, which can be sent using the Window/fetch, XMLHttpRequest.send() or navigator.sendBeacon() methods.1446- *1447- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData)1448- */1449-declare class FormData {1450- constructor();1451- /**1452- * The **`append()`** method of the FormData interface appends a new value onto an existing key inside a `FormData` object, or adds the key if it does not already exist.1453- *1454- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append)1455- */1456- append(name: string, value: string | Blob): void;1457- /**1458- * The **`append()`** method of the FormData interface appends a new value onto an existing key inside a `FormData` object, or adds the key if it does not already exist.1459- *1460- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append)1461- */1462- append(name: string, value: string): void;1463- /**1464- * The **`append()`** method of the FormData interface appends a new value onto an existing key inside a `FormData` object, or adds the key if it does not already exist.1465- *1466- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append)1467- */1468- append(name: string, value: Blob, filename?: string): void;1469- /**1470- * The **`delete()`** method of the FormData interface deletes a key and its value(s) from a `FormData` object.1471- *1472- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/delete)1473- */1474- delete(name: string): void;1475- /**1476- * The **`get()`** method of the FormData interface returns the first value associated with a given key from within a `FormData` object.1477- *1478- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/get)1479- */1480- get(name: string): (File | string) | null;1481- /**1482- * The **`getAll()`** method of the FormData interface returns all the values associated with a given key from within a `FormData` object.1483- *1484- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/getAll)1485- */1486- getAll(name: string): (File | string)[];1487- /**1488- * The **`has()`** method of the FormData interface returns whether a `FormData` object contains a certain key.1489- *1490- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/has)1491- */1492- has(name: string): boolean;1493- /**1494- * The **`set()`** method of the FormData interface sets a new value for an existing key inside a `FormData` object, or adds the key/value if it does not already exist.1495- *1496- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set)1497- */1498- set(name: string, value: string | Blob): void;1499- /**1500- * The **`set()`** method of the FormData interface sets a new value for an existing key inside a `FormData` object, or adds the key/value if it does not already exist.1501- *1502- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set)1503- */1504- set(name: string, value: string): void;1505- /**1506- * The **`set()`** method of the FormData interface sets a new value for an existing key inside a `FormData` object, or adds the key/value if it does not already exist.1507- *1508- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set)1509- */1510- set(name: string, value: Blob, filename?: string): void;1511- /* Returns an array of key, value pairs for every entry in the list. */1512- entries(): IterableIterator<[1513- key: string,1514- value: File | string1515- ]>;1516- /* Returns a list of keys in the list. */1517- keys(): IterableIterator<string>;1518- /* Returns a list of values in the list. */1519- values(): IterableIterator<(File | string)>;1520- forEach<This = unknown>(callback: (this: This, value: File | string, key: string, parent: FormData) => void, thisArg?: This): void;1521- [Symbol.iterator](): IterableIterator<[1522- key: string,1523- value: File | string1524- ]>;1525-}1526-interface ContentOptions {1527- html?: boolean;1528-}1529-declare class HTMLRewriter {1530- constructor();1531- on(selector: string, handlers: HTMLRewriterElementContentHandlers): HTMLRewriter;1532- onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter;1533- transform(response: Response): Response;1534-}1535-interface HTMLRewriterElementContentHandlers {1536- element?(element: Element): void | Promise<void>;1537- comments?(comment: Comment): void | Promise<void>;1538- text?(element: Text): void | Promise<void>;1539-}1540-interface HTMLRewriterDocumentContentHandlers {1541- doctype?(doctype: Doctype): void | Promise<void>;1542- comments?(comment: Comment): void | Promise<void>;1543- text?(text: Text): void | Promise<void>;1544- end?(end: DocumentEnd): void | Promise<void>;1545-}1546-interface Doctype {1547- readonly name: string | null;1548- readonly publicId: string | null;1549- readonly systemId: string | null;1550-}1551-interface Element {1552- tagName: string;1553- readonly attributes: IterableIterator<string[]>;1554- readonly removed: boolean;1555- readonly namespaceURI: string;1556- getAttribute(name: string): string | null;1557- hasAttribute(name: string): boolean;1558- setAttribute(name: string, value: string): Element;1559- removeAttribute(name: string): Element;1560- before(content: string | ReadableStream | Response, options?: ContentOptions): Element;1561- after(content: string | ReadableStream | Response, options?: ContentOptions): Element;1562- prepend(content: string | ReadableStream | Response, options?: ContentOptions): Element;1563- append(content: string | ReadableStream | Response, options?: ContentOptions): Element;1564- replace(content: string | ReadableStream | Response, options?: ContentOptions): Element;1565- remove(): Element;1566- removeAndKeepContent(): Element;1567- setInnerContent(content: string | ReadableStream | Response, options?: ContentOptions): Element;1568- onEndTag(handler: (tag: EndTag) => void | Promise<void>): void;1569-}1570-interface EndTag {1571- name: string;1572- before(content: string | ReadableStream | Response, options?: ContentOptions): EndTag;1573- after(content: string | ReadableStream | Response, options?: ContentOptions): EndTag;1574- remove(): EndTag;1575-}1576-interface Comment {1577- text: string;1578- readonly removed: boolean;1579- before(content: string, options?: ContentOptions): Comment;1580- after(content: string, options?: ContentOptions): Comment;1581- replace(content: string, options?: ContentOptions): Comment;1582- remove(): Comment;1583-}1584-interface Text {1585- readonly text: string;1586- readonly lastInTextNode: boolean;1587- readonly removed: boolean;1588- before(content: string | ReadableStream | Response, options?: ContentOptions): Text;1589- after(content: string | ReadableStream | Response, options?: ContentOptions): Text;1590- replace(content: string | ReadableStream | Response, options?: ContentOptions): Text;1591- remove(): Text;1592-}1593-interface DocumentEnd {1594- append(content: string, options?: ContentOptions): DocumentEnd;1595-}1596-/**1597- * This is the event type for `fetch` events dispatched on the ServiceWorkerGlobalScope.1598- *1599- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent)1600- */1601-declare abstract class FetchEvent extends ExtendableEvent {1602- /**1603- * The **`request`** read-only property of the the event handler.1604- *1605- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/request)1606- */1607- readonly request: Request;1608- /**1609- * The **`respondWith()`** method of allows you to provide a promise for a Response yourself.1610- *1611- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/respondWith)1612- */1613- respondWith(promise: Response | Promise<Response>): void;1614- passThroughOnException(): void;1615-}1616-type HeadersInit = Headers | Iterable<Iterable<string>> | Record<string, string>;1617-/**1618- * The **`Headers`** interface of the Fetch API allows you to perform various actions on HTTP request and response headers.1619- *1620- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers)1621- */1622-declare class Headers {1623- constructor(init?: HeadersInit);1624- /**1625- * The **`get()`** method of the Headers interface returns a byte string of all the values of a header within a `Headers` object with a given name.1626- *1627- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/get)1628- */1629- get(name: string): string | null;1630- getAll(name: string): string[];1631- /**1632- * The **`getSetCookie()`** method of the Headers interface returns an array containing the values of all Set-Cookie headers associated with a response.1633- *1634- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/getSetCookie)1635- */1636- getSetCookie(): string[];1637- /**1638- * The **`has()`** method of the Headers interface returns a boolean stating whether a `Headers` object contains a certain header.1639- *1640- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/has)1641- */1642- has(name: string): boolean;1643- /**1644- * The **`set()`** method of the Headers interface sets a new value for an existing header inside a `Headers` object, or adds the header if it does not already exist.1645- *1646- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/set)1647- */1648- set(name: string, value: string): void;1649- /**1650- * The **`append()`** method of the Headers interface appends a new value onto an existing header inside a `Headers` object, or adds the header if it does not already exist.1651- *1652- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/append)1653- */1654- append(name: string, value: string): void;1655- /**1656- * The **`delete()`** method of the Headers interface deletes a header from the current `Headers` object.1657- *1658- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/delete)1659- */1660- delete(name: string): void;1661- forEach<This = unknown>(callback: (this: This, value: string, key: string, parent: Headers) => void, thisArg?: This): void;1662- /* Returns an iterator allowing to go through all key/value pairs contained in this object. */1663- entries(): IterableIterator<[1664- key: string,1665- value: string1666- ]>;1667- /* Returns an iterator allowing to go through all keys of the key/value pairs contained in this object. */1668- keys(): IterableIterator<string>;1669- /* Returns an iterator allowing to go through all values of the key/value pairs contained in this object. */1670- values(): IterableIterator<string>;1671- [Symbol.iterator](): IterableIterator<[1672- key: string,1673- value: string1674- ]>;1675-}1676-type BodyInit = ReadableStream<Uint8Array> | string | ArrayBuffer | ArrayBufferView | Blob | URLSearchParams | FormData | Iterable<ArrayBuffer | ArrayBufferView> | AsyncIterable<ArrayBuffer | ArrayBufferView>;1677-declare abstract class Body {1678- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/body) */1679- get body(): ReadableStream | null;1680- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bodyUsed) */1681- get bodyUsed(): boolean;1682- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/arrayBuffer) */1683- arrayBuffer(): Promise<ArrayBuffer>;1684- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bytes) */1685- bytes(): Promise<Uint8Array>;1686- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/text) */1687- text(): Promise<string>;1688- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/json) */1689- json<T>(): Promise<T>;1690- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/formData) */1691- formData(): Promise<FormData>;1692- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/blob) */1693- blob(): Promise<Blob>;1694-}1695-/**1696- * The **`Response`** interface of the Fetch API represents the response to a request.1697- *1698- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)1699- */1700-declare var Response: {1701- prototype: Response;1702- new (body?: BodyInit | null, init?: ResponseInit): Response;1703- error(): Response;1704- redirect(url: string, status?: number): Response;1705- json(any: any, maybeInit?: (ResponseInit | Response)): Response;1706-};1707-/**1708- * The **`Response`** interface of the Fetch API represents the response to a request.1709- *1710- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)1711- */1712-interface Response extends Body {1713- /**1714- * The **`clone()`** method of the Response interface creates a clone of a response object, identical in every way, but stored in a different variable.1715- *1716- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/clone)1717- */1718- clone(): Response;1719- /**1720- * The **`status`** read-only property of the Response interface contains the HTTP status codes of the response.1721- *1722- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/status)1723- */1724- status: number;1725- /**1726- * The **`statusText`** read-only property of the Response interface contains the status message corresponding to the HTTP status code in Response.status.1727- *1728- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/statusText)1729- */1730- statusText: string;1731- /**1732- * The **`headers`** read-only property of the with the response.1733- *1734- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/headers)1735- */1736- headers: Headers;1737- /**1738- * The **`ok`** read-only property of the Response interface contains a Boolean stating whether the response was successful (status in the range 200-299) or not.1739- *1740- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/ok)1741- */1742- ok: boolean;1743- /**1744- * The **`redirected`** read-only property of the Response interface indicates whether or not the response is the result of a request you made which was redirected.1745- *1746- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirected)1747- */1748- redirected: boolean;1749- /**1750- * The **`url`** read-only property of the Response interface contains the URL of the response.1751- *1752- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/url)1753- */1754- url: string;1755- webSocket: WebSocket | null;1756- cf: any | undefined;1757- /**1758- * The **`type`** read-only property of the Response interface contains the type of the response.1759- *1760- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/type)1761- */1762- type: "default" | "error";1763-}1764-interface ResponseInit {1765- status?: number;1766- statusText?: string;1767- headers?: HeadersInit;1768- cf?: any;1769- webSocket?: (WebSocket | null);1770- encodeBody?: "automatic" | "manual";1771-}1772-type RequestInfo<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> = Request<CfHostMetadata, Cf> | string;1773-/**1774- * The **`Request`** interface of the Fetch API represents a resource request.1775- *1776- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request)1777- */1778-declare var Request: {1779- prototype: Request;1780- new <CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>>(input: RequestInfo<CfProperties> | URL, init?: RequestInit<Cf>): Request<CfHostMetadata, Cf>;1781-};1782-/**1783- * The **`Request`** interface of the Fetch API represents a resource request.1784- *1785- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request)1786- */1787-interface Request<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> extends Body {1788- /**1789- * The **`clone()`** method of the Request interface creates a copy of the current `Request` object.1790- *1791- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/clone)1792- */1793- clone(): Request<CfHostMetadata, Cf>;1794- /**1795- * The **`method`** read-only property of the `POST`, etc.) A String indicating the method of the request.1796- *1797- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/method)1798- */1799- method: string;1800- /**1801- * The **`url`** read-only property of the Request interface contains the URL of the request.1802- *1803- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/url)1804- */1805- url: string;1806- /**1807- * The **`headers`** read-only property of the with the request.1808- *1809- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/headers)1810- */1811- headers: Headers;1812- /**1813- * The **`redirect`** read-only property of the Request interface contains the mode for how redirects are handled.1814- *1815- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/redirect)1816- */1817- redirect: string;1818- fetcher: Fetcher | null;1819- /**1820- * The read-only **`signal`** property of the Request interface returns the AbortSignal associated with the request.1821- *1822- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/signal)1823- */1824- signal: AbortSignal;1825- cf?: Cf;1826- /**1827- * The **`integrity`** read-only property of the Request interface contains the subresource integrity value of the request.1828- *1829- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/integrity)1830- */1831- integrity: string;1832- /**1833- * The **`keepalive`** read-only property of the Request interface contains the request's `keepalive` setting (`true` or `false`), which indicates whether the browser will keep the associated request alive if the page that initiated it is unloaded before the request is complete.1834- *1835- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/keepalive)1836- */1837- keepalive: boolean;1838- /**1839- * The **`cache`** read-only property of the Request interface contains the cache mode of the request.1840- *1841- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/cache)1842- */1843- cache?: "no-store" | "no-cache";1844-}1845-interface RequestInit<Cf = CfProperties> {1846- /* A string to set request's method. */1847- method?: string;1848- /* A Headers object, an object literal, or an array of two-item arrays to set request's headers. */1849- headers?: HeadersInit;1850- /* A BodyInit object or null to set request's body. */1851- body?: BodyInit | null;1852- /* 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. */1853- redirect?: string;1854- fetcher?: (Fetcher | null);1855- cf?: Cf;1856- /* A string indicating how the request will interact with the browser's cache to set request's cache. */1857- cache?: "no-store" | "no-cache";1858- /* A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */1859- integrity?: string;1860- /* An AbortSignal to set request's signal. */1861- signal?: (AbortSignal | null);1862- encodeResponseBody?: "automatic" | "manual";1863-}1864-type Service<T extends (new (...args: any[]) => Rpc.WorkerEntrypointBranded) | Rpc.WorkerEntrypointBranded | ExportedHandler<any, any, any> | undefined = undefined> = T extends new (...args: any[]) => Rpc.WorkerEntrypointBranded ? Fetcher<InstanceType<T>> : T extends Rpc.WorkerEntrypointBranded ? Fetcher<T> : T extends Exclude<Rpc.EntrypointBranded, Rpc.WorkerEntrypointBranded> ? never : Fetcher<undefined>;1865-type Fetcher<T extends Rpc.EntrypointBranded | undefined = undefined, Reserved extends string = never> = (T extends Rpc.EntrypointBranded ? Rpc.Provider<T, Reserved | "fetch" | "connect"> : unknown) & {1866- fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;1867- connect(address: SocketAddress | string, options?: SocketOptions): Socket;1868-};1869-interface KVNamespaceListKey<Metadata, Key extends string = string> {1870- name: Key;1871- expiration?: number;1872- metadata?: Metadata;1873-}1874-type KVNamespaceListResult<Metadata, Key extends string = string> = {1875- list_complete: false;1876- keys: KVNamespaceListKey<Metadata, Key>[];1877- cursor: string;1878- cacheStatus: string | null;1879-} | {1880- list_complete: true;1881- keys: KVNamespaceListKey<Metadata, Key>[];1882- cacheStatus: string | null;1883-};1884-interface KVNamespace<Key extends string = string> {1885- get(key: Key, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<string | null>;1886- get(key: Key, type: "text"): Promise<string | null>;1887- get<ExpectedValue = unknown>(key: Key, type: "json"): Promise<ExpectedValue | null>;1888- get(key: Key, type: "arrayBuffer"): Promise<ArrayBuffer | null>;1889- get(key: Key, type: "stream"): Promise<ReadableStream | null>;1890- get(key: Key, options?: KVNamespaceGetOptions<"text">): Promise<string | null>;1891- get<ExpectedValue = unknown>(key: Key, options?: KVNamespaceGetOptions<"json">): Promise<ExpectedValue | null>;1892- get(key: Key, options?: KVNamespaceGetOptions<"arrayBuffer">): Promise<ArrayBuffer | null>;1893- get(key: Key, options?: KVNamespaceGetOptions<"stream">): Promise<ReadableStream | null>;1894- get(key: Array<Key>, type: "text"): Promise<Map<string, string | null>>;1895- get<ExpectedValue = unknown>(key: Array<Key>, type: "json"): Promise<Map<string, ExpectedValue | null>>;1896- get(key: Array<Key>, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<Map<string, string | null>>;1897- get(key: Array<Key>, options?: KVNamespaceGetOptions<"text">): Promise<Map<string, string | null>>;1898- get<ExpectedValue = unknown>(key: Array<Key>, options?: KVNamespaceGetOptions<"json">): Promise<Map<string, ExpectedValue | null>>;1899- list<Metadata = unknown>(options?: KVNamespaceListOptions): Promise<KVNamespaceListResult<Metadata, Key>>;1900- put(key: Key, value: string | ArrayBuffer | ArrayBufferView | ReadableStream, options?: KVNamespacePutOptions): Promise<void>;1901- getWithMetadata<Metadata = unknown>(key: Key, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;1902- getWithMetadata<Metadata = unknown>(key: Key, type: "text"): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;1903- getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Key, type: "json"): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;1904- getWithMetadata<Metadata = unknown>(key: Key, type: "arrayBuffer"): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;1905- getWithMetadata<Metadata = unknown>(key: Key, type: "stream"): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;1906- getWithMetadata<Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<"text">): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;1907- getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<"json">): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;1908- getWithMetadata<Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<"arrayBuffer">): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;1909- getWithMetadata<Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<"stream">): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;1910- getWithMetadata<Metadata = unknown>(key: Array<Key>, type: "text"): Promise<Map<string, KVNamespaceGetWithMetadataResult<string, Metadata>>>;1911- getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Array<Key>, type: "json"): Promise<Map<string, KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>>;1912- getWithMetadata<Metadata = unknown>(key: Array<Key>, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<Map<string, KVNamespaceGetWithMetadataResult<string, Metadata>>>;1913- getWithMetadata<Metadata = unknown>(key: Array<Key>, options?: KVNamespaceGetOptions<"text">): Promise<Map<string, KVNamespaceGetWithMetadataResult<string, Metadata>>>;1914- getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Array<Key>, options?: KVNamespaceGetOptions<"json">): Promise<Map<string, KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>>;1915- delete(key: Key): Promise<void>;1916-}1917-interface KVNamespaceListOptions {1918- limit?: number;1919- prefix?: (string | null);1920- cursor?: (string | null);1921-}1922-interface KVNamespaceGetOptions<Type> {1923- type: Type;1924- cacheTtl?: number;1925-}1926-interface KVNamespacePutOptions {1927- expiration?: number;1928- expirationTtl?: number;1929- metadata?: (any | null);1930-}1931-interface KVNamespaceGetWithMetadataResult<Value, Metadata> {1932- value: Value | null;1933- metadata: Metadata | null;1934- cacheStatus: string | null;1935-}1936-type QueueContentType = "text" | "bytes" | "json" | "v8";1937-interface Queue<Body = unknown> {1938- metrics(): Promise<QueueMetrics>;1939- send(message: Body, options?: QueueSendOptions): Promise<QueueSendResponse>;1940- sendBatch(messages: Iterable<MessageSendRequest<Body>>, options?: QueueSendBatchOptions): Promise<QueueSendBatchResponse>;1941-}1942-interface QueueSendMetrics {1943- backlogCount: number;1944- backlogBytes: number;1945- oldestMessageTimestamp?: Date;1946-}1947-interface QueueSendMetadata {1948- metrics: QueueSendMetrics;1949-}1950-interface QueueSendResponse {1951- metadata: QueueSendMetadata;1952-}1953-interface QueueSendBatchMetrics {1954- backlogCount: number;1955- backlogBytes: number;1956- oldestMessageTimestamp?: Date;1957-}1958-interface QueueSendBatchMetadata {1959- metrics: QueueSendBatchMetrics;1960-}1961-interface QueueSendBatchResponse {1962- metadata: QueueSendBatchMetadata;1963-}1964-interface QueueSendOptions {1965- contentType?: QueueContentType;1966- delaySeconds?: number;1967-}1968-interface QueueSendBatchOptions {1969- delaySeconds?: number;1970-}1971-interface MessageSendRequest<Body = unknown> {1972- body: Body;1973- contentType?: QueueContentType;1974- delaySeconds?: number;1975-}1976-interface QueueMetrics {1977- backlogCount: number;1978- backlogBytes: number;1979- oldestMessageTimestamp?: Date;1980-}1981-interface MessageBatchMetrics {1982- backlogCount: number;1983- backlogBytes: number;1984- oldestMessageTimestamp?: Date;1985-}1986-interface MessageBatchMetadata {1987- metrics: MessageBatchMetrics;1988-}1989-interface QueueRetryOptions {1990- delaySeconds?: number;1991-}1992-interface Message<Body = unknown> {1993- readonly id: string;1994- readonly timestamp: Date;1995- readonly body: Body;1996- readonly attempts: number;1997- retry(options?: QueueRetryOptions): void;1998- ack(): void;1999-}2000-interface QueueEvent<Body = unknown> extends ExtendableEvent {2001- readonly messages: readonly Message<Body>[];2002- readonly queue: string;2003- readonly metadata: MessageBatchMetadata;2004- retryAll(options?: QueueRetryOptions): void;2005- ackAll(): void;2006-}2007-interface MessageBatch<Body = unknown> {2008- readonly messages: readonly Message<Body>[];2009- readonly queue: string;2010- readonly metadata: MessageBatchMetadata;2011- retryAll(options?: QueueRetryOptions): void;2012- ackAll(): void;2013-}2014-interface R2Error extends Error {2015- readonly name: string;2016- readonly code: number;2017- readonly message: string;2018- readonly action: string;2019- readonly stack: any;2020-}2021-interface R2ListOptions {2022- limit?: number;2023- prefix?: string;2024- cursor?: string;2025- delimiter?: string;2026- startAfter?: string;2027- include?: ("httpMetadata" | "customMetadata")[];2028-}2029-interface R2Bucket {2030- head(key: string): Promise<R2Object | null>;2031- get(key: string, options: R2GetOptions & {2032- onlyIf: R2Conditional | Headers;2033- }): Promise<R2ObjectBody | R2Object | null>;2034- get(key: string, options?: R2GetOptions): Promise<R2ObjectBody | null>;2035- put(key: string, value: ReadableStream | ArrayBuffer | ArrayBufferView | string | null | Blob, options?: R2PutOptions & {2036- onlyIf: R2Conditional | Headers;2037- }): Promise<R2Object | null>;2038- put(key: string, value: ReadableStream | ArrayBuffer | ArrayBufferView | string | null | Blob, options?: R2PutOptions): Promise<R2Object>;2039- createMultipartUpload(key: string, options?: R2MultipartOptions): Promise<R2MultipartUpload>;2040- resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload;2041- delete(keys: string | string[]): Promise<void>;2042- list(options?: R2ListOptions): Promise<R2Objects>;2043-}2044-interface R2MultipartUpload {2045- readonly key: string;2046- readonly uploadId: string;2047- uploadPart(partNumber: number, value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob, options?: R2UploadPartOptions): Promise<R2UploadedPart>;2048- abort(): Promise<void>;2049- complete(uploadedParts: R2UploadedPart[]): Promise<R2Object>;2050-}2051-interface R2UploadedPart {2052- partNumber: number;2053- etag: string;2054-}2055-declare abstract class R2Object {2056- readonly key: string;2057- readonly version: string;2058- readonly size: number;2059- readonly etag: string;2060- readonly httpEtag: string;2061- readonly checksums: R2Checksums;2062- readonly uploaded: Date;2063- readonly httpMetadata?: R2HTTPMetadata;2064- readonly customMetadata?: Record<string, string>;2065- readonly range?: R2Range;2066- readonly storageClass: string;2067- readonly ssecKeyMd5?: string;2068- writeHttpMetadata(headers: Headers): void;2069-}2070-interface R2ObjectBody extends R2Object {2071- get body(): ReadableStream;2072- get bodyUsed(): boolean;2073- arrayBuffer(): Promise<ArrayBuffer>;2074- bytes(): Promise<Uint8Array>;2075- text(): Promise<string>;2076- json<T>(): Promise<T>;2077- blob(): Promise<Blob>;2078-}2079-type R2Range = {2080- offset: number;2081- length?: number;2082-} | {2083- offset?: number;2084- length: number;2085-} | {2086- suffix: number;2087-};2088-interface R2Conditional {2089- etagMatches?: string;2090- etagDoesNotMatch?: string;2091- uploadedBefore?: Date;2092- uploadedAfter?: Date;2093- secondsGranularity?: boolean;2094-}2095-interface R2GetOptions {2096- onlyIf?: (R2Conditional | Headers);2097- range?: (R2Range | Headers);2098- ssecKey?: (ArrayBuffer | string);2099-}2100-interface R2PutOptions {2101- onlyIf?: (R2Conditional | Headers);2102- httpMetadata?: (R2HTTPMetadata | Headers);2103- customMetadata?: Record<string, string>;2104- md5?: ((ArrayBuffer | ArrayBufferView) | string);2105- sha1?: ((ArrayBuffer | ArrayBufferView) | string);2106- sha256?: ((ArrayBuffer | ArrayBufferView) | string);2107- sha384?: ((ArrayBuffer | ArrayBufferView) | string);2108- sha512?: ((ArrayBuffer | ArrayBufferView) | string);2109- storageClass?: string;2110- ssecKey?: (ArrayBuffer | string);2111-}2112-interface R2MultipartOptions {2113- httpMetadata?: (R2HTTPMetadata | Headers);2114- customMetadata?: Record<string, string>;2115- storageClass?: string;2116- ssecKey?: (ArrayBuffer | string);2117-}2118-interface R2Checksums {2119- readonly md5?: ArrayBuffer;2120- readonly sha1?: ArrayBuffer;2121- readonly sha256?: ArrayBuffer;2122- readonly sha384?: ArrayBuffer;2123- readonly sha512?: ArrayBuffer;2124- toJSON(): R2StringChecksums;2125-}2126-interface R2StringChecksums {2127- md5?: string;2128- sha1?: string;2129- sha256?: string;2130- sha384?: string;2131- sha512?: string;2132-}2133-interface R2HTTPMetadata {2134- contentType?: string;2135- contentLanguage?: string;2136- contentDisposition?: string;2137- contentEncoding?: string;2138- cacheControl?: string;2139- cacheExpiry?: Date;2140-}2141-type R2Objects = {2142- objects: R2Object[];2143- delimitedPrefixes: string[];2144-} & ({2145- truncated: true;2146- cursor: string;2147-} | {2148- truncated: false;2149-});2150-interface R2UploadPartOptions {2151- ssecKey?: (ArrayBuffer | string);2152-}2153-declare abstract class ScheduledEvent extends ExtendableEvent {2154- readonly scheduledTime: number;2155- readonly cron: string;2156- noRetry(): void;2157-}2158-interface ScheduledController {2159- readonly scheduledTime: number;2160- readonly cron: string;2161- noRetry(): void;2162-}2163-interface QueuingStrategy<T = any> {2164- highWaterMark?: (number | bigint);2165- size?: (chunk: T) => number | bigint;2166-}2167-interface UnderlyingSink<W = any> {2168- type?: string;2169- start?: (controller: WritableStreamDefaultController) => void | Promise<void>;2170- write?: (chunk: W, controller: WritableStreamDefaultController) => void | Promise<void>;2171- abort?: (reason: any) => void | Promise<void>;2172- close?: () => void | Promise<void>;2173-}2174-interface UnderlyingByteSource {2175- type: "bytes";2176- autoAllocateChunkSize?: number;2177- start?: (controller: ReadableByteStreamController) => void | Promise<void>;2178- pull?: (controller: ReadableByteStreamController) => void | Promise<void>;2179- cancel?: (reason: any) => void | Promise<void>;2180-}2181-interface UnderlyingSource<R = any> {2182- type?: "" | undefined;2183- start?: (controller: ReadableStreamDefaultController<R>) => void | Promise<void>;2184- pull?: (controller: ReadableStreamDefaultController<R>) => void | Promise<void>;2185- cancel?: (reason: any) => void | Promise<void>;2186- expectedLength?: (number | bigint);2187-}2188-interface Transformer<I = any, O = any> {2189- readableType?: string;2190- writableType?: string;2191- start?: (controller: TransformStreamDefaultController<O>) => void | Promise<void>;2192- transform?: (chunk: I, controller: TransformStreamDefaultController<O>) => void | Promise<void>;2193- flush?: (controller: TransformStreamDefaultController<O>) => void | Promise<void>;2194- cancel?: (reason: any) => void | Promise<void>;2195- expectedLength?: number;2196-}2197-interface StreamPipeOptions {2198- preventAbort?: boolean;2199- preventCancel?: boolean;2200- /**2201- * 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.2202- *2203- * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.2204- *2205- * Errors and closures of the source and destination streams propagate as follows:2206- *2207- * 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.2208- *2209- * 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.2210- *2211- * 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.2212- *2213- * 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.2214- *2215- * 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.2216- */2217- preventClose?: boolean;2218- signal?: AbortSignal;2219-}2220-type ReadableStreamReadResult<R = any> = {2221- done: false;2222- value: R;2223-} | {2224- done: true;2225- value?: undefined;2226-};2227-/**2228- * The `ReadableStream` interface of the Streams API represents a readable stream of byte data.2229- *2230- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream)2231- */2232-interface ReadableStream<R = any> {2233- /**2234- * The **`locked`** read-only property of the ReadableStream interface returns whether or not the readable stream is locked to a reader.2235- *2236- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/locked)2237- */2238- get locked(): boolean;2239- /**2240- * The **`cancel()`** method of the ReadableStream interface returns a Promise that resolves when the stream is canceled.2241- *2242- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/cancel)2243- */2244- cancel(reason?: any): Promise<void>;2245- /**2246- * The **`getReader()`** method of the ReadableStream interface creates a reader and locks the stream to it.2247- *2248- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader)2249- */2250- getReader(): ReadableStreamDefaultReader<R>;2251- /**2252- * The **`getReader()`** method of the ReadableStream interface creates a reader and locks the stream to it.2253- *2254- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader)2255- */2256- getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader;2257- /**2258- * The **`pipeThrough()`** method of the ReadableStream interface provides a chainable way of piping the current stream through a transform stream or any other writable/readable pair.2259- *2260- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeThrough)2261- */2262- pipeThrough<T>(transform: ReadableWritablePair<T, R>, options?: StreamPipeOptions): ReadableStream<T>;2263- /**2264- * The **`pipeTo()`** method of the ReadableStream interface pipes the current `ReadableStream` to a given WritableStream and returns a Promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered.2265- *2266- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeTo)2267- */2268- pipeTo(destination: WritableStream<R>, options?: StreamPipeOptions): Promise<void>;2269- /**2270- * The **`tee()`** method of the two-element array containing the two resulting branches as new ReadableStream instances.2271- *2272- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/tee)2273- */2274- tee(): [2275- ReadableStream<R>,2276- ReadableStream<R>2277- ];2278- values(options?: ReadableStreamValuesOptions): AsyncIterableIterator<R>;2279- [Symbol.asyncIterator](options?: ReadableStreamValuesOptions): AsyncIterableIterator<R>;2280-}2281-/**2282- * The `ReadableStream` interface of the Streams API represents a readable stream of byte data.2283- *2284- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream)2285- */2286-declare const ReadableStream: {2287- prototype: ReadableStream;2288- new (underlyingSource: UnderlyingByteSource, strategy?: QueuingStrategy<Uint8Array>): ReadableStream<Uint8Array>;2289- new <R = any>(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;2290-};2291-/**2292- * The **`ReadableStreamDefaultReader`** interface of the Streams API represents a default reader that can be used to read stream data supplied from a network (such as a fetch request).2293- *2294- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader)2295- */2296-declare class ReadableStreamDefaultReader<R = any> {2297- constructor(stream: ReadableStream);2298- get closed(): Promise<void>;2299- cancel(reason?: any): Promise<void>;2300- /**2301- * The **`read()`** method of the ReadableStreamDefaultReader interface returns a Promise providing access to the next chunk in the stream's internal queue.2302- *2303- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/read)2304- */2305- read(): Promise<ReadableStreamReadResult<R>>;2306- /**2307- * The **`releaseLock()`** method of the ReadableStreamDefaultReader interface releases the reader's lock on the stream.2308- *2309- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/releaseLock)2310- */2311- releaseLock(): void;2312-}2313-/**2314- * The `ReadableStreamBYOBReader` interface of the Streams API defines a reader for a ReadableStream that supports zero-copy reading from an underlying byte source.2315- *2316- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader)2317- */2318-declare class ReadableStreamBYOBReader {2319- constructor(stream: ReadableStream);2320- get closed(): Promise<void>;2321- cancel(reason?: any): Promise<void>;2322- /**2323- * The **`read()`** method of the ReadableStreamBYOBReader interface is used to read data into a view on a user-supplied buffer from an associated readable byte stream.2324- *2325- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/read)2326- */2327- read<T extends ArrayBufferView>(view: T): Promise<ReadableStreamReadResult<T>>;2328- /**2329- * The **`releaseLock()`** method of the ReadableStreamBYOBReader interface releases the reader's lock on the stream.2330- *2331- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/releaseLock)2332- */2333- releaseLock(): void;2334- readAtLeast<T extends ArrayBufferView>(minElements: number, view: T): Promise<ReadableStreamReadResult<T>>;2335-}2336-interface ReadableStreamBYOBReaderReadableStreamBYOBReaderReadOptions {2337- min?: number;2338-}2339-interface ReadableStreamGetReaderOptions {2340- /**2341- * Creates a ReadableStreamBYOBReader and locks the stream to the new reader.2342- *2343- * This call behaves the same way as the no-argument variant, except that it only works on readable byte streams, i.e. streams which were constructed specifically with the ability to handle "bring your own buffer" reading. The returned BYOB reader provides the ability to directly read individual chunks from the stream via its read() method, into developer-supplied buffers, allowing more precise control over allocation.2344- */2345- mode: "byob";2346-}2347-/**2348- * The **`ReadableStreamBYOBRequest`** interface of the Streams API represents a 'pull request' for data from an underlying source that will made as a zero-copy transfer to a consumer (bypassing the stream's internal queues).2349- *2350- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest)2351- */2352-declare abstract class ReadableStreamBYOBRequest {2353- /**2354- * The **`view`** getter property of the ReadableStreamBYOBRequest interface returns the current view.2355- *2356- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/view)2357- */2358- get view(): Uint8Array | null;2359- /**2360- * The **`respond()`** method of the ReadableStreamBYOBRequest interface is used to signal to the associated readable byte stream that the specified number of bytes were written into the ReadableStreamBYOBRequest.view.2361- *2362- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respond)2363- */2364- respond(bytesWritten: number): void;2365- /**2366- * The **`respondWithNewView()`** method of the ReadableStreamBYOBRequest interface specifies a new view that the consumer of the associated readable byte stream should write to instead of ReadableStreamBYOBRequest.view.2367- *2368- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respondWithNewView)2369- */2370- respondWithNewView(view: ArrayBuffer | ArrayBufferView): void;2371- get atLeast(): number | null;2372-}2373-/**2374- * The **`ReadableStreamDefaultController`** interface of the Streams API represents a controller allowing control of a ReadableStream's state and internal queue.2375- *2376- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController)2377- */2378-declare abstract class ReadableStreamDefaultController<R = any> {2379- /**2380- * The **`desiredSize`** read-only property of the required to fill the stream's internal queue.2381- *2382- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/desiredSize)2383- */2384- get desiredSize(): number | null;2385- /**2386- * The **`close()`** method of the ReadableStreamDefaultController interface closes the associated stream.2387- *2388- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/close)2389- */2390- close(): void;2391- /**2392- * The **`enqueue()`** method of the ```js-nolint enqueue(chunk) ``` - `chunk` - : The chunk to enqueue.2393- *2394- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/enqueue)2395- */2396- enqueue(chunk?: R): void;2397- /**2398- * The **`error()`** method of the with the associated stream to error.2399- *2400- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/error)2401- */2402- error(reason: any): void;2403-}2404-/**2405- * The **`ReadableByteStreamController`** interface of the Streams API represents a controller for a readable byte stream.2406- *2407- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController)2408- */2409-declare abstract class ReadableByteStreamController {2410- /**2411- * The **`byobRequest`** read-only property of the ReadableByteStreamController interface returns the current BYOB request, or `null` if there are no pending requests.2412- *2413- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/byobRequest)2414- */2415- get byobRequest(): ReadableStreamBYOBRequest | null;2416- /**2417- * The **`desiredSize`** read-only property of the ReadableByteStreamController interface returns the number of bytes required to fill the stream's internal queue to its 'desired size'.2418- *2419- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/desiredSize)2420- */2421- get desiredSize(): number | null;2422- /**2423- * The **`close()`** method of the ReadableByteStreamController interface closes the associated stream.2424- *2425- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/close)2426- */2427- close(): void;2428- /**2429- * The **`enqueue()`** method of the ReadableByteStreamController interface enqueues a given chunk on the associated readable byte stream (the chunk is copied into the stream's internal queues).2430- *2431- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/enqueue)2432- */2433- enqueue(chunk: ArrayBuffer | ArrayBufferView): void;2434- /**2435- * The **`error()`** method of the ReadableByteStreamController interface causes any future interactions with the associated stream to error with the specified reason.2436- *2437- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/error)2438- */2439- error(reason: any): void;2440-}2441-/**2442- * The **`WritableStreamDefaultController`** interface of the Streams API represents a controller allowing control of a WritableStream's state.2443- *2444- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController)2445- */2446-declare abstract class WritableStreamDefaultController {2447- /**2448- * The read-only **`signal`** property of the WritableStreamDefaultController interface returns the AbortSignal associated with the controller.2449- *2450- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/signal)2451- */2452- get signal(): AbortSignal;2453- /**2454- * The **`error()`** method of the with the associated stream to error.2455- *2456- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/error)2457- */2458- error(reason?: any): void;2459-}2460-/**2461- * The **`TransformStreamDefaultController`** interface of the Streams API provides methods to manipulate the associated ReadableStream and WritableStream.2462- *2463- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController)2464- */2465-declare abstract class TransformStreamDefaultController<O = any> {2466- /**2467- * The **`desiredSize`** read-only property of the TransformStreamDefaultController interface returns the desired size to fill the queue of the associated ReadableStream.2468- *2469- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/desiredSize)2470- */2471- get desiredSize(): number | null;2472- /**2473- * The **`enqueue()`** method of the TransformStreamDefaultController interface enqueues the given chunk in the readable side of the stream.2474- *2475- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/enqueue)2476- */2477- enqueue(chunk?: O): void;2478- /**2479- * The **`error()`** method of the TransformStreamDefaultController interface errors both sides of the stream.2480- *2481- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/error)2482- */2483- error(reason: any): void;2484- /**2485- * The **`terminate()`** method of the TransformStreamDefaultController interface closes the readable side and errors the writable side of the stream.2486- *2487- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/terminate)2488- */2489- terminate(): void;2490-}2491-interface ReadableWritablePair<R = any, W = any> {2492- readable: ReadableStream<R>;2493- /**2494- * 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.2495- *2496- * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.2497- */2498- writable: WritableStream<W>;2499-}2500-/**2501- * The **`WritableStream`** interface of the Streams API provides a standard abstraction for writing streaming data to a destination, known as a sink.2502- *2503- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream)2504- */2505-declare class WritableStream<W = any> {2506- constructor(underlyingSink?: UnderlyingSink, queuingStrategy?: QueuingStrategy);2507- /**2508- * The **`locked`** read-only property of the WritableStream interface returns a boolean indicating whether the `WritableStream` is locked to a writer.2509- *2510- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/locked)2511- */2512- get locked(): boolean;2513- /**2514- * The **`abort()`** method of the WritableStream interface aborts the stream, signaling that the producer can no longer successfully write to the stream and it is to be immediately moved to an error state, with any queued writes discarded.2515- *2516- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/abort)2517- */2518- abort(reason?: any): Promise<void>;2519- /**2520- * The **`close()`** method of the WritableStream interface closes the associated stream.2521- *2522- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/close)2523- */2524- close(): Promise<void>;2525- /**2526- * The **`getWriter()`** method of the WritableStream interface returns a new instance of WritableStreamDefaultWriter and locks the stream to that instance.2527- *2528- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/getWriter)2529- */2530- getWriter(): WritableStreamDefaultWriter<W>;2531-}2532-/**2533- * The **`WritableStreamDefaultWriter`** interface of the Streams API is the object returned by WritableStream.getWriter() and once created locks the writer to the `WritableStream` ensuring that no other streams can write to the underlying sink.2534- *2535- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter)2536- */2537-declare class WritableStreamDefaultWriter<W = any> {2538- constructor(stream: WritableStream);2539- /**2540- * The **`closed`** read-only property of the the stream errors or the writer's lock is released.2541- *2542- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/closed)2543- */2544- get closed(): Promise<void>;2545- /**2546- * The **`ready`** read-only property of the that resolves when the desired size of the stream's internal queue transitions from non-positive to positive, signaling that it is no longer applying backpressure.2547- *2548- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/ready)2549- */2550- get ready(): Promise<void>;2551- /**2552- * The **`desiredSize`** read-only property of the to fill the stream's internal queue.2553- *2554- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/desiredSize)2555- */2556- get desiredSize(): number | null;2557- /**2558- * The **`abort()`** method of the the producer can no longer successfully write to the stream and it is to be immediately moved to an error state, with any queued writes discarded.2559- *2560- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/abort)2561- */2562- abort(reason?: any): Promise<void>;2563- /**2564- * The **`close()`** method of the stream.2565- *2566- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/close)2567- */2568- close(): Promise<void>;2569- /**2570- * The **`write()`** method of the operation.2571- *2572- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/write)2573- */2574- write(chunk?: W): Promise<void>;2575- /**2576- * The **`releaseLock()`** method of the corresponding stream.2577- *2578- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/releaseLock)2579- */2580- releaseLock(): void;2581-}2582-/**2583- * The **`TransformStream`** interface of the Streams API represents a concrete implementation of the pipe chain _transform stream_ concept.2584- *2585- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream)2586- */2587-declare class TransformStream<I = any, O = any> {2588- constructor(transformer?: Transformer<I, O>, writableStrategy?: QueuingStrategy<I>, readableStrategy?: QueuingStrategy<O>);2589- /**2590- * The **`readable`** read-only property of the TransformStream interface returns the ReadableStream instance controlled by this `TransformStream`.2591- *2592- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/readable)2593- */2594- get readable(): ReadableStream<O>;2595- /**2596- * The **`writable`** read-only property of the TransformStream interface returns the WritableStream instance controlled by this `TransformStream`.2597- *2598- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/writable)2599- */2600- get writable(): WritableStream<I>;2601-}2602-declare class FixedLengthStream extends IdentityTransformStream {2603- constructor(expectedLength: number | bigint, queuingStrategy?: IdentityTransformStreamQueuingStrategy);2604-}2605-declare class IdentityTransformStream extends TransformStream<ArrayBuffer | ArrayBufferView, Uint8Array> {2606- constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);2607-}2608-interface IdentityTransformStreamQueuingStrategy {2609- highWaterMark?: (number | bigint);2610-}2611-interface ReadableStreamValuesOptions {2612- preventCancel?: boolean;2613-}2614-/**2615- * The **`CompressionStream`** interface of the Compression Streams API is an API for compressing a stream of data.2616- *2617- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CompressionStream)2618- */2619-declare class CompressionStream extends TransformStream<ArrayBuffer | ArrayBufferView, Uint8Array> {2620- constructor(format: "gzip" | "deflate" | "deflate-raw");2621-}2622-/**2623- * The **`DecompressionStream`** interface of the Compression Streams API is an API for decompressing a stream of data.2624- *2625- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DecompressionStream)2626- */2627-declare class DecompressionStream extends TransformStream<ArrayBuffer | ArrayBufferView, Uint8Array> {2628- constructor(format: "gzip" | "deflate" | "deflate-raw");2629-}2630-/**2631- * The **`TextEncoderStream`** interface of the Encoding API converts a stream of strings into bytes in the UTF-8 encoding.2632- *2633- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoderStream)2634- */2635-declare class TextEncoderStream extends TransformStream<string, Uint8Array> {2636- constructor();2637- get encoding(): string;2638-}2639-/**2640- * The **`TextDecoderStream`** interface of the Encoding API converts a stream of text in a binary encoding, such as UTF-8 etc., to a stream of strings.2641- *2642- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoderStream)2643- */2644-declare class TextDecoderStream extends TransformStream<ArrayBuffer | ArrayBufferView, string> {2645- constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit);2646- get encoding(): string;2647- get fatal(): boolean;2648- get ignoreBOM(): boolean;2649-}2650-interface TextDecoderStreamTextDecoderStreamInit {2651- fatal?: boolean;2652- ignoreBOM?: boolean;2653-}2654-/**2655- * The **`ByteLengthQueuingStrategy`** interface of the Streams API provides a built-in byte length queuing strategy that can be used when constructing streams.2656- *2657- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy)2658- */2659-declare class ByteLengthQueuingStrategy implements QueuingStrategy<ArrayBufferView> {2660- constructor(init: QueuingStrategyInit);2661- /**2662- * The read-only **`ByteLengthQueuingStrategy.highWaterMark`** property returns the total number of bytes that can be contained in the internal queue before backpressure is applied.2663- *2664- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/highWaterMark)2665- */2666- get highWaterMark(): number;2667- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/size) */2668- get size(): (chunk?: any) => number;2669-}2670-/**2671- * The **`CountQueuingStrategy`** interface of the Streams API provides a built-in chunk counting queuing strategy that can be used when constructing streams.2672- *2673- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy)2674- */2675-declare class CountQueuingStrategy implements QueuingStrategy {2676- constructor(init: QueuingStrategyInit);2677- /**2678- * The read-only **`CountQueuingStrategy.highWaterMark`** property returns the total number of chunks that can be contained in the internal queue before backpressure is applied.2679- *2680- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/highWaterMark)2681- */2682- get highWaterMark(): number;2683- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/size) */2684- get size(): (chunk?: any) => number;2685-}2686-interface QueuingStrategyInit {2687- /**2688- * Creates a new ByteLengthQueuingStrategy with the provided high water mark.2689- *2690- * 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.2691- */2692- highWaterMark: number;2693-}2694-interface TracePreviewInfo {2695- id: string;2696- slug: string;2697- name: string;2698-}2699-interface ScriptVersion {2700- id?: string;2701- tag?: string;2702- message?: string;2703-}2704-declare abstract class TailEvent extends ExtendableEvent {2705- readonly events: TraceItem[];2706- readonly traces: TraceItem[];2707-}2708-interface TraceItem {2709- readonly event: (TraceItemFetchEventInfo | TraceItemJsRpcEventInfo | TraceItemConnectEventInfo | TraceItemScheduledEventInfo | TraceItemAlarmEventInfo | TraceItemQueueEventInfo | TraceItemEmailEventInfo | TraceItemTailEventInfo | TraceItemCustomEventInfo | TraceItemHibernatableWebSocketEventInfo) | null;2710- readonly eventTimestamp: number | null;2711- readonly logs: TraceLog[];2712- readonly exceptions: TraceException[];2713- readonly diagnosticsChannelEvents: TraceDiagnosticChannelEvent[];2714- readonly scriptName: string | null;2715- readonly entrypoint?: string;2716- readonly scriptVersion?: ScriptVersion;2717- readonly dispatchNamespace?: string;2718- readonly scriptTags?: string[];2719- readonly tailAttributes?: Record<string, boolean | number | string>;2720- readonly preview?: TracePreviewInfo;2721- readonly durableObjectId?: string;2722- readonly outcome: string;2723- readonly executionModel: string;2724- readonly truncated: boolean;2725- readonly cpuTime: number;2726- readonly wallTime: number;2727-}2728-interface TraceItemAlarmEventInfo {2729- readonly scheduledTime: Date;2730-}2731-interface TraceItemConnectEventInfo {2732-}2733-interface TraceItemCustomEventInfo {2734-}2735-interface TraceItemScheduledEventInfo {2736- readonly scheduledTime: number;2737- readonly cron: string;2738-}2739-interface TraceItemQueueEventInfo {2740- readonly queue: string;2741- readonly batchSize: number;2742-}2743-interface TraceItemEmailEventInfo {2744- readonly mailFrom: string;2745- readonly rcptTo: string;2746- readonly rawSize: number;2747-}2748-interface TraceItemTailEventInfo {2749- readonly consumedEvents: TraceItemTailEventInfoTailItem[];2750-}2751-interface TraceItemTailEventInfoTailItem {2752- readonly scriptName: string | null;2753-}2754-interface TraceItemFetchEventInfo {2755- readonly response?: TraceItemFetchEventInfoResponse;2756- readonly request: TraceItemFetchEventInfoRequest;2757-}2758-interface TraceItemFetchEventInfoRequest {2759- readonly cf?: any;2760- readonly headers: Record<string, string>;2761- readonly method: string;2762- readonly url: string;2763- getUnredacted(): TraceItemFetchEventInfoRequest;2764-}2765-interface TraceItemFetchEventInfoResponse {2766- readonly status: number;2767-}2768-interface TraceItemJsRpcEventInfo {2769- readonly rpcMethod: string;2770-}2771-interface TraceItemHibernatableWebSocketEventInfo {2772- readonly getWebSocketEvent: TraceItemHibernatableWebSocketEventInfoMessage | TraceItemHibernatableWebSocketEventInfoClose | TraceItemHibernatableWebSocketEventInfoError;2773-}2774-interface TraceItemHibernatableWebSocketEventInfoMessage {2775- readonly webSocketEventType: string;2776-}2777-interface TraceItemHibernatableWebSocketEventInfoClose {2778- readonly webSocketEventType: string;2779- readonly code: number;2780- readonly wasClean: boolean;2781-}2782-interface TraceItemHibernatableWebSocketEventInfoError {2783- readonly webSocketEventType: string;2784-}2785-interface TraceLog {2786- readonly timestamp: number;2787- readonly level: string;2788- readonly message: any;2789-}2790-interface TraceException {2791- readonly timestamp: number;2792- readonly message: string;2793- readonly name: string;2794- readonly stack?: string;2795-}2796-interface TraceDiagnosticChannelEvent {2797- readonly timestamp: number;2798- readonly channel: string;2799- readonly message: any;2800-}2801-interface TraceMetrics {2802- readonly cpuTime: number;2803- readonly wallTime: number;2804-}2805-interface UnsafeTraceMetrics {2806- fromTrace(item: TraceItem): TraceMetrics;2807-}2808-/**2809- * The **`URL`** interface is used to parse, construct, normalize, and encode URL.2810- *2811- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL)2812- */2813-declare class URL {2814- constructor(url: string | URL, base?: string | URL);2815- /**2816- * The **`origin`** read-only property of the URL interface returns a string containing the Unicode serialization of the origin of the represented URL.2817- *2818- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/origin)2819- */2820- get origin(): string;2821- /**2822- * The **`href`** property of the URL interface is a string containing the whole URL.2823- *2824- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href)2825- */2826- get href(): string;2827- /**2828- * The **`href`** property of the URL interface is a string containing the whole URL.2829- *2830- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href)2831- */2832- set href(value: string);2833- /**2834- * The **`protocol`** property of the URL interface is a string containing the protocol or scheme of the URL, including the final `':'`.2835- *2836- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol)2837- */2838- get protocol(): string;2839- /**2840- * The **`protocol`** property of the URL interface is a string containing the protocol or scheme of the URL, including the final `':'`.2841- *2842- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol)2843- */2844- set protocol(value: string);2845- /**2846- * The **`username`** property of the URL interface is a string containing the username component of the URL.2847- *2848- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username)2849- */2850- get username(): string;2851- /**2852- * The **`username`** property of the URL interface is a string containing the username component of the URL.2853- *2854- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username)2855- */2856- set username(value: string);2857- /**2858- * The **`password`** property of the URL interface is a string containing the password component of the URL.2859- *2860- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password)2861- */2862- get password(): string;2863- /**2864- * The **`password`** property of the URL interface is a string containing the password component of the URL.2865- *2866- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password)2867- */2868- set password(value: string);2869- /**2870- * The **`host`** property of the URL interface is a string containing the host, which is the URL.hostname, and then, if the port of the URL is nonempty, a `':'`, followed by the URL.port of the URL.2871- *2872- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host)2873- */2874- get host(): string;2875- /**2876- * The **`host`** property of the URL interface is a string containing the host, which is the URL.hostname, and then, if the port of the URL is nonempty, a `':'`, followed by the URL.port of the URL.2877- *2878- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host)2879- */2880- set host(value: string);2881- /**2882- * The **`hostname`** property of the URL interface is a string containing either the domain name or IP address of the URL.2883- *2884- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname)2885- */2886- get hostname(): string;2887- /**2888- * The **`hostname`** property of the URL interface is a string containing either the domain name or IP address of the URL.2889- *2890- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname)2891- */2892- set hostname(value: string);2893- /**2894- * The **`port`** property of the URL interface is a string containing the port number of the URL.2895- *2896- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port)2897- */2898- get port(): string;2899- /**2900- * The **`port`** property of the URL interface is a string containing the port number of the URL.2901- *2902- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port)2903- */2904- set port(value: string);2905- /**2906- * The **`pathname`** property of the URL interface represents a location in a hierarchical structure.2907- *2908- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname)2909- */2910- get pathname(): string;2911- /**2912- * The **`pathname`** property of the URL interface represents a location in a hierarchical structure.2913- *2914- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname)2915- */2916- set pathname(value: string);2917- /**2918- * The **`search`** property of the URL interface is a search string, also called a _query string_, that is a string containing a `'?'` followed by the parameters of the URL.2919- *2920- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search)2921- */2922- get search(): string;2923- /**2924- * The **`search`** property of the URL interface is a search string, also called a _query string_, that is a string containing a `'?'` followed by the parameters of the URL.2925- *2926- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search)2927- */2928- set search(value: string);2929- /**2930- * The **`hash`** property of the URL interface is a string containing a `'#'` followed by the fragment identifier of the URL.2931- *2932- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash)2933- */2934- get hash(): string;2935- /**2936- * The **`hash`** property of the URL interface is a string containing a `'#'` followed by the fragment identifier of the URL.2937- *2938- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash)2939- */2940- set hash(value: string);2941- /**2942- * The **`searchParams`** read-only property of the access to the [MISSING: httpmethod('GET')] decoded query arguments contained in the URL.2943- *2944- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/searchParams)2945- */2946- get searchParams(): URLSearchParams;2947- /**2948- * The **`toJSON()`** method of the URL interface returns a string containing a serialized version of the URL, although in practice it seems to have the same effect as ```js-nolint toJSON() ``` None.2949- *2950- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/toJSON)2951- */2952- toJSON(): string;2953- /*function toString() { [native code] }*/2954- toString(): string;2955- /**2956- * The **`URL.canParse()`** static method of the URL interface returns a boolean indicating whether or not an absolute URL, or a relative URL combined with a base URL, are parsable and valid.2957- *2958- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/canParse_static)2959- */2960- static canParse(url: string, base?: string): boolean;2961- /**2962- * The **`URL.parse()`** static method of the URL interface returns a newly created URL object representing the URL defined by the parameters.2963- *2964- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/parse_static)2965- */2966- static parse(url: string, base?: string): URL | null;2967- /**2968- * The **`createObjectURL()`** static method of the URL interface creates a string containing a URL representing the object given in the parameter.2969- *2970- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/createObjectURL_static)2971- */2972- static createObjectURL(object: File | Blob): string;2973- /**2974- * The **`revokeObjectURL()`** static method of the URL interface releases an existing object URL which was previously created by calling Call this method when you've finished using an object URL to let the browser know not to keep the reference to the file any longer.2975- *2976- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/revokeObjectURL_static)2977- */2978- static revokeObjectURL(object_url: string): void;2979-}2980-/**2981- * The **`URLSearchParams`** interface defines utility methods to work with the query string of a URL.2982- *2983- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams)2984- */2985-declare class URLSearchParams {2986- constructor(init?: (Iterable<Iterable<string>> | Record<string, string> | string));2987- /**2988- * The **`size`** read-only property of the URLSearchParams interface indicates the total number of search parameter entries.2989- *2990- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/size)2991- */2992- get size(): number;2993- /**2994- * The **`append()`** method of the URLSearchParams interface appends a specified key/value pair as a new search parameter.2995- *2996- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/append)2997- */2998- append(name: string, value: string): void;2999- /**3000- * The **`delete()`** method of the URLSearchParams interface deletes specified parameters and their associated value(s) from the list of all search parameters.3001- *3002- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/delete)3003- */3004- delete(name: string, value?: string): void;3005- /**3006- * The **`get()`** method of the URLSearchParams interface returns the first value associated to the given search parameter.3007- *3008- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/get)3009- */3010- get(name: string): string | null;3011- /**3012- * The **`getAll()`** method of the URLSearchParams interface returns all the values associated with a given search parameter as an array.3013- *3014- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/getAll)3015- */3016- getAll(name: string): string[];3017- /**3018- * The **`has()`** method of the URLSearchParams interface returns a boolean value that indicates whether the specified parameter is in the search parameters.3019- *
diff truncated