+
+
+
Marfa A shared data layer for your apps
+
diff --git a/src/components/Footer.astro b/src/components/Footer.astro
index 1c10dcc..55bfdb8 100644
--- a/src/components/Footer.astro
+++ b/src/components/Footer.astro
@@ -1,12 +1,46 @@
---
+/**
+ * The footer, and the Contact card it opens. The card shows the address before
+ * anything opens a mail app, and offers to copy it instead.
+ */
const path = Astro.url.pathname.replace(/(\/index)?\.html$/, '') || '/';
+const EMAIL = 'hello@withmarfa.com';
---
+
+
+
+
diff --git a/src/components/Subscribe.astro b/src/components/Subscribe.astro
new file mode 100644
index 0000000..e46461e
--- /dev/null
+++ b/src/components/Subscribe.astro
@@ -0,0 +1,171 @@
+---
+/**
+ * Signs someone up for updates. Without JavaScript the form posts and the
+ * Worker redirects to /subscribed; with it, the result shows in place. The
+ * `website` field is left empty by people and filled by bots, which the Worker
+ * then ignores.
+ */
+---
+
+
+
+
+
+
diff --git a/src/layouts/Base.astro b/src/layouts/Base.astro
index 091c471..be0fea2 100644
--- a/src/layouts/Base.astro
+++ b/src/layouts/Base.astro
@@ -6,13 +6,14 @@ import Footer from '../components/Footer.astro';
interface Props {
title: string;
description: string;
- /** Off for the 404 page, which has no address of its own. */
+ /** Off for pages search engines should skip, such as the 404 page. */
indexable?: boolean;
}
const { title, description, indexable = true } = Astro.props;
// Pages build to `about.html`, which Cloudflare serves at `/about`.
const canonical = new URL(Astro.url.pathname.replace(/(\/index)?\.html$/, '') || '/', Astro.site);
+const image = new URL('/og.png', Astro.site).href;
---
@@ -25,7 +26,7 @@ const canonical = new URL(Astro.url.pathname.replace(/(\/index)?\.html$/, '') ||
{title}
- {indexable && }
+ {indexable ? : }
@@ -34,6 +35,12 @@ const canonical = new URL(Astro.url.pathname.replace(/(\/index)?\.html$/, '') ||
{indexable && }
+
+
+
+
+
+
diff --git a/src/pages/about.astro b/src/pages/about.astro
index 2e72418..1599a8f 100644
--- a/src/pages/about.astro
+++ b/src/pages/about.astro
@@ -1,26 +1,39 @@
---
import Base from '../layouts/Base.astro';
+import Subscribe from '../components/Subscribe.astro';
/** What's next. `now` marks the step in progress, shown in bold. */
const next = [
{ when: 'Early October', what: 'Development builds, open source' },
- { when: 'Late October', what: 'Marfa 0.1, first semi-stable release', now: true },
- { when: 'Early November', what: 'Mac and iOS apps: early TestFlight' },
- { when: 'Late November', what: 'Mac and iOS apps: public TestFlight' },
- { when: 'December', what: 'More apps, and Marfa Cloud testing' },
+ { when: 'Late October', what: 'Marfa 0.1, the first semi-stable release', now: true },
+ { when: 'Early November', what: 'The Mac and iOS apps with early testers' },
+ { when: 'Late November', what: 'Public TestFlight, Marfa Cloud in testing, and the full website' },
];
---
-
+
About
- Marfa began as my own way of managing my data: one place that every app and tool I use could work from. This year
- it went from a hosted service to something you run yourself, with a Rust core under its command-line tool and
- native apps.
+ Marfa grew out of a frustration. After trying more apps than I can count, every switch meant leaving something
+ behind. It also draws on experience with customer data platforms, where one well-modelled source of data is the
+ whole point.
- It’s a personal project, not a business. I’ll keep maintaining it and building apps on it, and it’s open source so
- that anyone can run it, build on it or take it somewhere new.
+ That matters more now that agents can build an app in an afternoon. Apps can come and go; the data underneath
+ should last, and make sense to whatever reads it next.
+
+
+ Marfa has been rebuilt more than once this year. It began as a hosted service that tried to be compatible with
+ everything, which pulled it away from what mattered most: a sound data model and a server you can rely on. So it
+ became something you run yourself, with a Rust core under its command-line tool and native apps. Marfa Cloud will
+ follow as an optional relay for reaching it from anywhere, without holding your data.
+
+
+ It’s a personal project, not a business. It ships when it works, not before. It’s free and open source, so anyone
+ can run it, build on it or take it somewhere new.
What’s next
@@ -35,8 +48,12 @@ const next = [
}
- Get in touch
- Questions, ideas or something you’ve built? Email hello@withmarfa.com .
+ Follow along
+
+ Marfa is being shaped with a small group of early testers. Leave your email to hear as the apps open up and new
+ things ship.
+
+
diff --git a/src/pages/sitemap.xml.ts b/src/pages/sitemap.xml.ts
new file mode 100644
index 0000000..0e15ae9
--- /dev/null
+++ b/src/pages/sitemap.xml.ts
@@ -0,0 +1,20 @@
+import type { APIRoute } from 'astro';
+
+/** Pages that are not for search: the 404 page and the sign-up thank-you. */
+const UNLISTED = new Set(['404', 'subscribed']);
+
+const pages = Object.keys(import.meta.glob('./*.astro'))
+ .map((file) => file.slice(2, -'.astro'.length))
+ .filter((name) => !UNLISTED.has(name))
+ .map((name) => (name === 'index' ? '/' : `/${name}`))
+ .sort();
+
+export const GET: APIRoute = ({ site }) => {
+ const urls = pages.map((path) => ` ${new URL(path, site).href} `).join('\n');
+ const body = `
+
+${urls}
+
+`;
+ return new Response(body, { headers: { 'Content-Type': 'application/xml' } });
+};
diff --git a/src/pages/subscribed.astro b/src/pages/subscribed.astro
new file mode 100644
index 0000000..8d1a33b
--- /dev/null
+++ b/src/pages/subscribed.astro
@@ -0,0 +1,8 @@
+---
+import Base from '../layouts/Base.astro';
+---
+
+
+ You’re on the list
+ Thanks. You’ll hear when there’s news. Back to the home page .
+
diff --git a/tsconfig.json b/tsconfig.json
index 8bf91d3..abffe97 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,5 +1,5 @@
{
"extends": "astro/tsconfigs/strict",
"include": [".astro/types.d.ts", "**/*"],
- "exclude": ["dist"]
+ "exclude": ["dist", "worker"]
}
diff --git a/worker/index.ts b/worker/index.ts
new file mode 100644
index 0000000..1fdeaf9
--- /dev/null
+++ b/worker/index.ts
@@ -0,0 +1,90 @@
+/**
+ * The site's one piece of server code: POST /api/subscribe keeps an email
+ * address for updates. Pages never reach it; `run_worker_first` in
+ * wrangler.jsonc sends only /api/* here.
+ *
+ * Without JavaScript the form posts here and is redirected to a page; the
+ * site's own script asks for JSON instead and shows the result in place.
+ */
+
+type Result = 'ok' | 'invalid' | 'limited' | 'error';
+
+const STATUS: Record = { ok: 200, invalid: 400, limited: 429, error: 500 };
+
+// Deliberately loose: the browser's own check runs first, and the only aim
+// here is to turn away input that cannot be an address.
+const EMAIL = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
+
+// A real form body is a few hundred bytes.
+const MAX_BODY = 2048;
+
+export default {
+ async fetch(request, env): Promise {
+ const url = new URL(request.url);
+ if (url.pathname !== '/api/subscribe') {
+ return new Response('Not found', { status: 404, headers: baseHeaders() });
+ }
+ if (request.method !== 'POST') {
+ return new Response('Method not allowed', { status: 405, headers: { ...baseHeaders(), Allow: 'POST' } });
+ }
+
+ const wantsJson = (request.headers.get('Accept') ?? '').includes('application/json');
+ const reply = (result: Result) => respond(result, wantsJson, url);
+
+ // Browsers always send Origin with a POST, so anything else is not this
+ // site's form.
+ if (request.headers.get('Origin') !== url.origin) {
+ return new Response('Forbidden', { status: 403, headers: baseHeaders() });
+ }
+
+ const length = Number(request.headers.get('Content-Length') ?? 'NaN');
+ if (!Number.isFinite(length) || length > MAX_BODY) return reply('invalid');
+
+ const { success } = await env.SIGNUP_LIMIT.limit({ key: request.headers.get('CF-Connecting-IP') ?? 'unknown' });
+ if (!success) return reply('limited');
+
+ let form: FormData;
+ try {
+ form = await request.formData();
+ } catch {
+ return reply('invalid');
+ }
+
+ // The hidden field is filled only by bots: tell them it worked and keep nothing.
+ if (String(form.get('website') ?? '') !== '') return reply('ok');
+
+ const email = String(form.get('email') ?? '')
+ .trim()
+ .toLowerCase();
+ if (email.length > 254 || !EMAIL.test(email)) return reply('invalid');
+
+ try {
+ const { meta } = await env.DB.prepare(
+ 'INSERT INTO signups (email, created_at) VALUES (?1, ?2) ON CONFLICT (email) DO NOTHING',
+ )
+ .bind(email, new Date().toISOString())
+ .run();
+ // Never log the address itself.
+ console.log(JSON.stringify({ event: 'signup', added: meta.changes > 0 }));
+ } catch (error) {
+ console.error(JSON.stringify({ event: 'signup_failed', error: String(error) }));
+ return reply('error');
+ }
+
+ // A repeat sign-up looks the same as a new one, so the form never reveals
+ // whether an address is already on the list.
+ return reply('ok');
+ },
+} satisfies ExportedHandler;
+
+function respond(result: Result, wantsJson: boolean, url: URL): Response {
+ if (wantsJson) {
+ return Response.json({ result }, { status: STATUS[result], headers: baseHeaders() });
+ }
+ const to = result === 'ok' ? '/subscribed' : '/about#follow';
+ return new Response(null, { status: 303, headers: { ...baseHeaders(), Location: new URL(to, url).href } });
+}
+
+function baseHeaders(): Record {
+ return { 'Cache-Control': 'no-store', 'X-Content-Type-Options': 'nosniff' };
+}
diff --git a/worker/tsconfig.json b/worker/tsconfig.json
new file mode 100644
index 0000000..3b4d7f4
--- /dev/null
+++ b/worker/tsconfig.json
@@ -0,0 +1,14 @@
+{
+ "compilerOptions": {
+ "target": "es2024",
+ "module": "es2022",
+ "moduleResolution": "bundler",
+ "lib": ["es2024"],
+ "types": [],
+ "strict": true,
+ "noEmit": true,
+ "skipLibCheck": true,
+ "isolatedModules": true
+ },
+ "include": ["index.ts", "worker-configuration.d.ts"]
+}
diff --git a/worker/worker-configuration.d.ts b/worker/worker-configuration.d.ts
new file mode 100644
index 0000000..5735494
--- /dev/null
+++ b/worker/worker-configuration.d.ts
@@ -0,0 +1,16268 @@
+/* eslint-disable */
+// Generated by Wrangler by running `wrangler types worker/worker-configuration.d.ts` (hash: 1af85b0457706c71e5feff3d8f582c2d)
+// Runtime types generated with workerd@1.20261019.1 2026-10-21
+interface __BaseEnv_Env {
+ DB: D1Database;
+ SIGNUP_LIMIT: RateLimit;
+}
+declare namespace Cloudflare {
+ interface GlobalProps {
+ mainModule: typeof import("./index");
+ }
+ interface Env extends __BaseEnv_Env {}
+}
+interface Env extends __BaseEnv_Env {}
+declare module "*.txt" {
+ const value: string;
+ export default value;
+}
+declare module "*.html" {
+ const value: string;
+ export default value;
+}
+declare module "*.sql" {
+ const value: string;
+ export default value;
+}
+declare module "*.bin" {
+ const value: ArrayBuffer;
+ export default value;
+}
+declare module "*.wasm" {
+ const value: WebAssembly.Module;
+ export default value;
+}
+declare module "*.wasm?module" {
+ const value: WebAssembly.Module;
+ export default value;
+}
+// Begin runtime types
+/*! *****************************************************************************
+Copyright (c) Cloudflare. All rights reserved.
+Copyright (c) Microsoft Corporation. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License"); you may not use
+this file except in compliance with the License. You may obtain a copy of the
+License at http://www.apache.org/licenses/LICENSE-2.0
+THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
+WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
+MERCHANTABLITY OR NON-INFRINGEMENT.
+See the Apache Version 2.0 License for specific language governing permissions
+and limitations under the License.
+***************************************************************************** */
+/* eslint-disable */
+// noinspection JSUnusedGlobalSymbols
+declare var onmessage: never;
+/**
+ * The **`DOMException`** interface represents an abnormal event (called an exception) that occurs as a result of calling a method or accessing a property of a web API. This is how error conditions are described in web APIs.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException)
+ */
+declare class DOMException extends Error {
+ constructor(message?: string, name?: string);
+ /**
+ * The **`message`** read-only property of the DOMException interface returns a string representing a message or description associated with the given error name.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message)
+ */
+ readonly message: string;
+ /**
+ * The **`name`** read-only property of the DOMException interface returns a string that contains one of the strings associated with an error name.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name)
+ */
+ readonly name: string;
+ /**
+ * The **`code`** read-only property of the DOMException interface returns one of the legacy error code constants, or 0 if none match.
+ * @deprecated
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code)
+ */
+ readonly code: number;
+ static readonly INDEX_SIZE_ERR: number;
+ static readonly DOMSTRING_SIZE_ERR: number;
+ static readonly HIERARCHY_REQUEST_ERR: number;
+ static readonly WRONG_DOCUMENT_ERR: number;
+ static readonly INVALID_CHARACTER_ERR: number;
+ static readonly NO_DATA_ALLOWED_ERR: number;
+ static readonly NO_MODIFICATION_ALLOWED_ERR: number;
+ static readonly NOT_FOUND_ERR: number;
+ static readonly NOT_SUPPORTED_ERR: number;
+ static readonly INUSE_ATTRIBUTE_ERR: number;
+ static readonly INVALID_STATE_ERR: number;
+ static readonly SYNTAX_ERR: number;
+ static readonly INVALID_MODIFICATION_ERR: number;
+ static readonly NAMESPACE_ERR: number;
+ static readonly INVALID_ACCESS_ERR: number;
+ static readonly VALIDATION_ERR: number;
+ static readonly TYPE_MISMATCH_ERR: number;
+ static readonly SECURITY_ERR: number;
+ static readonly NETWORK_ERR: number;
+ static readonly ABORT_ERR: number;
+ static readonly URL_MISMATCH_ERR: number;
+ static readonly QUOTA_EXCEEDED_ERR: number;
+ static readonly TIMEOUT_ERR: number;
+ static readonly INVALID_NODE_TYPE_ERR: number;
+ static readonly DATA_CLONE_ERR: number;
+ get stack(): any;
+ set stack(value: any);
+}
+type WorkerGlobalScopeEventMap = {
+ fetch: FetchEvent;
+ scheduled: ScheduledEvent;
+ queue: QueueEvent;
+ unhandledrejection: PromiseRejectionEvent;
+ rejectionhandled: PromiseRejectionEvent;
+};
+declare abstract class WorkerGlobalScope extends EventTarget {
+ EventTarget: typeof EventTarget;
+}
+/* The **`console`** object provides access to the debugging console (e.g., the Web console in Firefox). *
+ * The **`console`** object provides access to the debugging console (e.g., the Web console in Firefox).
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console)
+ */
+interface Console {
+ "assert"(condition?: boolean, ...data: any[]): void;
+ /**
+ * The **`console.clear()`** static method clears the console if possible.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/clear_static)
+ */
+ clear(): void;
+ /**
+ * The **`console.count()`** static method logs the number of times that this particular call to count() has been called.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/count_static)
+ */
+ count(label?: string): void;
+ /**
+ * The **`console.countReset()`** static method resets counter used with console.count().
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/countReset_static)
+ */
+ countReset(label?: string): void;
+ /**
+ * The **`console.debug()`** static method outputs a message to the console at the "debug" log level. The message is only displayed to the user if the console is configured to display debug output. In most cases, the log level is configured within the console UI. This log level might correspond to the Debug or Verbose log level.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/debug_static)
+ */
+ debug(...data: any[]): void;
+ /**
+ * The **`console.dir()`** static method displays a list of the properties of the specified JavaScript object. In browser consoles, the output is presented as a hierarchical listing with disclosure triangles that let you see the contents of child objects.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dir_static)
+ */
+ dir(item?: any, options?: any): void;
+ /**
+ * The **`console.dirxml()`** static method displays an interactive tree of the descendant elements of the specified XML/HTML element. If it is not possible to display as an element the JavaScript Object view is shown instead. The output is presented as a hierarchical listing of expandable nodes that let you see the contents of child nodes.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dirxml_static)
+ */
+ dirxml(...data: any[]): void;
+ /**
+ * The **`console.error()`** static method outputs a message to the console at the "error" log level. The message is only displayed to the user if the console is configured to display error output. In most cases, the log level is configured within the console UI. The message may be formatted as an error, with red colors and call stack information.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/error_static)
+ */
+ error(...data: any[]): void;
+ /**
+ * The **`console.group()`** static method creates a new inline group in the Web console log, causing any subsequent console messages to be indented by an additional level, until console.groupEnd() is called.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/group_static)
+ */
+ group(...data: any[]): void;
+ /**
+ * The **`console.groupCollapsed()`** static method creates a new inline group in the console. Unlike console.group(), however, the new group is created collapsed. The user will need to use the disclosure button next to it to expand it, revealing the entries created in the group.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupCollapsed_static)
+ */
+ groupCollapsed(...data: any[]): void;
+ /**
+ * The **`console.groupEnd()`** static method exits the current inline group in the console. See Using groups in the console in the console documentation for details and examples.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupEnd_static)
+ */
+ groupEnd(): void;
+ /**
+ * The **`console.info()`** static method outputs a message to the console at the "info" log level. The message is only displayed to the user if the console is configured to display info output. In most cases, the log level is configured within the console UI. The message may receive special formatting, such as a small "i" icon next to it.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/info_static)
+ */
+ info(...data: any[]): void;
+ /**
+ * The **`console.log()`** static method outputs a message to the console.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/log_static)
+ */
+ log(...data: any[]): void;
+ /**
+ * The **`console.table()`** static method displays tabular data as a table.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/table_static)
+ */
+ table(tabularData?: any, properties?: string[]): void;
+ /**
+ * The **`console.time()`** static method starts a timer you can use to track how long an operation takes. You give each timer a unique name, and may have up to 10,000 timers running on a given page. When you call console.timeEnd() with the same name, the browser will output the time, in milliseconds, that elapsed since the timer was started.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/time_static)
+ */
+ time(label?: string): void;
+ /**
+ * The **`console.timeEnd()`** static method stops a timer that was previously started by calling console.time().
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeEnd_static)
+ */
+ timeEnd(label?: string): void;
+ /**
+ * The **`console.timeLog()`** static method logs the current value of a timer that was previously started by calling console.time().
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeLog_static)
+ */
+ timeLog(label?: string, ...data: any[]): void;
+ /* The **`console.timeStamp()`** static method adds a single marker to the browser's Performance tool (Firefox bug 1387528, Chrome). This lets you correlate a point in your code with the other events recorded in the timeline, such as layout and paint events. */
+ timeStamp(label?: string): void;
+ /**
+ * The **`console.trace()`** static method outputs a stack trace to the console.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/trace_static)
+ */
+ trace(...data: any[]): void;
+ /**
+ * The **`console.warn()`** static method outputs a warning message to the console at the "warning" log level. The message is only displayed to the user if the console is configured to display warning output. In most cases, the log level is configured within the console UI. The message may receive special formatting, such as yellow colors and a warning icon.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/warn_static)
+ */
+ warn(...data: any[]): void;
+}
+declare const console: Console;
+type BufferSource = ArrayBufferView | ArrayBuffer;
+type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array;
+declare namespace WebAssembly {
+ class CompileError extends Error {
+ constructor(message?: string);
+ }
+ class RuntimeError extends Error {
+ constructor(message?: string);
+ }
+ type ValueType = "anyfunc" | "externref" | "f32" | "f64" | "i32" | "i64" | "v128";
+ interface GlobalDescriptor {
+ value: ValueType;
+ mutable?: boolean;
+ }
+ class Global {
+ constructor(descriptor: GlobalDescriptor, value?: any);
+ value: any;
+ valueOf(): any;
+ }
+ type ImportValue = ExportValue | number;
+ type ModuleImports = Record;
+ type Imports = Record;
+ type ExportValue = Function | Global | Memory | Table;
+ type Exports = Record;
+ class Instance {
+ constructor(module: Module, imports?: Imports);
+ readonly exports: Exports;
+ }
+ interface MemoryDescriptor {
+ initial: number;
+ maximum?: number;
+ shared?: boolean;
+ }
+ class Memory {
+ constructor(descriptor: MemoryDescriptor);
+ readonly buffer: ArrayBuffer;
+ grow(delta: number): number;
+ }
+ type ImportExportKind = "function" | "global" | "memory" | "table";
+ interface ModuleExportDescriptor {
+ kind: ImportExportKind;
+ name: string;
+ }
+ interface ModuleImportDescriptor {
+ kind: ImportExportKind;
+ module: string;
+ name: string;
+ }
+ abstract class Module {
+ static customSections(module: Module, sectionName: string): ArrayBuffer[];
+ static exports(module: Module): ModuleExportDescriptor[];
+ static imports(module: Module): ModuleImportDescriptor[];
+ }
+ type TableKind = "anyfunc" | "externref";
+ interface TableDescriptor {
+ element: TableKind;
+ initial: number;
+ maximum?: number;
+ }
+ class Table {
+ constructor(descriptor: TableDescriptor, value?: any);
+ readonly length: number;
+ get(index: number): any;
+ grow(delta: number, value?: any): number;
+ set(index: number, value?: any): void;
+ }
+ function instantiate(module: Module, imports?: Imports): Promise;
+ function validate(bytes: BufferSource): boolean;
+}
+/**
+ * The **`ServiceWorkerGlobalScope`** interface of the Service Worker API represents the global execution context of a service worker.
+ * Available only in secure contexts.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorkerGlobalScope)
+ */
+interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
+ DOMException: typeof DOMException;
+ WorkerGlobalScope: typeof WorkerGlobalScope;
+ btoa(data: string): string;
+ atob(data: string): string;
+ setTimeout(callback: (...args: any[]) => void, msDelay?: number): number;
+ setTimeout(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;
+ clearTimeout(timeoutId: number | null): void;
+ setInterval(callback: (...args: any[]) => void, msDelay?: number): number;
+ setInterval(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;
+ clearInterval(timeoutId: number | null): void;
+ queueMicrotask(task: Function): void;
+ structuredClone(value: T, options?: StructuredSerializeOptions): T;
+ reportError(error: any): void;
+ fetch(input: RequestInfo | URL, init?: RequestInit): Promise;
+ self: ServiceWorkerGlobalScope;
+ crypto: Crypto;
+ caches: CacheStorage;
+ scheduler: Scheduler;
+ performance: Performance;
+ Cloudflare: Cloudflare;
+ readonly origin: string;
+ Event: typeof Event;
+ ExtendableEvent: typeof ExtendableEvent;
+ CustomEvent: typeof CustomEvent;
+ PromiseRejectionEvent: typeof PromiseRejectionEvent;
+ FetchEvent: typeof FetchEvent;
+ TailEvent: typeof TailEvent;
+ TraceEvent: typeof TailEvent;
+ ScheduledEvent: typeof ScheduledEvent;
+ MessageEvent: typeof MessageEvent;
+ CloseEvent: typeof CloseEvent;
+ ReadableStreamDefaultReader: typeof ReadableStreamDefaultReader;
+ ReadableStreamBYOBReader: typeof ReadableStreamBYOBReader;
+ ReadableStream: typeof ReadableStream;
+ WritableStream: typeof WritableStream;
+ WritableStreamDefaultWriter: typeof WritableStreamDefaultWriter;
+ TransformStream: typeof TransformStream;
+ ByteLengthQueuingStrategy: typeof ByteLengthQueuingStrategy;
+ CountQueuingStrategy: typeof CountQueuingStrategy;
+ ErrorEvent: typeof ErrorEvent;
+ MessageChannel: typeof MessageChannel;
+ MessagePort: typeof MessagePort;
+ EventSource: typeof EventSource;
+ ReadableStreamBYOBRequest: typeof ReadableStreamBYOBRequest;
+ ReadableStreamDefaultController: typeof ReadableStreamDefaultController;
+ ReadableByteStreamController: typeof ReadableByteStreamController;
+ WritableStreamDefaultController: typeof WritableStreamDefaultController;
+ TransformStreamDefaultController: typeof TransformStreamDefaultController;
+ CompressionStream: typeof CompressionStream;
+ DecompressionStream: typeof DecompressionStream;
+ TextEncoderStream: typeof TextEncoderStream;
+ TextDecoderStream: typeof TextDecoderStream;
+ Headers: typeof Headers;
+ Body: typeof Body;
+ Request: typeof Request;
+ Response: typeof Response;
+ WebSocket: typeof WebSocket;
+ WebSocketPair: typeof WebSocketPair;
+ WebSocketRequestResponsePair: typeof WebSocketRequestResponsePair;
+ AbortController: typeof AbortController;
+ AbortSignal: typeof AbortSignal;
+ TextDecoder: typeof TextDecoder;
+ TextEncoder: typeof TextEncoder;
+ navigator: Navigator;
+ Navigator: typeof Navigator;
+ URL: typeof URL;
+ URLSearchParams: typeof URLSearchParams;
+ URLPattern: typeof URLPattern;
+ Blob: typeof Blob;
+ File: typeof File;
+ FormData: typeof FormData;
+ Crypto: typeof Crypto;
+ SubtleCrypto: typeof SubtleCrypto;
+ CryptoKey: typeof CryptoKey;
+ CacheStorage: typeof CacheStorage;
+ Cache: typeof Cache;
+ FixedLengthStream: typeof FixedLengthStream;
+ IdentityTransformStream: typeof IdentityTransformStream;
+ HTMLRewriter: typeof HTMLRewriter;
+}
+declare function addEventListener(type: Type, handler: EventListenerOrEventListenerObject, options?: EventTargetAddEventListenerOptions | boolean): void;
+declare function removeEventListener(type: Type, handler: EventListenerOrEventListenerObject, options?: EventTargetEventListenerOptions | boolean): void;
+/**
+ * The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually with dispatchEvent().
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
+ */
+declare function dispatchEvent(event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap]): boolean;
+/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/btoa) */
+declare function btoa(data: string): string;
+/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/atob) */
+declare function atob(data: string): string;
+/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setTimeout) */
+declare function setTimeout(callback: (...args: any[]) => void, msDelay?: number): number;
+/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setTimeout) */
+declare function setTimeout(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;
+/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/clearTimeout) */
+declare function clearTimeout(timeoutId: number | null): void;
+/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setInterval) */
+declare function setInterval(callback: (...args: any[]) => void, msDelay?: number): number;
+/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setInterval) */
+declare function setInterval(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;
+/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/clearInterval) */
+declare function clearInterval(timeoutId: number | null): void;
+/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/queueMicrotask) */
+declare function queueMicrotask(task: Function): void;
+/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/structuredClone) */
+declare function structuredClone(value: T, options?: StructuredSerializeOptions): T;
+/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/reportError) */
+declare function reportError(error: any): void;
+/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/fetch) */
+declare function fetch(input: RequestInfo | URL, init?: RequestInit): Promise;
+declare const self: ServiceWorkerGlobalScope;
+/**
+* The Web Crypto API provides a set of low-level functions for common cryptographic tasks.
+* The Workers runtime implements the full surface of this API, but with some differences in
+* the [supported algorithms](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/#supported-algorithms)
+* compared to those implemented in most browsers.
+*
+* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/)
+*/
+declare const crypto: Crypto;
+/**
+* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache.
+*
+* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/)
+*/
+declare const caches: CacheStorage;
+/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/scheduler) */
+declare const scheduler: Scheduler;
+/**
+* The Workers runtime supports a subset of the Performance API, used to measure timing and performance,
+* as well as timing of subrequests and other operations.
+*
+* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)
+*/
+declare const performance: Performance;
+declare const Cloudflare: Cloudflare;
+declare const origin: string;
+declare const navigator: Navigator;
+interface TestController {
+}
+interface ExecutionContext {
+ waitUntil(promise: Promise): void;
+ passThroughOnException(): void;
+ readonly exports: Cloudflare.Exports;
+ readonly props: Props;
+ cache?: CacheContext;
+ readonly access?: CloudflareAccessContext;
+ tracing: Tracing;
+ abort(reason?: any): void;
+}
+type ExportedHandlerFetchHandler = (request: Request>, env: Env, ctx: ExecutionContext) => Response | Promise;
+type ExportedHandlerConnectHandler = (socket: Socket, env: Env, ctx: ExecutionContext) => void | Promise;
+type ExportedHandlerTailHandler = (events: TraceItem[], env: Env, ctx: ExecutionContext) => void | Promise;
+type ExportedHandlerTraceHandler = (traces: TraceItem[], env: Env, ctx: ExecutionContext) => void | Promise;
+type ExportedHandlerTailStreamHandler = (event: TailStream.TailEvent, env: Env, ctx: ExecutionContext) => TailStream.TailEventHandlerType | undefined | Promise;
+type ExportedHandlerScheduledHandler = (controller: ScheduledController, env: Env, ctx: ExecutionContext) => void | Promise;
+type ExportedHandlerQueueHandler = (batch: MessageBatch, env: Env, ctx: ExecutionContext) => void | Promise;
+type ExportedHandlerTestHandler = (controller: TestController, env: Env, ctx: ExecutionContext) => void | Promise;
+interface ExportedHandler {
+ fetch?: ExportedHandlerFetchHandler;
+ connect?: ExportedHandlerConnectHandler;
+ tail?: ExportedHandlerTailHandler;
+ trace?: ExportedHandlerTraceHandler;
+ tailStream?: ExportedHandlerTailStreamHandler;
+ scheduled?: ExportedHandlerScheduledHandler;
+ test?: ExportedHandlerTestHandler;
+ email?: EmailExportedHandler;
+ queue?: ExportedHandlerQueueHandler;
+}
+interface StructuredSerializeOptions {
+ transfer?: any[];
+}
+declare abstract class Navigator {
+ sendBeacon(url: string, body?: BodyInit): boolean;
+ readonly userAgent: string;
+ readonly hardwareConcurrency: number;
+ readonly platform: string;
+ readonly language: string;
+ readonly languages: string[];
+}
+interface AlarmInvocationInfo {
+ readonly isRetry: boolean;
+ readonly retryCount: number;
+ readonly scheduledTime: number;
+}
+interface Cloudflare {
+ readonly compatibilityFlags: Record;
+}
+interface CachePurgeError {
+ code: number;
+ message: string;
+}
+interface CachePurgeResult {
+ success: boolean;
+ errors: CachePurgeError[];
+}
+interface CachePurgeOptions {
+ tags?: string[];
+ pathPrefixes?: string[];
+ purgeEverything?: boolean;
+}
+interface CacheContext {
+ purge(options: CachePurgeOptions): Promise;
+ invalidate(options: CachePurgeOptions): Promise;
+}
+interface CloudflareAccessContext {
+ readonly aud: string;
+ getIdentity(): Promise;
+}
+declare abstract class ColoLocalActorNamespace {
+ get(actorId: string): Fetcher;
+}
+interface DurableObject {
+ fetch(request: Request): Response | Promise;
+ connect?(socket: Socket): void | Promise;
+ alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise;
+ webSocketMessage?(ws: WebSocket, message: string | ArrayBuffer): void | Promise;
+ webSocketClose?(ws: WebSocket, code: number, reason: string, wasClean: boolean): void | Promise;
+ webSocketError?(ws: WebSocket, error: unknown): void | Promise;
+}
+type DurableObjectStub = Fetcher & {
+ readonly id: DurableObjectId;
+ readonly name?: string;
+};
+interface DurableObjectId {
+ toString(): string;
+ equals(other: DurableObjectId): boolean;
+ readonly name?: string;
+ readonly jurisdiction?: string;
+}
+declare abstract class DurableObjectNamespace {
+ newUniqueId(options?: DurableObjectNamespaceNewUniqueIdOptions): DurableObjectId;
+ idFromName(name: string): DurableObjectId;
+ idFromString(id: string): DurableObjectId;
+ get(id: DurableObjectId, options?: DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStub;
+ getByName(name: string, options?: DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStub;
+ jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace;
+}
+type DurableObjectJurisdiction = "eu" | "fedramp" | "fedramp-high" | "us";
+interface DurableObjectNamespaceNewUniqueIdOptions {
+ jurisdiction?: DurableObjectJurisdiction;
+}
+type DurableObjectLocationHint = "wnam" | "enam" | "sam" | "weur" | "eeur" | "apac" | "apac-ne" | "apac-se" | "oc" | "afr" | "me";
+type DurableObjectRoutingMode = "primary-only";
+interface DurableObjectNamespaceGetDurableObjectOptions {
+ locationHint?: DurableObjectLocationHint;
+ routingMode?: DurableObjectRoutingMode;
+}
+interface DurableObjectClass<_T extends Rpc.DurableObjectBranded | undefined = undefined> {
+}
+interface DurableObjectState {
+ waitUntil(promise: Promise): void;
+ readonly exports: Cloudflare.Exports;
+ readonly props: Props;
+ readonly id: DurableObjectId;
+ readonly storage: DurableObjectStorage;
+ container?: Container;
+ facets: DurableObjectFacets;
+ blockConcurrencyWhile(callback: () => Promise): Promise;
+ acceptWebSocket(ws: WebSocket, tags?: string[]): void;
+ getWebSockets(tag?: string): WebSocket[];
+ setWebSocketAutoResponse(maybeReqResp?: WebSocketRequestResponsePair): void;
+ getWebSocketAutoResponse(): WebSocketRequestResponsePair | null;
+ getWebSocketAutoResponseTimestamp(ws: WebSocket): Date | null;
+ setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;
+ getHibernatableWebSocketEventTimeout(): number | null;
+ getTags(ws: WebSocket): string[];
+ abort(reason?: string, options?: DurableObjectAbortOptions): void;
+}
+interface DurableObjectTransaction {
+ get(key: string, options?: DurableObjectGetOptions): Promise;
+ get(keys: string[], options?: DurableObjectGetOptions): Promise>;
+ list(options?: DurableObjectListOptions): Promise>;
+ put(key: string, value: T, options?: DurableObjectPutOptions): Promise;
+ put(entries: Record, options?: DurableObjectPutOptions): Promise;
+ delete(key: string, options?: DurableObjectPutOptions): Promise;
+ delete(keys: string[], options?: DurableObjectPutOptions): Promise;
+ rollback(): void;
+ getAlarm(options?: DurableObjectGetAlarmOptions): Promise;
+ setAlarm(scheduledTime: number | Date, options?: DurableObjectSetAlarmOptions): Promise;
+ deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise;
+}
+interface DurableObjectStorage {
+ get(key: string, options?: DurableObjectGetOptions): Promise;
+ get(keys: string[], options?: DurableObjectGetOptions): Promise>;
+ list(options?: DurableObjectListOptions): Promise>;
+ put(key: string, value: T, options?: DurableObjectPutOptions): Promise;
+ put(entries: Record, options?: DurableObjectPutOptions): Promise;
+ delete(key: string, options?: DurableObjectPutOptions): Promise;
+ delete(keys: string[], options?: DurableObjectPutOptions): Promise;
+ deleteAll(options?: DurableObjectPutOptions): Promise;
+ transaction(closure: (txn: DurableObjectTransaction) => Promise): Promise;
+ getAlarm(options?: DurableObjectGetAlarmOptions): Promise;
+ setAlarm(scheduledTime: number | Date, options?: DurableObjectSetAlarmOptions): Promise;
+ deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise;
+ sync(): Promise;
+ sql: SqlStorage;
+ kv: SyncKvStorage;
+ transactionSync(closure: () => T): T;
+ getCurrentBookmark(): Promise;
+ getBookmarkForTime(timestamp: number | Date): Promise;
+ onNextSessionRestoreBookmark(bookmark: string): Promise;
+}
+interface DurableObjectAbortOptions {
+ retryAlarm?: boolean;
+}
+interface DurableObjectListOptions {
+ start?: string;
+ startAfter?: string;
+ end?: string;
+ prefix?: string;
+ reverse?: boolean;
+ limit?: number;
+ allowConcurrency?: boolean;
+ noCache?: boolean;
+}
+interface DurableObjectGetOptions {
+ allowConcurrency?: boolean;
+ noCache?: boolean;
+}
+interface DurableObjectGetAlarmOptions {
+ allowConcurrency?: boolean;
+}
+interface DurableObjectPutOptions {
+ allowConcurrency?: boolean;
+ allowUnconfirmed?: boolean;
+ noCache?: boolean;
+}
+interface DurableObjectSetAlarmOptions {
+ allowConcurrency?: boolean;
+ allowUnconfirmed?: boolean;
+}
+declare class WebSocketRequestResponsePair {
+ constructor(request: string, response: string);
+ get request(): string;
+ get response(): string;
+}
+interface DurableObjectFacets {
+ get(name: string, getStartupOptions: () => FacetStartupOptions | Promise>): Fetcher;
+ abort(name: string, reason: any): void;
+ delete(name: string): void;
+ clone(src: string, dst: string): void;
+}
+interface FacetStartupOptions {
+ id?: DurableObjectId | string;
+ class: DurableObjectClass;
+}
+interface AnalyticsEngineDataset {
+ writeDataPoint(event?: AnalyticsEngineDataPoint): void;
+}
+interface AnalyticsEngineDataPoint {
+ indexes?: ((ArrayBuffer | string) | null)[];
+ doubles?: number[];
+ blobs?: ((ArrayBuffer | string) | null)[];
+}
+/**
+ * The **`Event`** interface represents an event which takes place on an EventTarget.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event)
+ */
+declare class Event {
+ constructor(type: string, init?: EventInit);
+ /**
+ * The **`type`** read-only property of the Event interface returns a string containing the event's type. It is set when the event is constructed and is the name commonly used to refer to the specific event, such as click, load, or error.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/type)
+ */
+ get type(): string;
+ /**
+ * The **`eventPhase`** read-only property of the Event interface indicates which phase of the event flow is currently being evaluated.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/eventPhase)
+ */
+ get eventPhase(): number;
+ /**
+ * The read-only **`composed`** property of the Event interface returns a boolean value which indicates whether or not the event will propagate across the shadow DOM boundary into the standard DOM.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composed)
+ */
+ get composed(): boolean;
+ /**
+ * The **`bubbles`** read-only property of the Event interface indicates whether the event bubbles up through the DOM tree or not.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/bubbles)
+ */
+ get bubbles(): boolean;
+ /**
+ * The **`cancelable`** read-only property of the Event interface indicates whether the event can be canceled, and therefore prevented as if the event never happened.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelable)
+ */
+ get cancelable(): boolean;
+ /**
+ * The **`defaultPrevented`** read-only property of the Event interface returns a boolean value indicating whether or not the call to Event.preventDefault() canceled the event.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/defaultPrevented)
+ */
+ get defaultPrevented(): boolean;
+ /**
+ * The Event property **`returnValue`** indicates whether the default action for this event has been prevented or not.
+ * @deprecated
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/returnValue)
+ */
+ get returnValue(): boolean;
+ /**
+ * The **`currentTarget`** read-only property of the Event interface identifies the element to which the event handler has been attached.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/currentTarget)
+ */
+ get currentTarget(): EventTarget | undefined;
+ /**
+ * The read-only **`target`** property of the Event interface is a reference to the object onto which the event was dispatched. It is different from Event.currentTarget when the event handler is called during the bubbling or capturing phase of the event.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/target)
+ */
+ get target(): EventTarget | undefined;
+ /**
+ * The deprecated **`Event.srcElement`** is an alias for the Event.target property. Use Event.target instead.
+ * @deprecated
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/srcElement)
+ */
+ get srcElement(): EventTarget | undefined;
+ /**
+ * The **`timeStamp`** read-only property of the Event interface returns the time (in milliseconds) at which the event was created.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/timeStamp)
+ */
+ get timeStamp(): number;
+ /**
+ * The **`isTrusted`** read-only property of the Event interface is a boolean value that is true 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 EventTarget.dispatchEvent(). The only exception is the click event, which initializes the isTrusted property to false in user agents.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/isTrusted)
+ */
+ get isTrusted(): boolean;
+ /**
+ * The **`cancelBubble`** property of the Event interface is deprecated. Use Event.stopPropagation() instead. Setting its value to true before returning from an event handler prevents propagation of the event. In later implementations, setting this to false does nothing. See Browser compatibility for details.
+ * @deprecated
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)
+ */
+ get cancelBubble(): boolean;
+ /**
+ * The **`cancelBubble`** property of the Event interface is deprecated. Use Event.stopPropagation() instead. Setting its value to true before returning from an event handler prevents propagation of the event. In later implementations, setting this to false does nothing. See Browser compatibility for details.
+ * @deprecated
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)
+ */
+ set cancelBubble(value: boolean);
+ /**
+ * The **`stopImmediatePropagation()`** method of the Event interface prevents other listeners of the same event from being called.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopImmediatePropagation)
+ */
+ stopImmediatePropagation(): void;
+ /**
+ * The **`preventDefault()`** method of the Event interface tells the user agent that the event is being explicitly handled, so its default action, such as page scrolling, link navigation, or pasting text, should not be taken.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/preventDefault)
+ */
+ preventDefault(): void;
+ /**
+ * The **`stopPropagation()`** method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases. It does not, however, prevent any default behaviors from occurring; for instance, clicks on links are still processed. If you want to stop those behaviors, see the preventDefault() method. It also does not prevent propagation to other event-handlers of the current element. If you want to stop those, see stopImmediatePropagation().
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopPropagation)
+ */
+ stopPropagation(): void;
+ /**
+ * The **`composedPath()`** method of the Event interface returns the event's path which is an array of the objects on which listeners will be invoked. This does not include nodes in shadow trees if the shadow root was created with its ShadowRoot.mode closed.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composedPath)
+ */
+ composedPath(): EventTarget[];
+ static readonly NONE: number;
+ static readonly CAPTURING_PHASE: number;
+ static readonly AT_TARGET: number;
+ static readonly BUBBLING_PHASE: number;
+}
+interface EventInit {
+ bubbles?: boolean;
+ cancelable?: boolean;
+ composed?: boolean;
+}
+type EventListener = (event: EventType) => void;
+interface EventListenerObject {
+ handleEvent(event: EventType): void;
+}
+type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
+/**
+ * The **`EventTarget`** interface is implemented by objects that can receive events and may have listeners for them. In other words, any target of events implements the three methods associated with this interface.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget)
+ */
+declare class EventTarget = Record> {
+ constructor();
+ /**
+ * The **`addEventListener()`** method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
+ */
+ addEventListener(type: Type, handler: EventListenerOrEventListenerObject, options?: EventTargetAddEventListenerOptions | boolean): void;
+ /**
+ * The **`removeEventListener()`** method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target. The event listener to be removed is identified using a combination of the event type, the event listener function itself, and various optional options that may affect the matching process; see Matching event listeners for removal.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
+ */
+ removeEventListener(type: Type, handler: EventListenerOrEventListenerObject, options?: EventTargetEventListenerOptions | boolean): void;
+ /**
+ * The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually with dispatchEvent().
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
+ */
+ dispatchEvent(event: EventMap[keyof EventMap]): boolean;
+}
+interface EventTargetEventListenerOptions {
+ capture?: boolean;
+}
+interface EventTargetAddEventListenerOptions {
+ capture?: boolean;
+ passive?: boolean;
+ once?: boolean;
+ signal?: AbortSignal;
+}
+interface EventTargetHandlerObject {
+ handleEvent: (event: Event) => any | undefined;
+}
+/**
+ * The **`AbortController`** interface represents a controller object that allows you to abort one or more Web requests as and when desired.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController)
+ */
+declare class AbortController {
+ constructor();
+ /**
+ * The **`signal`** read-only property of the AbortController interface returns an AbortSignal object instance, which can be used to communicate with/abort an asynchronous operation as desired.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/signal)
+ */
+ get signal(): AbortSignal;
+ /**
+ * The **`abort()`** method of the AbortController interface aborts an asynchronous operation before it has completed. This is able to abort fetch requests, the consumption of any response bodies, or streams.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/abort)
+ */
+ abort(reason?: any): void;
+}
+/**
+ * The **`AbortSignal`** interface represents a signal object that allows you to communicate with an asynchronous operation (such as a fetch request) and abort it if required via an AbortController object.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal)
+ */
+declare abstract class AbortSignal extends EventTarget {
+ /**
+ * The **`AbortSignal.abort()`** static method returns an AbortSignal that is already set as aborted (and which does not trigger an abort event).
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_static)
+ */
+ static abort(reason?: any): AbortSignal;
+ /**
+ * The **`AbortSignal.timeout()`** static method returns an AbortSignal that will automatically abort after a specified time.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/timeout_static)
+ */
+ static timeout(delay: number): AbortSignal;
+ /**
+ * The **`AbortSignal.any()`** static method takes an iterable of abort signals and returns an AbortSignal. The returned abort signal is aborted when any of the input iterable abort signals are aborted. The abort reason will be set to the reason of the first signal that is aborted. If any of the given abort signals are already aborted then so will be the returned AbortSignal.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/any_static)
+ */
+ static any(signals: AbortSignal[]): AbortSignal;
+ /**
+ * The **`aborted`** read-only property returns a value that indicates whether the asynchronous operations the signal is communicating with are aborted (true) or not (false).
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/aborted)
+ */
+ get aborted(): boolean;
+ /**
+ * The **`reason`** read-only property returns a JavaScript value that indicates the abort reason.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/reason)
+ */
+ get reason(): any;
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */
+ get onabort(): any | null;
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */
+ set onabort(value: any | null);
+ /**
+ * The **`throwIfAborted()`** method throws the signal's abort reason if the signal has been aborted; otherwise it does nothing.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/throwIfAborted)
+ */
+ throwIfAborted(): void;
+}
+/**
+ * The **`Scheduler`** interface of the Prioritized Task Scheduling API provides methods for scheduling prioritized tasks.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Scheduler)
+ */
+interface Scheduler {
+ wait(delay: number, maybeOptions?: SchedulerWaitOptions): Promise;
+}
+interface SchedulerWaitOptions {
+ signal?: AbortSignal;
+}
+/**
+ * The **`ExtendableEvent`** interface extends the lifetime of the install and activate events dispatched on the global scope as part of the service worker lifecycle. This ensures that any functional events (like FetchEvent) are not dispatched until it upgrades database schemas and deletes the outdated cache entries.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent)
+ */
+declare abstract class ExtendableEvent extends Event {
+ /**
+ * The **`ExtendableEvent.waitUntil()`** method tells the event dispatcher that work is ongoing. It can also be used to detect whether that work was successful. In service workers, waitUntil() tells the browser that work is ongoing until the promise settles, and it shouldn't terminate the service worker if it wants that work to complete.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent/waitUntil)
+ */
+ waitUntil(promise: Promise): void;
+}
+/**
+ * The **`CustomEvent`** interface can be used to attach custom data to an event generated by an application.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent)
+ */
+declare class CustomEvent extends Event {
+ constructor(type: string, init?: CustomEventCustomEventInit);
+ /**
+ * The read-only **`detail`** property of the CustomEvent interface returns any data passed when initializing the event.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent/detail)
+ */
+ get detail(): T;
+}
+interface CustomEventCustomEventInit {
+ bubbles?: boolean;
+ cancelable?: boolean;
+ composed?: boolean;
+ detail?: any;
+}
+/**
+ * The **`Blob`** interface represents a blob, which is a file-like object of immutable, raw data; they can be read as text or binary data, or converted into a ReadableStream so its methods can be used for processing the data.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob)
+ */
+declare class Blob {
+ constructor(bits?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[], options?: BlobOptions);
+ /**
+ * The **`size`** read-only property of the Blob interface returns the size of the Blob or File in bytes.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size)
+ */
+ get size(): number;
+ /**
+ * The **`type`** read-only property of the Blob interface returns the MIME type of the file.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type)
+ */
+ get type(): string;
+ /**
+ * The **`slice()`** method of the Blob interface creates and returns a new Blob object which contains data from a subset of the blob on which it's called.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice)
+ */
+ slice(start?: number, end?: number, type?: string): Blob;
+ /**
+ * The **`arrayBuffer()`** method of the Blob interface returns a Promise that resolves with the contents of the blob as binary data contained in an ArrayBuffer.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/arrayBuffer)
+ */
+ arrayBuffer(): Promise;
+ /**
+ * The **`bytes()`** method of the Blob interface returns a Promise that resolves with a Uint8Array containing the contents of the blob as an array of bytes.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/bytes)
+ */
+ bytes(): Promise;
+ /**
+ * The **`text()`** method of the Blob interface returns a Promise that resolves with a string containing the contents of the blob, interpreted as UTF-8.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text)
+ */
+ text(): Promise;
+ /**
+ * The **`stream()`** method of the Blob interface returns a ReadableStream which upon reading returns the data contained within the Blob.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/stream)
+ */
+ stream(): ReadableStream;
+}
+interface BlobOptions {
+ type?: string;
+}
+/**
+ * The **`File`** interface provides information about files and allows JavaScript in a web page to access their content.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File)
+ */
+declare class File extends Blob {
+ constructor(bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined, name: string, options?: FileOptions);
+ /**
+ * The **`name`** read-only property of the File interface returns the name of the file represented by a File object. For security reasons, the path is excluded from this property.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name)
+ */
+ get name(): string;
+ /**
+ * The **`lastModified`** read-only property of the File interface provides the last modified date of the file as the number of milliseconds since the Unix epoch (January 1, 1970 at midnight). Files without a known last modified date return the current date.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified)
+ */
+ get lastModified(): number;
+}
+interface FileOptions {
+ type?: string;
+ lastModified?: number;
+}
+/**
+* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache.
+*
+* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/)
+*/
+declare abstract class CacheStorage {
+ /**
+ * The **`open()`** method of the CacheStorage interface returns a Promise that resolves to the Cache object matching the cacheName.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/open)
+ */
+ open(cacheName: string): Promise;
+ readonly default: Cache;
+}
+/**
+* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache.
+*
+* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/)
+*/
+declare abstract class Cache {
+ /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#delete) */
+ delete(request: RequestInfo | URL, options?: CacheQueryOptions): Promise;
+ /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#match) */
+ match(request: RequestInfo | URL, options?: CacheQueryOptions): Promise