diff --git a/examples-cloudflare/playground14/.dev.vars b/examples-cloudflare/playground14/.dev.vars
deleted file mode 100644
index 17f2dcc2..00000000
--- a/examples-cloudflare/playground14/.dev.vars
+++ /dev/null
@@ -1 +0,0 @@
-NEXTJS_ENV=development
\ No newline at end of file
diff --git a/examples-cloudflare/playground14/.env.development b/examples-cloudflare/playground14/.env.development
deleted file mode 100644
index 561d7791..00000000
--- a/examples-cloudflare/playground14/.env.development
+++ /dev/null
@@ -1,2 +0,0 @@
-TEST_ENV_VAR=TEST_VALUE
-PROCESS_ENV_VAR=.ENV_FILE
\ No newline at end of file
diff --git a/examples-cloudflare/playground14/.gitignore b/examples-cloudflare/playground14/.gitignore
deleted file mode 100644
index 3a282111..00000000
--- a/examples-cloudflare/playground14/.gitignore
+++ /dev/null
@@ -1,45 +0,0 @@
-# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
-
-# dependencies
-/node_modules
-/.pnp
-.pnp.js
-.yarn/install-state.gz
-
-# testing
-/coverage
-
-# next.js
-/.next/
-/out/
-
-# production
-/build
-
-# misc
-.DS_Store
-*.pem
-
-# debug
-npm-debug.log*
-yarn-debug.log*
-yarn-error.log*
-
-# local env files
-.env*.local
-
-# vercel
-.vercel
-
-# typescript
-*.tsbuildinfo
-next-env.d.ts
-
-# wrangler
-.wrangler
-
-# playwright
-/test-results/
-/playwright-report/
-/blob-report/
-/playwright/.cache/
diff --git a/examples-cloudflare/playground14/app/api/buildid/route.ts b/examples-cloudflare/playground14/app/api/buildid/route.ts
deleted file mode 100644
index 4c1d46ad..00000000
--- a/examples-cloudflare/playground14/app/api/buildid/route.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-// Use headers to force a dynamic response
-import { headers } from "next/headers";
-
-export async function GET() {
- const nextConfig = process.env.__NEXT_PRIVATE_STANDALONE_CONFIG
- ? JSON.parse(process.env.__NEXT_PRIVATE_STANDALONE_CONFIG)
- : undefined;
- return Response.json({ nextConfig, headers: headers() });
-}
diff --git a/examples-cloudflare/playground14/app/api/env/route.ts b/examples-cloudflare/playground14/app/api/env/route.ts
deleted file mode 100644
index d51838cf..00000000
--- a/examples-cloudflare/playground14/app/api/env/route.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-// This test relies on using `.dev.vars` to set the environment to `development`
-// However `next build` is not passed an environment, so we do not want to cache
-// the output.
-export const dynamic = "force-dynamic";
-
-export async function GET() {
- return new Response(JSON.stringify(process.env));
-}
diff --git a/examples-cloudflare/playground14/app/api/hello/route.ts b/examples-cloudflare/playground14/app/api/hello/route.ts
deleted file mode 100644
index f969ff6d..00000000
--- a/examples-cloudflare/playground14/app/api/hello/route.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-import { getCloudflareContext } from "@opennextjs/cloudflare";
-import { headers } from "next/headers";
-
-export async function GET() {
- const headersList = headers();
-
- const fromCloudflareContext = headersList.has("from-cloudflare-context");
-
- if (!fromCloudflareContext) {
- return new Response("Hello World!");
- }
-
- // Retrieve the bindings defined in wrangler.json
- return new Response(getCloudflareContext().env.hello);
-}
-
-export async function POST(request: Request) {
- const text = await request.text();
- return new Response(`Hello post-World! body=${text}`);
-}
diff --git a/examples-cloudflare/playground14/app/api/instrumentation/route.ts b/examples-cloudflare/playground14/app/api/instrumentation/route.ts
deleted file mode 100644
index 4d27372e..00000000
--- a/examples-cloudflare/playground14/app/api/instrumentation/route.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import { NextResponse } from "next/server";
-
-export const dynamic = "force-dynamic";
-
-export function GET() {
- return NextResponse.json({
- "nodejs-instrumentation-setup": globalThis["__NODEJS_INSTRUMENTATION_SETUP"],
- "edge-instrumentation-setup": globalThis["__EDGE_INSTRUMENTATION_SETUP"],
- });
-}
diff --git a/examples-cloudflare/playground14/app/api/request/route.ts b/examples-cloudflare/playground14/app/api/request/route.ts
deleted file mode 100644
index 277e4236..00000000
--- a/examples-cloudflare/playground14/app/api/request/route.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-import { NextRequest } from "next/server";
-
-export const GET = (request: NextRequest) => {
- return new Response(JSON.stringify({ nextUrl: request.nextUrl.href, url: request.url }));
-};
diff --git a/examples-cloudflare/playground14/app/isr/[id]/dynamic/page.tsx b/examples-cloudflare/playground14/app/isr/[id]/dynamic/page.tsx
deleted file mode 100644
index 95883aad..00000000
--- a/examples-cloudflare/playground14/app/isr/[id]/dynamic/page.tsx
+++ /dev/null
@@ -1,32 +0,0 @@
-import { getPost } from "../../../../lib/posts";
-
-// Imported from https://nextjs.org/docs/app/building-your-application/data-fetching/incremental-static-regeneration
-interface Post {
- id: string;
- title: string;
- content: string;
-}
-
-// Next.js will invalidate the cache when a
-// request comes in, at most once every 1 hour.
-export const revalidate = 3600;
-
-// We'll prerender only the params from `generateStaticParams` at build time.
-// If a request comes in for a path that hasn't been generated,
-// Next.js will server-render the page on-demand.
-export const dynamicParams = true;
-
-export async function generateStaticParams() {
- return [{ id: "1" }, { id: "2" }, { id: "3" }];
-}
-
-export default async function Page({ params }: { params: Promise<{ id: string }> }) {
- const id = (await params).id;
- const post: Post = await getPost({ id }).then((res) => res.json());
- return (
-
- {post.title}
- {post.content}
-
- );
-}
diff --git a/examples-cloudflare/playground14/app/isr/[id]/no-dynamic/page.tsx b/examples-cloudflare/playground14/app/isr/[id]/no-dynamic/page.tsx
deleted file mode 100644
index 8dbec2f1..00000000
--- a/examples-cloudflare/playground14/app/isr/[id]/no-dynamic/page.tsx
+++ /dev/null
@@ -1,31 +0,0 @@
-import { getPost } from "../../../../lib/posts";
-
-// Imported from https://nextjs.org/docs/app/building-your-application/data-fetching/incremental-static-regeneration
-interface Post {
- id: string;
- title: string;
- content: string;
-}
-
-// Next.js will invalidate the cache when a
-// request comes in, at most once every 1 hour.
-export const revalidate = 3600;
-
-// We'll prerender only the params from `generateStaticParams` at build time.
-// If a request comes in for a path that hasn't been generated, it will 404.
-export const dynamicParams = false;
-
-export async function generateStaticParams() {
- return [{ id: "1" }, { id: "2" }, { id: "3" }];
-}
-
-export default async function Page({ params }: { params: Promise<{ id: string }> }) {
- const id = (await params).id;
- const post: Post = await getPost({ id }).then((res) => res.json());
- return (
-
- {post.title}
- {post.content}
-
- );
-}
diff --git a/examples-cloudflare/playground14/app/layout.js b/examples-cloudflare/playground14/app/layout.js
deleted file mode 100644
index d3cded23..00000000
--- a/examples-cloudflare/playground14/app/layout.js
+++ /dev/null
@@ -1,12 +0,0 @@
-export const metadata = {
- title: "API hello-world",
- description: "a simple api hello-world app",
-};
-
-export default function RootLayout({ children }) {
- return (
-
-
{children}
-
- );
-}
diff --git a/examples-cloudflare/playground14/app/og/route.tsx b/examples-cloudflare/playground14/app/og/route.tsx
deleted file mode 100644
index 97766095..00000000
--- a/examples-cloudflare/playground14/app/og/route.tsx
+++ /dev/null
@@ -1,63 +0,0 @@
-import { ImageResponse } from "next/og";
-
-export const dynamic = "force-dynamic";
-
-export async function GET() {
- try {
- return new ImageResponse(
-
-
-
-
-
- 'next/og'
-
-
,
- {
- width: 1200,
- height: 630,
- }
- );
- } catch (e: any) {
- return new Response("Failed to generate the image", {
- status: 500,
- });
- }
-}
diff --git a/examples-cloudflare/playground14/app/page.js b/examples-cloudflare/playground14/app/page.js
deleted file mode 100644
index 081a8856..00000000
--- a/examples-cloudflare/playground14/app/page.js
+++ /dev/null
@@ -1,7 +0,0 @@
-export default function Home() {
- return (
-
- Test misc Next features
-
- );
-}
diff --git a/examples-cloudflare/playground14/e2e/base.spec.ts b/examples-cloudflare/playground14/e2e/base.spec.ts
deleted file mode 100644
index 492aee9f..00000000
--- a/examples-cloudflare/playground14/e2e/base.spec.ts
+++ /dev/null
@@ -1,67 +0,0 @@
-import { createHash } from "node:crypto";
-import type { BinaryLike } from "node:crypto";
-
-import { test, expect } from "@playwright/test";
-
-const OG_MD5 = "2f7b724d62d8c7739076da211aa62e7b";
-
-export function validateMd5(data: Buffer, expectedHash: string) {
- return (
- createHash("md5")
- .update(data as BinaryLike)
- .digest("hex") === expectedHash
- );
-}
-
-test.describe("playground/base", () => {
- test("index", async ({ page }) => {
- await page.goto("/");
- await expect(page.getByText("Test misc Next features")).toBeVisible();
- });
-
- test("the hello-world api GET route works as intended", async ({ page }) => {
- const res = await page.request.get("/api/hello");
- expect(res.headers()["content-type"]).toContain("text/plain");
- expect(await res.text()).toEqual("Hello World!");
- });
-
- test("returns a hello world string from the cloudflare context env", async ({ page }) => {
- const res = await page.request.get("/api/hello", {
- headers: {
- "from-cloudflare-context": "true",
- },
- });
- expect(res.headers()["content-type"]).toContain("text/plain");
- expect(await res.text()).toEqual("Hello World from the cloudflare context!");
- });
-
- test("the hello-world api POST route works as intended", async ({ page }) => {
- const res = await page.request.post("/api/hello", { data: "some body" });
- expect(res.headers()["content-type"]).toContain("text/plain");
- await expect(res.text()).resolves.toEqual("Hello post-World! body=some body");
- });
-
- test("sets environment variables from the Next.js env file", async ({ page }) => {
- const res = await page.request.get("/api/env");
- await expect(res.json()).resolves.toEqual(expect.objectContaining({ TEST_ENV_VAR: "TEST_VALUE" }));
- });
-
- test("returns correct information about the request from a route handler", async ({ page, baseURL }) => {
- const res = await page.request.get("/api/request");
- // Next.js can fall back to `localhost:3000` or `n` if it doesn't get the host - neither of these are expected.
- const expectedURL = `${baseURL}/api/request`;
- await expect(res.json()).resolves.toEqual({ nextUrl: expectedURL, url: expectedURL });
- });
-
- test("Pages router API routes", async ({ page }) => {
- const res = await page.request.get("/api/pages");
- expect(await res.json()).toEqual({ hello: "world" });
- });
-
- test("generates an og image successfully", async ({ page }) => {
- const res = await page.request.get("/og");
- expect(res.status()).toEqual(200);
- expect(res.headers()["content-type"]).toEqual("image/png");
- expect(validateMd5(await res.body(), OG_MD5)).toEqual(true);
- });
-});
diff --git a/examples-cloudflare/playground14/e2e/cloudflare.spec.ts b/examples-cloudflare/playground14/e2e/cloudflare.spec.ts
deleted file mode 100644
index 7a9a8b9b..00000000
--- a/examples-cloudflare/playground14/e2e/cloudflare.spec.ts
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- * Cloudflare specific tests.
- *
- * The tests in this file do not run on Node (`next dev`).
- */
-
-import { test, expect } from "@playwright/test";
-import sharp from "sharp";
-
-test.describe("playground/cloudflare", () => {
- test("NextConfig", async ({ page }) => {
- const res = await page.request.get("/api/buildid");
- expect(res.status()).toEqual(200);
- const { nextConfig } = await res.json();
- expect(nextConfig.output).toEqual("standalone");
- });
-
- test("Environment variable defined on process.env are not overridden by .env files", async ({ page }) => {
- const res = await page.request.get("/api/env");
- await expect(res.json()).resolves.toEqual(expect.objectContaining({ PROCESS_ENV_VAR: "process.env" }));
- });
-
- test.describe("remotePatterns", () => {
- test("fetch an image allowed by remotePatterns", async ({ page }) => {
- const res = await page.request.get(
- "/_next/image?url=https://avatars.githubusercontent.com/u/248818&w=256&q=75"
- );
- expect(res.status()).toBe(200);
- expect(res.headers()).toMatchObject({ "content-type": "image/jpeg" });
- });
-
- test("400 when fetching an image disallowed by remotePatterns", async ({ page }) => {
- const res = await page.request.get(
- "/_next/image?url=https://avatars.githubusercontent.com/u/248817&w=256&q=75"
- );
- expect(res.status()).toBe(400);
- });
- });
-
- test.describe("localPatterns", () => {
- test("fetch an image allowed by localPatterns", async ({ page }) => {
- const res = await page.request.get("/_next/image?url=/snipp/snipp.webp?iscute=yes&w=256&q=75");
- expect(res.status()).toBe(200);
- expect(res.headers()).toMatchObject({ "content-type": "image/webp" });
- });
-
- test("400 when fetching an image disallowed by localPatterns with wrong query parameter", async ({
- page,
- }) => {
- const res = await page.request.get("/_next/image?url=/snipp/snipp?iscute=no&w=256&q=75");
- expect(res.status()).toBe(400);
- });
-
- test("400 when fetching an image disallowed by localPatterns without query parameter", async ({
- page,
- }) => {
- const res = await page.request.get("/_next/image?url=/snipp/snipp&w=256&q=75");
- expect(res.status()).toBe(400);
- });
- });
-
- test.describe("imageSizes", () => {
- test("400 when fetching an image with unsupported width value", async ({ page }) => {
- const res = await page.request.get("/_next/image?url=/snipp/snipp.webp?iscute=yes&w=100&q=75");
- expect(res.status()).toBe(400);
- });
- });
-
- test.describe("qualities", () => {
- test("400 when fetching an image with unsupported quality value", async ({ page }) => {
- const res = await page.request.get("/_next/image?url=/snipp/snipp.webp?iscute=yes&w=256&q=100");
- expect(res.status()).toBe(400);
- });
- });
-
- test.describe('"w" parameter', () => {
- test("Image is shrunk to target width", async ({ page }) => {
- const res = await page.request.get("/_next/image?url=/snipp/snipp.webp?iscute=yes&w=256&q=75");
- expect(res.status()).toBe(200);
- const buffer = await res.body();
- const metadata = await sharp(buffer).metadata();
- expect(metadata.width).toBe(256);
- });
- });
-});
diff --git a/examples-cloudflare/playground14/e2e/head.spec.ts b/examples-cloudflare/playground14/e2e/head.spec.ts
deleted file mode 100644
index 77d9fded..00000000
--- a/examples-cloudflare/playground14/e2e/head.spec.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-import { test, expect } from "@playwright/test";
-
-test.describe("head properly populated", () => {
- test("should properly populate the ", async ({ page }) => {
- await page.goto("/head");
- const title = await page.title();
- const description = await page.locator('meta[name="description"]').getAttribute("content");
- const favicon = await page.locator('link[rel="icon"]').getAttribute("href");
- expect(title).toBe("SSR Head");
- expect(description).toBe("SSR");
- expect(favicon).toBe("/favicon.ico");
- });
-});
diff --git a/examples-cloudflare/playground14/e2e/instrumentation.spec.ts b/examples-cloudflare/playground14/e2e/instrumentation.spec.ts
deleted file mode 100644
index 9ffc4fee..00000000
--- a/examples-cloudflare/playground14/e2e/instrumentation.spec.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-import { test, expect } from "@playwright/test";
-
-test.describe("instrumentation", () => {
- test("the instrumentation register hook should work for the nodejs runtime", async ({ page }) => {
- const res = await page.request.get("/api/instrumentation");
- const respJson: Record = await res.json();
- expect(respJson["nodejs-instrumentation-setup"]).toEqual(
- "this value has been set by calling the instrumentation `register` callback in the nodejs runtime"
- );
- });
-
- test("the instrumentation register hook should work for the edge runtime", async ({ page }) => {
- const res = await page.request.get("/middleware-instrumentation");
- const respJson: Record = await res.json();
- expect(respJson["edge-instrumentation-setup"]).toEqual(
- "this value has been set by calling the instrumentation `register` callback in the edge runtime"
- );
- });
-
- // Note: we cannot test this since currently both runtimes share the same global scope
- // (see: https://github.com/opennextjs/opennextjs-cloudflare/issues/408)
- test.describe.skip("isolation", () => {
- test("the instrumentation register hook nodejs logic should not effect edge routes", async ({ page }) => {
- const res = await page.request.get("/middleware-instrumentation");
- const respJson: Record = await res.json();
- expect(respJson["nodejs-instrumentation-setup"]).toBeUndefined();
- });
-
- test("the instrumentation register hook edge logic should not effect nodejs routes", async ({ page }) => {
- const res = await page.request.get("/api/instrumentation");
- const respJson: Record = await res.json();
- expect(respJson["edge-instrumentation-setup"]).toBeUndefined();
- });
- });
-});
diff --git a/examples-cloudflare/playground14/e2e/isr.spec.ts b/examples-cloudflare/playground14/e2e/isr.spec.ts
deleted file mode 100644
index 1a85540b..00000000
--- a/examples-cloudflare/playground14/e2e/isr.spec.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-import { test, expect, type APIResponse } from "@playwright/test";
-
-test.describe("playground/isr", () => {
- test("Generated pages exist", async ({ page }) => {
- const generatedIds = [1, 2, 3];
- let res: APIResponse;
- for (const id of generatedIds) {
- res = await page.request.get(`/isr/${id}/dynamic`);
- expect(res.status()).toBe(200);
- res = await page.request.get(`/isr/${id}/no-dynamic`);
- expect(res.status()).toBe(200);
- }
- });
-
- test("Non generated pages 404 when dynamic is false", async ({ page }) => {
- const generatedIds = [4, 5, 6];
- for (const id of generatedIds) {
- const res = await page.request.get(`/isr/${id}/no-dynamic`);
- expect(res.status()).toBe(404);
- }
- });
-
- test("Non generated pages are generated when dynamic is true", async ({ page }) => {
- const generatedIds = [4, 5, 6];
- for (const id of generatedIds) {
- const res = await page.request.get(`/isr/${id}/dynamic`);
- expect(res.status()).toBe(200);
- }
- });
-});
diff --git a/examples-cloudflare/playground14/e2e/playwright.config.ts b/examples-cloudflare/playground14/e2e/playwright.config.ts
deleted file mode 100644
index 4244c86d..00000000
--- a/examples-cloudflare/playground14/e2e/playwright.config.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import { configurePlaywright } from "../../common/config-e2e";
-
-export default configurePlaywright("playground14");
diff --git a/examples-cloudflare/playground14/e2e/playwright.dev.config.ts b/examples-cloudflare/playground14/e2e/playwright.dev.config.ts
deleted file mode 100644
index 5eb1bf01..00000000
--- a/examples-cloudflare/playground14/e2e/playwright.dev.config.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-import { configurePlaywright } from "../../common/config-e2e";
-
-export default configurePlaywright("playground14", {
- isWorker: false,
-});
diff --git a/examples-cloudflare/playground14/instrumentation.js b/examples-cloudflare/playground14/instrumentation.js
deleted file mode 100644
index cae6f386..00000000
--- a/examples-cloudflare/playground14/instrumentation.js
+++ /dev/null
@@ -1,15 +0,0 @@
-export function register() {
- // Note: we register instrumentation for both the nodejs and edge runtime, we do that using the NEXT_RUNTIME env
- // variable as recommended in the official docs:
- // https://nextjs.org/docs/app/building-your-application/optimizing/instrumentation#importing-runtime-specific-code
-
- if (process.env.NEXT_RUNTIME === "nodejs") {
- globalThis["__NODEJS_INSTRUMENTATION_SETUP"] =
- "this value has been set by calling the instrumentation `register` callback in the nodejs runtime";
- }
-
- if (process.env.NEXT_RUNTIME === "edge") {
- globalThis["__EDGE_INSTRUMENTATION_SETUP"] =
- "this value has been set by calling the instrumentation `register` callback in the edge runtime";
- }
-}
diff --git a/examples-cloudflare/playground14/lib/posts.ts b/examples-cloudflare/playground14/lib/posts.ts
deleted file mode 100644
index 410fc2b2..00000000
--- a/examples-cloudflare/playground14/lib/posts.ts
+++ /dev/null
@@ -1,53 +0,0 @@
-const posts = [
- {
- id: 1,
- title: "Lorem Ipsum - What Is It and How to Use It?",
- content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. ...",
- author: "John Doe",
- date: "2023-08-01",
- category: "Technology",
- },
- {
- id: 2,
- title: "The Benefits of Regular Exercise",
- content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. ...",
- author: "Jane Smith",
- date: "2023-07-25",
- category: "Health & Fitness",
- },
- {
- id: 3,
- title: "Mastering the Art of Cooking",
- content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. ...",
- author: "Michael Johnson",
- date: "2023-07-18",
- category: "Food & Cooking",
- },
- {
- id: 4,
- title: "Traveling on a Budget - Tips and Tricks",
- content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. ...",
- author: "Emily Brown",
- date: "2023-07-10",
- category: "Travel",
- },
- {
- id: 5,
- title: "The Rise of Artificial Intelligence in Modern Society",
- content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. ...",
- author: "David Lee",
- date: "2023-06-29",
- category: "Technology",
- },
- {
- id: 6,
- title: "10 Must-Read Books for Summer",
- content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. ...",
- author: "Sarah Johnson",
- date: "2023-06-21",
- category: "Books",
- },
-];
-
-export const getPost = (opts: { id: string }) =>
- Promise.resolve(new Response(JSON.stringify(posts.find((p) => p.id === Number(opts.id)))));
diff --git a/examples-cloudflare/playground14/middleware.js b/examples-cloudflare/playground14/middleware.js
deleted file mode 100644
index 1b43c89c..00000000
--- a/examples-cloudflare/playground14/middleware.js
+++ /dev/null
@@ -1,12 +0,0 @@
-import { NextResponse } from "next/server";
-
-export function middleware() {
- return NextResponse.json({
- "nodejs-instrumentation-setup": globalThis["__NODEJS_INSTRUMENTATION_SETUP"],
- "edge-instrumentation-setup": globalThis["__EDGE_INSTRUMENTATION_SETUP"],
- });
-}
-
-export const config = {
- matcher: ["/middleware-instrumentation"],
-};
diff --git a/examples-cloudflare/playground14/next.config.mjs b/examples-cloudflare/playground14/next.config.mjs
deleted file mode 100644
index 24e77289..00000000
--- a/examples-cloudflare/playground14/next.config.mjs
+++ /dev/null
@@ -1,31 +0,0 @@
-import { initOpenNextCloudflareForDev } from "@opennextjs/cloudflare";
-
-initOpenNextCloudflareForDev();
-
-/** @type {import('next').NextConfig} */
-const nextConfig = {
- typescript: { ignoreBuildErrors: true },
- eslint: { ignoreDuringBuilds: true },
- experimental: {
- // Generate source map to validate the fix for opennextjs/opennextjs-cloudflare#341
- serverSourceMaps: true,
- instrumentationHook: true,
- },
- images: {
- remotePatterns: [
- {
- protocol: "https",
- hostname: "avatars.githubusercontent.com",
- pathname: "/u/248818",
- },
- ],
- localPatterns: [
- {
- pathname: "/snipp/**",
- search: "?iscute=yes",
- },
- ],
- },
-};
-
-export default nextConfig;
diff --git a/examples-cloudflare/playground14/open-next.config.ts b/examples-cloudflare/playground14/open-next.config.ts
deleted file mode 100644
index 6ea08a5a..00000000
--- a/examples-cloudflare/playground14/open-next.config.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import { defineCloudflareConfig } from "@opennextjs/cloudflare";
-import kvIncrementalCache from "@opennextjs/cloudflare/overrides/incremental-cache/kv-incremental-cache";
-
-export default defineCloudflareConfig({
- incrementalCache: kvIncrementalCache,
- enableCacheInterception: true,
-});
diff --git a/examples-cloudflare/playground14/package.json b/examples-cloudflare/playground14/package.json
deleted file mode 100644
index 282af481..00000000
--- a/examples-cloudflare/playground14/package.json
+++ /dev/null
@@ -1,30 +0,0 @@
-{
- "name": "examples-cloudflare/playground14",
- "version": "0.1.0",
- "private": true,
- "type": "module",
- "scripts": {
- "dev": "next dev",
- "build": "next build",
- "start": "next start",
- "lint": "next lint",
- "build:worker": "pnpm opennextjs-cloudflare build",
- "preview:worker": "pnpm opennextjs-cloudflare preview",
- "preview": "pnpm build:worker && pnpm preview:worker",
- "e2e": "playwright test -c e2e/playwright.config.ts",
- "e2e:dev": "playwright test -c e2e/playwright.dev.config.ts",
- "cf-typegen": "wrangler types --env-interface CloudflareEnv"
- },
- "dependencies": {
- "next": "^14.2.35",
- "react": "^18.2.0",
- "react-dom": "^18.2.0"
- },
- "devDependencies": {
- "@opennextjs/cloudflare": "workspace:*",
- "@playwright/test": "catalog:",
- "@types/node": "catalog:",
- "sharp": "^0.34.5",
- "wrangler": "catalog:"
- }
-}
diff --git a/examples-cloudflare/playground14/pages/api/pages.ts b/examples-cloudflare/playground14/pages/api/pages.ts
deleted file mode 100644
index 1d07ebcb..00000000
--- a/examples-cloudflare/playground14/pages/api/pages.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-import type { NextApiRequest, NextApiResponse } from "next";
-
-type Data = {
- hello: string;
-};
-
-export default function handler(req: NextApiRequest, res: NextApiResponse) {
- res.status(200).json({ hello: "world" });
-}
diff --git a/examples-cloudflare/playground14/pages/head.tsx b/examples-cloudflare/playground14/pages/head.tsx
deleted file mode 100644
index acb1d483..00000000
--- a/examples-cloudflare/playground14/pages/head.tsx
+++ /dev/null
@@ -1,23 +0,0 @@
-import Head from "next/head";
-
-export function getServerSideProps() {
- return {
- props: {
- time: new Date().toISOString(),
- },
- };
-}
-export default function Page({ time }) {
- return (
-
-
-
SSR Head
-
-
-
-
- Time: {time}
-
-
- );
-}
diff --git a/examples-cloudflare/playground14/public/.gitkeep b/examples-cloudflare/playground14/public/.gitkeep
deleted file mode 100644
index e69de29b..00000000
diff --git a/examples-cloudflare/playground14/public/snipp/snipp.webp b/examples-cloudflare/playground14/public/snipp/snipp.webp
deleted file mode 100644
index 366de09d..00000000
Binary files a/examples-cloudflare/playground14/public/snipp/snipp.webp and /dev/null differ
diff --git a/examples-cloudflare/playground14/tsconfig.json b/examples-cloudflare/playground14/tsconfig.json
deleted file mode 100644
index e6328fd1..00000000
--- a/examples-cloudflare/playground14/tsconfig.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "compilerOptions": {
- "lib": ["dom", "dom.iterable", "esnext"],
- "allowJs": true,
- "skipLibCheck": true,
- "strict": false,
- "noEmit": true,
- "incremental": true,
- "module": "esnext",
- "esModuleInterop": true,
- "moduleResolution": "node",
- "resolveJsonModule": true,
- "isolatedModules": true,
- "jsx": "preserve",
- "plugins": [
- {
- "name": "next"
- }
- ],
- "strictNullChecks": true,
- "target": "ES2017"
- },
- "include": ["next-env.d.ts", ".next/types/**/*.ts", "**/*.ts", "**/*.tsx", "worker-configuration.d.ts"],
- "exclude": ["node_modules", "open-next.config.ts"]
-}
diff --git a/examples-cloudflare/playground14/worker-configuration.d.ts b/examples-cloudflare/playground14/worker-configuration.d.ts
deleted file mode 100644
index d50bfd21..00000000
--- a/examples-cloudflare/playground14/worker-configuration.d.ts
+++ /dev/null
@@ -1,6414 +0,0 @@
-// Generated by Wrangler by running `wrangler types --env-interface CloudflareEnv` (hash: 976740db34c5d1fe56354241e8e8ce14)
-// Runtime types generated with workerd@1.20250410.0 2024-12-30 nodejs_compat
-declare namespace Cloudflare {
- interface Env {
- NEXT_INC_CACHE_KV: KVNamespace;
- hello: "Hello World from the cloudflare context!";
- PROCESS_ENV_VAR: "process.env";
- NEXTJS_ENV: string;
- ASSETS: Fetcher;
- }
-}
-interface CloudflareEnv extends Cloudflare.Env {}
-
-// Begin runtime types
-/*! *****************************************************************************
-Copyright (c) Cloudflare. All rights reserved.
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License"); you may not use
-this file except in compliance with the License. You may obtain a copy of the
-License at http://www.apache.org/licenses/LICENSE-2.0
-THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
-WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
-MERCHANTABLITY OR NON-INFRINGEMENT.
-See the Apache Version 2.0 License for specific language governing permissions
-and limitations under the License.
-***************************************************************************** */
-/* eslint-disable */
-// noinspection JSUnusedGlobalSymbols
-declare var onmessage: never;
-/**
- * An abnormal event (called an exception) which occurs as a result of calling a method or accessing a property of a web API.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException)
- */
-declare class DOMException extends Error {
- constructor(message?: string, name?: string);
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message) */
- readonly message: string;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name) */
- readonly name: string;
- /**
- * @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;
-}
-/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console) */
-interface Console {
- "assert"(condition?: boolean, ...data: any[]): void;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/clear_static) */
- clear(): void;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/count_static) */
- count(label?: string): void;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/countreset_static) */
- countReset(label?: string): void;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/debug_static) */
- debug(...data: any[]): void;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dir_static) */
- dir(item?: any, options?: any): void;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dirxml_static) */
- dirxml(...data: any[]): void;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/error_static) */
- error(...data: any[]): void;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/group_static) */
- group(...data: any[]): void;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupcollapsed_static) */
- groupCollapsed(...data: any[]): void;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupend_static) */
- groupEnd(): void;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/info_static) */
- info(...data: any[]): void;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/log_static) */
- log(...data: any[]): void;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/table_static) */
- table(tabularData?: any, properties?: string[]): void;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/time_static) */
- time(label?: string): void;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeend_static) */
- timeEnd(label?: string): void;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timelog_static) */
- timeLog(label?: string, ...data: any[]): void;
- timeStamp(label?: string): void;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/trace_static) */
- trace(...data: any[]): void;
- /* [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;
-}
-/**
- * This ServiceWorker API interface 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;
- 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;
-/**
- * Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.
- *
- * [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/setTimeout) */
-declare function setTimeout(callback: (...args: any[]) => void, msDelay?: number): number;
-/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/setTimeout) */
-declare function setTimeout(
- callback: (...args: Args) => void,
- msDelay?: number,
- ...args: Args
-): number;
-/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/clearTimeout) */
-declare function clearTimeout(timeoutId: number | null): void;
-/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/setInterval) */
-declare function setInterval(callback: (...args: any[]) => void, msDelay?: number): number;
-/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/setInterval) */
-declare function setInterval(
- callback: (...args: Args) => void,
- msDelay?: number,
- ...args: Args
-): number;
-/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/clearInterval) */
-declare function clearInterval(timeoutId: number | null): void;
-/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/queueMicrotask) */
-declare function queueMicrotask(task: Function): void;
-/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/structuredClone) */
-declare function structuredClone(value: T, options?: StructuredSerializeOptions): T;
-/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/reportError) */
-declare function reportError(error: any): void;
-/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/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;
-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;
- props: any;
-}
-type ExportedHandlerFetchHandler = (
- request: Request>,
- env: Env,
- ctx: ExecutionContext
-) => Response | 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 | 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;
- tail?: ExportedHandlerTailHandler;
- trace?: ExportedHandlerTraceHandler;
- tailStream?: ExportedHandlerTailStreamHandler;
- scheduled?: ExportedHandlerScheduledHandler;
- test?: ExportedHandlerTestHandler;
- email?: EmailExportedHandler;
- queue?: ExportedHandlerQueueHandler;
-}
-interface StructuredSerializeOptions {
- transfer?: any[];
-}
-/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent) */
-declare abstract class PromiseRejectionEvent extends Event {
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/promise) */
- readonly promise: Promise;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/reason) */
- readonly reason: any;
-}
-declare abstract class Navigator {
- sendBeacon(
- url: string,
- body?:
- | ReadableStream
- | string
- | (ArrayBuffer | ArrayBufferView)
- | Blob
- | FormData
- | URLSearchParams
- | URLSearchParams
- ): boolean;
- readonly userAgent: string;
- readonly hardwareConcurrency: number;
-}
-/**
- * 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/)
- */
-interface Performance {
- /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancetimeorigin) */
- readonly timeOrigin: number;
- /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */
- now(): number;
-}
-interface AlarmInvocationInfo {
- readonly isRetry: boolean;
- readonly retryCount: number;
-}
-interface Cloudflare {
- readonly compatibilityFlags: Record;
-}
-interface DurableObject {
- fetch(request: Request): Response | 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<
- T,
- "alarm" | "webSocketMessage" | "webSocketClose" | "webSocketError"
-> & {
- readonly id: DurableObjectId;
- readonly name?: string;
-};
-interface DurableObjectId {
- toString(): string;
- equals(other: DurableObjectId): boolean;
- readonly name?: string;
-}
-interface DurableObjectNamespace {
- newUniqueId(options?: DurableObjectNamespaceNewUniqueIdOptions): DurableObjectId;
- idFromName(name: string): DurableObjectId;
- idFromString(id: string): DurableObjectId;
- get(id: DurableObjectId, options?: DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStub;
- jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace;
-}
-type DurableObjectJurisdiction = "eu" | "fedramp";
-interface DurableObjectNamespaceNewUniqueIdOptions {
- jurisdiction?: DurableObjectJurisdiction;
-}
-type DurableObjectLocationHint = "wnam" | "enam" | "sam" | "weur" | "eeur" | "apac" | "oc" | "afr" | "me";
-interface DurableObjectNamespaceGetDurableObjectOptions {
- locationHint?: DurableObjectLocationHint;
-}
-interface DurableObjectState {
- waitUntil(promise: Promise): void;
- readonly id: DurableObjectId;
- readonly storage: DurableObjectStorage;
- container?: Container;
- 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): 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;
- transactionSync(closure: () => T): T;
- getCurrentBookmark(): Promise;
- getBookmarkForTime(timestamp: number | Date): Promise;
- onNextSessionRestoreBookmark(bookmark: string): Promise;
-}
-interface DurableObjectListOptions {
- start?: string;
- startAfter?: string;
- end?: string;
- prefix?: string;
- reverse?: boolean;
- limit?: number;
- allowConcurrency?: boolean;
- noCache?: boolean;
-}
-interface DurableObjectGetOptions {
- allowConcurrency?: boolean;
- noCache?: boolean;
-}
-interface DurableObjectGetAlarmOptions {
- allowConcurrency?: boolean;
-}
-interface DurableObjectPutOptions {
- allowConcurrency?: boolean;
- allowUnconfirmed?: boolean;
- noCache?: boolean;
-}
-interface DurableObjectSetAlarmOptions {
- allowConcurrency?: boolean;
- allowUnconfirmed?: boolean;
-}
-declare class WebSocketRequestResponsePair {
- constructor(request: string, response: string);
- get request(): string;
- get response(): string;
-}
-interface AnalyticsEngineDataset {
- writeDataPoint(event?: AnalyticsEngineDataPoint): void;
-}
-interface AnalyticsEngineDataPoint {
- indexes?: ((ArrayBuffer | string) | null)[];
- doubles?: number[];
- blobs?: ((ArrayBuffer | string) | null)[];
-}
-/**
- * An event which takes place in the DOM.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event)
- */
-declare class Event {
- constructor(type: string, init?: EventInit);
- /**
- * Returns the type of event, e.g. "click", "hashchange", or "submit".
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/type)
- */
- get type(): string;
- /**
- * Returns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/eventPhase)
- */
- get eventPhase(): number;
- /**
- * Returns true or false depending on how event was initialized. True if event invokes listeners past a ShadowRoot node that is the root of its target, and false otherwise.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composed)
- */
- get composed(): boolean;
- /**
- * Returns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/bubbles)
- */
- get bubbles(): boolean;
- /**
- * Returns true or false depending on how event was initialized. Its return value does not always carry meaning, but true can indicate that part of the operation during which event was dispatched, can be canceled by invoking the preventDefault() method.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelable)
- */
- get cancelable(): boolean;
- /**
- * Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/defaultPrevented)
- */
- get defaultPrevented(): boolean;
- /**
- * @deprecated
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/returnValue)
- */
- get returnValue(): boolean;
- /**
- * Returns the object whose event listener's callback is currently being invoked.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/currentTarget)
- */
- get currentTarget(): EventTarget | undefined;
- /**
- * Returns the object to which event is dispatched (its target).
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/target)
- */
- get target(): EventTarget | undefined;
- /**
- * @deprecated
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/srcElement)
- */
- get srcElement(): EventTarget | undefined;
- /**
- * Returns the event's timestamp as the number of milliseconds measured relative to the time origin.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/timeStamp)
- */
- get timeStamp(): number;
- /**
- * Returns true if event was dispatched by the user agent, and false otherwise.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/isTrusted)
- */
- get isTrusted(): boolean;
- /**
- * @deprecated
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)
- */
- get cancelBubble(): boolean;
- /**
- * @deprecated
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)
- */
- set cancelBubble(value: boolean);
- /**
- * Invoking this method prevents event from reaching any registered event listeners after the current one finishes running and, when dispatched in a tree, also prevents event from reaching any other objects.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopImmediatePropagation)
- */
- stopImmediatePropagation(): void;
- /**
- * If invoked when the cancelable attribute value is true, and while executing a listener for the event with passive set to false, signals to the operation that caused event to be dispatched that it needs to be canceled.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/preventDefault)
- */
- preventDefault(): void;
- /**
- * When dispatched in a tree, invoking this method prevents event from reaching any objects other than the current object.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopPropagation)
- */
- stopPropagation(): void;
- /**
- * Returns the invocation target objects of event's path (objects on which listeners will be invoked), except for any nodes in shadow trees of which the shadow root's mode is "closed" that are not reachable from event's currentTarget.
- *
- * [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;
-/**
- * EventTarget is a DOM interface implemented by objects that can receive events and may have listeners for them.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget)
- */
-declare class EventTarget = Record> {
- constructor();
- /**
- * Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
- *
- * The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
- *
- * When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
- *
- * When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
- *
- * When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
- *
- * If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
- *
- * The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
- */
- addEventListener(
- type: Type,
- handler: EventListenerOrEventListenerObject,
- options?: EventTargetAddEventListenerOptions | boolean
- ): void;
- /**
- * Removes the event listener in target's event listener list with the same type, callback, and options.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
- */
- removeEventListener(
- type: Type,
- handler: EventListenerOrEventListenerObject,
- options?: EventTargetEventListenerOptions | boolean
- ): void;
- /**
- * Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.
- *
- * [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;
-}
-/**
- * A controller object that allows you to abort one or more DOM requests as and when desired.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController)
- */
-declare class AbortController {
- constructor();
- /**
- * Returns the AbortSignal object associated with this object.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/signal)
- */
- get signal(): AbortSignal;
- /**
- * Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/abort)
- */
- abort(reason?: any): void;
-}
-/**
- * A signal object that allows you to communicate with a DOM request (such as a Fetch) 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 {
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_static) */
- static abort(reason?: any): AbortSignal;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/timeout_static) */
- static timeout(delay: number): AbortSignal;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/any_static) */
- static any(signals: AbortSignal[]): AbortSignal;
- /**
- * Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/aborted)
- */
- get aborted(): boolean;
- /* [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);
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/throwIfAborted) */
- throwIfAborted(): void;
-}
-interface Scheduler {
- wait(delay: number, maybeOptions?: SchedulerWaitOptions): Promise;
-}
-interface SchedulerWaitOptions {
- signal?: AbortSignal;
-}
-/**
- * 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 {
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent/waitUntil) */
- waitUntil(promise: Promise): void;
-}
-/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent) */
-declare class CustomEvent extends Event {
- constructor(type: string, init?: CustomEventCustomEventInit);
- /**
- * Returns any custom data event was created with. Typically used for synthetic events.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent/detail)
- */
- get detail(): T;
-}
-interface CustomEventCustomEventInit {
- bubbles?: boolean;
- cancelable?: boolean;
- composed?: boolean;
- detail?: any;
-}
-/**
- * A file-like object of immutable, raw data. Blobs represent data that isn't necessarily in a JavaScript-native format. The File interface is based on Blob, inheriting blob functionality and expanding it to support files on the user's system.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob)
- */
-declare class Blob {
- constructor(type?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[], options?: BlobOptions);
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size) */
- get size(): number;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type) */
- get type(): string;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice) */
- slice(start?: number, end?: number, type?: string): Blob;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/arrayBuffer) */
- arrayBuffer(): Promise;
- bytes(): Promise;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text) */
- text(): Promise;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/stream) */
- stream(): ReadableStream;
-}
-interface BlobOptions {
- type?: string;
-}
-/**
- * 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
- );
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name) */
- get name(): string;
- /* [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 {
- /* [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;
- /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#put) */
- put(request: RequestInfo | URL, response: Response): Promise;
-}
-interface CacheQueryOptions {
- ignoreMethod?: boolean;
-}
-/**
- * The Web Crypto API provides a set of low-level functions for common cryptographic tasks.
- * The Workers runtime implements the full surface of this API, but with some differences in
- * the [supported algorithms](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/#supported-algorithms)
- * compared to those implemented in most browsers.
- *
- * [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/)
- */
-declare abstract class Crypto {
- /**
- * Available only in secure contexts.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/subtle)
- */
- get subtle(): SubtleCrypto;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues) */
- getRandomValues<
- T extends
- | Int8Array
- | Uint8Array
- | Int16Array
- | Uint16Array
- | Int32Array
- | Uint32Array
- | BigInt64Array
- | BigUint64Array,
- >(buffer: T): T;
- /**
- * Available only in secure contexts.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/randomUUID)
- */
- randomUUID(): string;
- DigestStream: typeof DigestStream;
-}
-/**
- * This Web Crypto API interface provides a number of low-level cryptographic functions. It is accessed via the Crypto.subtle properties available in a window context (via Window.crypto).
- * Available only in secure contexts.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto)
- */
-declare abstract class SubtleCrypto {
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/encrypt) */
- encrypt(
- algorithm: string | SubtleCryptoEncryptAlgorithm,
- key: CryptoKey,
- plainText: ArrayBuffer | ArrayBufferView
- ): Promise;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/decrypt) */
- decrypt(
- algorithm: string | SubtleCryptoEncryptAlgorithm,
- key: CryptoKey,
- cipherText: ArrayBuffer | ArrayBufferView
- ): Promise;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/sign) */
- sign(
- algorithm: string | SubtleCryptoSignAlgorithm,
- key: CryptoKey,
- data: ArrayBuffer | ArrayBufferView
- ): Promise;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/verify) */
- verify(
- algorithm: string | SubtleCryptoSignAlgorithm,
- key: CryptoKey,
- signature: ArrayBuffer | ArrayBufferView,
- data: ArrayBuffer | ArrayBufferView
- ): Promise;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/digest) */
- digest(
- algorithm: string | SubtleCryptoHashAlgorithm,
- data: ArrayBuffer | ArrayBufferView
- ): Promise;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/generateKey) */
- generateKey(
- algorithm: string | SubtleCryptoGenerateKeyAlgorithm,
- extractable: boolean,
- keyUsages: string[]
- ): Promise;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveKey) */
- deriveKey(
- algorithm: string | SubtleCryptoDeriveKeyAlgorithm,
- baseKey: CryptoKey,
- derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm,
- extractable: boolean,
- keyUsages: string[]
- ): Promise;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveBits) */
- deriveBits(
- algorithm: string | SubtleCryptoDeriveKeyAlgorithm,
- baseKey: CryptoKey,
- length?: number | null
- ): Promise;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/importKey) */
- importKey(
- format: string,
- keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey,
- algorithm: string | SubtleCryptoImportKeyAlgorithm,
- extractable: boolean,
- keyUsages: string[]
- ): Promise;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/exportKey) */
- exportKey(format: string, key: CryptoKey): Promise;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/wrapKey) */
- wrapKey(
- format: string,
- key: CryptoKey,
- wrappingKey: CryptoKey,
- wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm
- ): Promise;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/unwrapKey) */
- unwrapKey(
- format: string,
- wrappedKey: ArrayBuffer | ArrayBufferView,
- unwrappingKey: CryptoKey,
- unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm,
- unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm,
- extractable: boolean,
- keyUsages: string[]
- ): Promise;
- timingSafeEqual(a: ArrayBuffer | ArrayBufferView, b: ArrayBuffer | ArrayBufferView): boolean;
-}
-/**
- * The CryptoKey dictionary of the Web Crypto API represents a cryptographic key.
- * Available only in secure contexts.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey)
- */
-declare abstract class CryptoKey {
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/type) */
- readonly type: string;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/extractable) */
- readonly extractable: boolean;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/algorithm) */
- readonly algorithm:
- | CryptoKeyKeyAlgorithm
- | CryptoKeyAesKeyAlgorithm
- | CryptoKeyHmacKeyAlgorithm
- | CryptoKeyRsaKeyAlgorithm
- | CryptoKeyEllipticKeyAlgorithm
- | CryptoKeyArbitraryKeyAlgorithm;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/usages) */
- readonly usages: string[];
-}
-interface CryptoKeyPair {
- publicKey: CryptoKey;
- privateKey: CryptoKey;
-}
-interface JsonWebKey {
- kty: string;
- use?: string;
- key_ops?: string[];
- alg?: string;
- ext?: boolean;
- crv?: string;
- x?: string;
- y?: string;
- d?: string;
- n?: string;
- e?: string;
- p?: string;
- q?: string;
- dp?: string;
- dq?: string;
- qi?: string;
- oth?: RsaOtherPrimesInfo[];
- k?: string;
-}
-interface RsaOtherPrimesInfo {
- r?: string;
- d?: string;
- t?: string;
-}
-interface SubtleCryptoDeriveKeyAlgorithm {
- name: string;
- salt?: ArrayBuffer | ArrayBufferView;
- iterations?: number;
- hash?: string | SubtleCryptoHashAlgorithm;
- $public?: CryptoKey;
- info?: ArrayBuffer | ArrayBufferView;
-}
-interface SubtleCryptoEncryptAlgorithm {
- name: string;
- iv?: ArrayBuffer | ArrayBufferView;
- additionalData?: ArrayBuffer | ArrayBufferView;
- tagLength?: number;
- counter?: ArrayBuffer | ArrayBufferView;
- length?: number;
- label?: ArrayBuffer | ArrayBufferView;
-}
-interface SubtleCryptoGenerateKeyAlgorithm {
- name: string;
- hash?: string | SubtleCryptoHashAlgorithm;
- modulusLength?: number;
- publicExponent?: ArrayBuffer | ArrayBufferView;
- length?: number;
- namedCurve?: string;
-}
-interface SubtleCryptoHashAlgorithm {
- name: string;
-}
-interface SubtleCryptoImportKeyAlgorithm {
- name: string;
- hash?: string | SubtleCryptoHashAlgorithm;
- length?: number;
- namedCurve?: string;
- compressed?: boolean;
-}
-interface SubtleCryptoSignAlgorithm {
- name: string;
- hash?: string | SubtleCryptoHashAlgorithm;
- dataLength?: number;
- saltLength?: number;
-}
-interface CryptoKeyKeyAlgorithm {
- name: string;
-}
-interface CryptoKeyAesKeyAlgorithm {
- name: string;
- length: number;
-}
-interface CryptoKeyHmacKeyAlgorithm {
- name: string;
- hash: CryptoKeyKeyAlgorithm;
- length: number;
-}
-interface CryptoKeyRsaKeyAlgorithm {
- name: string;
- modulusLength: number;
- publicExponent: ArrayBuffer | ArrayBufferView;
- hash?: CryptoKeyKeyAlgorithm;
-}
-interface CryptoKeyEllipticKeyAlgorithm {
- name: string;
- namedCurve: string;
-}
-interface CryptoKeyArbitraryKeyAlgorithm {
- name: string;
- hash?: CryptoKeyKeyAlgorithm;
- namedCurve?: string;
- length?: number;
-}
-declare class DigestStream extends WritableStream {
- constructor(algorithm: string | SubtleCryptoHashAlgorithm);
- readonly digest: Promise;
- get bytesWritten(): number | bigint;
-}
-/**
- * A decoder for a specific method, that is a specific character encoding, like utf-8, iso-8859-2, koi8, cp1261, gbk, etc. A decoder takes a stream of bytes as input and emits a stream of code points. For a more scalable, non-native library, see StringView – a C-like representation of strings based on typed arrays.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder)
- */
-declare class TextDecoder {
- constructor(label?: string, options?: TextDecoderConstructorOptions);
- /**
- * Returns the result of running encoding's decoder. The method can be invoked zero or more times with options's stream set to true, and then once without options's stream (or set to false), to process a fragmented input. If the invocation without options's stream (or set to false) has no input, it's clearest to omit both arguments.
- *
- * ```
- * var string = "", decoder = new TextDecoder(encoding), buffer;
- * while(buffer = next_chunk()) {
- * string += decoder.decode(buffer, {stream:true});
- * }
- * string += decoder.decode(); // end-of-queue
- * ```
- *
- * If the error mode is "fatal" and encoding's decoder returns error, throws a TypeError.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder/decode)
- */
- decode(input?: ArrayBuffer | ArrayBufferView, options?: TextDecoderDecodeOptions): string;
- get encoding(): string;
- get fatal(): boolean;
- get ignoreBOM(): boolean;
-}
-/**
- * TextEncoder takes a stream of code points as input and emits a stream of bytes. For a more scalable, non-native library, see StringView – a C-like representation of strings based on typed arrays.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder)
- */
-declare class TextEncoder {
- constructor();
- /**
- * Returns the result of running UTF-8's encoder.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encode)
- */
- encode(input?: string): Uint8Array;
- /**
- * Runs the UTF-8 encoder on source, stores the result of that operation into destination, and returns the progress made as an object wherein read is the number of converted code units of source and written is the number of bytes modified in destination.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encodeInto)
- */
- encodeInto(input: string, buffer: ArrayBuffer | ArrayBufferView): TextEncoderEncodeIntoResult;
- get encoding(): string;
-}
-interface TextDecoderConstructorOptions {
- fatal: boolean;
- ignoreBOM: boolean;
-}
-interface TextDecoderDecodeOptions {
- stream: boolean;
-}
-interface TextEncoderEncodeIntoResult {
- read: number;
- written: number;
-}
-/**
- * Events providing information related to errors in scripts or in files.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent)
- */
-declare class ErrorEvent extends Event {
- constructor(type: string, init?: ErrorEventErrorEventInit);
- get filename(): string;
- get message(): string;
- get lineno(): number;
- get colno(): number;
- get error(): any;
-}
-interface ErrorEventErrorEventInit {
- message?: string;
- filename?: string;
- lineno?: number;
- colno?: number;
- error?: any;
-}
-/**
- * Provides a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using the XMLHttpRequest.send() method. It uses the same format a form would use if the encoding type were set to "multipart/form-data".
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData)
- */
-declare class FormData {
- constructor();
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append) */
- append(name: string, value: string): void;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append) */
- append(name: string, value: Blob, filename?: string): void;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/delete) */
- delete(name: string): void;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/get) */
- get(name: string): (File | string) | null;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/getAll) */
- getAll(name: string): (File | string)[];
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/has) */
- has(name: string): boolean;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set) */
- set(name: string, value: string): void;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set) */
- set(name: string, value: Blob, filename?: string): void;
- /* Returns an array of key, value pairs for every entry in the list. */
- entries(): IterableIterator<[key: string, value: File | string]>;
- /* Returns a list of keys in the list. */
- keys(): IterableIterator;
- /* Returns a list of values in the list. */
- values(): IterableIterator;
- forEach(
- callback: (this: This, value: File | string, key: string, parent: FormData) => void,
- thisArg?: This
- ): void;
- [Symbol.iterator](): IterableIterator<[key: string, value: File | string]>;
-}
-interface ContentOptions {
- html?: boolean;
-}
-declare class HTMLRewriter {
- constructor();
- on(selector: string, handlers: HTMLRewriterElementContentHandlers): HTMLRewriter;
- onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter;
- transform(response: Response): Response;
-}
-interface HTMLRewriterElementContentHandlers {
- element?(element: Element): void | Promise;
- comments?(comment: Comment): void | Promise;
- text?(element: Text): void | Promise;
-}
-interface HTMLRewriterDocumentContentHandlers {
- doctype?(doctype: Doctype): void | Promise;
- comments?(comment: Comment): void | Promise;
- text?(text: Text): void | Promise;
- end?(end: DocumentEnd): void | Promise;
-}
-interface Doctype {
- readonly name: string | null;
- readonly publicId: string | null;
- readonly systemId: string | null;
-}
-interface Element {
- tagName: string;
- readonly attributes: IterableIterator;
- readonly removed: boolean;
- readonly namespaceURI: string;
- getAttribute(name: string): string | null;
- hasAttribute(name: string): boolean;
- setAttribute(name: string, value: string): Element;
- removeAttribute(name: string): Element;
- before(content: string | ReadableStream | Response, options?: ContentOptions): Element;
- after(content: string | ReadableStream | Response, options?: ContentOptions): Element;
- prepend(content: string | ReadableStream | Response, options?: ContentOptions): Element;
- append(content: string | ReadableStream | Response, options?: ContentOptions): Element;
- replace(content: string | ReadableStream | Response, options?: ContentOptions): Element;
- remove(): Element;
- removeAndKeepContent(): Element;
- setInnerContent(content: string | ReadableStream | Response, options?: ContentOptions): Element;
- onEndTag(handler: (tag: EndTag) => void | Promise): void;
-}
-interface EndTag {
- name: string;
- before(content: string | ReadableStream | Response, options?: ContentOptions): EndTag;
- after(content: string | ReadableStream | Response, options?: ContentOptions): EndTag;
- remove(): EndTag;
-}
-interface Comment {
- text: string;
- readonly removed: boolean;
- before(content: string, options?: ContentOptions): Comment;
- after(content: string, options?: ContentOptions): Comment;
- replace(content: string, options?: ContentOptions): Comment;
- remove(): Comment;
-}
-interface Text {
- readonly text: string;
- readonly lastInTextNode: boolean;
- readonly removed: boolean;
- before(content: string | ReadableStream | Response, options?: ContentOptions): Text;
- after(content: string | ReadableStream | Response, options?: ContentOptions): Text;
- replace(content: string | ReadableStream | Response, options?: ContentOptions): Text;
- remove(): Text;
-}
-interface DocumentEnd {
- append(content: string, options?: ContentOptions): DocumentEnd;
-}
-/**
- * This is the event type for fetch events dispatched on the service worker global scope. It contains information about the fetch, including the request and how the receiver will treat the response. It provides the event.respondWith() method, which allows us to provide a response to this fetch.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent)
- */
-declare abstract class FetchEvent extends ExtendableEvent {
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/request) */
- readonly request: Request;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/respondWith) */
- respondWith(promise: Response | Promise): void;
- passThroughOnException(): void;
-}
-type HeadersInit = Headers | Iterable> | Record;
-/**
- * This Fetch API interface allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs. You can add to this using methods like append() (see Examples.) In all methods of this interface, header names are matched by case-insensitive byte sequence.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers)
- */
-declare class Headers {
- constructor(init?: HeadersInit);
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/get) */
- get(name: string): string | null;
- getAll(name: string): string[];
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/getSetCookie) */
- getSetCookie(): string[];
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/has) */
- has(name: string): boolean;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/set) */
- set(name: string, value: string): void;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/append) */
- append(name: string, value: string): void;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/delete) */
- delete(name: string): void;
- forEach(
- callback: (this: This, value: string, key: string, parent: Headers) => void,
- thisArg?: This
- ): void;
- /* Returns an iterator allowing to go through all key/value pairs contained in this object. */
- entries(): IterableIterator<[key: string, value: string]>;
- /* Returns an iterator allowing to go through all keys of the key/value pairs contained in this object. */
- keys(): IterableIterator;
- /* Returns an iterator allowing to go through all values of the key/value pairs contained in this object. */
- values(): IterableIterator;
- [Symbol.iterator](): IterableIterator<[key: string, value: string]>;
-}
-type BodyInit =
- | ReadableStream
- | string
- | ArrayBuffer
- | ArrayBufferView
- | Blob
- | URLSearchParams
- | FormData;
-declare abstract class Body {
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/body) */
- get body(): ReadableStream | null;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bodyUsed) */
- get bodyUsed(): boolean;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/arrayBuffer) */
- arrayBuffer(): Promise;
- bytes(): Promise;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/text) */
- text(): Promise;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/json) */
- json(): Promise;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/formData) */
- formData(): Promise;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/blob) */
- blob(): Promise;
-}
-/**
- * This Fetch API interface represents the response to a request.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)
- */
-declare var Response: {
- prototype: Response;
- new (body?: BodyInit | null, init?: ResponseInit): Response;
- error(): Response;
- redirect(url: string, status?: number): Response;
- json(any: any, maybeInit?: ResponseInit | Response): Response;
-};
-/**
- * This Fetch API interface represents the response to a request.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)
- */
-interface Response extends Body {
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/clone) */
- clone(): Response;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/status) */
- status: number;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/statusText) */
- statusText: string;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/headers) */
- headers: Headers;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/ok) */
- ok: boolean;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirected) */
- redirected: boolean;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/url) */
- url: string;
- webSocket: WebSocket | null;
- cf: any | undefined;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/type) */
- type: "default" | "error";
-}
-interface ResponseInit {
- status?: number;
- statusText?: string;
- headers?: HeadersInit;
- cf?: any;
- webSocket?: WebSocket | null;
- encodeBody?: "automatic" | "manual";
-}
-type RequestInfo> =
- | Request
- | string;
-/**
- * This Fetch API interface represents a resource request.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request)
- */
-declare var Request: {
- prototype: Request;
- new >(
- input: RequestInfo | URL,
- init?: RequestInit
- ): Request;
-};
-/**
- * This Fetch API interface represents a resource request.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request)
- */
-interface Request> extends Body {
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/clone) */
- clone(): Request;
- /**
- * Returns request's HTTP method, which is "GET" by default.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/method)
- */
- method: string;
- /**
- * Returns the URL of request as a string.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/url)
- */
- url: string;
- /**
- * Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the "Host" header.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/headers)
- */
- headers: Headers;
- /**
- * Returns the redirect mode associated with request, which is a string indicating how redirects for the request will be handled during fetching. A request will follow redirects by default.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/redirect)
- */
- redirect: string;
- fetcher: Fetcher | null;
- /**
- * Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/signal)
- */
- signal: AbortSignal;
- cf: Cf | undefined;
- /**
- * Returns request's subresource integrity metadata, which is a cryptographic hash of the resource being fetched. Its value consists of multiple hashes separated by whitespace. [SRI]
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/integrity)
- */
- integrity: string;
- /* Returns a boolean indicating whether or not request can outlive the global in which it was created. */
- keepalive: boolean;
- /**
- * Returns the cache mode associated with request, which is a string indicating how the request will interact with the browser's cache when fetching.
- *
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/cache)
- */
- cache?: "no-store";
-}
-interface RequestInit {
- /* A string to set request's method. */
- method?: string;
- /* A Headers object, an object literal, or an array of two-item arrays to set request's headers. */
- headers?: HeadersInit;
- /* A BodyInit object or null to set request's body. */
- body?: BodyInit | null;
- /* A string indicating whether request follows redirects, results in an error upon encountering a redirect, or returns the redirect (in an opaque fashion). Sets request's redirect. */
- redirect?: string;
- fetcher?: Fetcher | null;
- cf?: Cf;
- /* A string indicating how the request will interact with the browser's cache to set request's cache. */
- cache?: "no-store";
- /* A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
- integrity?: string;
- /* An AbortSignal to set request's signal. */
- signal?: AbortSignal | null;
- encodeResponseBody?: "automatic" | "manual";
-}
-type Service = Fetcher;
-type Fetcher<
- T extends Rpc.EntrypointBranded | undefined = undefined,
- Reserved extends string = never,
-> = (T extends Rpc.EntrypointBranded ? Rpc.Provider : unknown) & {
- fetch(input: RequestInfo | URL, init?: RequestInit): Promise;
- connect(address: SocketAddress | string, options?: SocketOptions): Socket;
-};
-interface KVNamespaceListKey {
- name: Key;
- expiration?: number;
- metadata?: Metadata;
-}
-type KVNamespaceListResult =
- | {
- list_complete: false;
- keys: KVNamespaceListKey[];
- cursor: string;
- cacheStatus: string | null;
- }
- | {
- list_complete: true;
- keys: KVNamespaceListKey[];
- cacheStatus: string | null;
- };
-interface KVNamespace {
- get(key: Key, options?: Partial>): Promise;
- get(key: Key, type: "text"): Promise;
- get(key: Key, type: "json"): Promise;
- get(key: Key, type: "arrayBuffer"): Promise;
- get(key: Key, type: "stream"): Promise;
- get(key: Key, options?: KVNamespaceGetOptions<"text">): Promise;
- get(
- key: Key,
- options?: KVNamespaceGetOptions<"json">
- ): Promise;
- get(key: Key, options?: KVNamespaceGetOptions<"arrayBuffer">): Promise;
- get(key: Key, options?: KVNamespaceGetOptions<"stream">): Promise;
- get(key: Array, type: "text"): Promise>;
- get(key: Array, type: "json"): Promise>;
- get(
- key: Array,
- options?: Partial>
- ): Promise>;
- get(key: Array, options?: KVNamespaceGetOptions<"text">): Promise>;
- get(
- key: Array,
- options?: KVNamespaceGetOptions<"json">
- ): Promise>;
- list(options?: KVNamespaceListOptions): Promise>;
- put(
- key: Key,
- value: string | ArrayBuffer | ArrayBufferView | ReadableStream,
- options?: KVNamespacePutOptions
- ): Promise;
- getWithMetadata(
- key: Key,
- options?: Partial>
- ): Promise>;
- getWithMetadata(
- key: Key,
- type: "text"
- ): Promise>;
- getWithMetadata(
- key: Key,
- type: "json"
- ): Promise>;
- getWithMetadata(
- key: Key,
- type: "arrayBuffer"
- ): Promise>;
- getWithMetadata(
- key: Key,
- type: "stream"
- ): Promise>;
- getWithMetadata(
- key: Key,
- options: KVNamespaceGetOptions<"text">
- ): Promise>;
- getWithMetadata(
- key: Key,
- options: KVNamespaceGetOptions<"json">
- ): Promise>;
- getWithMetadata(
- key: Key,
- options: KVNamespaceGetOptions<"arrayBuffer">
- ): Promise>;
- getWithMetadata(
- key: Key,
- options: KVNamespaceGetOptions<"stream">
- ): Promise>;
- getWithMetadata(
- key: Array,
- type: "text"
- ): Promise>>;
- getWithMetadata(
- key: Array,
- type: "json"
- ): Promise>>;
- getWithMetadata(
- key: Array,
- options?: Partial>
- ): Promise>>;
- getWithMetadata(
- key: Array,
- options?: KVNamespaceGetOptions<"text">
- ): Promise>>;
- getWithMetadata(
- key: Array,
- options?: KVNamespaceGetOptions<"json">
- ): Promise>>;
- delete(key: Key): Promise;
-}
-interface KVNamespaceListOptions {
- limit?: number;
- prefix?: string | null;
- cursor?: string | null;
-}
-interface KVNamespaceGetOptions {
- type: Type;
- cacheTtl?: number;
-}
-interface KVNamespacePutOptions {
- expiration?: number;
- expirationTtl?: number;
- metadata?: any | null;
-}
-interface KVNamespaceGetWithMetadataResult {
- value: Value | null;
- metadata: Metadata | null;
- cacheStatus: string | null;
-}
-type QueueContentType = "text" | "bytes" | "json" | "v8";
-interface Queue {
- send(message: Body, options?: QueueSendOptions): Promise;
- sendBatch(messages: Iterable>, options?: QueueSendBatchOptions): Promise