#
tokens: 97689/50000 1/327 files (page 9/9)
lines: on (toggle) GitHub
raw markdown copy reset
This is page 9 of 9. Use http://codebase.md/bucketco/bucket-javascript-sdk?lines=true&page={x} to view the full context.

# Directory Structure

```
├── .editorconfig
├── .gitattributes
├── .github
│   └── workflows
│       ├── package-ci.yml
│       └── publish.yml
├── .gitignore
├── .nvmrc
├── .prettierignore
├── .vscode
│   ├── extensions.json
│   └── settings.json
├── .yarnrc.yml
├── docs.sh
├── lerna.json
├── LICENSE
├── package.json
├── packages
│   ├── browser-sdk
│   │   ├── .prettierignore
│   │   ├── eslint.config.js
│   │   ├── example
│   │   │   ├── feedback
│   │   │   │   ├── feedback.html
│   │   │   │   └── Feedback.jsx
│   │   │   └── typescript
│   │   │       ├── app.ts
│   │   │       └── index.html
│   │   ├── FEEDBACK.md
│   │   ├── index.html
│   │   ├── package.json
│   │   ├── playwright.config.ts
│   │   ├── postcss.config.js
│   │   ├── README.md
│   │   ├── src
│   │   │   ├── client.ts
│   │   │   ├── config.ts
│   │   │   ├── context.ts
│   │   │   ├── feedback
│   │   │   │   ├── feedback.ts
│   │   │   │   ├── prompts.ts
│   │   │   │   ├── promptStorage.ts
│   │   │   │   └── ui
│   │   │   │       ├── Button.css
│   │   │   │       ├── Button.tsx
│   │   │   │       ├── config
│   │   │   │       │   └── defaultTranslations.tsx
│   │   │   │       ├── css.d.ts
│   │   │   │       ├── FeedbackDialog.css
│   │   │   │       ├── FeedbackDialog.tsx
│   │   │   │       ├── FeedbackForm.css
│   │   │   │       ├── FeedbackForm.tsx
│   │   │   │       ├── hooks
│   │   │   │       │   └── useTimer.ts
│   │   │   │       ├── index.css
│   │   │   │       ├── index.ts
│   │   │   │       ├── Plug.tsx
│   │   │   │       ├── RadialProgress.css
│   │   │   │       ├── RadialProgress.tsx
│   │   │   │       ├── StarRating.css
│   │   │   │       ├── StarRating.tsx
│   │   │   │       └── types.ts
│   │   │   ├── flag
│   │   │   │   ├── flagCache.ts
│   │   │   │   └── flags.ts
│   │   │   ├── hooksManager.ts
│   │   │   ├── httpClient.ts
│   │   │   ├── index.ts
│   │   │   ├── logger.ts
│   │   │   ├── rateLimiter.ts
│   │   │   ├── sse.ts
│   │   │   ├── toolbar
│   │   │   │   ├── Flags.css
│   │   │   │   ├── Flags.tsx
│   │   │   │   ├── index.css
│   │   │   │   ├── index.ts
│   │   │   │   ├── Switch.css
│   │   │   │   ├── Switch.tsx
│   │   │   │   ├── Toolbar.css
│   │   │   │   └── Toolbar.tsx
│   │   │   └── ui
│   │   │       ├── constants.ts
│   │   │       ├── Dialog.css
│   │   │       ├── Dialog.tsx
│   │   │       ├── icons
│   │   │       │   ├── Check.tsx
│   │   │       │   ├── CheckCircle.tsx
│   │   │       │   ├── Close.tsx
│   │   │       │   ├── Dissatisfied.tsx
│   │   │       │   ├── Logo.tsx
│   │   │       │   ├── Neutral.tsx
│   │   │       │   ├── Satisfied.tsx
│   │   │       │   ├── VeryDissatisfied.tsx
│   │   │       │   └── VerySatisfied.tsx
│   │   │       ├── packages
│   │   │       │   └── floating-ui-preact-dom
│   │   │       │       ├── arrow.ts
│   │   │       │       ├── index.ts
│   │   │       │       ├── README.md
│   │   │       │       ├── types.ts
│   │   │       │       ├── useFloating.ts
│   │   │       │       └── utils
│   │   │       │           ├── deepEqual.ts
│   │   │       │           ├── getDPR.ts
│   │   │       │           ├── roundByDPR.ts
│   │   │       │           └── useLatestRef.ts
│   │   │       ├── types.ts
│   │   │       └── utils.ts
│   │   ├── test
│   │   │   ├── client.test.ts
│   │   │   ├── e2e
│   │   │   │   ├── acceptance.browser.spec.ts
│   │   │   │   ├── empty.html
│   │   │   │   ├── feedback-widget.browser.spec.ts
│   │   │   │   └── give-feedback-button.html
│   │   │   ├── flagCache.test.ts
│   │   │   ├── flags.test.ts
│   │   │   ├── hooksManager.test.ts
│   │   │   ├── httpClient.test.ts
│   │   │   ├── init.test.ts
│   │   │   ├── mocks
│   │   │   │   ├── handlers.ts
│   │   │   │   └── server.ts
│   │   │   ├── prompts.test.ts
│   │   │   ├── promptStorage.test.ts
│   │   │   ├── rateLimiter.test.ts
│   │   │   ├── sse.test.ts
│   │   │   ├── testLogger.ts
│   │   │   └── usage.test.ts
│   │   ├── tsconfig.build.json
│   │   ├── tsconfig.eslint.json
│   │   ├── tsconfig.json
│   │   ├── typedoc.json
│   │   ├── vite.config.mjs
│   │   ├── vite.e2e.config.js
│   │   └── vitest.setup.ts
│   ├── cli
│   │   ├── .prettierignore
│   │   ├── commands
│   │   │   ├── apps.ts
│   │   │   ├── auth.ts
│   │   │   ├── flags.ts
│   │   │   ├── init.ts
│   │   │   ├── mcp.ts
│   │   │   ├── new.ts
│   │   │   └── rules.ts
│   │   ├── eslint.config.js
│   │   ├── index.ts
│   │   ├── package.json
│   │   ├── README.md
│   │   ├── schema.json
│   │   ├── services
│   │   │   ├── bootstrap.ts
│   │   │   ├── flags.ts
│   │   │   ├── mcp.ts
│   │   │   └── rules.ts
│   │   ├── stores
│   │   │   ├── auth.ts
│   │   │   └── config.ts
│   │   ├── test
│   │   │   └── json.test.ts
│   │   ├── tsconfig.eslint.json
│   │   ├── tsconfig.json
│   │   ├── utils
│   │   │   ├── auth.ts
│   │   │   ├── commander.ts
│   │   │   ├── constants.ts
│   │   │   ├── errors.ts
│   │   │   ├── file.ts
│   │   │   ├── gen.ts
│   │   │   ├── json.ts
│   │   │   ├── options.ts
│   │   │   ├── schemas.ts
│   │   │   ├── types.ts
│   │   │   ├── urls.ts
│   │   │   └── version.ts
│   │   └── vite.config.js
│   ├── eslint-config
│   │   ├── base.js
│   │   └── package.json
│   ├── flag-evaluation
│   │   ├── .prettierignore
│   │   ├── eslint.config.js
│   │   ├── jest.config.js
│   │   ├── package.json
│   │   ├── src
│   │   │   └── index.ts
│   │   ├── test
│   │   │   └── index.test.ts
│   │   ├── tsconfig.build.json
│   │   ├── tsconfig.eslint.json
│   │   └── tsconfig.json
│   ├── node-sdk
│   │   ├── .prettierignore
│   │   ├── docs
│   │   │   ├── type-check-failed.png
│   │   │   └── type-check-payload-failed.png
│   │   ├── eslint.config.js
│   │   ├── examples
│   │   │   ├── cloudflare-worker
│   │   │   │   ├── .gitignore
│   │   │   │   ├── .prettierignore
│   │   │   │   ├── .vscode
│   │   │   │   │   └── settings.json
│   │   │   │   ├── package.json
│   │   │   │   ├── README.md
│   │   │   │   ├── src
│   │   │   │   │   └── index.ts
│   │   │   │   ├── tsconfig.json
│   │   │   │   ├── vitest.config.mts
│   │   │   │   ├── worker-configuration.d.ts
│   │   │   │   ├── wrangler.jsonc
│   │   │   │   └── yarn.lock
│   │   │   └── express
│   │   │       ├── app.test.ts
│   │   │       ├── app.ts
│   │   │       ├── bucket.ts
│   │   │       ├── bucketConfig.json
│   │   │       ├── package.json
│   │   │       ├── README.md
│   │   │       ├── serve.ts
│   │   │       ├── tsconfig.json
│   │   │       └── yarn.lock
│   │   ├── package.json
│   │   ├── README.md
│   │   ├── src
│   │   │   ├── batch-buffer.ts
│   │   │   ├── client.ts
│   │   │   ├── config.ts
│   │   │   ├── edgeClient.ts
│   │   │   ├── fetch-http-client.ts
│   │   │   ├── flusher.ts
│   │   │   ├── index.ts
│   │   │   ├── inRequestCache.ts
│   │   │   ├── periodicallyUpdatingCache.ts
│   │   │   ├── rate-limiter.ts
│   │   │   ├── types.ts
│   │   │   └── utils.ts
│   │   ├── test
│   │   │   ├── batch-buffer.test.ts
│   │   │   ├── client.test.ts
│   │   │   ├── config.test.ts
│   │   │   ├── fetch-http-client.test.ts
│   │   │   ├── flusher.test.ts
│   │   │   ├── inRequestCache.test.ts
│   │   │   ├── periodicallyUpdatingCache.test.ts
│   │   │   ├── rate-limiter.test.ts
│   │   │   ├── testConfig.json
│   │   │   └── utils.test.ts
│   │   ├── tsconfig.build.json
│   │   ├── tsconfig.eslint.json
│   │   ├── tsconfig.json
│   │   ├── typedoc.json
│   │   └── vite.config.js
│   ├── openfeature-browser-provider
│   │   ├── .prettierignore
│   │   ├── eslint.config.js
│   │   ├── example
│   │   │   ├── .eslintrc.json
│   │   │   ├── .gitignore
│   │   │   ├── app
│   │   │   │   ├── featureManagement.ts
│   │   │   │   ├── globals.css
│   │   │   │   ├── layout.tsx
│   │   │   │   └── page.tsx
│   │   │   ├── components
│   │   │   │   ├── Context.tsx
│   │   │   │   ├── HuddleFeature.tsx
│   │   │   │   └── OpenFeatureProvider.tsx
│   │   │   ├── next.config.mjs
│   │   │   ├── package.json
│   │   │   ├── postcss.config.mjs
│   │   │   ├── README.md
│   │   │   ├── tailwind.config.ts
│   │   │   └── tsconfig.json
│   │   ├── package.json
│   │   ├── README.md
│   │   ├── src
│   │   │   ├── index.test.ts
│   │   │   └── index.ts
│   │   ├── tsconfig.build.json
│   │   ├── tsconfig.eslint.json
│   │   ├── tsconfig.json
│   │   └── vite.config.js
│   ├── openfeature-node-provider
│   │   ├── .prettierignore
│   │   ├── eslint.config.js
│   │   ├── example
│   │   │   ├── app.ts
│   │   │   ├── package.json
│   │   │   ├── README.md
│   │   │   ├── reflag.ts
│   │   │   ├── serve.ts
│   │   │   ├── tsconfig.json
│   │   │   └── yarn.lock
│   │   ├── package.json
│   │   ├── README.md
│   │   ├── src
│   │   │   ├── index.test.ts
│   │   │   └── index.ts
│   │   ├── tsconfig.build.json
│   │   ├── tsconfig.eslint.json
│   │   ├── tsconfig.json
│   │   └── vite.config.js
│   ├── react-sdk
│   │   ├── .prettierignore
│   │   ├── dev
│   │   │   ├── .env
│   │   │   ├── nextjs-bootstrap-demo
│   │   │   │   ├── .eslintrc.json
│   │   │   │   ├── .gitignore
│   │   │   │   ├── app
│   │   │   │   │   ├── client.ts
│   │   │   │   │   ├── favicon.ico
│   │   │   │   │   ├── globals.css
│   │   │   │   │   ├── layout.tsx
│   │   │   │   │   └── page.tsx
│   │   │   │   ├── components
│   │   │   │   │   └── Flags.tsx
│   │   │   │   ├── next.config.mjs
│   │   │   │   ├── package.json
│   │   │   │   ├── postcss.config.mjs
│   │   │   │   ├── public
│   │   │   │   │   ├── next.svg
│   │   │   │   │   └── vercel.svg
│   │   │   │   ├── README.md
│   │   │   │   ├── tailwind.config.ts
│   │   │   │   └── tsconfig.json
│   │   │   ├── nextjs-flag-demo
│   │   │   │   ├── .eslintrc.json
│   │   │   │   ├── .gitignore
│   │   │   │   ├── app
│   │   │   │   │   ├── favicon.ico
│   │   │   │   │   ├── globals.css
│   │   │   │   │   ├── layout.tsx
│   │   │   │   │   └── page.tsx
│   │   │   │   ├── components
│   │   │   │   │   ├── Flags.tsx
│   │   │   │   │   └── Providers.tsx
│   │   │   │   ├── next.config.mjs
│   │   │   │   ├── package.json
│   │   │   │   ├── postcss.config.mjs
│   │   │   │   ├── public
│   │   │   │   │   ├── next.svg
│   │   │   │   │   └── vercel.svg
│   │   │   │   ├── README.md
│   │   │   │   ├── tailwind.config.ts
│   │   │   │   └── tsconfig.json
│   │   │   └── plain
│   │   │       ├── app.tsx
│   │   │       ├── index.html
│   │   │       ├── index.tsx
│   │   │       ├── tsconfig.json
│   │   │       └── vite-env.d.ts
│   │   ├── eslint.config.js
│   │   ├── package.json
│   │   ├── README.md
│   │   ├── src
│   │   │   └── index.tsx
│   │   ├── test
│   │   │   └── usage.test.tsx
│   │   ├── tsconfig.build.json
│   │   ├── tsconfig.eslint.json
│   │   ├── tsconfig.json
│   │   ├── typedoc.json
│   │   └── vite.config.mjs
│   ├── tsconfig
│   │   ├── library.json
│   │   └── package.json
│   └── vue-sdk
│       ├── .prettierignore
│       ├── dev
│       │   └── plain
│       │       ├── App.vue
│       │       ├── components
│       │       │   ├── Events.vue
│       │       │   ├── FlagsList.vue
│       │       │   ├── MissingKeyMessage.vue
│       │       │   ├── RequestFeedback.vue
│       │       │   ├── Section.vue
│       │       │   ├── StartHuddlesButton.vue
│       │       │   └── Track.vue
│       │       ├── env.d.ts
│       │       ├── index.html
│       │       └── index.ts
│       ├── eslint.config.js
│       ├── package.json
│       ├── README.md
│       ├── src
│       │   ├── hooks.ts
│       │   ├── index.ts
│       │   ├── ReflagBootstrappedProvider.vue
│       │   ├── ReflagClientProvider.vue
│       │   ├── ReflagProvider.vue
│       │   ├── types.ts
│       │   ├── version.ts
│       │   └── vue.d.ts
│       ├── test
│       │   └── usage.test.ts
│       ├── tsconfig.build.json
│       ├── tsconfig.eslint.json
│       ├── tsconfig.json
│       ├── typedoc.json
│       └── vite.config.mjs
├── README.md
├── typedoc.json
├── vitest.workspace.js
└── yarn.lock
```

# Files

--------------------------------------------------------------------------------
/packages/node-sdk/examples/cloudflare-worker/worker-configuration.d.ts:
--------------------------------------------------------------------------------

```typescript
   1 | /* eslint-disable */
   2 | // Generated by Wrangler by running `wrangler types` (hash: 869ac3b4ce0f52ba3b2e0bc70c49089e)
   3 | // Runtime types generated with [email protected] 2025-06-20 nodejs_compat
   4 | declare namespace Cloudflare {
   5 |   interface Env {}
   6 | }
   7 | interface Env extends Cloudflare.Env {}
   8 | 
   9 | // Begin runtime types
  10 | /*! *****************************************************************************
  11 | Copyright (c) Cloudflare. All rights reserved.
  12 | Copyright (c) Microsoft Corporation. All rights reserved.
  13 | 
  14 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use
  15 | this file except in compliance with the License. You may obtain a copy of the
  16 | License at http://www.apache.org/licenses/LICENSE-2.0
  17 | THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  18 | KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
  19 | WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
  20 | MERCHANTABLITY OR NON-INFRINGEMENT.
  21 | See the Apache Version 2.0 License for specific language governing permissions
  22 | and limitations under the License.
  23 | ***************************************************************************** */
  24 | /* eslint-disable */
  25 | // noinspection JSUnusedGlobalSymbols
  26 | declare var onmessage: never;
  27 | /**
  28 |  * An abnormal event (called an exception) which occurs as a result of calling a method or accessing a property of a web API.
  29 |  *
  30 |  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException)
  31 |  */
  32 | declare class DOMException extends Error {
  33 |   constructor(message?: string, name?: string);
  34 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message) */
  35 |   readonly message: string;
  36 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name) */
  37 |   readonly name: string;
  38 |   /**
  39 |    * @deprecated
  40 |    *
  41 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code)
  42 |    */
  43 |   readonly code: number;
  44 |   static readonly INDEX_SIZE_ERR: number;
  45 |   static readonly DOMSTRING_SIZE_ERR: number;
  46 |   static readonly HIERARCHY_REQUEST_ERR: number;
  47 |   static readonly WRONG_DOCUMENT_ERR: number;
  48 |   static readonly INVALID_CHARACTER_ERR: number;
  49 |   static readonly NO_DATA_ALLOWED_ERR: number;
  50 |   static readonly NO_MODIFICATION_ALLOWED_ERR: number;
  51 |   static readonly NOT_FOUND_ERR: number;
  52 |   static readonly NOT_SUPPORTED_ERR: number;
  53 |   static readonly INUSE_ATTRIBUTE_ERR: number;
  54 |   static readonly INVALID_STATE_ERR: number;
  55 |   static readonly SYNTAX_ERR: number;
  56 |   static readonly INVALID_MODIFICATION_ERR: number;
  57 |   static readonly NAMESPACE_ERR: number;
  58 |   static readonly INVALID_ACCESS_ERR: number;
  59 |   static readonly VALIDATION_ERR: number;
  60 |   static readonly TYPE_MISMATCH_ERR: number;
  61 |   static readonly SECURITY_ERR: number;
  62 |   static readonly NETWORK_ERR: number;
  63 |   static readonly ABORT_ERR: number;
  64 |   static readonly URL_MISMATCH_ERR: number;
  65 |   static readonly QUOTA_EXCEEDED_ERR: number;
  66 |   static readonly TIMEOUT_ERR: number;
  67 |   static readonly INVALID_NODE_TYPE_ERR: number;
  68 |   static readonly DATA_CLONE_ERR: number;
  69 |   get stack(): any;
  70 |   set stack(value: any);
  71 | }
  72 | type WorkerGlobalScopeEventMap = {
  73 |   fetch: FetchEvent;
  74 |   scheduled: ScheduledEvent;
  75 |   queue: QueueEvent;
  76 |   unhandledrejection: PromiseRejectionEvent;
  77 |   rejectionhandled: PromiseRejectionEvent;
  78 | };
  79 | declare abstract class WorkerGlobalScope extends EventTarget<WorkerGlobalScopeEventMap> {
  80 |   EventTarget: typeof EventTarget;
  81 | }
  82 | /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console) */
  83 | interface Console {
  84 |   "assert"(condition?: boolean, ...data: any[]): void;
  85 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/clear_static) */
  86 |   clear(): void;
  87 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/count_static) */
  88 |   count(label?: string): void;
  89 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/countReset_static) */
  90 |   countReset(label?: string): void;
  91 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/debug_static) */
  92 |   debug(...data: any[]): void;
  93 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dir_static) */
  94 |   dir(item?: any, options?: any): void;
  95 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dirxml_static) */
  96 |   dirxml(...data: any[]): void;
  97 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/error_static) */
  98 |   error(...data: any[]): void;
  99 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/group_static) */
 100 |   group(...data: any[]): void;
 101 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupCollapsed_static) */
 102 |   groupCollapsed(...data: any[]): void;
 103 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupEnd_static) */
 104 |   groupEnd(): void;
 105 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/info_static) */
 106 |   info(...data: any[]): void;
 107 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/log_static) */
 108 |   log(...data: any[]): void;
 109 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/table_static) */
 110 |   table(tabularData?: any, properties?: string[]): void;
 111 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/time_static) */
 112 |   time(label?: string): void;
 113 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeEnd_static) */
 114 |   timeEnd(label?: string): void;
 115 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeLog_static) */
 116 |   timeLog(label?: string, ...data: any[]): void;
 117 |   timeStamp(label?: string): void;
 118 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/trace_static) */
 119 |   trace(...data: any[]): void;
 120 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/warn_static) */
 121 |   warn(...data: any[]): void;
 122 | }
 123 | declare const console: Console;
 124 | type BufferSource = ArrayBufferView | ArrayBuffer;
 125 | type TypedArray =
 126 |   | Int8Array
 127 |   | Uint8Array
 128 |   | Uint8ClampedArray
 129 |   | Int16Array
 130 |   | Uint16Array
 131 |   | Int32Array
 132 |   | Uint32Array
 133 |   | Float32Array
 134 |   | Float64Array
 135 |   | BigInt64Array
 136 |   | BigUint64Array;
 137 | declare namespace WebAssembly {
 138 |   class CompileError extends Error {
 139 |     constructor(message?: string);
 140 |   }
 141 |   class RuntimeError extends Error {
 142 |     constructor(message?: string);
 143 |   }
 144 |   type ValueType =
 145 |     | "anyfunc"
 146 |     | "externref"
 147 |     | "f32"
 148 |     | "f64"
 149 |     | "i32"
 150 |     | "i64"
 151 |     | "v128";
 152 |   interface GlobalDescriptor {
 153 |     value: ValueType;
 154 |     mutable?: boolean;
 155 |   }
 156 |   class Global {
 157 |     constructor(descriptor: GlobalDescriptor, value?: any);
 158 |     value: any;
 159 |     valueOf(): any;
 160 |   }
 161 |   type ImportValue = ExportValue | number;
 162 |   type ModuleImports = Record<string, ImportValue>;
 163 |   type Imports = Record<string, ModuleImports>;
 164 |   type ExportValue = Function | Global | Memory | Table;
 165 |   type Exports = Record<string, ExportValue>;
 166 |   class Instance {
 167 |     constructor(module: Module, imports?: Imports);
 168 |     readonly exports: Exports;
 169 |   }
 170 |   interface MemoryDescriptor {
 171 |     initial: number;
 172 |     maximum?: number;
 173 |     shared?: boolean;
 174 |   }
 175 |   class Memory {
 176 |     constructor(descriptor: MemoryDescriptor);
 177 |     readonly buffer: ArrayBuffer;
 178 |     grow(delta: number): number;
 179 |   }
 180 |   type ImportExportKind = "function" | "global" | "memory" | "table";
 181 |   interface ModuleExportDescriptor {
 182 |     kind: ImportExportKind;
 183 |     name: string;
 184 |   }
 185 |   interface ModuleImportDescriptor {
 186 |     kind: ImportExportKind;
 187 |     module: string;
 188 |     name: string;
 189 |   }
 190 |   abstract class Module {
 191 |     static customSections(module: Module, sectionName: string): ArrayBuffer[];
 192 |     static exports(module: Module): ModuleExportDescriptor[];
 193 |     static imports(module: Module): ModuleImportDescriptor[];
 194 |   }
 195 |   type TableKind = "anyfunc" | "externref";
 196 |   interface TableDescriptor {
 197 |     element: TableKind;
 198 |     initial: number;
 199 |     maximum?: number;
 200 |   }
 201 |   class Table {
 202 |     constructor(descriptor: TableDescriptor, value?: any);
 203 |     readonly length: number;
 204 |     get(index: number): any;
 205 |     grow(delta: number, value?: any): number;
 206 |     set(index: number, value?: any): void;
 207 |   }
 208 |   function instantiate(module: Module, imports?: Imports): Promise<Instance>;
 209 |   function validate(bytes: BufferSource): boolean;
 210 | }
 211 | /**
 212 |  * This ServiceWorker API interface represents the global execution context of a service worker.
 213 |  * Available only in secure contexts.
 214 |  *
 215 |  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorkerGlobalScope)
 216 |  */
 217 | interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
 218 |   DOMException: typeof DOMException;
 219 |   WorkerGlobalScope: typeof WorkerGlobalScope;
 220 |   btoa(data: string): string;
 221 |   atob(data: string): string;
 222 |   setTimeout(callback: (...args: any[]) => void, msDelay?: number): number;
 223 |   setTimeout<Args extends any[]>(
 224 |     callback: (...args: Args) => void,
 225 |     msDelay?: number,
 226 |     ...args: Args
 227 |   ): number;
 228 |   clearTimeout(timeoutId: number | null): void;
 229 |   setInterval(callback: (...args: any[]) => void, msDelay?: number): number;
 230 |   setInterval<Args extends any[]>(
 231 |     callback: (...args: Args) => void,
 232 |     msDelay?: number,
 233 |     ...args: Args
 234 |   ): number;
 235 |   clearInterval(timeoutId: number | null): void;
 236 |   queueMicrotask(task: Function): void;
 237 |   structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;
 238 |   reportError(error: any): void;
 239 |   fetch(
 240 |     input: RequestInfo | URL,
 241 |     init?: RequestInit<RequestInitCfProperties>,
 242 |   ): Promise<Response>;
 243 |   self: ServiceWorkerGlobalScope;
 244 |   crypto: Crypto;
 245 |   caches: CacheStorage;
 246 |   scheduler: Scheduler;
 247 |   performance: Performance;
 248 |   Cloudflare: Cloudflare;
 249 |   readonly origin: string;
 250 |   Event: typeof Event;
 251 |   ExtendableEvent: typeof ExtendableEvent;
 252 |   CustomEvent: typeof CustomEvent;
 253 |   PromiseRejectionEvent: typeof PromiseRejectionEvent;
 254 |   FetchEvent: typeof FetchEvent;
 255 |   TailEvent: typeof TailEvent;
 256 |   TraceEvent: typeof TailEvent;
 257 |   ScheduledEvent: typeof ScheduledEvent;
 258 |   MessageEvent: typeof MessageEvent;
 259 |   CloseEvent: typeof CloseEvent;
 260 |   ReadableStreamDefaultReader: typeof ReadableStreamDefaultReader;
 261 |   ReadableStreamBYOBReader: typeof ReadableStreamBYOBReader;
 262 |   ReadableStream: typeof ReadableStream;
 263 |   WritableStream: typeof WritableStream;
 264 |   WritableStreamDefaultWriter: typeof WritableStreamDefaultWriter;
 265 |   TransformStream: typeof TransformStream;
 266 |   ByteLengthQueuingStrategy: typeof ByteLengthQueuingStrategy;
 267 |   CountQueuingStrategy: typeof CountQueuingStrategy;
 268 |   ErrorEvent: typeof ErrorEvent;
 269 |   EventSource: typeof EventSource;
 270 |   ReadableStreamBYOBRequest: typeof ReadableStreamBYOBRequest;
 271 |   ReadableStreamDefaultController: typeof ReadableStreamDefaultController;
 272 |   ReadableByteStreamController: typeof ReadableByteStreamController;
 273 |   WritableStreamDefaultController: typeof WritableStreamDefaultController;
 274 |   TransformStreamDefaultController: typeof TransformStreamDefaultController;
 275 |   CompressionStream: typeof CompressionStream;
 276 |   DecompressionStream: typeof DecompressionStream;
 277 |   TextEncoderStream: typeof TextEncoderStream;
 278 |   TextDecoderStream: typeof TextDecoderStream;
 279 |   Headers: typeof Headers;
 280 |   Body: typeof Body;
 281 |   Request: typeof Request;
 282 |   Response: typeof Response;
 283 |   WebSocket: typeof WebSocket;
 284 |   WebSocketPair: typeof WebSocketPair;
 285 |   WebSocketRequestResponsePair: typeof WebSocketRequestResponsePair;
 286 |   AbortController: typeof AbortController;
 287 |   AbortSignal: typeof AbortSignal;
 288 |   TextDecoder: typeof TextDecoder;
 289 |   TextEncoder: typeof TextEncoder;
 290 |   navigator: Navigator;
 291 |   Navigator: typeof Navigator;
 292 |   URL: typeof URL;
 293 |   URLSearchParams: typeof URLSearchParams;
 294 |   URLPattern: typeof URLPattern;
 295 |   Blob: typeof Blob;
 296 |   File: typeof File;
 297 |   FormData: typeof FormData;
 298 |   Crypto: typeof Crypto;
 299 |   SubtleCrypto: typeof SubtleCrypto;
 300 |   CryptoKey: typeof CryptoKey;
 301 |   CacheStorage: typeof CacheStorage;
 302 |   Cache: typeof Cache;
 303 |   FixedLengthStream: typeof FixedLengthStream;
 304 |   IdentityTransformStream: typeof IdentityTransformStream;
 305 |   HTMLRewriter: typeof HTMLRewriter;
 306 | }
 307 | declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(
 308 |   type: Type,
 309 |   handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>,
 310 |   options?: EventTargetAddEventListenerOptions | boolean,
 311 | ): void;
 312 | declare function removeEventListener<
 313 |   Type extends keyof WorkerGlobalScopeEventMap,
 314 | >(
 315 |   type: Type,
 316 |   handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>,
 317 |   options?: EventTargetEventListenerOptions | boolean,
 318 | ): void;
 319 | /**
 320 |  * 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.
 321 |  *
 322 |  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
 323 |  */
 324 | declare function dispatchEvent(
 325 |   event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap],
 326 | ): boolean;
 327 | /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/btoa) */
 328 | declare function btoa(data: string): string;
 329 | /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/atob) */
 330 | declare function atob(data: string): string;
 331 | /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setTimeout) */
 332 | declare function setTimeout(
 333 |   callback: (...args: any[]) => void,
 334 |   msDelay?: number,
 335 | ): number;
 336 | /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setTimeout) */
 337 | declare function setTimeout<Args extends any[]>(
 338 |   callback: (...args: Args) => void,
 339 |   msDelay?: number,
 340 |   ...args: Args
 341 | ): number;
 342 | /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/clearTimeout) */
 343 | declare function clearTimeout(timeoutId: number | null): void;
 344 | /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setInterval) */
 345 | declare function setInterval(
 346 |   callback: (...args: any[]) => void,
 347 |   msDelay?: number,
 348 | ): number;
 349 | /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setInterval) */
 350 | declare function setInterval<Args extends any[]>(
 351 |   callback: (...args: Args) => void,
 352 |   msDelay?: number,
 353 |   ...args: Args
 354 | ): number;
 355 | /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/clearInterval) */
 356 | declare function clearInterval(timeoutId: number | null): void;
 357 | /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/queueMicrotask) */
 358 | declare function queueMicrotask(task: Function): void;
 359 | /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/structuredClone) */
 360 | declare function structuredClone<T>(
 361 |   value: T,
 362 |   options?: StructuredSerializeOptions,
 363 | ): T;
 364 | /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/reportError) */
 365 | declare function reportError(error: any): void;
 366 | /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/fetch) */
 367 | declare function fetch(
 368 |   input: RequestInfo | URL,
 369 |   init?: RequestInit<RequestInitCfProperties>,
 370 | ): Promise<Response>;
 371 | declare const self: ServiceWorkerGlobalScope;
 372 | /**
 373 |  * The Web Crypto API provides a set of low-level functions for common cryptographic tasks.
 374 |  * The Workers runtime implements the full surface of this API, but with some differences in
 375 |  * the [supported algorithms](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/#supported-algorithms)
 376 |  * compared to those implemented in most browsers.
 377 |  *
 378 |  * [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/)
 379 |  */
 380 | declare const crypto: Crypto;
 381 | /**
 382 |  * The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache.
 383 |  *
 384 |  * [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/)
 385 |  */
 386 | declare const caches: CacheStorage;
 387 | declare const scheduler: Scheduler;
 388 | /**
 389 |  * The Workers runtime supports a subset of the Performance API, used to measure timing and performance,
 390 |  * as well as timing of subrequests and other operations.
 391 |  *
 392 |  * [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)
 393 |  */
 394 | declare const performance: Performance;
 395 | declare const Cloudflare: Cloudflare;
 396 | declare const origin: string;
 397 | declare const navigator: Navigator;
 398 | interface TestController {}
 399 | interface ExecutionContext {
 400 |   waitUntil(promise: Promise<any>): void;
 401 |   passThroughOnException(): void;
 402 |   props: any;
 403 | }
 404 | type ExportedHandlerFetchHandler<Env = unknown, CfHostMetadata = unknown> = (
 405 |   request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>,
 406 |   env: Env,
 407 |   ctx: ExecutionContext,
 408 | ) => Response | Promise<Response>;
 409 | type ExportedHandlerTailHandler<Env = unknown> = (
 410 |   events: TraceItem[],
 411 |   env: Env,
 412 |   ctx: ExecutionContext,
 413 | ) => void | Promise<void>;
 414 | type ExportedHandlerTraceHandler<Env = unknown> = (
 415 |   traces: TraceItem[],
 416 |   env: Env,
 417 |   ctx: ExecutionContext,
 418 | ) => void | Promise<void>;
 419 | type ExportedHandlerTailStreamHandler<Env = unknown> = (
 420 |   event: TailStream.TailEvent,
 421 |   env: Env,
 422 |   ctx: ExecutionContext,
 423 | ) => TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;
 424 | type ExportedHandlerScheduledHandler<Env = unknown> = (
 425 |   controller: ScheduledController,
 426 |   env: Env,
 427 |   ctx: ExecutionContext,
 428 | ) => void | Promise<void>;
 429 | type ExportedHandlerQueueHandler<Env = unknown, Message = unknown> = (
 430 |   batch: MessageBatch<Message>,
 431 |   env: Env,
 432 |   ctx: ExecutionContext,
 433 | ) => void | Promise<void>;
 434 | type ExportedHandlerTestHandler<Env = unknown> = (
 435 |   controller: TestController,
 436 |   env: Env,
 437 |   ctx: ExecutionContext,
 438 | ) => void | Promise<void>;
 439 | interface ExportedHandler<
 440 |   Env = unknown,
 441 |   QueueHandlerMessage = unknown,
 442 |   CfHostMetadata = unknown,
 443 | > {
 444 |   fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
 445 |   tail?: ExportedHandlerTailHandler<Env>;
 446 |   trace?: ExportedHandlerTraceHandler<Env>;
 447 |   tailStream?: ExportedHandlerTailStreamHandler<Env>;
 448 |   scheduled?: ExportedHandlerScheduledHandler<Env>;
 449 |   test?: ExportedHandlerTestHandler<Env>;
 450 |   email?: EmailExportedHandler<Env>;
 451 |   queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage>;
 452 | }
 453 | interface StructuredSerializeOptions {
 454 |   transfer?: any[];
 455 | }
 456 | /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent) */
 457 | declare abstract class PromiseRejectionEvent extends Event {
 458 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/promise) */
 459 |   readonly promise: Promise<any>;
 460 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/reason) */
 461 |   readonly reason: any;
 462 | }
 463 | declare abstract class Navigator {
 464 |   sendBeacon(
 465 |     url: string,
 466 |     body?:
 467 |       | ReadableStream
 468 |       | string
 469 |       | (ArrayBuffer | ArrayBufferView)
 470 |       | Blob
 471 |       | FormData
 472 |       | URLSearchParams
 473 |       | URLSearchParams,
 474 |   ): boolean;
 475 |   readonly userAgent: string;
 476 |   readonly hardwareConcurrency: number;
 477 |   readonly language: string;
 478 |   readonly languages: string[];
 479 | }
 480 | /**
 481 |  * The Workers runtime supports a subset of the Performance API, used to measure timing and performance,
 482 |  * as well as timing of subrequests and other operations.
 483 |  *
 484 |  * [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)
 485 |  */
 486 | interface Performance {
 487 |   /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancetimeorigin) */
 488 |   readonly timeOrigin: number;
 489 |   /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */
 490 |   now(): number;
 491 | }
 492 | interface AlarmInvocationInfo {
 493 |   readonly isRetry: boolean;
 494 |   readonly retryCount: number;
 495 | }
 496 | interface Cloudflare {
 497 |   readonly compatibilityFlags: Record<string, boolean>;
 498 | }
 499 | interface DurableObject {
 500 |   fetch(request: Request): Response | Promise<Response>;
 501 |   alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;
 502 |   webSocketMessage?(
 503 |     ws: WebSocket,
 504 |     message: string | ArrayBuffer,
 505 |   ): void | Promise<void>;
 506 |   webSocketClose?(
 507 |     ws: WebSocket,
 508 |     code: number,
 509 |     reason: string,
 510 |     wasClean: boolean,
 511 |   ): void | Promise<void>;
 512 |   webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;
 513 | }
 514 | type DurableObjectStub<
 515 |   T extends Rpc.DurableObjectBranded | undefined = undefined,
 516 | > = Fetcher<
 517 |   T,
 518 |   "alarm" | "webSocketMessage" | "webSocketClose" | "webSocketError"
 519 | > & {
 520 |   readonly id: DurableObjectId;
 521 |   readonly name?: string;
 522 | };
 523 | interface DurableObjectId {
 524 |   toString(): string;
 525 |   equals(other: DurableObjectId): boolean;
 526 |   readonly name?: string;
 527 | }
 528 | interface DurableObjectNamespace<
 529 |   T extends Rpc.DurableObjectBranded | undefined = undefined,
 530 | > {
 531 |   newUniqueId(
 532 |     options?: DurableObjectNamespaceNewUniqueIdOptions,
 533 |   ): DurableObjectId;
 534 |   idFromName(name: string): DurableObjectId;
 535 |   idFromString(id: string): DurableObjectId;
 536 |   get(
 537 |     id: DurableObjectId,
 538 |     options?: DurableObjectNamespaceGetDurableObjectOptions,
 539 |   ): DurableObjectStub<T>;
 540 |   jurisdiction(
 541 |     jurisdiction: DurableObjectJurisdiction,
 542 |   ): DurableObjectNamespace<T>;
 543 | }
 544 | type DurableObjectJurisdiction = "eu" | "fedramp" | "fedramp-high";
 545 | interface DurableObjectNamespaceNewUniqueIdOptions {
 546 |   jurisdiction?: DurableObjectJurisdiction;
 547 | }
 548 | type DurableObjectLocationHint =
 549 |   | "wnam"
 550 |   | "enam"
 551 |   | "sam"
 552 |   | "weur"
 553 |   | "eeur"
 554 |   | "apac"
 555 |   | "oc"
 556 |   | "afr"
 557 |   | "me";
 558 | interface DurableObjectNamespaceGetDurableObjectOptions {
 559 |   locationHint?: DurableObjectLocationHint;
 560 | }
 561 | interface DurableObjectState {
 562 |   waitUntil(promise: Promise<any>): void;
 563 |   readonly id: DurableObjectId;
 564 |   readonly storage: DurableObjectStorage;
 565 |   container?: Container;
 566 |   blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
 567 |   acceptWebSocket(ws: WebSocket, tags?: string[]): void;
 568 |   getWebSockets(tag?: string): WebSocket[];
 569 |   setWebSocketAutoResponse(maybeReqResp?: WebSocketRequestResponsePair): void;
 570 |   getWebSocketAutoResponse(): WebSocketRequestResponsePair | null;
 571 |   getWebSocketAutoResponseTimestamp(ws: WebSocket): Date | null;
 572 |   setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;
 573 |   getHibernatableWebSocketEventTimeout(): number | null;
 574 |   getTags(ws: WebSocket): string[];
 575 |   abort(reason?: string): void;
 576 | }
 577 | interface DurableObjectTransaction {
 578 |   get<T = unknown>(
 579 |     key: string,
 580 |     options?: DurableObjectGetOptions,
 581 |   ): Promise<T | undefined>;
 582 |   get<T = unknown>(
 583 |     keys: string[],
 584 |     options?: DurableObjectGetOptions,
 585 |   ): Promise<Map<string, T>>;
 586 |   list<T = unknown>(
 587 |     options?: DurableObjectListOptions,
 588 |   ): Promise<Map<string, T>>;
 589 |   put<T>(
 590 |     key: string,
 591 |     value: T,
 592 |     options?: DurableObjectPutOptions,
 593 |   ): Promise<void>;
 594 |   put<T>(
 595 |     entries: Record<string, T>,
 596 |     options?: DurableObjectPutOptions,
 597 |   ): Promise<void>;
 598 |   delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;
 599 |   delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;
 600 |   rollback(): void;
 601 |   getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;
 602 |   setAlarm(
 603 |     scheduledTime: number | Date,
 604 |     options?: DurableObjectSetAlarmOptions,
 605 |   ): Promise<void>;
 606 |   deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
 607 | }
 608 | interface DurableObjectStorage {
 609 |   get<T = unknown>(
 610 |     key: string,
 611 |     options?: DurableObjectGetOptions,
 612 |   ): Promise<T | undefined>;
 613 |   get<T = unknown>(
 614 |     keys: string[],
 615 |     options?: DurableObjectGetOptions,
 616 |   ): Promise<Map<string, T>>;
 617 |   list<T = unknown>(
 618 |     options?: DurableObjectListOptions,
 619 |   ): Promise<Map<string, T>>;
 620 |   put<T>(
 621 |     key: string,
 622 |     value: T,
 623 |     options?: DurableObjectPutOptions,
 624 |   ): Promise<void>;
 625 |   put<T>(
 626 |     entries: Record<string, T>,
 627 |     options?: DurableObjectPutOptions,
 628 |   ): Promise<void>;
 629 |   delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;
 630 |   delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;
 631 |   deleteAll(options?: DurableObjectPutOptions): Promise<void>;
 632 |   transaction<T>(
 633 |     closure: (txn: DurableObjectTransaction) => Promise<T>,
 634 |   ): Promise<T>;
 635 |   getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;
 636 |   setAlarm(
 637 |     scheduledTime: number | Date,
 638 |     options?: DurableObjectSetAlarmOptions,
 639 |   ): Promise<void>;
 640 |   deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
 641 |   sync(): Promise<void>;
 642 |   sql: SqlStorage;
 643 |   transactionSync<T>(closure: () => T): T;
 644 |   getCurrentBookmark(): Promise<string>;
 645 |   getBookmarkForTime(timestamp: number | Date): Promise<string>;
 646 |   onNextSessionRestoreBookmark(bookmark: string): Promise<string>;
 647 | }
 648 | interface DurableObjectListOptions {
 649 |   start?: string;
 650 |   startAfter?: string;
 651 |   end?: string;
 652 |   prefix?: string;
 653 |   reverse?: boolean;
 654 |   limit?: number;
 655 |   allowConcurrency?: boolean;
 656 |   noCache?: boolean;
 657 | }
 658 | interface DurableObjectGetOptions {
 659 |   allowConcurrency?: boolean;
 660 |   noCache?: boolean;
 661 | }
 662 | interface DurableObjectGetAlarmOptions {
 663 |   allowConcurrency?: boolean;
 664 | }
 665 | interface DurableObjectPutOptions {
 666 |   allowConcurrency?: boolean;
 667 |   allowUnconfirmed?: boolean;
 668 |   noCache?: boolean;
 669 | }
 670 | interface DurableObjectSetAlarmOptions {
 671 |   allowConcurrency?: boolean;
 672 |   allowUnconfirmed?: boolean;
 673 | }
 674 | declare class WebSocketRequestResponsePair {
 675 |   constructor(request: string, response: string);
 676 |   get request(): string;
 677 |   get response(): string;
 678 | }
 679 | interface AnalyticsEngineDataset {
 680 |   writeDataPoint(event?: AnalyticsEngineDataPoint): void;
 681 | }
 682 | interface AnalyticsEngineDataPoint {
 683 |   indexes?: ((ArrayBuffer | string) | null)[];
 684 |   doubles?: number[];
 685 |   blobs?: ((ArrayBuffer | string) | null)[];
 686 | }
 687 | /**
 688 |  * An event which takes place in the DOM.
 689 |  *
 690 |  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event)
 691 |  */
 692 | declare class Event {
 693 |   constructor(type: string, init?: EventInit);
 694 |   /**
 695 |    * Returns the type of event, e.g. "click", "hashchange", or "submit".
 696 |    *
 697 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/type)
 698 |    */
 699 |   get type(): string;
 700 |   /**
 701 |    * Returns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE.
 702 |    *
 703 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/eventPhase)
 704 |    */
 705 |   get eventPhase(): number;
 706 |   /**
 707 |    * 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.
 708 |    *
 709 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composed)
 710 |    */
 711 |   get composed(): boolean;
 712 |   /**
 713 |    * 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.
 714 |    *
 715 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/bubbles)
 716 |    */
 717 |   get bubbles(): boolean;
 718 |   /**
 719 |    * 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.
 720 |    *
 721 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelable)
 722 |    */
 723 |   get cancelable(): boolean;
 724 |   /**
 725 |    * Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise.
 726 |    *
 727 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/defaultPrevented)
 728 |    */
 729 |   get defaultPrevented(): boolean;
 730 |   /**
 731 |    * @deprecated
 732 |    *
 733 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/returnValue)
 734 |    */
 735 |   get returnValue(): boolean;
 736 |   /**
 737 |    * Returns the object whose event listener's callback is currently being invoked.
 738 |    *
 739 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/currentTarget)
 740 |    */
 741 |   get currentTarget(): EventTarget | undefined;
 742 |   /**
 743 |    * Returns the object to which event is dispatched (its target).
 744 |    *
 745 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/target)
 746 |    */
 747 |   get target(): EventTarget | undefined;
 748 |   /**
 749 |    * @deprecated
 750 |    *
 751 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/srcElement)
 752 |    */
 753 |   get srcElement(): EventTarget | undefined;
 754 |   /**
 755 |    * Returns the event's timestamp as the number of milliseconds measured relative to the time origin.
 756 |    *
 757 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/timeStamp)
 758 |    */
 759 |   get timeStamp(): number;
 760 |   /**
 761 |    * Returns true if event was dispatched by the user agent, and false otherwise.
 762 |    *
 763 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/isTrusted)
 764 |    */
 765 |   get isTrusted(): boolean;
 766 |   /**
 767 |    * @deprecated
 768 |    *
 769 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)
 770 |    */
 771 |   get cancelBubble(): boolean;
 772 |   /**
 773 |    * @deprecated
 774 |    *
 775 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)
 776 |    */
 777 |   set cancelBubble(value: boolean);
 778 |   /**
 779 |    * 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.
 780 |    *
 781 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopImmediatePropagation)
 782 |    */
 783 |   stopImmediatePropagation(): void;
 784 |   /**
 785 |    * 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.
 786 |    *
 787 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/preventDefault)
 788 |    */
 789 |   preventDefault(): void;
 790 |   /**
 791 |    * When dispatched in a tree, invoking this method prevents event from reaching any objects other than the current object.
 792 |    *
 793 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopPropagation)
 794 |    */
 795 |   stopPropagation(): void;
 796 |   /**
 797 |    * 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.
 798 |    *
 799 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composedPath)
 800 |    */
 801 |   composedPath(): EventTarget[];
 802 |   static readonly NONE: number;
 803 |   static readonly CAPTURING_PHASE: number;
 804 |   static readonly AT_TARGET: number;
 805 |   static readonly BUBBLING_PHASE: number;
 806 | }
 807 | interface EventInit {
 808 |   bubbles?: boolean;
 809 |   cancelable?: boolean;
 810 |   composed?: boolean;
 811 | }
 812 | type EventListener<EventType extends Event = Event> = (
 813 |   event: EventType,
 814 | ) => void;
 815 | interface EventListenerObject<EventType extends Event = Event> {
 816 |   handleEvent(event: EventType): void;
 817 | }
 818 | type EventListenerOrEventListenerObject<EventType extends Event = Event> =
 819 |   | EventListener<EventType>
 820 |   | EventListenerObject<EventType>;
 821 | /**
 822 |  * EventTarget is a DOM interface implemented by objects that can receive events and may have listeners for them.
 823 |  *
 824 |  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget)
 825 |  */
 826 | declare class EventTarget<
 827 |   EventMap extends Record<string, Event> = Record<string, Event>,
 828 | > {
 829 |   constructor();
 830 |   /**
 831 |    * 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.
 832 |    *
 833 |    * 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.
 834 |    *
 835 |    * 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.
 836 |    *
 837 |    * 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.
 838 |    *
 839 |    * When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
 840 |    *
 841 |    * If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
 842 |    *
 843 |    * The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
 844 |    *
 845 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
 846 |    */
 847 |   addEventListener<Type extends keyof EventMap>(
 848 |     type: Type,
 849 |     handler: EventListenerOrEventListenerObject<EventMap[Type]>,
 850 |     options?: EventTargetAddEventListenerOptions | boolean,
 851 |   ): void;
 852 |   /**
 853 |    * Removes the event listener in target's event listener list with the same type, callback, and options.
 854 |    *
 855 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
 856 |    */
 857 |   removeEventListener<Type extends keyof EventMap>(
 858 |     type: Type,
 859 |     handler: EventListenerOrEventListenerObject<EventMap[Type]>,
 860 |     options?: EventTargetEventListenerOptions | boolean,
 861 |   ): void;
 862 |   /**
 863 |    * 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.
 864 |    *
 865 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
 866 |    */
 867 |   dispatchEvent(event: EventMap[keyof EventMap]): boolean;
 868 | }
 869 | interface EventTargetEventListenerOptions {
 870 |   capture?: boolean;
 871 | }
 872 | interface EventTargetAddEventListenerOptions {
 873 |   capture?: boolean;
 874 |   passive?: boolean;
 875 |   once?: boolean;
 876 |   signal?: AbortSignal;
 877 | }
 878 | interface EventTargetHandlerObject {
 879 |   handleEvent: (event: Event) => any | undefined;
 880 | }
 881 | /**
 882 |  * A controller object that allows you to abort one or more DOM requests as and when desired.
 883 |  *
 884 |  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController)
 885 |  */
 886 | declare class AbortController {
 887 |   constructor();
 888 |   /**
 889 |    * Returns the AbortSignal object associated with this object.
 890 |    *
 891 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/signal)
 892 |    */
 893 |   get signal(): AbortSignal;
 894 |   /**
 895 |    * 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.
 896 |    *
 897 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/abort)
 898 |    */
 899 |   abort(reason?: any): void;
 900 | }
 901 | /**
 902 |  * 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.
 903 |  *
 904 |  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal)
 905 |  */
 906 | declare abstract class AbortSignal extends EventTarget {
 907 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_static) */
 908 |   static abort(reason?: any): AbortSignal;
 909 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/timeout_static) */
 910 |   static timeout(delay: number): AbortSignal;
 911 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/any_static) */
 912 |   static any(signals: AbortSignal[]): AbortSignal;
 913 |   /**
 914 |    * Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise.
 915 |    *
 916 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/aborted)
 917 |    */
 918 |   get aborted(): boolean;
 919 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/reason) */
 920 |   get reason(): any;
 921 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */
 922 |   get onabort(): any | null;
 923 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */
 924 |   set onabort(value: any | null);
 925 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/throwIfAborted) */
 926 |   throwIfAborted(): void;
 927 | }
 928 | interface Scheduler {
 929 |   wait(delay: number, maybeOptions?: SchedulerWaitOptions): Promise<void>;
 930 | }
 931 | interface SchedulerWaitOptions {
 932 |   signal?: AbortSignal;
 933 | }
 934 | /**
 935 |  * 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.
 936 |  *
 937 |  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent)
 938 |  */
 939 | declare abstract class ExtendableEvent extends Event {
 940 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent/waitUntil) */
 941 |   waitUntil(promise: Promise<any>): void;
 942 | }
 943 | /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent) */
 944 | declare class CustomEvent<T = any> extends Event {
 945 |   constructor(type: string, init?: CustomEventCustomEventInit);
 946 |   /**
 947 |    * Returns any custom data event was created with. Typically used for synthetic events.
 948 |    *
 949 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent/detail)
 950 |    */
 951 |   get detail(): T;
 952 | }
 953 | interface CustomEventCustomEventInit {
 954 |   bubbles?: boolean;
 955 |   cancelable?: boolean;
 956 |   composed?: boolean;
 957 |   detail?: any;
 958 | }
 959 | /**
 960 |  * 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.
 961 |  *
 962 |  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob)
 963 |  */
 964 | declare class Blob {
 965 |   constructor(
 966 |     type?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[],
 967 |     options?: BlobOptions,
 968 |   );
 969 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size) */
 970 |   get size(): number;
 971 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type) */
 972 |   get type(): string;
 973 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice) */
 974 |   slice(start?: number, end?: number, type?: string): Blob;
 975 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/arrayBuffer) */
 976 |   arrayBuffer(): Promise<ArrayBuffer>;
 977 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/bytes) */
 978 |   bytes(): Promise<Uint8Array>;
 979 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text) */
 980 |   text(): Promise<string>;
 981 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/stream) */
 982 |   stream(): ReadableStream;
 983 | }
 984 | interface BlobOptions {
 985 |   type?: string;
 986 | }
 987 | /**
 988 |  * Provides information about files and allows JavaScript in a web page to access their content.
 989 |  *
 990 |  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File)
 991 |  */
 992 | declare class File extends Blob {
 993 |   constructor(
 994 |     bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined,
 995 |     name: string,
 996 |     options?: FileOptions,
 997 |   );
 998 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name) */
 999 |   get name(): string;
1000 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified) */
1001 |   get lastModified(): number;
1002 | }
1003 | interface FileOptions {
1004 |   type?: string;
1005 |   lastModified?: number;
1006 | }
1007 | /**
1008 |  * The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache.
1009 |  *
1010 |  * [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/)
1011 |  */
1012 | declare abstract class CacheStorage {
1013 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/open) */
1014 |   open(cacheName: string): Promise<Cache>;
1015 |   readonly default: Cache;
1016 | }
1017 | /**
1018 |  * The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache.
1019 |  *
1020 |  * [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/)
1021 |  */
1022 | declare abstract class Cache {
1023 |   /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#delete) */
1024 |   delete(
1025 |     request: RequestInfo | URL,
1026 |     options?: CacheQueryOptions,
1027 |   ): Promise<boolean>;
1028 |   /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#match) */
1029 |   match(
1030 |     request: RequestInfo | URL,
1031 |     options?: CacheQueryOptions,
1032 |   ): Promise<Response | undefined>;
1033 |   /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#put) */
1034 |   put(request: RequestInfo | URL, response: Response): Promise<void>;
1035 | }
1036 | interface CacheQueryOptions {
1037 |   ignoreMethod?: boolean;
1038 | }
1039 | /**
1040 |  * The Web Crypto API provides a set of low-level functions for common cryptographic tasks.
1041 |  * The Workers runtime implements the full surface of this API, but with some differences in
1042 |  * the [supported algorithms](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/#supported-algorithms)
1043 |  * compared to those implemented in most browsers.
1044 |  *
1045 |  * [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/)
1046 |  */
1047 | declare abstract class Crypto {
1048 |   /**
1049 |    * Available only in secure contexts.
1050 |    *
1051 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/subtle)
1052 |    */
1053 |   get subtle(): SubtleCrypto;
1054 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues) */
1055 |   getRandomValues<
1056 |     T extends
1057 |       | Int8Array
1058 |       | Uint8Array
1059 |       | Int16Array
1060 |       | Uint16Array
1061 |       | Int32Array
1062 |       | Uint32Array
1063 |       | BigInt64Array
1064 |       | BigUint64Array,
1065 |   >(buffer: T): T;
1066 |   /**
1067 |    * Available only in secure contexts.
1068 |    *
1069 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/randomUUID)
1070 |    */
1071 |   randomUUID(): string;
1072 |   DigestStream: typeof DigestStream;
1073 | }
1074 | /**
1075 |  * 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).
1076 |  * Available only in secure contexts.
1077 |  *
1078 |  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto)
1079 |  */
1080 | declare abstract class SubtleCrypto {
1081 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/encrypt) */
1082 |   encrypt(
1083 |     algorithm: string | SubtleCryptoEncryptAlgorithm,
1084 |     key: CryptoKey,
1085 |     plainText: ArrayBuffer | ArrayBufferView,
1086 |   ): Promise<ArrayBuffer>;
1087 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/decrypt) */
1088 |   decrypt(
1089 |     algorithm: string | SubtleCryptoEncryptAlgorithm,
1090 |     key: CryptoKey,
1091 |     cipherText: ArrayBuffer | ArrayBufferView,
1092 |   ): Promise<ArrayBuffer>;
1093 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/sign) */
1094 |   sign(
1095 |     algorithm: string | SubtleCryptoSignAlgorithm,
1096 |     key: CryptoKey,
1097 |     data: ArrayBuffer | ArrayBufferView,
1098 |   ): Promise<ArrayBuffer>;
1099 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/verify) */
1100 |   verify(
1101 |     algorithm: string | SubtleCryptoSignAlgorithm,
1102 |     key: CryptoKey,
1103 |     signature: ArrayBuffer | ArrayBufferView,
1104 |     data: ArrayBuffer | ArrayBufferView,
1105 |   ): Promise<boolean>;
1106 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/digest) */
1107 |   digest(
1108 |     algorithm: string | SubtleCryptoHashAlgorithm,
1109 |     data: ArrayBuffer | ArrayBufferView,
1110 |   ): Promise<ArrayBuffer>;
1111 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/generateKey) */
1112 |   generateKey(
1113 |     algorithm: string | SubtleCryptoGenerateKeyAlgorithm,
1114 |     extractable: boolean,
1115 |     keyUsages: string[],
1116 |   ): Promise<CryptoKey | CryptoKeyPair>;
1117 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveKey) */
1118 |   deriveKey(
1119 |     algorithm: string | SubtleCryptoDeriveKeyAlgorithm,
1120 |     baseKey: CryptoKey,
1121 |     derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm,
1122 |     extractable: boolean,
1123 |     keyUsages: string[],
1124 |   ): Promise<CryptoKey>;
1125 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveBits) */
1126 |   deriveBits(
1127 |     algorithm: string | SubtleCryptoDeriveKeyAlgorithm,
1128 |     baseKey: CryptoKey,
1129 |     length?: number | null,
1130 |   ): Promise<ArrayBuffer>;
1131 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/importKey) */
1132 |   importKey(
1133 |     format: string,
1134 |     keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey,
1135 |     algorithm: string | SubtleCryptoImportKeyAlgorithm,
1136 |     extractable: boolean,
1137 |     keyUsages: string[],
1138 |   ): Promise<CryptoKey>;
1139 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/exportKey) */
1140 |   exportKey(format: string, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;
1141 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/wrapKey) */
1142 |   wrapKey(
1143 |     format: string,
1144 |     key: CryptoKey,
1145 |     wrappingKey: CryptoKey,
1146 |     wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm,
1147 |   ): Promise<ArrayBuffer>;
1148 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/unwrapKey) */
1149 |   unwrapKey(
1150 |     format: string,
1151 |     wrappedKey: ArrayBuffer | ArrayBufferView,
1152 |     unwrappingKey: CryptoKey,
1153 |     unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm,
1154 |     unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm,
1155 |     extractable: boolean,
1156 |     keyUsages: string[],
1157 |   ): Promise<CryptoKey>;
1158 |   timingSafeEqual(
1159 |     a: ArrayBuffer | ArrayBufferView,
1160 |     b: ArrayBuffer | ArrayBufferView,
1161 |   ): boolean;
1162 | }
1163 | /**
1164 |  * The CryptoKey dictionary of the Web Crypto API represents a cryptographic key.
1165 |  * Available only in secure contexts.
1166 |  *
1167 |  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey)
1168 |  */
1169 | declare abstract class CryptoKey {
1170 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/type) */
1171 |   readonly type: string;
1172 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/extractable) */
1173 |   readonly extractable: boolean;
1174 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/algorithm) */
1175 |   readonly algorithm:
1176 |     | CryptoKeyKeyAlgorithm
1177 |     | CryptoKeyAesKeyAlgorithm
1178 |     | CryptoKeyHmacKeyAlgorithm
1179 |     | CryptoKeyRsaKeyAlgorithm
1180 |     | CryptoKeyEllipticKeyAlgorithm
1181 |     | CryptoKeyArbitraryKeyAlgorithm;
1182 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/usages) */
1183 |   readonly usages: string[];
1184 | }
1185 | interface CryptoKeyPair {
1186 |   publicKey: CryptoKey;
1187 |   privateKey: CryptoKey;
1188 | }
1189 | interface JsonWebKey {
1190 |   kty: string;
1191 |   use?: string;
1192 |   key_ops?: string[];
1193 |   alg?: string;
1194 |   ext?: boolean;
1195 |   crv?: string;
1196 |   x?: string;
1197 |   y?: string;
1198 |   d?: string;
1199 |   n?: string;
1200 |   e?: string;
1201 |   p?: string;
1202 |   q?: string;
1203 |   dp?: string;
1204 |   dq?: string;
1205 |   qi?: string;
1206 |   oth?: RsaOtherPrimesInfo[];
1207 |   k?: string;
1208 | }
1209 | interface RsaOtherPrimesInfo {
1210 |   r?: string;
1211 |   d?: string;
1212 |   t?: string;
1213 | }
1214 | interface SubtleCryptoDeriveKeyAlgorithm {
1215 |   name: string;
1216 |   salt?: ArrayBuffer | ArrayBufferView;
1217 |   iterations?: number;
1218 |   hash?: string | SubtleCryptoHashAlgorithm;
1219 |   $public?: CryptoKey;
1220 |   info?: ArrayBuffer | ArrayBufferView;
1221 | }
1222 | interface SubtleCryptoEncryptAlgorithm {
1223 |   name: string;
1224 |   iv?: ArrayBuffer | ArrayBufferView;
1225 |   additionalData?: ArrayBuffer | ArrayBufferView;
1226 |   tagLength?: number;
1227 |   counter?: ArrayBuffer | ArrayBufferView;
1228 |   length?: number;
1229 |   label?: ArrayBuffer | ArrayBufferView;
1230 | }
1231 | interface SubtleCryptoGenerateKeyAlgorithm {
1232 |   name: string;
1233 |   hash?: string | SubtleCryptoHashAlgorithm;
1234 |   modulusLength?: number;
1235 |   publicExponent?: ArrayBuffer | ArrayBufferView;
1236 |   length?: number;
1237 |   namedCurve?: string;
1238 | }
1239 | interface SubtleCryptoHashAlgorithm {
1240 |   name: string;
1241 | }
1242 | interface SubtleCryptoImportKeyAlgorithm {
1243 |   name: string;
1244 |   hash?: string | SubtleCryptoHashAlgorithm;
1245 |   length?: number;
1246 |   namedCurve?: string;
1247 |   compressed?: boolean;
1248 | }
1249 | interface SubtleCryptoSignAlgorithm {
1250 |   name: string;
1251 |   hash?: string | SubtleCryptoHashAlgorithm;
1252 |   dataLength?: number;
1253 |   saltLength?: number;
1254 | }
1255 | interface CryptoKeyKeyAlgorithm {
1256 |   name: string;
1257 | }
1258 | interface CryptoKeyAesKeyAlgorithm {
1259 |   name: string;
1260 |   length: number;
1261 | }
1262 | interface CryptoKeyHmacKeyAlgorithm {
1263 |   name: string;
1264 |   hash: CryptoKeyKeyAlgorithm;
1265 |   length: number;
1266 | }
1267 | interface CryptoKeyRsaKeyAlgorithm {
1268 |   name: string;
1269 |   modulusLength: number;
1270 |   publicExponent: ArrayBuffer | ArrayBufferView;
1271 |   hash?: CryptoKeyKeyAlgorithm;
1272 | }
1273 | interface CryptoKeyEllipticKeyAlgorithm {
1274 |   name: string;
1275 |   namedCurve: string;
1276 | }
1277 | interface CryptoKeyArbitraryKeyAlgorithm {
1278 |   name: string;
1279 |   hash?: CryptoKeyKeyAlgorithm;
1280 |   namedCurve?: string;
1281 |   length?: number;
1282 | }
1283 | declare class DigestStream extends WritableStream<
1284 |   ArrayBuffer | ArrayBufferView
1285 | > {
1286 |   constructor(algorithm: string | SubtleCryptoHashAlgorithm);
1287 |   readonly digest: Promise<ArrayBuffer>;
1288 |   get bytesWritten(): number | bigint;
1289 | }
1290 | /**
1291 |  * 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.
1292 |  *
1293 |  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder)
1294 |  */
1295 | declare class TextDecoder {
1296 |   constructor(label?: string, options?: TextDecoderConstructorOptions);
1297 |   /**
1298 |    * 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.
1299 |    *
1300 |    * ```
1301 |    * var string = "", decoder = new TextDecoder(encoding), buffer;
1302 |    * while(buffer = next_chunk()) {
1303 |    *   string += decoder.decode(buffer, {stream:true});
1304 |    * }
1305 |    * string += decoder.decode(); // end-of-queue
1306 |    * ```
1307 |    *
1308 |    * If the error mode is "fatal" and encoding's decoder returns error, throws a TypeError.
1309 |    *
1310 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder/decode)
1311 |    */
1312 |   decode(
1313 |     input?: ArrayBuffer | ArrayBufferView,
1314 |     options?: TextDecoderDecodeOptions,
1315 |   ): string;
1316 |   get encoding(): string;
1317 |   get fatal(): boolean;
1318 |   get ignoreBOM(): boolean;
1319 | }
1320 | /**
1321 |  * 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.
1322 |  *
1323 |  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder)
1324 |  */
1325 | declare class TextEncoder {
1326 |   constructor();
1327 |   /**
1328 |    * Returns the result of running UTF-8's encoder.
1329 |    *
1330 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encode)
1331 |    */
1332 |   encode(input?: string): Uint8Array;
1333 |   /**
1334 |    * 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.
1335 |    *
1336 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encodeInto)
1337 |    */
1338 |   encodeInto(
1339 |     input: string,
1340 |     buffer: ArrayBuffer | ArrayBufferView,
1341 |   ): TextEncoderEncodeIntoResult;
1342 |   get encoding(): string;
1343 | }
1344 | interface TextDecoderConstructorOptions {
1345 |   fatal: boolean;
1346 |   ignoreBOM: boolean;
1347 | }
1348 | interface TextDecoderDecodeOptions {
1349 |   stream: boolean;
1350 | }
1351 | interface TextEncoderEncodeIntoResult {
1352 |   read: number;
1353 |   written: number;
1354 | }
1355 | /**
1356 |  * Events providing information related to errors in scripts or in files.
1357 |  *
1358 |  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent)
1359 |  */
1360 | declare class ErrorEvent extends Event {
1361 |   constructor(type: string, init?: ErrorEventErrorEventInit);
1362 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/filename) */
1363 |   get filename(): string;
1364 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/message) */
1365 |   get message(): string;
1366 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/lineno) */
1367 |   get lineno(): number;
1368 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/colno) */
1369 |   get colno(): number;
1370 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/error) */
1371 |   get error(): any;
1372 | }
1373 | interface ErrorEventErrorEventInit {
1374 |   message?: string;
1375 |   filename?: string;
1376 |   lineno?: number;
1377 |   colno?: number;
1378 |   error?: any;
1379 | }
1380 | /**
1381 |  * 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".
1382 |  *
1383 |  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData)
1384 |  */
1385 | declare class FormData {
1386 |   constructor();
1387 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append) */
1388 |   append(name: string, value: string): void;
1389 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append) */
1390 |   append(name: string, value: Blob, filename?: string): void;
1391 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/delete) */
1392 |   delete(name: string): void;
1393 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/get) */
1394 |   get(name: string): (File | string) | null;
1395 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/getAll) */
1396 |   getAll(name: string): (File | string)[];
1397 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/has) */
1398 |   has(name: string): boolean;
1399 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set) */
1400 |   set(name: string, value: string): void;
1401 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set) */
1402 |   set(name: string, value: Blob, filename?: string): void;
1403 |   /* Returns an array of key, value pairs for every entry in the list. */
1404 |   entries(): IterableIterator<[key: string, value: File | string]>;
1405 |   /* Returns a list of keys in the list. */
1406 |   keys(): IterableIterator<string>;
1407 |   /* Returns a list of values in the list. */
1408 |   values(): IterableIterator<File | string>;
1409 |   forEach<This = unknown>(
1410 |     callback: (
1411 |       this: This,
1412 |       value: File | string,
1413 |       key: string,
1414 |       parent: FormData,
1415 |     ) => void,
1416 |     thisArg?: This,
1417 |   ): void;
1418 |   [Symbol.iterator](): IterableIterator<[key: string, value: File | string]>;
1419 | }
1420 | interface ContentOptions {
1421 |   html?: boolean;
1422 | }
1423 | declare class HTMLRewriter {
1424 |   constructor();
1425 |   on(
1426 |     selector: string,
1427 |     handlers: HTMLRewriterElementContentHandlers,
1428 |   ): HTMLRewriter;
1429 |   onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter;
1430 |   transform(response: Response): Response;
1431 | }
1432 | interface HTMLRewriterElementContentHandlers {
1433 |   element?(element: Element): void | Promise<void>;
1434 |   comments?(comment: Comment): void | Promise<void>;
1435 |   text?(element: Text): void | Promise<void>;
1436 | }
1437 | interface HTMLRewriterDocumentContentHandlers {
1438 |   doctype?(doctype: Doctype): void | Promise<void>;
1439 |   comments?(comment: Comment): void | Promise<void>;
1440 |   text?(text: Text): void | Promise<void>;
1441 |   end?(end: DocumentEnd): void | Promise<void>;
1442 | }
1443 | interface Doctype {
1444 |   readonly name: string | null;
1445 |   readonly publicId: string | null;
1446 |   readonly systemId: string | null;
1447 | }
1448 | interface Element {
1449 |   tagName: string;
1450 |   readonly attributes: IterableIterator<string[]>;
1451 |   readonly removed: boolean;
1452 |   readonly namespaceURI: string;
1453 |   getAttribute(name: string): string | null;
1454 |   hasAttribute(name: string): boolean;
1455 |   setAttribute(name: string, value: string): Element;
1456 |   removeAttribute(name: string): Element;
1457 |   before(
1458 |     content: string | ReadableStream | Response,
1459 |     options?: ContentOptions,
1460 |   ): Element;
1461 |   after(
1462 |     content: string | ReadableStream | Response,
1463 |     options?: ContentOptions,
1464 |   ): Element;
1465 |   prepend(
1466 |     content: string | ReadableStream | Response,
1467 |     options?: ContentOptions,
1468 |   ): Element;
1469 |   append(
1470 |     content: string | ReadableStream | Response,
1471 |     options?: ContentOptions,
1472 |   ): Element;
1473 |   replace(
1474 |     content: string | ReadableStream | Response,
1475 |     options?: ContentOptions,
1476 |   ): Element;
1477 |   remove(): Element;
1478 |   removeAndKeepContent(): Element;
1479 |   setInnerContent(
1480 |     content: string | ReadableStream | Response,
1481 |     options?: ContentOptions,
1482 |   ): Element;
1483 |   onEndTag(handler: (tag: EndTag) => void | Promise<void>): void;
1484 | }
1485 | interface EndTag {
1486 |   name: string;
1487 |   before(
1488 |     content: string | ReadableStream | Response,
1489 |     options?: ContentOptions,
1490 |   ): EndTag;
1491 |   after(
1492 |     content: string | ReadableStream | Response,
1493 |     options?: ContentOptions,
1494 |   ): EndTag;
1495 |   remove(): EndTag;
1496 | }
1497 | interface Comment {
1498 |   text: string;
1499 |   readonly removed: boolean;
1500 |   before(content: string, options?: ContentOptions): Comment;
1501 |   after(content: string, options?: ContentOptions): Comment;
1502 |   replace(content: string, options?: ContentOptions): Comment;
1503 |   remove(): Comment;
1504 | }
1505 | interface Text {
1506 |   readonly text: string;
1507 |   readonly lastInTextNode: boolean;
1508 |   readonly removed: boolean;
1509 |   before(
1510 |     content: string | ReadableStream | Response,
1511 |     options?: ContentOptions,
1512 |   ): Text;
1513 |   after(
1514 |     content: string | ReadableStream | Response,
1515 |     options?: ContentOptions,
1516 |   ): Text;
1517 |   replace(
1518 |     content: string | ReadableStream | Response,
1519 |     options?: ContentOptions,
1520 |   ): Text;
1521 |   remove(): Text;
1522 | }
1523 | interface DocumentEnd {
1524 |   append(content: string, options?: ContentOptions): DocumentEnd;
1525 | }
1526 | /**
1527 |  * 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.
1528 |  *
1529 |  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent)
1530 |  */
1531 | declare abstract class FetchEvent extends ExtendableEvent {
1532 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/request) */
1533 |   readonly request: Request;
1534 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/respondWith) */
1535 |   respondWith(promise: Response | Promise<Response>): void;
1536 |   passThroughOnException(): void;
1537 | }
1538 | type HeadersInit =
1539 |   | Headers
1540 |   | Iterable<Iterable<string>>
1541 |   | Record<string, string>;
1542 | /**
1543 |  * 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.
1544 |  *
1545 |  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers)
1546 |  */
1547 | declare class Headers {
1548 |   constructor(init?: HeadersInit);
1549 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/get) */
1550 |   get(name: string): string | null;
1551 |   getAll(name: string): string[];
1552 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/getSetCookie) */
1553 |   getSetCookie(): string[];
1554 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/has) */
1555 |   has(name: string): boolean;
1556 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/set) */
1557 |   set(name: string, value: string): void;
1558 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/append) */
1559 |   append(name: string, value: string): void;
1560 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/delete) */
1561 |   delete(name: string): void;
1562 |   forEach<This = unknown>(
1563 |     callback: (this: This, value: string, key: string, parent: Headers) => void,
1564 |     thisArg?: This,
1565 |   ): void;
1566 |   /* Returns an iterator allowing to go through all key/value pairs contained in this object. */
1567 |   entries(): IterableIterator<[key: string, value: string]>;
1568 |   /* Returns an iterator allowing to go through all keys of the key/value pairs contained in this object. */
1569 |   keys(): IterableIterator<string>;
1570 |   /* Returns an iterator allowing to go through all values of the key/value pairs contained in this object. */
1571 |   values(): IterableIterator<string>;
1572 |   [Symbol.iterator](): IterableIterator<[key: string, value: string]>;
1573 | }
1574 | type BodyInit =
1575 |   | ReadableStream<Uint8Array>
1576 |   | string
1577 |   | ArrayBuffer
1578 |   | ArrayBufferView
1579 |   | Blob
1580 |   | URLSearchParams
1581 |   | FormData;
1582 | declare abstract class Body {
1583 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/body) */
1584 |   get body(): ReadableStream | null;
1585 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bodyUsed) */
1586 |   get bodyUsed(): boolean;
1587 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/arrayBuffer) */
1588 |   arrayBuffer(): Promise<ArrayBuffer>;
1589 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bytes) */
1590 |   bytes(): Promise<Uint8Array>;
1591 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/text) */
1592 |   text(): Promise<string>;
1593 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/json) */
1594 |   json<T>(): Promise<T>;
1595 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/formData) */
1596 |   formData(): Promise<FormData>;
1597 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/blob) */
1598 |   blob(): Promise<Blob>;
1599 | }
1600 | /**
1601 |  * This Fetch API interface represents the response to a request.
1602 |  *
1603 |  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)
1604 |  */
1605 | declare var Response: {
1606 |   prototype: Response;
1607 |   new (body?: BodyInit | null, init?: ResponseInit): Response;
1608 |   error(): Response;
1609 |   redirect(url: string, status?: number): Response;
1610 |   json(any: any, maybeInit?: ResponseInit | Response): Response;
1611 | };
1612 | /**
1613 |  * This Fetch API interface represents the response to a request.
1614 |  *
1615 |  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)
1616 |  */
1617 | interface Response extends Body {
1618 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/clone) */
1619 |   clone(): Response;
1620 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/status) */
1621 |   status: number;
1622 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/statusText) */
1623 |   statusText: string;
1624 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/headers) */
1625 |   headers: Headers;
1626 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/ok) */
1627 |   ok: boolean;
1628 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirected) */
1629 |   redirected: boolean;
1630 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/url) */
1631 |   url: string;
1632 |   webSocket: WebSocket | null;
1633 |   cf: any | undefined;
1634 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/type) */
1635 |   type: "default" | "error";
1636 | }
1637 | interface ResponseInit {
1638 |   status?: number;
1639 |   statusText?: string;
1640 |   headers?: HeadersInit;
1641 |   cf?: any;
1642 |   webSocket?: WebSocket | null;
1643 |   encodeBody?: "automatic" | "manual";
1644 | }
1645 | type RequestInfo<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> =
1646 |   | Request<CfHostMetadata, Cf>
1647 |   | string;
1648 | /**
1649 |  * This Fetch API interface represents a resource request.
1650 |  *
1651 |  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request)
1652 |  */
1653 | declare var Request: {
1654 |   prototype: Request;
1655 |   new <CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>>(
1656 |     input: RequestInfo<CfProperties> | URL,
1657 |     init?: RequestInit<Cf>,
1658 |   ): Request<CfHostMetadata, Cf>;
1659 | };
1660 | /**
1661 |  * This Fetch API interface represents a resource request.
1662 |  *
1663 |  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request)
1664 |  */
1665 | interface Request<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>>
1666 |   extends Body {
1667 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/clone) */
1668 |   clone(): Request<CfHostMetadata, Cf>;
1669 |   /**
1670 |    * Returns request's HTTP method, which is "GET" by default.
1671 |    *
1672 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/method)
1673 |    */
1674 |   method: string;
1675 |   /**
1676 |    * Returns the URL of request as a string.
1677 |    *
1678 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/url)
1679 |    */
1680 |   url: string;
1681 |   /**
1682 |    * 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.
1683 |    *
1684 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/headers)
1685 |    */
1686 |   headers: Headers;
1687 |   /**
1688 |    * 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.
1689 |    *
1690 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/redirect)
1691 |    */
1692 |   redirect: string;
1693 |   fetcher: Fetcher | null;
1694 |   /**
1695 |    * Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler.
1696 |    *
1697 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/signal)
1698 |    */
1699 |   signal: AbortSignal;
1700 |   cf: Cf | undefined;
1701 |   /**
1702 |    * 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]
1703 |    *
1704 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/integrity)
1705 |    */
1706 |   integrity: string;
1707 |   /**
1708 |    * Returns a boolean indicating whether or not request can outlive the global in which it was created.
1709 |    *
1710 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/keepalive)
1711 |    */
1712 |   keepalive: boolean;
1713 |   /**
1714 |    * Returns the cache mode associated with request, which is a string indicating how the request will interact with the browser's cache when fetching.
1715 |    *
1716 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/cache)
1717 |    */
1718 |   cache?: "no-store";
1719 | }
1720 | interface RequestInit<Cf = CfProperties> {
1721 |   /* A string to set request's method. */
1722 |   method?: string;
1723 |   /* A Headers object, an object literal, or an array of two-item arrays to set request's headers. */
1724 |   headers?: HeadersInit;
1725 |   /* A BodyInit object or null to set request's body. */
1726 |   body?: BodyInit | null;
1727 |   /* 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. */
1728 |   redirect?: string;
1729 |   fetcher?: Fetcher | null;
1730 |   cf?: Cf;
1731 |   /* A string indicating how the request will interact with the browser's cache to set request's cache. */
1732 |   cache?: "no-store";
1733 |   /* A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
1734 |   integrity?: string;
1735 |   /* An AbortSignal to set request's signal. */
1736 |   signal?: AbortSignal | null;
1737 |   encodeResponseBody?: "automatic" | "manual";
1738 | }
1739 | type Service<T extends Rpc.WorkerEntrypointBranded | undefined = undefined> =
1740 |   Fetcher<T>;
1741 | type Fetcher<
1742 |   T extends Rpc.EntrypointBranded | undefined = undefined,
1743 |   Reserved extends string = never,
1744 | > = (T extends Rpc.EntrypointBranded
1745 |   ? Rpc.Provider<T, Reserved | "fetch" | "connect">
1746 |   : unknown) & {
1747 |   fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
1748 |   connect(address: SocketAddress | string, options?: SocketOptions): Socket;
1749 | };
1750 | interface KVNamespaceListKey<Metadata, Key extends string = string> {
1751 |   name: Key;
1752 |   expiration?: number;
1753 |   metadata?: Metadata;
1754 | }
1755 | type KVNamespaceListResult<Metadata, Key extends string = string> =
1756 |   | {
1757 |       list_complete: false;
1758 |       keys: KVNamespaceListKey<Metadata, Key>[];
1759 |       cursor: string;
1760 |       cacheStatus: string | null;
1761 |     }
1762 |   | {
1763 |       list_complete: true;
1764 |       keys: KVNamespaceListKey<Metadata, Key>[];
1765 |       cacheStatus: string | null;
1766 |     };
1767 | interface KVNamespace<Key extends string = string> {
1768 |   get(
1769 |     key: Key,
1770 |     options?: Partial<KVNamespaceGetOptions<undefined>>,
1771 |   ): Promise<string | null>;
1772 |   get(key: Key, type: "text"): Promise<string | null>;
1773 |   get<ExpectedValue = unknown>(
1774 |     key: Key,
1775 |     type: "json",
1776 |   ): Promise<ExpectedValue | null>;
1777 |   get(key: Key, type: "arrayBuffer"): Promise<ArrayBuffer | null>;
1778 |   get(key: Key, type: "stream"): Promise<ReadableStream | null>;
1779 |   get(
1780 |     key: Key,
1781 |     options?: KVNamespaceGetOptions<"text">,
1782 |   ): Promise<string | null>;
1783 |   get<ExpectedValue = unknown>(
1784 |     key: Key,
1785 |     options?: KVNamespaceGetOptions<"json">,
1786 |   ): Promise<ExpectedValue | null>;
1787 |   get(
1788 |     key: Key,
1789 |     options?: KVNamespaceGetOptions<"arrayBuffer">,
1790 |   ): Promise<ArrayBuffer | null>;
1791 |   get(
1792 |     key: Key,
1793 |     options?: KVNamespaceGetOptions<"stream">,
1794 |   ): Promise<ReadableStream | null>;
1795 |   get(key: Array<Key>, type: "text"): Promise<Map<string, string | null>>;
1796 |   get<ExpectedValue = unknown>(
1797 |     key: Array<Key>,
1798 |     type: "json",
1799 |   ): Promise<Map<string, ExpectedValue | null>>;
1800 |   get(
1801 |     key: Array<Key>,
1802 |     options?: Partial<KVNamespaceGetOptions<undefined>>,
1803 |   ): Promise<Map<string, string | null>>;
1804 |   get(
1805 |     key: Array<Key>,
1806 |     options?: KVNamespaceGetOptions<"text">,
1807 |   ): Promise<Map<string, string | null>>;
1808 |   get<ExpectedValue = unknown>(
1809 |     key: Array<Key>,
1810 |     options?: KVNamespaceGetOptions<"json">,
1811 |   ): Promise<Map<string, ExpectedValue | null>>;
1812 |   list<Metadata = unknown>(
1813 |     options?: KVNamespaceListOptions,
1814 |   ): Promise<KVNamespaceListResult<Metadata, Key>>;
1815 |   put(
1816 |     key: Key,
1817 |     value: string | ArrayBuffer | ArrayBufferView | ReadableStream,
1818 |     options?: KVNamespacePutOptions,
1819 |   ): Promise<void>;
1820 |   getWithMetadata<Metadata = unknown>(
1821 |     key: Key,
1822 |     options?: Partial<KVNamespaceGetOptions<undefined>>,
1823 |   ): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
1824 |   getWithMetadata<Metadata = unknown>(
1825 |     key: Key,
1826 |     type: "text",
1827 |   ): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
1828 |   getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(
1829 |     key: Key,
1830 |     type: "json",
1831 |   ): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;
1832 |   getWithMetadata<Metadata = unknown>(
1833 |     key: Key,
1834 |     type: "arrayBuffer",
1835 |   ): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;
1836 |   getWithMetadata<Metadata = unknown>(
1837 |     key: Key,
1838 |     type: "stream",
1839 |   ): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;
1840 |   getWithMetadata<Metadata = unknown>(
1841 |     key: Key,
1842 |     options: KVNamespaceGetOptions<"text">,
1843 |   ): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
1844 |   getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(
1845 |     key: Key,
1846 |     options: KVNamespaceGetOptions<"json">,
1847 |   ): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;
1848 |   getWithMetadata<Metadata = unknown>(
1849 |     key: Key,
1850 |     options: KVNamespaceGetOptions<"arrayBuffer">,
1851 |   ): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;
1852 |   getWithMetadata<Metadata = unknown>(
1853 |     key: Key,
1854 |     options: KVNamespaceGetOptions<"stream">,
1855 |   ): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;
1856 |   getWithMetadata<Metadata = unknown>(
1857 |     key: Array<Key>,
1858 |     type: "text",
1859 |   ): Promise<Map<string, KVNamespaceGetWithMetadataResult<string, Metadata>>>;
1860 |   getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(
1861 |     key: Array<Key>,
1862 |     type: "json",
1863 |   ): Promise<
1864 |     Map<string, KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>
1865 |   >;
1866 |   getWithMetadata<Metadata = unknown>(
1867 |     key: Array<Key>,
1868 |     options?: Partial<KVNamespaceGetOptions<undefined>>,
1869 |   ): Promise<Map<string, KVNamespaceGetWithMetadataResult<string, Metadata>>>;
1870 |   getWithMetadata<Metadata = unknown>(
1871 |     key: Array<Key>,
1872 |     options?: KVNamespaceGetOptions<"text">,
1873 |   ): Promise<Map<string, KVNamespaceGetWithMetadataResult<string, Metadata>>>;
1874 |   getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(
1875 |     key: Array<Key>,
1876 |     options?: KVNamespaceGetOptions<"json">,
1877 |   ): Promise<
1878 |     Map<string, KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>
1879 |   >;
1880 |   delete(key: Key): Promise<void>;
1881 | }
1882 | interface KVNamespaceListOptions {
1883 |   limit?: number;
1884 |   prefix?: string | null;
1885 |   cursor?: string | null;
1886 | }
1887 | interface KVNamespaceGetOptions<Type> {
1888 |   type: Type;
1889 |   cacheTtl?: number;
1890 | }
1891 | interface KVNamespacePutOptions {
1892 |   expiration?: number;
1893 |   expirationTtl?: number;
1894 |   metadata?: any | null;
1895 | }
1896 | interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
1897 |   value: Value | null;
1898 |   metadata: Metadata | null;
1899 |   cacheStatus: string | null;
1900 | }
1901 | type QueueContentType = "text" | "bytes" | "json" | "v8";
1902 | interface Queue<Body = unknown> {
1903 |   send(message: Body, options?: QueueSendOptions): Promise<void>;
1904 |   sendBatch(
1905 |     messages: Iterable<MessageSendRequest<Body>>,
1906 |     options?: QueueSendBatchOptions,
1907 |   ): Promise<void>;
1908 | }
1909 | interface QueueSendOptions {
1910 |   contentType?: QueueContentType;
1911 |   delaySeconds?: number;
1912 | }
1913 | interface QueueSendBatchOptions {
1914 |   delaySeconds?: number;
1915 | }
1916 | interface MessageSendRequest<Body = unknown> {
1917 |   body: Body;
1918 |   contentType?: QueueContentType;
1919 |   delaySeconds?: number;
1920 | }
1921 | interface QueueRetryOptions {
1922 |   delaySeconds?: number;
1923 | }
1924 | interface Message<Body = unknown> {
1925 |   readonly id: string;
1926 |   readonly timestamp: Date;
1927 |   readonly body: Body;
1928 |   readonly attempts: number;
1929 |   retry(options?: QueueRetryOptions): void;
1930 |   ack(): void;
1931 | }
1932 | interface QueueEvent<Body = unknown> extends ExtendableEvent {
1933 |   readonly messages: readonly Message<Body>[];
1934 |   readonly queue: string;
1935 |   retryAll(options?: QueueRetryOptions): void;
1936 |   ackAll(): void;
1937 | }
1938 | interface MessageBatch<Body = unknown> {
1939 |   readonly messages: readonly Message<Body>[];
1940 |   readonly queue: string;
1941 |   retryAll(options?: QueueRetryOptions): void;
1942 |   ackAll(): void;
1943 | }
1944 | interface R2Error extends Error {
1945 |   readonly name: string;
1946 |   readonly code: number;
1947 |   readonly message: string;
1948 |   readonly action: string;
1949 |   readonly stack: any;
1950 | }
1951 | interface R2ListOptions {
1952 |   limit?: number;
1953 |   prefix?: string;
1954 |   cursor?: string;
1955 |   delimiter?: string;
1956 |   startAfter?: string;
1957 |   include?: ("httpMetadata" | "customMetadata")[];
1958 | }
1959 | declare abstract class R2Bucket {
1960 |   head(key: string): Promise<R2Object | null>;
1961 |   get(
1962 |     key: string,
1963 |     options: R2GetOptions & {
1964 |       onlyIf: R2Conditional | Headers;
1965 |     },
1966 |   ): Promise<R2ObjectBody | R2Object | null>;
1967 |   get(key: string, options?: R2GetOptions): Promise<R2ObjectBody | null>;
1968 |   put(
1969 |     key: string,
1970 |     value:
1971 |       | ReadableStream
1972 |       | ArrayBuffer
1973 |       | ArrayBufferView
1974 |       | string
1975 |       | null
1976 |       | Blob,
1977 |     options?: R2PutOptions & {
1978 |       onlyIf: R2Conditional | Headers;
1979 |     },
1980 |   ): Promise<R2Object | null>;
1981 |   put(
1982 |     key: string,
1983 |     value:
1984 |       | ReadableStream
1985 |       | ArrayBuffer
1986 |       | ArrayBufferView
1987 |       | string
1988 |       | null
1989 |       | Blob,
1990 |     options?: R2PutOptions,
1991 |   ): Promise<R2Object>;
1992 |   createMultipartUpload(
1993 |     key: string,
1994 |     options?: R2MultipartOptions,
1995 |   ): Promise<R2MultipartUpload>;
1996 |   resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload;
1997 |   delete(keys: string | string[]): Promise<void>;
1998 |   list(options?: R2ListOptions): Promise<R2Objects>;
1999 | }
2000 | interface R2MultipartUpload {
2001 |   readonly key: string;
2002 |   readonly uploadId: string;
2003 |   uploadPart(
2004 |     partNumber: number,
2005 |     value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob,
2006 |     options?: R2UploadPartOptions,
2007 |   ): Promise<R2UploadedPart>;
2008 |   abort(): Promise<void>;
2009 |   complete(uploadedParts: R2UploadedPart[]): Promise<R2Object>;
2010 | }
2011 | interface R2UploadedPart {
2012 |   partNumber: number;
2013 |   etag: string;
2014 | }
2015 | declare abstract class R2Object {
2016 |   readonly key: string;
2017 |   readonly version: string;
2018 |   readonly size: number;
2019 |   readonly etag: string;
2020 |   readonly httpEtag: string;
2021 |   readonly checksums: R2Checksums;
2022 |   readonly uploaded: Date;
2023 |   readonly httpMetadata?: R2HTTPMetadata;
2024 |   readonly customMetadata?: Record<string, string>;
2025 |   readonly range?: R2Range;
2026 |   readonly storageClass: string;
2027 |   readonly ssecKeyMd5?: string;
2028 |   writeHttpMetadata(headers: Headers): void;
2029 | }
2030 | interface R2ObjectBody extends R2Object {
2031 |   get body(): ReadableStream;
2032 |   get bodyUsed(): boolean;
2033 |   arrayBuffer(): Promise<ArrayBuffer>;
2034 |   bytes(): Promise<Uint8Array>;
2035 |   text(): Promise<string>;
2036 |   json<T>(): Promise<T>;
2037 |   blob(): Promise<Blob>;
2038 | }
2039 | type R2Range =
2040 |   | {
2041 |       offset: number;
2042 |       length?: number;
2043 |     }
2044 |   | {
2045 |       offset?: number;
2046 |       length: number;
2047 |     }
2048 |   | {
2049 |       suffix: number;
2050 |     };
2051 | interface R2Conditional {
2052 |   etagMatches?: string;
2053 |   etagDoesNotMatch?: string;
2054 |   uploadedBefore?: Date;
2055 |   uploadedAfter?: Date;
2056 |   secondsGranularity?: boolean;
2057 | }
2058 | interface R2GetOptions {
2059 |   onlyIf?: R2Conditional | Headers;
2060 |   range?: R2Range | Headers;
2061 |   ssecKey?: ArrayBuffer | string;
2062 | }
2063 | interface R2PutOptions {
2064 |   onlyIf?: R2Conditional | Headers;
2065 |   httpMetadata?: R2HTTPMetadata | Headers;
2066 |   customMetadata?: Record<string, string>;
2067 |   md5?: (ArrayBuffer | ArrayBufferView) | string;
2068 |   sha1?: (ArrayBuffer | ArrayBufferView) | string;
2069 |   sha256?: (ArrayBuffer | ArrayBufferView) | string;
2070 |   sha384?: (ArrayBuffer | ArrayBufferView) | string;
2071 |   sha512?: (ArrayBuffer | ArrayBufferView) | string;
2072 |   storageClass?: string;
2073 |   ssecKey?: ArrayBuffer | string;
2074 | }
2075 | interface R2MultipartOptions {
2076 |   httpMetadata?: R2HTTPMetadata | Headers;
2077 |   customMetadata?: Record<string, string>;
2078 |   storageClass?: string;
2079 |   ssecKey?: ArrayBuffer | string;
2080 | }
2081 | interface R2Checksums {
2082 |   readonly md5?: ArrayBuffer;
2083 |   readonly sha1?: ArrayBuffer;
2084 |   readonly sha256?: ArrayBuffer;
2085 |   readonly sha384?: ArrayBuffer;
2086 |   readonly sha512?: ArrayBuffer;
2087 |   toJSON(): R2StringChecksums;
2088 | }
2089 | interface R2StringChecksums {
2090 |   md5?: string;
2091 |   sha1?: string;
2092 |   sha256?: string;
2093 |   sha384?: string;
2094 |   sha512?: string;
2095 | }
2096 | interface R2HTTPMetadata {
2097 |   contentType?: string;
2098 |   contentLanguage?: string;
2099 |   contentDisposition?: string;
2100 |   contentEncoding?: string;
2101 |   cacheControl?: string;
2102 |   cacheExpiry?: Date;
2103 | }
2104 | type R2Objects = {
2105 |   objects: R2Object[];
2106 |   delimitedPrefixes: string[];
2107 | } & (
2108 |   | {
2109 |       truncated: true;
2110 |       cursor: string;
2111 |     }
2112 |   | {
2113 |       truncated: false;
2114 |     }
2115 | );
2116 | interface R2UploadPartOptions {
2117 |   ssecKey?: ArrayBuffer | string;
2118 | }
2119 | declare abstract class ScheduledEvent extends ExtendableEvent {
2120 |   readonly scheduledTime: number;
2121 |   readonly cron: string;
2122 |   noRetry(): void;
2123 | }
2124 | interface ScheduledController {
2125 |   readonly scheduledTime: number;
2126 |   readonly cron: string;
2127 |   noRetry(): void;
2128 | }
2129 | interface QueuingStrategy<T = any> {
2130 |   highWaterMark?: number | bigint;
2131 |   size?: (chunk: T) => number | bigint;
2132 | }
2133 | interface UnderlyingSink<W = any> {
2134 |   type?: string;
2135 |   start?: (controller: WritableStreamDefaultController) => void | Promise<void>;
2136 |   write?: (
2137 |     chunk: W,
2138 |     controller: WritableStreamDefaultController,
2139 |   ) => void | Promise<void>;
2140 |   abort?: (reason: any) => void | Promise<void>;
2141 |   close?: () => void | Promise<void>;
2142 | }
2143 | interface UnderlyingByteSource {
2144 |   type: "bytes";
2145 |   autoAllocateChunkSize?: number;
2146 |   start?: (controller: ReadableByteStreamController) => void | Promise<void>;
2147 |   pull?: (controller: ReadableByteStreamController) => void | Promise<void>;
2148 |   cancel?: (reason: any) => void | Promise<void>;
2149 | }
2150 | interface UnderlyingSource<R = any> {
2151 |   type?: "" | undefined;
2152 |   start?: (
2153 |     controller: ReadableStreamDefaultController<R>,
2154 |   ) => void | Promise<void>;
2155 |   pull?: (
2156 |     controller: ReadableStreamDefaultController<R>,
2157 |   ) => void | Promise<void>;
2158 |   cancel?: (reason: any) => void | Promise<void>;
2159 |   expectedLength?: number | bigint;
2160 | }
2161 | interface Transformer<I = any, O = any> {
2162 |   readableType?: string;
2163 |   writableType?: string;
2164 |   start?: (
2165 |     controller: TransformStreamDefaultController<O>,
2166 |   ) => void | Promise<void>;
2167 |   transform?: (
2168 |     chunk: I,
2169 |     controller: TransformStreamDefaultController<O>,
2170 |   ) => void | Promise<void>;
2171 |   flush?: (
2172 |     controller: TransformStreamDefaultController<O>,
2173 |   ) => void | Promise<void>;
2174 |   cancel?: (reason: any) => void | Promise<void>;
2175 |   expectedLength?: number;
2176 | }
2177 | interface StreamPipeOptions {
2178 |   /**
2179 |    * Pipes this readable stream to a given writable stream destination. The way in which the piping process behaves under various error conditions can be customized with a number of passed options. It returns a promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered.
2180 |    *
2181 |    * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.
2182 |    *
2183 |    * Errors and closures of the source and destination streams propagate as follows:
2184 |    *
2185 |    * An error in this source readable stream will abort destination, unless preventAbort is truthy. The returned promise will be rejected with the source's error, or with any error that occurs during aborting the destination.
2186 |    *
2187 |    * An error in destination will cancel this source readable stream, unless preventCancel is truthy. The returned promise will be rejected with the destination's error, or with any error that occurs during canceling the source.
2188 |    *
2189 |    * When this source readable stream closes, destination will be closed, unless preventClose is truthy. The returned promise will be fulfilled once this process completes, unless an error is encountered while closing the destination, in which case it will be rejected with that error.
2190 |    *
2191 |    * If destination starts out closed or closing, this source readable stream will be canceled, unless preventCancel is true. The returned promise will be rejected with an error indicating piping to a closed stream failed, or with any error that occurs during canceling the source.
2192 |    *
2193 |    * The signal option can be set to an AbortSignal to allow aborting an ongoing pipe operation via the corresponding AbortController. In this case, this source readable stream will be canceled, and destination aborted, unless the respective options preventCancel or preventAbort are set.
2194 |    */
2195 |   preventClose?: boolean;
2196 |   preventAbort?: boolean;
2197 |   preventCancel?: boolean;
2198 |   signal?: AbortSignal;
2199 | }
2200 | type ReadableStreamReadResult<R = any> =
2201 |   | {
2202 |       done: false;
2203 |       value: R;
2204 |     }
2205 |   | {
2206 |       done: true;
2207 |       value?: undefined;
2208 |     };
2209 | /**
2210 |  * This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object.
2211 |  *
2212 |  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream)
2213 |  */
2214 | interface ReadableStream<R = any> {
2215 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/locked) */
2216 |   get locked(): boolean;
2217 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/cancel) */
2218 |   cancel(reason?: any): Promise<void>;
2219 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader) */
2220 |   getReader(): ReadableStreamDefaultReader<R>;
2221 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader) */
2222 |   getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader;
2223 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeThrough) */
2224 |   pipeThrough<T>(
2225 |     transform: ReadableWritablePair<T, R>,
2226 |     options?: StreamPipeOptions,
2227 |   ): ReadableStream<T>;
2228 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeTo) */
2229 |   pipeTo(
2230 |     destination: WritableStream<R>,
2231 |     options?: StreamPipeOptions,
2232 |   ): Promise<void>;
2233 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/tee) */
2234 |   tee(): [ReadableStream<R>, ReadableStream<R>];
2235 |   values(options?: ReadableStreamValuesOptions): AsyncIterableIterator<R>;
2236 |   [Symbol.asyncIterator](
2237 |     options?: ReadableStreamValuesOptions,
2238 |   ): AsyncIterableIterator<R>;
2239 | }
2240 | /**
2241 |  * This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object.
2242 |  *
2243 |  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream)
2244 |  */
2245 | declare const ReadableStream: {
2246 |   prototype: ReadableStream;
2247 |   new (
2248 |     underlyingSource: UnderlyingByteSource,
2249 |     strategy?: QueuingStrategy<Uint8Array>,
2250 |   ): ReadableStream<Uint8Array>;
2251 |   new <R = any>(
2252 |     underlyingSource?: UnderlyingSource<R>,
2253 |     strategy?: QueuingStrategy<R>,
2254 |   ): ReadableStream<R>;
2255 | };
2256 | /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader) */
2257 | declare class ReadableStreamDefaultReader<R = any> {
2258 |   constructor(stream: ReadableStream);
2259 |   get closed(): Promise<void>;
2260 |   cancel(reason?: any): Promise<void>;
2261 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/read) */
2262 |   read(): Promise<ReadableStreamReadResult<R>>;
2263 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/releaseLock) */
2264 |   releaseLock(): void;
2265 | }
2266 | /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader) */
2267 | declare class ReadableStreamBYOBReader {
2268 |   constructor(stream: ReadableStream);
2269 |   get closed(): Promise<void>;
2270 |   cancel(reason?: any): Promise<void>;
2271 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/read) */
2272 |   read<T extends ArrayBufferView>(
2273 |     view: T,
2274 |   ): Promise<ReadableStreamReadResult<T>>;
2275 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/releaseLock) */
2276 |   releaseLock(): void;
2277 |   readAtLeast<T extends ArrayBufferView>(
2278 |     minElements: number,
2279 |     view: T,
2280 |   ): Promise<ReadableStreamReadResult<T>>;
2281 | }
2282 | interface ReadableStreamBYOBReaderReadableStreamBYOBReaderReadOptions {
2283 |   min?: number;
2284 | }
2285 | interface ReadableStreamGetReaderOptions {
2286 |   /**
2287 |    * Creates a ReadableStreamBYOBReader and locks the stream to the new reader.
2288 |    *
2289 |    * This call behaves the same way as the no-argument variant, except that it only works on readable byte streams, i.e. streams which were constructed specifically with the ability to handle "bring your own buffer" reading. The returned BYOB reader provides the ability to directly read individual chunks from the stream via its read() method, into developer-supplied buffers, allowing more precise control over allocation.
2290 |    */
2291 |   mode: "byob";
2292 | }
2293 | /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest) */
2294 | declare abstract class ReadableStreamBYOBRequest {
2295 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/view) */
2296 |   get view(): Uint8Array | null;
2297 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respond) */
2298 |   respond(bytesWritten: number): void;
2299 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respondWithNewView) */
2300 |   respondWithNewView(view: ArrayBuffer | ArrayBufferView): void;
2301 |   get atLeast(): number | null;
2302 | }
2303 | /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController) */
2304 | declare abstract class ReadableStreamDefaultController<R = any> {
2305 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/desiredSize) */
2306 |   get desiredSize(): number | null;
2307 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/close) */
2308 |   close(): void;
2309 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/enqueue) */
2310 |   enqueue(chunk?: R): void;
2311 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/error) */
2312 |   error(reason: any): void;
2313 | }
2314 | /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController) */
2315 | declare abstract class ReadableByteStreamController {
2316 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/byobRequest) */
2317 |   get byobRequest(): ReadableStreamBYOBRequest | null;
2318 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/desiredSize) */
2319 |   get desiredSize(): number | null;
2320 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/close) */
2321 |   close(): void;
2322 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/enqueue) */
2323 |   enqueue(chunk: ArrayBuffer | ArrayBufferView): void;
2324 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/error) */
2325 |   error(reason: any): void;
2326 | }
2327 | /**
2328 |  * This Streams API interface represents a controller allowing control of a WritableStream's state. When constructing a WritableStream, the underlying sink is given a corresponding WritableStreamDefaultController instance to manipulate.
2329 |  *
2330 |  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController)
2331 |  */
2332 | declare abstract class WritableStreamDefaultController {
2333 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/signal) */
2334 |   get signal(): AbortSignal;
2335 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/error) */
2336 |   error(reason?: any): void;
2337 | }
2338 | /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController) */
2339 | declare abstract class TransformStreamDefaultController<O = any> {
2340 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/desiredSize) */
2341 |   get desiredSize(): number | null;
2342 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/enqueue) */
2343 |   enqueue(chunk?: O): void;
2344 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/error) */
2345 |   error(reason: any): void;
2346 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/terminate) */
2347 |   terminate(): void;
2348 | }
2349 | interface ReadableWritablePair<R = any, W = any> {
2350 |   /**
2351 |    * Provides a convenient, chainable way of piping this readable stream through a transform stream (or any other { writable, readable } pair). It simply pipes the stream into the writable side of the supplied pair, and returns the readable side for further use.
2352 |    *
2353 |    * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.
2354 |    */
2355 |   writable: WritableStream<W>;
2356 |   readable: ReadableStream<R>;
2357 | }
2358 | /**
2359 |  * This Streams API interface provides a standard abstraction for writing streaming data to a destination, known as a sink. This object comes with built-in backpressure and queuing.
2360 |  *
2361 |  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream)
2362 |  */
2363 | declare class WritableStream<W = any> {
2364 |   constructor(
2365 |     underlyingSink?: UnderlyingSink,
2366 |     queuingStrategy?: QueuingStrategy,
2367 |   );
2368 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/locked) */
2369 |   get locked(): boolean;
2370 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/abort) */
2371 |   abort(reason?: any): Promise<void>;
2372 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/close) */
2373 |   close(): Promise<void>;
2374 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/getWriter) */
2375 |   getWriter(): WritableStreamDefaultWriter<W>;
2376 | }
2377 | /**
2378 |  * This Streams API interface is the object returned by WritableStream.getWriter() and once created locks the < writer to the WritableStream ensuring that no other streams can write to the underlying sink.
2379 |  *
2380 |  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter)
2381 |  */
2382 | declare class WritableStreamDefaultWriter<W = any> {
2383 |   constructor(stream: WritableStream);
2384 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/closed) */
2385 |   get closed(): Promise<void>;
2386 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/ready) */
2387 |   get ready(): Promise<void>;
2388 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/desiredSize) */
2389 |   get desiredSize(): number | null;
2390 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/abort) */
2391 |   abort(reason?: any): Promise<void>;
2392 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/close) */
2393 |   close(): Promise<void>;
2394 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/write) */
2395 |   write(chunk?: W): Promise<void>;
2396 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/releaseLock) */
2397 |   releaseLock(): void;
2398 | }
2399 | /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream) */
2400 | declare class TransformStream<I = any, O = any> {
2401 |   constructor(
2402 |     transformer?: Transformer<I, O>,
2403 |     writableStrategy?: QueuingStrategy<I>,
2404 |     readableStrategy?: QueuingStrategy<O>,
2405 |   );
2406 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/readable) */
2407 |   get readable(): ReadableStream<O>;
2408 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/writable) */
2409 |   get writable(): WritableStream<I>;
2410 | }
2411 | declare class FixedLengthStream extends IdentityTransformStream {
2412 |   constructor(
2413 |     expectedLength: number | bigint,
2414 |     queuingStrategy?: IdentityTransformStreamQueuingStrategy,
2415 |   );
2416 | }
2417 | declare class IdentityTransformStream extends TransformStream<
2418 |   ArrayBuffer | ArrayBufferView,
2419 |   Uint8Array
2420 | > {
2421 |   constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);
2422 | }
2423 | interface IdentityTransformStreamQueuingStrategy {
2424 |   highWaterMark?: number | bigint;
2425 | }
2426 | interface ReadableStreamValuesOptions {
2427 |   preventCancel?: boolean;
2428 | }
2429 | /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CompressionStream) */
2430 | declare class CompressionStream extends TransformStream<
2431 |   ArrayBuffer | ArrayBufferView,
2432 |   Uint8Array
2433 | > {
2434 |   constructor(format: "gzip" | "deflate" | "deflate-raw");
2435 | }
2436 | /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DecompressionStream) */
2437 | declare class DecompressionStream extends TransformStream<
2438 |   ArrayBuffer | ArrayBufferView,
2439 |   Uint8Array
2440 | > {
2441 |   constructor(format: "gzip" | "deflate" | "deflate-raw");
2442 | }
2443 | /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoderStream) */
2444 | declare class TextEncoderStream extends TransformStream<string, Uint8Array> {
2445 |   constructor();
2446 |   get encoding(): string;
2447 | }
2448 | /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoderStream) */
2449 | declare class TextDecoderStream extends TransformStream<
2450 |   ArrayBuffer | ArrayBufferView,
2451 |   string
2452 | > {
2453 |   constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit);
2454 |   get encoding(): string;
2455 |   get fatal(): boolean;
2456 |   get ignoreBOM(): boolean;
2457 | }
2458 | interface TextDecoderStreamTextDecoderStreamInit {
2459 |   fatal?: boolean;
2460 |   ignoreBOM?: boolean;
2461 | }
2462 | /**
2463 |  * This Streams API interface provides a built-in byte length queuing strategy that can be used when constructing streams.
2464 |  *
2465 |  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy)
2466 |  */
2467 | declare class ByteLengthQueuingStrategy
2468 |   implements QueuingStrategy<ArrayBufferView>
2469 | {
2470 |   constructor(init: QueuingStrategyInit);
2471 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/highWaterMark) */
2472 |   get highWaterMark(): number;
2473 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/size) */
2474 |   get size(): (chunk?: any) => number;
2475 | }
2476 | /**
2477 |  * This Streams API interface provides a built-in byte length queuing strategy that can be used when constructing streams.
2478 |  *
2479 |  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy)
2480 |  */
2481 | declare class CountQueuingStrategy implements QueuingStrategy {
2482 |   constructor(init: QueuingStrategyInit);
2483 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/highWaterMark) */
2484 |   get highWaterMark(): number;
2485 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/size) */
2486 |   get size(): (chunk?: any) => number;
2487 | }
2488 | interface QueuingStrategyInit {
2489 |   /**
2490 |    * Creates a new ByteLengthQueuingStrategy with the provided high water mark.
2491 |    *
2492 |    * Note that the provided high water mark will not be validated ahead of time. Instead, if it is negative, NaN, or not a number, the resulting ByteLengthQueuingStrategy will cause the corresponding stream constructor to throw.
2493 |    */
2494 |   highWaterMark: number;
2495 | }
2496 | interface ScriptVersion {
2497 |   id?: string;
2498 |   tag?: string;
2499 |   message?: string;
2500 | }
2501 | declare abstract class TailEvent extends ExtendableEvent {
2502 |   readonly events: TraceItem[];
2503 |   readonly traces: TraceItem[];
2504 | }
2505 | interface TraceItem {
2506 |   readonly event:
2507 |     | (
2508 |         | TraceItemFetchEventInfo
2509 |         | TraceItemJsRpcEventInfo
2510 |         | TraceItemScheduledEventInfo
2511 |         | TraceItemAlarmEventInfo
2512 |         | TraceItemQueueEventInfo
2513 |         | TraceItemEmailEventInfo
2514 |         | TraceItemTailEventInfo
2515 |         | TraceItemCustomEventInfo
2516 |         | TraceItemHibernatableWebSocketEventInfo
2517 |       )
2518 |     | null;
2519 |   readonly eventTimestamp: number | null;
2520 |   readonly logs: TraceLog[];
2521 |   readonly exceptions: TraceException[];
2522 |   readonly diagnosticsChannelEvents: TraceDiagnosticChannelEvent[];
2523 |   readonly scriptName: string | null;
2524 |   readonly entrypoint?: string;
2525 |   readonly scriptVersion?: ScriptVersion;
2526 |   readonly dispatchNamespace?: string;
2527 |   readonly scriptTags?: string[];
2528 |   readonly outcome: string;
2529 |   readonly executionModel: string;
2530 |   readonly truncated: boolean;
2531 |   readonly cpuTime: number;
2532 |   readonly wallTime: number;
2533 | }
2534 | interface TraceItemAlarmEventInfo {
2535 |   readonly scheduledTime: Date;
2536 | }
2537 | interface TraceItemCustomEventInfo {}
2538 | interface TraceItemScheduledEventInfo {
2539 |   readonly scheduledTime: number;
2540 |   readonly cron: string;
2541 | }
2542 | interface TraceItemQueueEventInfo {
2543 |   readonly queue: string;
2544 |   readonly batchSize: number;
2545 | }
2546 | interface TraceItemEmailEventInfo {
2547 |   readonly mailFrom: string;
2548 |   readonly rcptTo: string;
2549 |   readonly rawSize: number;
2550 | }
2551 | interface TraceItemTailEventInfo {
2552 |   readonly consumedEvents: TraceItemTailEventInfoTailItem[];
2553 | }
2554 | interface TraceItemTailEventInfoTailItem {
2555 |   readonly scriptName: string | null;
2556 | }
2557 | interface TraceItemFetchEventInfo {
2558 |   readonly response?: TraceItemFetchEventInfoResponse;
2559 |   readonly request: TraceItemFetchEventInfoRequest;
2560 | }
2561 | interface TraceItemFetchEventInfoRequest {
2562 |   readonly cf?: any;
2563 |   readonly headers: Record<string, string>;
2564 |   readonly method: string;
2565 |   readonly url: string;
2566 |   getUnredacted(): TraceItemFetchEventInfoRequest;
2567 | }
2568 | interface TraceItemFetchEventInfoResponse {
2569 |   readonly status: number;
2570 | }
2571 | interface TraceItemJsRpcEventInfo {
2572 |   readonly rpcMethod: string;
2573 | }
2574 | interface TraceItemHibernatableWebSocketEventInfo {
2575 |   readonly getWebSocketEvent:
2576 |     | TraceItemHibernatableWebSocketEventInfoMessage
2577 |     | TraceItemHibernatableWebSocketEventInfoClose
2578 |     | TraceItemHibernatableWebSocketEventInfoError;
2579 | }
2580 | interface TraceItemHibernatableWebSocketEventInfoMessage {
2581 |   readonly webSocketEventType: string;
2582 | }
2583 | interface TraceItemHibernatableWebSocketEventInfoClose {
2584 |   readonly webSocketEventType: string;
2585 |   readonly code: number;
2586 |   readonly wasClean: boolean;
2587 | }
2588 | interface TraceItemHibernatableWebSocketEventInfoError {
2589 |   readonly webSocketEventType: string;
2590 | }
2591 | interface TraceLog {
2592 |   readonly timestamp: number;
2593 |   readonly level: string;
2594 |   readonly message: any;
2595 | }
2596 | interface TraceException {
2597 |   readonly timestamp: number;
2598 |   readonly message: string;
2599 |   readonly name: string;
2600 |   readonly stack?: string;
2601 | }
2602 | interface TraceDiagnosticChannelEvent {
2603 |   readonly timestamp: number;
2604 |   readonly channel: string;
2605 |   readonly message: any;
2606 | }
2607 | interface TraceMetrics {
2608 |   readonly cpuTime: number;
2609 |   readonly wallTime: number;
2610 | }
2611 | interface UnsafeTraceMetrics {
2612 |   fromTrace(item: TraceItem): TraceMetrics;
2613 | }
2614 | /**
2615 |  * The URL interface represents an object providing static methods used for creating object URLs.
2616 |  *
2617 |  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL)
2618 |  */
2619 | declare class URL {
2620 |   constructor(url: string | URL, base?: string | URL);
2621 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/origin) */
2622 |   get origin(): string;
2623 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href) */
2624 |   get href(): string;
2625 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href) */
2626 |   set href(value: string);
2627 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol) */
2628 |   get protocol(): string;
2629 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol) */
2630 |   set protocol(value: string);
2631 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username) */
2632 |   get username(): string;
2633 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username) */
2634 |   set username(value: string);
2635 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password) */
2636 |   get password(): string;
2637 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password) */
2638 |   set password(value: string);
2639 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host) */
2640 |   get host(): string;
2641 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host) */
2642 |   set host(value: string);
2643 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname) */
2644 |   get hostname(): string;
2645 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname) */
2646 |   set hostname(value: string);
2647 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port) */
2648 |   get port(): string;
2649 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port) */
2650 |   set port(value: string);
2651 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname) */
2652 |   get pathname(): string;
2653 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname) */
2654 |   set pathname(value: string);
2655 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search) */
2656 |   get search(): string;
2657 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search) */
2658 |   set search(value: string);
2659 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash) */
2660 |   get hash(): string;
2661 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash) */
2662 |   set hash(value: string);
2663 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/searchParams) */
2664 |   get searchParams(): URLSearchParams;
2665 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/toJSON) */
2666 |   toJSON(): string;
2667 |   /*function toString() { [native code] }*/
2668 |   toString(): string;
2669 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/canParse_static) */
2670 |   static canParse(url: string, base?: string): boolean;
2671 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/parse_static) */
2672 |   static parse(url: string, base?: string): URL | null;
2673 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/createObjectURL_static) */
2674 |   static createObjectURL(object: File | Blob): string;
2675 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/revokeObjectURL_static) */
2676 |   static revokeObjectURL(object_url: string): void;
2677 | }
2678 | /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams) */
2679 | declare class URLSearchParams {
2680 |   constructor(
2681 |     init?: Iterable<Iterable<string>> | Record<string, string> | string,
2682 |   );
2683 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/size) */
2684 |   get size(): number;
2685 |   /**
2686 |    * Appends a specified key/value pair as a new search parameter.
2687 |    *
2688 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/append)
2689 |    */
2690 |   append(name: string, value: string): void;
2691 |   /**
2692 |    * Deletes the given search parameter, and its associated value, from the list of all search parameters.
2693 |    *
2694 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/delete)
2695 |    */
2696 |   delete(name: string, value?: string): void;
2697 |   /**
2698 |    * Returns the first value associated to the given search parameter.
2699 |    *
2700 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/get)
2701 |    */
2702 |   get(name: string): string | null;
2703 |   /**
2704 |    * Returns all the values association with a given search parameter.
2705 |    *
2706 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/getAll)
2707 |    */
2708 |   getAll(name: string): string[];
2709 |   /**
2710 |    * Returns a Boolean indicating if such a search parameter exists.
2711 |    *
2712 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/has)
2713 |    */
2714 |   has(name: string, value?: string): boolean;
2715 |   /**
2716 |    * Sets the value associated to a given search parameter to the given value. If there were several values, delete the others.
2717 |    *
2718 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/set)
2719 |    */
2720 |   set(name: string, value: string): void;
2721 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/sort) */
2722 |   sort(): void;
2723 |   /* Returns an array of key, value pairs for every entry in the search params. */
2724 |   entries(): IterableIterator<[key: string, value: string]>;
2725 |   /* Returns a list of keys in the search params. */
2726 |   keys(): IterableIterator<string>;
2727 |   /* Returns a list of values in the search params. */
2728 |   values(): IterableIterator<string>;
2729 |   forEach<This = unknown>(
2730 |     callback: (
2731 |       this: This,
2732 |       value: string,
2733 |       key: string,
2734 |       parent: URLSearchParams,
2735 |     ) => void,
2736 |     thisArg?: This,
2737 |   ): void;
2738 |   /*function toString() { [native code] } Returns a string containing a query string suitable for use in a URL. Does not include the question mark. */
2739 |   toString(): string;
2740 |   [Symbol.iterator](): IterableIterator<[key: string, value: string]>;
2741 | }
2742 | declare class URLPattern {
2743 |   constructor(
2744 |     input?: string | URLPatternInit,
2745 |     baseURL?: string | URLPatternOptions,
2746 |     patternOptions?: URLPatternOptions,
2747 |   );
2748 |   get protocol(): string;
2749 |   get username(): string;
2750 |   get password(): string;
2751 |   get hostname(): string;
2752 |   get port(): string;
2753 |   get pathname(): string;
2754 |   get search(): string;
2755 |   get hash(): string;
2756 |   get hasRegExpGroups(): boolean;
2757 |   test(input?: string | URLPatternInit, baseURL?: string): boolean;
2758 |   exec(
2759 |     input?: string | URLPatternInit,
2760 |     baseURL?: string,
2761 |   ): URLPatternResult | null;
2762 | }
2763 | interface URLPatternInit {
2764 |   protocol?: string;
2765 |   username?: string;
2766 |   password?: string;
2767 |   hostname?: string;
2768 |   port?: string;
2769 |   pathname?: string;
2770 |   search?: string;
2771 |   hash?: string;
2772 |   baseURL?: string;
2773 | }
2774 | interface URLPatternComponentResult {
2775 |   input: string;
2776 |   groups: Record<string, string>;
2777 | }
2778 | interface URLPatternResult {
2779 |   inputs: (string | URLPatternInit)[];
2780 |   protocol: URLPatternComponentResult;
2781 |   username: URLPatternComponentResult;
2782 |   password: URLPatternComponentResult;
2783 |   hostname: URLPatternComponentResult;
2784 |   port: URLPatternComponentResult;
2785 |   pathname: URLPatternComponentResult;
2786 |   search: URLPatternComponentResult;
2787 |   hash: URLPatternComponentResult;
2788 | }
2789 | interface URLPatternOptions {
2790 |   ignoreCase?: boolean;
2791 | }
2792 | /**
2793 |  * A CloseEvent is sent to clients using WebSockets when the connection is closed. This is delivered to the listener indicated by the WebSocket object's onclose attribute.
2794 |  *
2795 |  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent)
2796 |  */
2797 | declare class CloseEvent extends Event {
2798 |   constructor(type: string, initializer?: CloseEventInit);
2799 |   /**
2800 |    * Returns the WebSocket connection close code provided by the server.
2801 |    *
2802 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/code)
2803 |    */
2804 |   readonly code: number;
2805 |   /**
2806 |    * Returns the WebSocket connection close reason provided by the server.
2807 |    *
2808 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/reason)
2809 |    */
2810 |   readonly reason: string;
2811 |   /**
2812 |    * Returns true if the connection closed cleanly; false otherwise.
2813 |    *
2814 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/wasClean)
2815 |    */
2816 |   readonly wasClean: boolean;
2817 | }
2818 | interface CloseEventInit {
2819 |   code?: number;
2820 |   reason?: string;
2821 |   wasClean?: boolean;
2822 | }
2823 | /**
2824 |  * A message received by a target object.
2825 |  *
2826 |  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent)
2827 |  */
2828 | declare class MessageEvent extends Event {
2829 |   constructor(type: string, initializer: MessageEventInit);
2830 |   /**
2831 |    * Returns the data of the message.
2832 |    *
2833 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/data)
2834 |    */
2835 |   readonly data: ArrayBuffer | string;
2836 | }
2837 | interface MessageEventInit {
2838 |   data: ArrayBuffer | string;
2839 | }
2840 | type WebSocketEventMap = {
2841 |   close: CloseEvent;
2842 |   message: MessageEvent;
2843 |   open: Event;
2844 |   error: ErrorEvent;
2845 | };
2846 | /**
2847 |  * Provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.
2848 |  *
2849 |  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)
2850 |  */
2851 | declare var WebSocket: {
2852 |   prototype: WebSocket;
2853 |   new (url: string, protocols?: string[] | string): WebSocket;
2854 |   readonly READY_STATE_CONNECTING: number;
2855 |   readonly CONNECTING: number;
2856 |   readonly READY_STATE_OPEN: number;
2857 |   readonly OPEN: number;
2858 |   readonly READY_STATE_CLOSING: number;
2859 |   readonly CLOSING: number;
2860 |   readonly READY_STATE_CLOSED: number;
2861 |   readonly CLOSED: number;
2862 | };
2863 | /**
2864 |  * Provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.
2865 |  *
2866 |  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)
2867 |  */
2868 | interface WebSocket extends EventTarget<WebSocketEventMap> {
2869 |   accept(): void;
2870 |   /**
2871 |    * Transmits data using the WebSocket connection. data can be a string, a Blob, an ArrayBuffer, or an ArrayBufferView.
2872 |    *
2873 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/send)
2874 |    */
2875 |   send(message: (ArrayBuffer | ArrayBufferView) | string): void;
2876 |   /**
2877 |    * Closes the WebSocket connection, optionally using code as the the WebSocket connection close code and reason as the the WebSocket connection close reason.
2878 |    *
2879 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/close)
2880 |    */
2881 |   close(code?: number, reason?: string): void;
2882 |   serializeAttachment(attachment: any): void;
2883 |   deserializeAttachment(): any | null;
2884 |   /**
2885 |    * Returns the state of the WebSocket object's connection. It can have the values described below.
2886 |    *
2887 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/readyState)
2888 |    */
2889 |   readyState: number;
2890 |   /**
2891 |    * Returns the URL that was used to establish the WebSocket connection.
2892 |    *
2893 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/url)
2894 |    */
2895 |   url: string | null;
2896 |   /**
2897 |    * Returns the subprotocol selected by the server, if any. It can be used in conjunction with the array form of the constructor's second argument to perform subprotocol negotiation.
2898 |    *
2899 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/protocol)
2900 |    */
2901 |   protocol: string | null;
2902 |   /**
2903 |    * Returns the extensions selected by the server, if any.
2904 |    *
2905 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/extensions)
2906 |    */
2907 |   extensions: string | null;
2908 | }
2909 | declare const WebSocketPair: {
2910 |   new (): {
2911 |     0: WebSocket;
2912 |     1: WebSocket;
2913 |   };
2914 | };
2915 | interface SqlStorage {
2916 |   exec<T extends Record<string, SqlStorageValue>>(
2917 |     query: string,
2918 |     ...bindings: any[]
2919 |   ): SqlStorageCursor<T>;
2920 |   get databaseSize(): number;
2921 |   Cursor: typeof SqlStorageCursor;
2922 |   Statement: typeof SqlStorageStatement;
2923 | }
2924 | declare abstract class SqlStorageStatement {}
2925 | type SqlStorageValue = ArrayBuffer | string | number | null;
2926 | declare abstract class SqlStorageCursor<
2927 |   T extends Record<string, SqlStorageValue>,
2928 | > {
2929 |   next():
2930 |     | {
2931 |         done?: false;
2932 |         value: T;
2933 |       }
2934 |     | {
2935 |         done: true;
2936 |         value?: never;
2937 |       };
2938 |   toArray(): T[];
2939 |   one(): T;
2940 |   raw<U extends SqlStorageValue[]>(): IterableIterator<U>;
2941 |   columnNames: string[];
2942 |   get rowsRead(): number;
2943 |   get rowsWritten(): number;
2944 |   [Symbol.iterator](): IterableIterator<T>;
2945 | }
2946 | interface Socket {
2947 |   get readable(): ReadableStream;
2948 |   get writable(): WritableStream;
2949 |   get closed(): Promise<void>;
2950 |   get opened(): Promise<SocketInfo>;
2951 |   get upgraded(): boolean;
2952 |   get secureTransport(): "on" | "off" | "starttls";
2953 |   close(): Promise<void>;
2954 |   startTls(options?: TlsOptions): Socket;
2955 | }
2956 | interface SocketOptions {
2957 |   secureTransport?: string;
2958 |   allowHalfOpen: boolean;
2959 |   highWaterMark?: number | bigint;
2960 | }
2961 | interface SocketAddress {
2962 |   hostname: string;
2963 |   port: number;
2964 | }
2965 | interface TlsOptions {
2966 |   expectedServerHostname?: string;
2967 | }
2968 | interface SocketInfo {
2969 |   remoteAddress?: string;
2970 |   localAddress?: string;
2971 | }
2972 | /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource) */
2973 | declare class EventSource extends EventTarget {
2974 |   constructor(url: string, init?: EventSourceEventSourceInit);
2975 |   /**
2976 |    * Aborts any instances of the fetch algorithm started for this EventSource object, and sets the readyState attribute to CLOSED.
2977 |    *
2978 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/close)
2979 |    */
2980 |   close(): void;
2981 |   /**
2982 |    * Returns the URL providing the event stream.
2983 |    *
2984 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/url)
2985 |    */
2986 |   get url(): string;
2987 |   /**
2988 |    * Returns true if the credentials mode for connection requests to the URL providing the event stream is set to "include", and false otherwise.
2989 |    *
2990 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials)
2991 |    */
2992 |   get withCredentials(): boolean;
2993 |   /**
2994 |    * Returns the state of this EventSource object's connection. It can have the values described below.
2995 |    *
2996 |    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/readyState)
2997 |    */
2998 |   get readyState(): number;
2999 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */
3000 |   get onopen(): any | null;
3001 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */
3002 |   set onopen(value: any | null);
3003 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */
3004 |   get onmessage(): any | null;
3005 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */
3006 |   set onmessage(value: any | null);
3007 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */
3008 |   get onerror(): any | null;
3009 |   /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */
3010 |   set onerror(value: any | null);
3011 |   static readonly CONNECTING: number;
3012 |   static readonly OPEN: number;
3013 |   static readonly CLOSED: number;
3014 |   static from(stream: ReadableStream): EventSource;
3015 | }
3016 | interface EventSourceEventSourceInit {
3017 |   withCredentials?: boolean;
3018 |   fetcher?: Fetcher;
3019 | }
3020 | interface Container {
3021 |   get running(): boolean;
3022 |   start(options?: ContainerStartupOptions): void;
3023 |   monitor(): Promise<void>;
3024 |   destroy(error?: any): Promise<void>;
3025 |   signal(signo: number): void;
3026 |   getTcpPort(port: number): Fetcher;
3027 | }
3028 | interface ContainerStartupOptions {
3029 |   entrypoint?: string[];
3030 |   enableInternet: boolean;
3031 |   env?: Record<string, string>;
3032 | }
3033 | type AiImageClassificationInput = {
3034 |   image: number[];
3035 | };
3036 | type AiImageClassificationOutput = {
3037 |   score?: number;
3038 |   label?: string;
3039 | }[];
3040 | declare abstract class BaseAiImageClassification {
3041 |   inputs: AiImageClassificationInput;
3042 |   postProcessedOutputs: AiImageClassificationOutput;
3043 | }
3044 | type AiImageToTextInput = {
3045 |   image: number[];
3046 |   prompt?: string;
3047 |   max_tokens?: number;
3048 |   temperature?: number;
3049 |   top_p?: number;
3050 |   top_k?: number;
3051 |   seed?: number;
3052 |   repetition_penalty?: number;
3053 |   frequency_penalty?: number;
3054 |   presence_penalty?: number;
3055 |   raw?: boolean;
3056 |   messages?: RoleScopedChatInput[];
3057 | };
3058 | type AiImageToTextOutput = {
3059 |   description: string;
3060 | };
3061 | declare abstract class BaseAiImageToText {
3062 |   inputs: AiImageToTextInput;
3063 |   postProcessedOutputs: AiImageToTextOutput;
3064 | }
3065 | type AiImageTextToTextInput = {
3066 |   image: string;
3067 |   prompt?: string;
3068 |   max_tokens?: number;
3069 |   temperature?: number;
3070 |   ignore_eos?: boolean;
3071 |   top_p?: number;
3072 |   top_k?: number;
3073 |   seed?: number;
3074 |   repetition_penalty?: number;
3075 |   frequency_penalty?: number;
3076 |   presence_penalty?: number;
3077 |   raw?: boolean;
3078 |   messages?: RoleScopedChatInput[];
3079 | };
3080 | type AiImageTextToTextOutput = {
3081 |   description: string;
3082 | };
3083 | declare abstract class BaseAiImageTextToText {
3084 |   inputs: AiImageTextToTextInput;
3085 |   postProcessedOutputs: AiImageTextToTextOutput;
3086 | }
3087 | type AiObjectDetectionInput = {
3088 |   image: number[];
3089 | };
3090 | type AiObjectDetectionOutput = {
3091 |   score?: number;
3092 |   label?: string;
3093 | }[];
3094 | declare abstract class BaseAiObjectDetection {
3095 |   inputs: AiObjectDetectionInput;
3096 |   postProcessedOutputs: AiObjectDetectionOutput;
3097 | }
3098 | type AiSentenceSimilarityInput = {
3099 |   source: string;
3100 |   sentences: string[];
3101 | };
3102 | type AiSentenceSimilarityOutput = number[];
3103 | declare abstract class BaseAiSentenceSimilarity {
3104 |   inputs: AiSentenceSimilarityInput;
3105 |   postProcessedOutputs: AiSentenceSimilarityOutput;
3106 | }
3107 | type AiAutomaticSpeechRecognitionInput = {
3108 |   audio: number[];
3109 | };
3110 | type AiAutomaticSpeechRecognitionOutput = {
3111 |   text?: string;
3112 |   words?: {
3113 |     word: string;
3114 |     start: number;
3115 |     end: number;
3116 |   }[];
3117 |   vtt?: string;
3118 | };
3119 | declare abstract class BaseAiAutomaticSpeechRecognition {
3120 |   inputs: AiAutomaticSpeechRecognitionInput;
3121 |   postProcessedOutputs: AiAutomaticSpeechRecognitionOutput;
3122 | }
3123 | type AiSummarizationInput = {
3124 |   input_text: string;
3125 |   max_length?: number;
3126 | };
3127 | type AiSummarizationOutput = {
3128 |   summary: string;
3129 | };
3130 | declare abstract class BaseAiSummarization {
3131 |   inputs: AiSummarizationInput;
3132 |   postProcessedOutputs: AiSummarizationOutput;
3133 | }
3134 | type AiTextClassificationInput = {
3135 |   text: string;
3136 | };
3137 | type AiTextClassificationOutput = {
3138 |   score?: number;
3139 |   label?: string;
3140 | }[];
3141 | declare abstract class BaseAiTextClassification {
3142 |   inputs: AiTextClassificationInput;
3143 |   postProcessedOutputs: AiTextClassificationOutput;
3144 | }
3145 | type AiTextEmbeddingsInput = {
3146 |   text: string | string[];
3147 | };
3148 | type AiTextEmbeddingsOutput = {
3149 |   shape: number[];
3150 |   data: number[][];
3151 | };
3152 | declare abstract class BaseAiTextEmbeddings {
3153 |   inputs: AiTextEmbeddingsInput;
3154 |   postProcessedOutputs: AiTextEmbeddingsOutput;
3155 | }
3156 | type RoleScopedChatInput = {
3157 |   role:
3158 |     | "user"
3159 |     | "assistant"
3160 |     | "system"
3161 |     | "tool"
3162 |     | (string & NonNullable<unknown>);
3163 |   content: string;
3164 |   name?: string;
3165 | };
3166 | type AiTextGenerationToolLegacyInput = {
3167 |   name: string;
3168 |   description: string;
3169 |   parameters?: {
3170 |     type: "object" | (string & NonNullable<unknown>);
3171 |     properties: {
3172 |       [key: string]: {
3173 |         type: string;
3174 |         description?: string;
3175 |       };
3176 |     };
3177 |     required: string[];
3178 |   };
3179 | };
3180 | type AiTextGenerationToolInput = {
3181 |   type: "function" | (string & NonNullable<unknown>);
3182 |   function: {
3183 |     name: string;
3184 |     description: string;
3185 |     parameters?: {
3186 |       type: "object" | (string & NonNullable<unknown>);
3187 |       properties: {
3188 |         [key: string]: {
3189 |           type: string;
3190 |           description?: string;
3191 |         };
3192 |       };
3193 |       required: string[];
3194 |     };
3195 |   };
3196 | };
3197 | type AiTextGenerationFunctionsInput = {
3198 |   name: string;
3199 |   code: string;
3200 | };
3201 | type AiTextGenerationResponseFormat = {
3202 |   type: string;
3203 |   json_schema?: any;
3204 | };
3205 | type AiTextGenerationInput = {
3206 |   prompt?: string;
3207 |   raw?: boolean;
3208 |   stream?: boolean;
3209 |   max_tokens?: number;
3210 |   temperature?: number;
3211 |   top_p?: number;
3212 |   top_k?: number;
3213 |   seed?: number;
3214 |   repetition_penalty?: number;
3215 |   frequency_penalty?: number;
3216 |   presence_penalty?: number;
3217 |   messages?: RoleScopedChatInput[];
3218 |   response_format?: AiTextGenerationResponseFormat;
3219 |   tools?:
3220 |     | AiTextGenerationToolInput[]
3221 |     | AiTextGenerationToolLegacyInput[]
3222 |     | (object & NonNullable<unknown>);
3223 |   functions?: AiTextGenerationFunctionsInput[];
3224 | };
3225 | type AiTextGenerationOutput = {
3226 |   response?: string;
3227 |   tool_calls?: {
3228 |     name: string;
3229 |     arguments: unknown;
3230 |   }[];
3231 | };
3232 | declare abstract class BaseAiTextGeneration {
3233 |   inputs: AiTextGenerationInput;
3234 |   postProcessedOutputs: AiTextGenerationOutput;
3235 | }
3236 | type AiTextToSpeechInput = {
3237 |   prompt: string;
3238 |   lang?: string;
3239 | };
3240 | type AiTextToSpeechOutput =
3241 |   | Uint8Array
3242 |   | {
3243 |       audio: string;
3244 |     };
3245 | declare abstract class BaseAiTextToSpeech {
3246 |   inputs: AiTextToSpeechInput;
3247 |   postProcessedOutputs: AiTextToSpeechOutput;
3248 | }
3249 | type AiTextToImageInput = {
3250 |   prompt: string;
3251 |   negative_prompt?: string;
3252 |   height?: number;
3253 |   width?: number;
3254 |   image?: number[];
3255 |   image_b64?: string;
3256 |   mask?: number[];
3257 |   num_steps?: number;
3258 |   strength?: number;
3259 |   guidance?: number;
3260 |   seed?: number;
3261 | };
3262 | type AiTextToImageOutput = ReadableStream<Uint8Array>;
3263 | declare abstract class BaseAiTextToImage {
3264 |   inputs: AiTextToImageInput;
3265 |   postProcessedOutputs: AiTextToImageOutput;
3266 | }
3267 | type AiTranslationInput = {
3268 |   text: string;
3269 |   target_lang: string;
3270 |   source_lang?: string;
3271 | };
3272 | type AiTranslationOutput = {
3273 |   translated_text?: string;
3274 | };
3275 | declare abstract class BaseAiTranslation {
3276 |   inputs: AiTranslationInput;
3277 |   postProcessedOutputs: AiTranslationOutput;
3278 | }
3279 | type Ai_Cf_Baai_Bge_Base_En_V1_5_Input =
3280 |   | {
3281 |       text: string | string[];
3282 |       /**
3283 |        * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.
3284 |        */
3285 |       pooling?: "mean" | "cls";
3286 |     }
3287 |   | {
3288 |       /**
3289 |        * Batch of the embeddings requests to run using async-queue
3290 |        */
3291 |       requests: {
3292 |         text: string | string[];
3293 |         /**
3294 |          * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.
3295 |          */
3296 |         pooling?: "mean" | "cls";
3297 |       }[];
3298 |     };
3299 | type Ai_Cf_Baai_Bge_Base_En_V1_5_Output =
3300 |   | {
3301 |       shape?: number[];
3302 |       /**
3303 |        * Embeddings of the requested text values
3304 |        */
3305 |       data?: number[][];
3306 |       /**
3307 |        * The pooling method used in the embedding process.
3308 |        */
3309 |       pooling?: "mean" | "cls";
3310 |     }
3311 |   | AsyncResponse;
3312 | interface AsyncResponse {
3313 |   /**
3314 |    * The async request id that can be used to obtain the results.
3315 |    */
3316 |   request_id?: string;
3317 | }
3318 | declare abstract class Base_Ai_Cf_Baai_Bge_Base_En_V1_5 {
3319 |   inputs: Ai_Cf_Baai_Bge_Base_En_V1_5_Input;
3320 |   postProcessedOutputs: Ai_Cf_Baai_Bge_Base_En_V1_5_Output;
3321 | }
3322 | type Ai_Cf_Openai_Whisper_Input =
3323 |   | string
3324 |   | {
3325 |       /**
3326 |        * An array of integers that represent the audio data constrained to 8-bit unsigned integer values
3327 |        */
3328 |       audio: number[];
3329 |     };
3330 | interface Ai_Cf_Openai_Whisper_Output {
3331 |   /**
3332 |    * The transcription
3333 |    */
3334 |   text: string;
3335 |   word_count?: number;
3336 |   words?: {
3337 |     word?: string;
3338 |     /**
3339 |      * The second this word begins in the recording
3340 |      */
3341 |     start?: number;
3342 |     /**
3343 |      * The ending second when the word completes
3344 |      */
3345 |     end?: number;
3346 |   }[];
3347 |   vtt?: string;
3348 | }
3349 | declare abstract class Base_Ai_Cf_Openai_Whisper {
3350 |   inputs: Ai_Cf_Openai_Whisper_Input;
3351 |   postProcessedOutputs: Ai_Cf_Openai_Whisper_Output;
3352 | }
3353 | type Ai_Cf_Meta_M2M100_1_2B_Input =
3354 |   | {
3355 |       /**
3356 |        * The text to be translated
3357 |        */
3358 |       text: string;
3359 |       /**
3360 |        * The language code of the source text (e.g., 'en' for English). Defaults to 'en' if not specified
3361 |        */
3362 |       source_lang?: string;
3363 |       /**
3364 |        * The language code to translate the text into (e.g., 'es' for Spanish)
3365 |        */
3366 |       target_lang: string;
3367 |     }
3368 |   | {
3369 |       /**
3370 |        * Batch of the embeddings requests to run using async-queue
3371 |        */
3372 |       requests: {
3373 |         /**
3374 |          * The text to be translated
3375 |          */
3376 |         text: string;
3377 |         /**
3378 |          * The language code of the source text (e.g., 'en' for English). Defaults to 'en' if not specified
3379 |          */
3380 |         source_lang?: string;
3381 |         /**
3382 |          * The language code to translate the text into (e.g., 'es' for Spanish)
3383 |          */
3384 |         target_lang: string;
3385 |       }[];
3386 |     };
3387 | type Ai_Cf_Meta_M2M100_1_2B_Output =
3388 |   | {
3389 |       /**
3390 |        * The translated text in the target language
3391 |        */
3392 |       translated_text?: string;
3393 |     }
3394 |   | AsyncResponse;
3395 | declare abstract class Base_Ai_Cf_Meta_M2M100_1_2B {
3396 |   inputs: Ai_Cf_Meta_M2M100_1_2B_Input;
3397 |   postProcessedOutputs: Ai_Cf_Meta_M2M100_1_2B_Output;
3398 | }
3399 | type Ai_Cf_Baai_Bge_Small_En_V1_5_Input =
3400 |   | {
3401 |       text: string | string[];
3402 |       /**
3403 |        * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.
3404 |        */
3405 |       pooling?: "mean" | "cls";
3406 |     }
3407 |   | {
3408 |       /**
3409 |        * Batch of the embeddings requests to run using async-queue
3410 |        */
3411 |       requests: {
3412 |         text: string | string[];
3413 |         /**
3414 |          * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.
3415 |          */
3416 |         pooling?: "mean" | "cls";
3417 |       }[];
3418 |     };
3419 | type Ai_Cf_Baai_Bge_Small_En_V1_5_Output =
3420 |   | {
3421 |       shape?: number[];
3422 |       /**
3423 |        * Embeddings of the requested text values
3424 |        */
3425 |       data?: number[][];
3426 |       /**
3427 |        * The pooling method used in the embedding process.
3428 |        */
3429 |       pooling?: "mean" | "cls";
3430 |     }
3431 |   | AsyncResponse;
3432 | declare abstract class Base_Ai_Cf_Baai_Bge_Small_En_V1_5 {
3433 |   inputs: Ai_Cf_Baai_Bge_Small_En_V1_5_Input;
3434 |   postProcessedOutputs: Ai_Cf_Baai_Bge_Small_En_V1_5_Output;
3435 | }
3436 | type Ai_Cf_Baai_Bge_Large_En_V1_5_Input =
3437 |   | {
3438 |       text: string | string[];
3439 |       /**
3440 |        * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.
3441 |        */
3442 |       pooling?: "mean" | "cls";
3443 |     }
3444 |   | {
3445 |       /**
3446 |        * Batch of the embeddings requests to run using async-queue
3447 |        */
3448 |       requests: {
3449 |         text: string | string[];
3450 |         /**
3451 |          * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.
3452 |          */
3453 |         pooling?: "mean" | "cls";
3454 |       }[];
3455 |     };
3456 | type Ai_Cf_Baai_Bge_Large_En_V1_5_Output =
3457 |   | {
3458 |       shape?: number[];
3459 |       /**
3460 |        * Embeddings of the requested text values
3461 |        */
3462 |       data?: number[][];
3463 |       /**
3464 |        * The pooling method used in the embedding process.
3465 |        */
3466 |       pooling?: "mean" | "cls";
3467 |     }
3468 |   | AsyncResponse;
3469 | declare abstract class Base_Ai_Cf_Baai_Bge_Large_En_V1_5 {
3470 |   inputs: Ai_Cf_Baai_Bge_Large_En_V1_5_Input;
3471 |   postProcessedOutputs: Ai_Cf_Baai_Bge_Large_En_V1_5_Output;
3472 | }
3473 | type Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Input =
3474 |   | string
3475 |   | {
3476 |       /**
3477 |        * The input text prompt for the model to generate a response.
3478 |        */
3479 |       prompt?: string;
3480 |       /**
3481 |        * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
3482 |        */
3483 |       raw?: boolean;
3484 |       /**
3485 |        * Controls the creativity of the AI's responses by adjusting how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
3486 |        */
3487 |       top_p?: number;
3488 |       /**
3489 |        * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.
3490 |        */
3491 |       top_k?: number;
3492 |       /**
3493 |        * Random seed for reproducibility of the generation.
3494 |        */
3495 |       seed?: number;
3496 |       /**
3497 |        * Penalty for repeated tokens; higher values discourage repetition.
3498 |        */
3499 |       repetition_penalty?: number;
3500 |       /**
3501 |        * Decreases the likelihood of the model repeating the same lines verbatim.
3502 |        */
3503 |       frequency_penalty?: number;
3504 |       /**
3505 |        * Increases the likelihood of the model introducing new topics.
3506 |        */
3507 |       presence_penalty?: number;
3508 |       image: number[] | (string & NonNullable<unknown>);
3509 |       /**
3510 |        * The maximum number of tokens to generate in the response.
3511 |        */
3512 |       max_tokens?: number;
3513 |     };
3514 | interface Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Output {
3515 |   description?: string;
3516 | }
3517 | declare abstract class Base_Ai_Cf_Unum_Uform_Gen2_Qwen_500M {
3518 |   inputs: Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Input;
3519 |   postProcessedOutputs: Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Output;
3520 | }
3521 | type Ai_Cf_Openai_Whisper_Tiny_En_Input =
3522 |   | string
3523 |   | {
3524 |       /**
3525 |        * An array of integers that represent the audio data constrained to 8-bit unsigned integer values
3526 |        */
3527 |       audio: number[];
3528 |     };
3529 | interface Ai_Cf_Openai_Whisper_Tiny_En_Output {
3530 |   /**
3531 |    * The transcription
3532 |    */
3533 |   text: string;
3534 |   word_count?: number;
3535 |   words?: {
3536 |     word?: string;
3537 |     /**
3538 |      * The second this word begins in the recording
3539 |      */
3540 |     start?: number;
3541 |     /**
3542 |      * The ending second when the word completes
3543 |      */
3544 |     end?: number;
3545 |   }[];
3546 |   vtt?: string;
3547 | }
3548 | declare abstract class Base_Ai_Cf_Openai_Whisper_Tiny_En {
3549 |   inputs: Ai_Cf_Openai_Whisper_Tiny_En_Input;
3550 |   postProcessedOutputs: Ai_Cf_Openai_Whisper_Tiny_En_Output;
3551 | }
3552 | interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input {
3553 |   /**
3554 |    * Base64 encoded value of the audio data.
3555 |    */
3556 |   audio: string;
3557 |   /**
3558 |    * Supported tasks are 'translate' or 'transcribe'.
3559 |    */
3560 |   task?: string;
3561 |   /**
3562 |    * The language of the audio being transcribed or translated.
3563 |    */
3564 |   language?: string;
3565 |   /**
3566 |    * Preprocess the audio with a voice activity detection model.
3567 |    */
3568 |   vad_filter?: boolean;
3569 |   /**
3570 |    * A text prompt to help provide context to the model on the contents of the audio.
3571 |    */
3572 |   initial_prompt?: string;
3573 |   /**
3574 |    * The prefix it appended the the beginning of the output of the transcription and can guide the transcription result.
3575 |    */
3576 |   prefix?: string;
3577 | }
3578 | interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output {
3579 |   transcription_info?: {
3580 |     /**
3581 |      * The language of the audio being transcribed or translated.
3582 |      */
3583 |     language?: string;
3584 |     /**
3585 |      * The confidence level or probability of the detected language being accurate, represented as a decimal between 0 and 1.
3586 |      */
3587 |     language_probability?: number;
3588 |     /**
3589 |      * The total duration of the original audio file, in seconds.
3590 |      */
3591 |     duration?: number;
3592 |     /**
3593 |      * The duration of the audio after applying Voice Activity Detection (VAD) to remove silent or irrelevant sections, in seconds.
3594 |      */
3595 |     duration_after_vad?: number;
3596 |   };
3597 |   /**
3598 |    * The complete transcription of the audio.
3599 |    */
3600 |   text: string;
3601 |   /**
3602 |    * The total number of words in the transcription.
3603 |    */
3604 |   word_count?: number;
3605 |   segments?: {
3606 |     /**
3607 |      * The starting time of the segment within the audio, in seconds.
3608 |      */
3609 |     start?: number;
3610 |     /**
3611 |      * The ending time of the segment within the audio, in seconds.
3612 |      */
3613 |     end?: number;
3614 |     /**
3615 |      * The transcription of the segment.
3616 |      */
3617 |     text?: string;
3618 |     /**
3619 |      * The temperature used in the decoding process, controlling randomness in predictions. Lower values result in more deterministic outputs.
3620 |      */
3621 |     temperature?: number;
3622 |     /**
3623 |      * The average log probability of the predictions for the words in this segment, indicating overall confidence.
3624 |      */
3625 |     avg_logprob?: number;
3626 |     /**
3627 |      * The compression ratio of the input to the output, measuring how much the text was compressed during the transcription process.
3628 |      */
3629 |     compression_ratio?: number;
3630 |     /**
3631 |      * The probability that the segment contains no speech, represented as a decimal between 0 and 1.
3632 |      */
3633 |     no_speech_prob?: number;
3634 |     words?: {
3635 |       /**
3636 |        * The individual word transcribed from the audio.
3637 |        */
3638 |       word?: string;
3639 |       /**
3640 |        * The starting time of the word within the audio, in seconds.
3641 |        */
3642 |       start?: number;
3643 |       /**
3644 |        * The ending time of the word within the audio, in seconds.
3645 |        */
3646 |       end?: number;
3647 |     }[];
3648 |   }[];
3649 |   /**
3650 |    * The transcription in WebVTT format, which includes timing and text information for use in subtitles.
3651 |    */
3652 |   vtt?: string;
3653 | }
3654 | declare abstract class Base_Ai_Cf_Openai_Whisper_Large_V3_Turbo {
3655 |   inputs: Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input;
3656 |   postProcessedOutputs: Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output;
3657 | }
3658 | type Ai_Cf_Baai_Bge_M3_Input =
3659 |   | BGEM3InputQueryAndContexts
3660 |   | BGEM3InputEmbedding
3661 |   | {
3662 |       /**
3663 |        * Batch of the embeddings requests to run using async-queue
3664 |        */
3665 |       requests: (BGEM3InputQueryAndContexts1 | BGEM3InputEmbedding1)[];
3666 |     };
3667 | interface BGEM3InputQueryAndContexts {
3668 |   /**
3669 |    * A query you wish to perform against the provided contexts. If no query is provided the model with respond with embeddings for contexts
3670 |    */
3671 |   query?: string;
3672 |   /**
3673 |    * List of provided contexts. Note that the index in this array is important, as the response will refer to it.
3674 |    */
3675 |   contexts: {
3676 |     /**
3677 |      * One of the provided context content
3678 |      */
3679 |     text?: string;
3680 |   }[];
3681 |   /**
3682 |    * When provided with too long context should the model error out or truncate the context to fit?
3683 |    */
3684 |   truncate_inputs?: boolean;
3685 | }
3686 | interface BGEM3InputEmbedding {
3687 |   text: string | string[];
3688 |   /**
3689 |    * When provided with too long context should the model error out or truncate the context to fit?
3690 |    */
3691 |   truncate_inputs?: boolean;
3692 | }
3693 | interface BGEM3InputQueryAndContexts1 {
3694 |   /**
3695 |    * A query you wish to perform against the provided contexts. If no query is provided the model with respond with embeddings for contexts
3696 |    */
3697 |   query?: string;
3698 |   /**
3699 |    * List of provided contexts. Note that the index in this array is important, as the response will refer to it.
3700 |    */
3701 |   contexts: {
3702 |     /**
3703 |      * One of the provided context content
3704 |      */
3705 |     text?: string;
3706 |   }[];
3707 |   /**
3708 |    * When provided with too long context should the model error out or truncate the context to fit?
3709 |    */
3710 |   truncate_inputs?: boolean;
3711 | }
3712 | interface BGEM3InputEmbedding1 {
3713 |   text: string | string[];
3714 |   /**
3715 |    * When provided with too long context should the model error out or truncate the context to fit?
3716 |    */
3717 |   truncate_inputs?: boolean;
3718 | }
3719 | type Ai_Cf_Baai_Bge_M3_Output =
3720 |   | BGEM3OuputQuery
3721 |   | BGEM3OutputEmbeddingForContexts
3722 |   | BGEM3OuputEmbedding
3723 |   | AsyncResponse;
3724 | interface BGEM3OuputQuery {
3725 |   response?: {
3726 |     /**
3727 |      * Index of the context in the request
3728 |      */
3729 |     id?: number;
3730 |     /**
3731 |      * Score of the context under the index.
3732 |      */
3733 |     score?: number;
3734 |   }[];
3735 | }
3736 | interface BGEM3OutputEmbeddingForContexts {
3737 |   response?: number[][];
3738 |   shape?: number[];
3739 |   /**
3740 |    * The pooling method used in the embedding process.
3741 |    */
3742 |   pooling?: "mean" | "cls";
3743 | }
3744 | interface BGEM3OuputEmbedding {
3745 |   shape?: number[];
3746 |   /**
3747 |    * Embeddings of the requested text values
3748 |    */
3749 |   data?: number[][];
3750 |   /**
3751 |    * The pooling method used in the embedding process.
3752 |    */
3753 |   pooling?: "mean" | "cls";
3754 | }
3755 | declare abstract class Base_Ai_Cf_Baai_Bge_M3 {
3756 |   inputs: Ai_Cf_Baai_Bge_M3_Input;
3757 |   postProcessedOutputs: Ai_Cf_Baai_Bge_M3_Output;
3758 | }
3759 | interface Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Input {
3760 |   /**
3761 |    * A text description of the image you want to generate.
3762 |    */
3763 |   prompt: string;
3764 |   /**
3765 |    * The number of diffusion steps; higher values can improve quality but take longer.
3766 |    */
3767 |   steps?: number;
3768 | }
3769 | interface Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Output {
3770 |   /**
3771 |    * The generated image in Base64 format.
3772 |    */
3773 |   image?: string;
3774 | }
3775 | declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_1_Schnell {
3776 |   inputs: Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Input;
3777 |   postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Output;
3778 | }
3779 | type Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Input = Prompt | Messages;
3780 | interface Prompt {
3781 |   /**
3782 |    * The input text prompt for the model to generate a response.
3783 |    */
3784 |   prompt: string;
3785 |   image?: number[] | (string & NonNullable<unknown>);
3786 |   /**
3787 |    * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
3788 |    */
3789 |   raw?: boolean;
3790 |   /**
3791 |    * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
3792 |    */
3793 |   stream?: boolean;
3794 |   /**
3795 |    * The maximum number of tokens to generate in the response.
3796 |    */
3797 |   max_tokens?: number;
3798 |   /**
3799 |    * Controls the randomness of the output; higher values produce more random results.
3800 |    */
3801 |   temperature?: number;
3802 |   /**
3803 |    * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
3804 |    */
3805 |   top_p?: number;
3806 |   /**
3807 |    * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.
3808 |    */
3809 |   top_k?: number;
3810 |   /**
3811 |    * Random seed for reproducibility of the generation.
3812 |    */
3813 |   seed?: number;
3814 |   /**
3815 |    * Penalty for repeated tokens; higher values discourage repetition.
3816 |    */
3817 |   repetition_penalty?: number;
3818 |   /**
3819 |    * Decreases the likelihood of the model repeating the same lines verbatim.
3820 |    */
3821 |   frequency_penalty?: number;
3822 |   /**
3823 |    * Increases the likelihood of the model introducing new topics.
3824 |    */
3825 |   presence_penalty?: number;
3826 |   /**
3827 |    * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.
3828 |    */
3829 |   lora?: string;
3830 | }
3831 | interface Messages {
3832 |   /**
3833 |    * An array of message objects representing the conversation history.
3834 |    */
3835 |   messages: {
3836 |     /**
3837 |      * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
3838 |      */
3839 |     role?: string;
3840 |     /**
3841 |      * The tool call id. Must be supplied for tool calls for Mistral-3. If you don't know what to put here you can fall back to 000000001
3842 |      */
3843 |     tool_call_id?: string;
3844 |     content?:
3845 |       | string
3846 |       | {
3847 |           /**
3848 |            * Type of the content provided
3849 |            */
3850 |           type?: string;
3851 |           text?: string;
3852 |           image_url?: {
3853 |             /**
3854 |              * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted
3855 |              */
3856 |             url?: string;
3857 |           };
3858 |         }[]
3859 |       | {
3860 |           /**
3861 |            * Type of the content provided
3862 |            */
3863 |           type?: string;
3864 |           text?: string;
3865 |           image_url?: {
3866 |             /**
3867 |              * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted
3868 |              */
3869 |             url?: string;
3870 |           };
3871 |         };
3872 |   }[];
3873 |   image?: number[] | (string & NonNullable<unknown>);
3874 |   functions?: {
3875 |     name: string;
3876 |     code: string;
3877 |   }[];
3878 |   /**
3879 |    * A list of tools available for the assistant to use.
3880 |    */
3881 |   tools?: (
3882 |     | {
3883 |         /**
3884 |          * The name of the tool. More descriptive the better.
3885 |          */
3886 |         name: string;
3887 |         /**
3888 |          * A brief description of what the tool does.
3889 |          */
3890 |         description: string;
3891 |         /**
3892 |          * Schema defining the parameters accepted by the tool.
3893 |          */
3894 |         parameters: {
3895 |           /**
3896 |            * The type of the parameters object (usually 'object').
3897 |            */
3898 |           type: string;
3899 |           /**
3900 |            * List of required parameter names.
3901 |            */
3902 |           required?: string[];
3903 |           /**
3904 |            * Definitions of each parameter.
3905 |            */
3906 |           properties: {
3907 |             [k: string]: {
3908 |               /**
3909 |                * The data type of the parameter.
3910 |                */
3911 |               type: string;
3912 |               /**
3913 |                * A description of the expected parameter.
3914 |                */
3915 |               description: string;
3916 |             };
3917 |           };
3918 |         };
3919 |       }
3920 |     | {
3921 |         /**
3922 |          * Specifies the type of tool (e.g., 'function').
3923 |          */
3924 |         type: string;
3925 |         /**
3926 |          * Details of the function tool.
3927 |          */
3928 |         function: {
3929 |           /**
3930 |            * The name of the function.
3931 |            */
3932 |           name: string;
3933 |           /**
3934 |            * A brief description of what the function does.
3935 |            */
3936 |           description: string;
3937 |           /**
3938 |            * Schema defining the parameters accepted by the function.
3939 |            */
3940 |           parameters: {
3941 |             /**
3942 |              * The type of the parameters object (usually 'object').
3943 |              */
3944 |             type: string;
3945 |             /**
3946 |              * List of required parameter names.
3947 |              */
3948 |             required?: string[];
3949 |             /**
3950 |              * Definitions of each parameter.
3951 |              */
3952 |             properties: {
3953 |               [k: string]: {
3954 |                 /**
3955 |                  * The data type of the parameter.
3956 |                  */
3957 |                 type: string;
3958 |                 /**
3959 |                  * A description of the expected parameter.
3960 |                  */
3961 |                 description: string;
3962 |               };
3963 |             };
3964 |           };
3965 |         };
3966 |       }
3967 |   )[];
3968 |   /**
3969 |    * If true, the response will be streamed back incrementally.
3970 |    */
3971 |   stream?: boolean;
3972 |   /**
3973 |    * The maximum number of tokens to generate in the response.
3974 |    */
3975 |   max_tokens?: number;
3976 |   /**
3977 |    * Controls the randomness of the output; higher values produce more random results.
3978 |    */
3979 |   temperature?: number;
3980 |   /**
3981 |    * Controls the creativity of the AI's responses by adjusting how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
3982 |    */
3983 |   top_p?: number;
3984 |   /**
3985 |    * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.
3986 |    */
3987 |   top_k?: number;
3988 |   /**
3989 |    * Random seed for reproducibility of the generation.
3990 |    */
3991 |   seed?: number;
3992 |   /**
3993 |    * Penalty for repeated tokens; higher values discourage repetition.
3994 |    */
3995 |   repetition_penalty?: number;
3996 |   /**
3997 |    * Decreases the likelihood of the model repeating the same lines verbatim.
3998 |    */
3999 |   frequency_penalty?: number;
4000 |   /**
4001 |    * Increases the likelihood of the model introducing new topics.
4002 |    */
4003 |   presence_penalty?: number;
4004 | }
4005 | type Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output = {
4006 |   /**
4007 |    * The generated text response from the model
4008 |    */
4009 |   response?: string;
4010 |   /**
4011 |    * An array of tool calls requests made during the response generation
4012 |    */
4013 |   tool_calls?: {
4014 |     /**
4015 |      * The arguments passed to be passed to the tool call request
4016 |      */
4017 |     arguments?: object;
4018 |     /**
4019 |      * The name of the tool to be called
4020 |      */
4021 |     name?: string;
4022 |   }[];
4023 | };
4024 | declare abstract class Base_Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct {
4025 |   inputs: Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Input;
4026 |   postProcessedOutputs: Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output;
4027 | }
4028 | type Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Input =
4029 |   | Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Prompt
4030 |   | Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Messages
4031 |   | AsyncBatch;
4032 | interface Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Prompt {
4033 |   /**
4034 |    * The input text prompt for the model to generate a response.
4035 |    */
4036 |   prompt: string;
4037 |   /**
4038 |    * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.
4039 |    */
4040 |   lora?: string;
4041 |   response_format?: JSONMode;
4042 |   /**
4043 |    * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
4044 |    */
4045 |   raw?: boolean;
4046 |   /**
4047 |    * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
4048 |    */
4049 |   stream?: boolean;
4050 |   /**
4051 |    * The maximum number of tokens to generate in the response.
4052 |    */
4053 |   max_tokens?: number;
4054 |   /**
4055 |    * Controls the randomness of the output; higher values produce more random results.
4056 |    */
4057 |   temperature?: number;
4058 |   /**
4059 |    * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
4060 |    */
4061 |   top_p?: number;
4062 |   /**
4063 |    * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.
4064 |    */
4065 |   top_k?: number;
4066 |   /**
4067 |    * Random seed for reproducibility of the generation.
4068 |    */
4069 |   seed?: number;
4070 |   /**
4071 |    * Penalty for repeated tokens; higher values discourage repetition.
4072 |    */
4073 |   repetition_penalty?: number;
4074 |   /**
4075 |    * Decreases the likelihood of the model repeating the same lines verbatim.
4076 |    */
4077 |   frequency_penalty?: number;
4078 |   /**
4079 |    * Increases the likelihood of the model introducing new topics.
4080 |    */
4081 |   presence_penalty?: number;
4082 | }
4083 | interface JSONMode {
4084 |   type?: "json_object" | "json_schema";
4085 |   json_schema?: unknown;
4086 | }
4087 | interface Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Messages {
4088 |   /**
4089 |    * An array of message objects representing the conversation history.
4090 |    */
4091 |   messages: {
4092 |     /**
4093 |      * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
4094 |      */
4095 |     role: string;
4096 |     /**
4097 |      * The content of the message as a string.
4098 |      */
4099 |     content: string;
4100 |   }[];
4101 |   functions?: {
4102 |     name: string;
4103 |     code: string;
4104 |   }[];
4105 |   /**
4106 |    * A list of tools available for the assistant to use.
4107 |    */
4108 |   tools?: (
4109 |     | {
4110 |         /**
4111 |          * The name of the tool. More descriptive the better.
4112 |          */
4113 |         name: string;
4114 |         /**
4115 |          * A brief description of what the tool does.
4116 |          */
4117 |         description: string;
4118 |         /**
4119 |          * Schema defining the parameters accepted by the tool.
4120 |          */
4121 |         parameters: {
4122 |           /**
4123 |            * The type of the parameters object (usually 'object').
4124 |            */
4125 |           type: string;
4126 |           /**
4127 |            * List of required parameter names.
4128 |            */
4129 |           required?: string[];
4130 |           /**
4131 |            * Definitions of each parameter.
4132 |            */
4133 |           properties: {
4134 |             [k: string]: {
4135 |               /**
4136 |                * The data type of the parameter.
4137 |                */
4138 |               type: string;
4139 |               /**
4140 |                * A description of the expected parameter.
4141 |                */
4142 |               description: string;
4143 |             };
4144 |           };
4145 |         };
4146 |       }
4147 |     | {
4148 |         /**
4149 |          * Specifies the type of tool (e.g., 'function').
4150 |          */
4151 |         type: string;
4152 |         /**
4153 |          * Details of the function tool.
4154 |          */
4155 |         function: {
4156 |           /**
4157 |            * The name of the function.
4158 |            */
4159 |           name: string;
4160 |           /**
4161 |            * A brief description of what the function does.
4162 |            */
4163 |           description: string;
4164 |           /**
4165 |            * Schema defining the parameters accepted by the function.
4166 |            */
4167 |           parameters: {
4168 |             /**
4169 |              * The type of the parameters object (usually 'object').
4170 |              */
4171 |             type: string;
4172 |             /**
4173 |              * List of required parameter names.
4174 |              */
4175 |             required?: string[];
4176 |             /**
4177 |              * Definitions of each parameter.
4178 |              */
4179 |             properties: {
4180 |               [k: string]: {
4181 |                 /**
4182 |                  * The data type of the parameter.
4183 |                  */
4184 |                 type: string;
4185 |                 /**
4186 |                  * A description of the expected parameter.
4187 |                  */
4188 |                 description: string;
4189 |               };
4190 |             };
4191 |           };
4192 |         };
4193 |       }
4194 |   )[];
4195 |   response_format?: JSONMode;
4196 |   /**
4197 |    * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
4198 |    */
4199 |   raw?: boolean;
4200 |   /**
4201 |    * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
4202 |    */
4203 |   stream?: boolean;
4204 |   /**
4205 |    * The maximum number of tokens to generate in the response.
4206 |    */
4207 |   max_tokens?: number;
4208 |   /**
4209 |    * Controls the randomness of the output; higher values produce more random results.
4210 |    */
4211 |   temperature?: number;
4212 |   /**
4213 |    * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
4214 |    */
4215 |   top_p?: number;
4216 |   /**
4217 |    * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.
4218 |    */
4219 |   top_k?: number;
4220 |   /**
4221 |    * Random seed for reproducibility of the generation.
4222 |    */
4223 |   seed?: number;
4224 |   /**
4225 |    * Penalty for repeated tokens; higher values discourage repetition.
4226 |    */
4227 |   repetition_penalty?: number;
4228 |   /**
4229 |    * Decreases the likelihood of the model repeating the same lines verbatim.
4230 |    */
4231 |   frequency_penalty?: number;
4232 |   /**
4233 |    * Increases the likelihood of the model introducing new topics.
4234 |    */
4235 |   presence_penalty?: number;
4236 | }
4237 | interface AsyncBatch {
4238 |   requests?: {
4239 |     /**
4240 |      * User-supplied reference. This field will be present in the response as well it can be used to reference the request and response. It's NOT validated to be unique.
4241 |      */
4242 |     external_reference?: string;
4243 |     /**
4244 |      * Prompt for the text generation model
4245 |      */
4246 |     prompt?: string;
4247 |     /**
4248 |      * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
4249 |      */
4250 |     stream?: boolean;
4251 |     /**
4252 |      * The maximum number of tokens to generate in the response.
4253 |      */
4254 |     max_tokens?: number;
4255 |     /**
4256 |      * Controls the randomness of the output; higher values produce more random results.
4257 |      */
4258 |     temperature?: number;
4259 |     /**
4260 |      * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
4261 |      */
4262 |     top_p?: number;
4263 |     /**
4264 |      * Random seed for reproducibility of the generation.
4265 |      */
4266 |     seed?: number;
4267 |     /**
4268 |      * Penalty for repeated tokens; higher values discourage repetition.
4269 |      */
4270 |     repetition_penalty?: number;
4271 |     /**
4272 |      * Decreases the likelihood of the model repeating the same lines verbatim.
4273 |      */
4274 |     frequency_penalty?: number;
4275 |     /**
4276 |      * Increases the likelihood of the model introducing new topics.
4277 |      */
4278 |     presence_penalty?: number;
4279 |     response_format?: JSONMode;
4280 |   }[];
4281 | }
4282 | type Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Output =
4283 |   | {
4284 |       /**
4285 |        * The generated text response from the model
4286 |        */
4287 |       response: string;
4288 |       /**
4289 |        * Usage statistics for the inference request
4290 |        */
4291 |       usage?: {
4292 |         /**
4293 |          * Total number of tokens in input
4294 |          */
4295 |         prompt_tokens?: number;
4296 |         /**
4297 |          * Total number of tokens in output
4298 |          */
4299 |         completion_tokens?: number;
4300 |         /**
4301 |          * Total number of input and output tokens
4302 |          */
4303 |         total_tokens?: number;
4304 |       };
4305 |       /**
4306 |        * An array of tool calls requests made during the response generation
4307 |        */
4308 |       tool_calls?: {
4309 |         /**
4310 |          * The arguments passed to be passed to the tool call request
4311 |          */
4312 |         arguments?: object;
4313 |         /**
4314 |          * The name of the tool to be called
4315 |          */
4316 |         name?: string;
4317 |       }[];
4318 |     }
4319 |   | AsyncResponse;
4320 | declare abstract class Base_Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast {
4321 |   inputs: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Input;
4322 |   postProcessedOutputs: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Output;
4323 | }
4324 | interface Ai_Cf_Meta_Llama_Guard_3_8B_Input {
4325 |   /**
4326 |    * An array of message objects representing the conversation history.
4327 |    */
4328 |   messages: {
4329 |     /**
4330 |      * The role of the message sender must alternate between 'user' and 'assistant'.
4331 |      */
4332 |     role: "user" | "assistant";
4333 |     /**
4334 |      * The content of the message as a string.
4335 |      */
4336 |     content: string;
4337 |   }[];
4338 |   /**
4339 |    * The maximum number of tokens to generate in the response.
4340 |    */
4341 |   max_tokens?: number;
4342 |   /**
4343 |    * Controls the randomness of the output; higher values produce more random results.
4344 |    */
4345 |   temperature?: number;
4346 |   /**
4347 |    * Dictate the output format of the generated response.
4348 |    */
4349 |   response_format?: {
4350 |     /**
4351 |      * Set to json_object to process and output generated text as JSON.
4352 |      */
4353 |     type?: string;
4354 |   };
4355 | }
4356 | interface Ai_Cf_Meta_Llama_Guard_3_8B_Output {
4357 |   response?:
4358 |     | string
4359 |     | {
4360 |         /**
4361 |          * Whether the conversation is safe or not.
4362 |          */
4363 |         safe?: boolean;
4364 |         /**
4365 |          * A list of what hazard categories predicted for the conversation, if the conversation is deemed unsafe.
4366 |          */
4367 |         categories?: string[];
4368 |       };
4369 |   /**
4370 |    * Usage statistics for the inference request
4371 |    */
4372 |   usage?: {
4373 |     /**
4374 |      * Total number of tokens in input
4375 |      */
4376 |     prompt_tokens?: number;
4377 |     /**
4378 |      * Total number of tokens in output
4379 |      */
4380 |     completion_tokens?: number;
4381 |     /**
4382 |      * Total number of input and output tokens
4383 |      */
4384 |     total_tokens?: number;
4385 |   };
4386 | }
4387 | declare abstract class Base_Ai_Cf_Meta_Llama_Guard_3_8B {
4388 |   inputs: Ai_Cf_Meta_Llama_Guard_3_8B_Input;
4389 |   postProcessedOutputs: Ai_Cf_Meta_Llama_Guard_3_8B_Output;
4390 | }
4391 | interface Ai_Cf_Baai_Bge_Reranker_Base_Input {
4392 |   /**
4393 |    * A query you wish to perform against the provided contexts.
4394 |    */
4395 |   query: string;
4396 |   /**
4397 |    * Number of returned results starting with the best score.
4398 |    */
4399 |   top_k?: number;
4400 |   /**
4401 |    * List of provided contexts. Note that the index in this array is important, as the response will refer to it.
4402 |    */
4403 |   contexts: {
4404 |     /**
4405 |      * One of the provided context content
4406 |      */
4407 |     text?: string;
4408 |   }[];
4409 | }
4410 | interface Ai_Cf_Baai_Bge_Reranker_Base_Output {
4411 |   response?: {
4412 |     /**
4413 |      * Index of the context in the request
4414 |      */
4415 |     id?: number;
4416 |     /**
4417 |      * Score of the context under the index.
4418 |      */
4419 |     score?: number;
4420 |   }[];
4421 | }
4422 | declare abstract class Base_Ai_Cf_Baai_Bge_Reranker_Base {
4423 |   inputs: Ai_Cf_Baai_Bge_Reranker_Base_Input;
4424 |   postProcessedOutputs: Ai_Cf_Baai_Bge_Reranker_Base_Output;
4425 | }
4426 | type Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Input =
4427 |   | Qwen2_5_Coder_32B_Instruct_Prompt
4428 |   | Qwen2_5_Coder_32B_Instruct_Messages;
4429 | interface Qwen2_5_Coder_32B_Instruct_Prompt {
4430 |   /**
4431 |    * The input text prompt for the model to generate a response.
4432 |    */
4433 |   prompt: string;
4434 |   /**
4435 |    * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.
4436 |    */
4437 |   lora?: string;
4438 |   response_format?: JSONMode;
4439 |   /**
4440 |    * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
4441 |    */
4442 |   raw?: boolean;
4443 |   /**
4444 |    * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
4445 |    */
4446 |   stream?: boolean;
4447 |   /**
4448 |    * The maximum number of tokens to generate in the response.
4449 |    */
4450 |   max_tokens?: number;
4451 |   /**
4452 |    * Controls the randomness of the output; higher values produce more random results.
4453 |    */
4454 |   temperature?: number;
4455 |   /**
4456 |    * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
4457 |    */
4458 |   top_p?: number;
4459 |   /**
4460 |    * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.
4461 |    */
4462 |   top_k?: number;
4463 |   /**
4464 |    * Random seed for reproducibility of the generation.
4465 |    */
4466 |   seed?: number;
4467 |   /**
4468 |    * Penalty for repeated tokens; higher values discourage repetition.
4469 |    */
4470 |   repetition_penalty?: number;
4471 |   /**
4472 |    * Decreases the likelihood of the model repeating the same lines verbatim.
4473 |    */
4474 |   frequency_penalty?: number;
4475 |   /**
4476 |    * Increases the likelihood of the model introducing new topics.
4477 |    */
4478 |   presence_penalty?: number;
4479 | }
4480 | interface Qwen2_5_Coder_32B_Instruct_Messages {
4481 |   /**
4482 |    * An array of message objects representing the conversation history.
4483 |    */
4484 |   messages: {
4485 |     /**
4486 |      * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
4487 |      */
4488 |     role: string;
4489 |     /**
4490 |      * The content of the message as a string.
4491 |      */
4492 |     content: string;
4493 |   }[];
4494 |   functions?: {
4495 |     name: string;
4496 |     code: string;
4497 |   }[];
4498 |   /**
4499 |    * A list of tools available for the assistant to use.
4500 |    */
4501 |   tools?: (
4502 |     | {
4503 |         /**
4504 |          * The name of the tool. More descriptive the better.
4505 |          */
4506 |         name: string;
4507 |         /**
4508 |          * A brief description of what the tool does.
4509 |          */
4510 |         description: string;
4511 |         /**
4512 |          * Schema defining the parameters accepted by the tool.
4513 |          */
4514 |         parameters: {
4515 |           /**
4516 |            * The type of the parameters object (usually 'object').
4517 |            */
4518 |           type: string;
4519 |           /**
4520 |            * List of required parameter names.
4521 |            */
4522 |           required?: string[];
4523 |           /**
4524 |            * Definitions of each parameter.
4525 |            */
4526 |           properties: {
4527 |             [k: string]: {
4528 |               /**
4529 |                * The data type of the parameter.
4530 |                */
4531 |               type: string;
4532 |               /**
4533 |                * A description of the expected parameter.
4534 |                */
4535 |               description: string;
4536 |             };
4537 |           };
4538 |         };
4539 |       }
4540 |     | {
4541 |         /**
4542 |          * Specifies the type of tool (e.g., 'function').
4543 |          */
4544 |         type: string;
4545 |         /**
4546 |          * Details of the function tool.
4547 |          */
4548 |         function: {
4549 |           /**
4550 |            * The name of the function.
4551 |            */
4552 |           name: string;
4553 |           /**
4554 |            * A brief description of what the function does.
4555 |            */
4556 |           description: string;
4557 |           /**
4558 |            * Schema defining the parameters accepted by the function.
4559 |            */
4560 |           parameters: {
4561 |             /**
4562 |              * The type of the parameters object (usually 'object').
4563 |              */
4564 |             type: string;
4565 |             /**
4566 |              * List of required parameter names.
4567 |              */
4568 |             required?: string[];
4569 |             /**
4570 |              * Definitions of each parameter.
4571 |              */
4572 |             properties: {
4573 |               [k: string]: {
4574 |                 /**
4575 |                  * The data type of the parameter.
4576 |                  */
4577 |                 type: string;
4578 |                 /**
4579 |                  * A description of the expected parameter.
4580 |                  */
4581 |                 description: string;
4582 |               };
4583 |             };
4584 |           };
4585 |         };
4586 |       }
4587 |   )[];
4588 |   response_format?: JSONMode;
4589 |   /**
4590 |    * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
4591 |    */
4592 |   raw?: boolean;
4593 |   /**
4594 |    * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
4595 |    */
4596 |   stream?: boolean;
4597 |   /**
4598 |    * The maximum number of tokens to generate in the response.
4599 |    */
4600 |   max_tokens?: number;
4601 |   /**
4602 |    * Controls the randomness of the output; higher values produce more random results.
4603 |    */
4604 |   temperature?: number;
4605 |   /**
4606 |    * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
4607 |    */
4608 |   top_p?: number;
4609 |   /**
4610 |    * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.
4611 |    */
4612 |   top_k?: number;
4613 |   /**
4614 |    * Random seed for reproducibility of the generation.
4615 |    */
4616 |   seed?: number;
4617 |   /**
4618 |    * Penalty for repeated tokens; higher values discourage repetition.
4619 |    */
4620 |   repetition_penalty?: number;
4621 |   /**
4622 |    * Decreases the likelihood of the model repeating the same lines verbatim.
4623 |    */
4624 |   frequency_penalty?: number;
4625 |   /**
4626 |    * Increases the likelihood of the model introducing new topics.
4627 |    */
4628 |   presence_penalty?: number;
4629 | }
4630 | type Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Output = {
4631 |   /**
4632 |    * The generated text response from the model
4633 |    */
4634 |   response: string;
4635 |   /**
4636 |    * Usage statistics for the inference request
4637 |    */
4638 |   usage?: {
4639 |     /**
4640 |      * Total number of tokens in input
4641 |      */
4642 |     prompt_tokens?: number;
4643 |     /**
4644 |      * Total number of tokens in output
4645 |      */
4646 |     completion_tokens?: number;
4647 |     /**
4648 |      * Total number of input and output tokens
4649 |      */
4650 |     total_tokens?: number;
4651 |   };
4652 |   /**
4653 |    * An array of tool calls requests made during the response generation
4654 |    */
4655 |   tool_calls?: {
4656 |     /**
4657 |      * The arguments passed to be passed to the tool call request
4658 |      */
4659 |     arguments?: object;
4660 |     /**
4661 |      * The name of the tool to be called
4662 |      */
4663 |     name?: string;
4664 |   }[];
4665 | };
4666 | declare abstract class Base_Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct {
4667 |   inputs: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Input;
4668 |   postProcessedOutputs: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Output;
4669 | }
4670 | type Ai_Cf_Qwen_Qwq_32B_Input = Qwen_Qwq_32B_Prompt | Qwen_Qwq_32B_Messages;
4671 | interface Qwen_Qwq_32B_Prompt {
4672 |   /**
4673 |    * The input text prompt for the model to generate a response.
4674 |    */
4675 |   prompt: string;
4676 |   /**
4677 |    * JSON schema that should be fulfilled for the response.
4678 |    */
4679 |   guided_json?: object;
4680 |   /**
4681 |    * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
4682 |    */
4683 |   raw?: boolean;
4684 |   /**
4685 |    * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
4686 |    */
4687 |   stream?: boolean;
4688 |   /**
4689 |    * The maximum number of tokens to generate in the response.
4690 |    */
4691 |   max_tokens?: number;
4692 |   /**
4693 |    * Controls the randomness of the output; higher values produce more random results.
4694 |    */
4695 |   temperature?: number;
4696 |   /**
4697 |    * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
4698 |    */
4699 |   top_p?: number;
4700 |   /**
4701 |    * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.
4702 |    */
4703 |   top_k?: number;
4704 |   /**
4705 |    * Random seed for reproducibility of the generation.
4706 |    */
4707 |   seed?: number;
4708 |   /**
4709 |    * Penalty for repeated tokens; higher values discourage repetition.
4710 |    */
4711 |   repetition_penalty?: number;
4712 |   /**
4713 |    * Decreases the likelihood of the model repeating the same lines verbatim.
4714 |    */
4715 |   frequency_penalty?: number;
4716 |   /**
4717 |    * Increases the likelihood of the model introducing new topics.
4718 |    */
4719 |   presence_penalty?: number;
4720 | }
4721 | interface Qwen_Qwq_32B_Messages {
4722 |   /**
4723 |    * An array of message objects representing the conversation history.
4724 |    */
4725 |   messages: {
4726 |     /**
4727 |      * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
4728 |      */
4729 |     role?: string;
4730 |     /**
4731 |      * The tool call id. Must be supplied for tool calls for Mistral-3. If you don't know what to put here you can fall back to 000000001
4732 |      */
4733 |     tool_call_id?: string;
4734 |     content?:
4735 |       | string
4736 |       | {
4737 |           /**
4738 |            * Type of the content provided
4739 |            */
4740 |           type?: string;
4741 |           text?: string;
4742 |           image_url?: {
4743 |             /**
4744 |              * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted
4745 |              */
4746 |             url?: string;
4747 |           };
4748 |         }[]
4749 |       | {
4750 |           /**
4751 |            * Type of the content provided
4752 |            */
4753 |           type?: string;
4754 |           text?: string;
4755 |           image_url?: {
4756 |             /**
4757 |              * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted
4758 |              */
4759 |             url?: string;
4760 |           };
4761 |         };
4762 |   }[];
4763 |   functions?: {
4764 |     name: string;
4765 |     code: string;
4766 |   }[];
4767 |   /**
4768 |    * A list of tools available for the assistant to use.
4769 |    */
4770 |   tools?: (
4771 |     | {
4772 |         /**
4773 |          * The name of the tool. More descriptive the better.
4774 |          */
4775 |         name: string;
4776 |         /**
4777 |          * A brief description of what the tool does.
4778 |          */
4779 |         description: string;
4780 |         /**
4781 |          * Schema defining the parameters accepted by the tool.
4782 |          */
4783 |         parameters: {
4784 |           /**
4785 |            * The type of the parameters object (usually 'object').
4786 |            */
4787 |           type: string;
4788 |           /**
4789 |            * List of required parameter names.
4790 |            */
4791 |           required?: string[];
4792 |           /**
4793 |            * Definitions of each parameter.
4794 |            */
4795 |           properties: {
4796 |             [k: string]: {
4797 |               /**
4798 |                * The data type of the parameter.
4799 |                */
4800 |               type: string;
4801 |               /**
4802 |                * A description of the expected parameter.
4803 |                */
4804 |               description: string;
4805 |             };
4806 |           };
4807 |         };
4808 |       }
4809 |     | {
4810 |         /**
4811 |          * Specifies the type of tool (e.g., 'function').
4812 |          */
4813 |         type: string;
4814 |         /**
4815 |          * Details of the function tool.
4816 |          */
4817 |         function: {
4818 |           /**
4819 |            * The name of the function.
4820 |            */
4821 |           name: string;
4822 |           /**
4823 |            * A brief description of what the function does.
4824 |            */
4825 |           description: string;
4826 |           /**
4827 |            * Schema defining the parameters accepted by the function.
4828 |            */
4829 |           parameters: {
4830 |             /**
4831 |              * The type of the parameters object (usually 'object').
4832 |              */
4833 |             type: string;
4834 |             /**
4835 |              * List of required parameter names.
4836 |              */
4837 |             required?: string[];
4838 |             /**
4839 |              * Definitions of each parameter.
4840 |              */
4841 |             properties: {
4842 |               [k: string]: {
4843 |                 /**
4844 |                  * The data type of the parameter.
4845 |                  */
4846 |                 type: string;
4847 |                 /**
4848 |                  * A description of the expected parameter.
4849 |                  */
4850 |                 description: string;
4851 |               };
4852 |             };
4853 |           };
4854 |         };
4855 |       }
4856 |   )[];
4857 |   /**
4858 |    * JSON schema that should be fufilled for the response.
4859 |    */
4860 |   guided_json?: object;
4861 |   /**
4862 |    * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
4863 |    */
4864 |   raw?: boolean;
4865 |   /**
4866 |    * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
4867 |    */
4868 |   stream?: boolean;
4869 |   /**
4870 |    * The maximum number of tokens to generate in the response.
4871 |    */
4872 |   max_tokens?: number;
4873 |   /**
4874 |    * Controls the randomness of the output; higher values produce more random results.
4875 |    */
4876 |   temperature?: number;
4877 |   /**
4878 |    * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
4879 |    */
4880 |   top_p?: number;
4881 |   /**
4882 |    * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.
4883 |    */
4884 |   top_k?: number;
4885 |   /**
4886 |    * Random seed for reproducibility of the generation.
4887 |    */
4888 |   seed?: number;
4889 |   /**
4890 |    * Penalty for repeated tokens; higher values discourage repetition.
4891 |    */
4892 |   repetition_penalty?: number;
4893 |   /**
4894 |    * Decreases the likelihood of the model repeating the same lines verbatim.
4895 |    */
4896 |   frequency_penalty?: number;
4897 |   /**
4898 |    * Increases the likelihood of the model introducing new topics.
4899 |    */
4900 |   presence_penalty?: number;
4901 | }
4902 | type Ai_Cf_Qwen_Qwq_32B_Output = {
4903 |   /**
4904 |    * The generated text response from the model
4905 |    */
4906 |   response: string;
4907 |   /**
4908 |    * Usage statistics for the inference request
4909 |    */
4910 |   usage?: {
4911 |     /**
4912 |      * Total number of tokens in input
4913 |      */
4914 |     prompt_tokens?: number;
4915 |     /**
4916 |      * Total number of tokens in output
4917 |      */
4918 |     completion_tokens?: number;
4919 |     /**
4920 |      * Total number of input and output tokens
4921 |      */
4922 |     total_tokens?: number;
4923 |   };
4924 |   /**
4925 |    * An array of tool calls requests made during the response generation
4926 |    */
4927 |   tool_calls?: {
4928 |     /**
4929 |      * The arguments passed to be passed to the tool call request
4930 |      */
4931 |     arguments?: object;
4932 |     /**
4933 |      * The name of the tool to be called
4934 |      */
4935 |     name?: string;
4936 |   }[];
4937 | };
4938 | declare abstract class Base_Ai_Cf_Qwen_Qwq_32B {
4939 |   inputs: Ai_Cf_Qwen_Qwq_32B_Input;
4940 |   postProcessedOutputs: Ai_Cf_Qwen_Qwq_32B_Output;
4941 | }
4942 | type Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Input =
4943 |   | Mistral_Small_3_1_24B_Instruct_Prompt
4944 |   | Mistral_Small_3_1_24B_Instruct_Messages;
4945 | interface Mistral_Small_3_1_24B_Instruct_Prompt {
4946 |   /**
4947 |    * The input text prompt for the model to generate a response.
4948 |    */
4949 |   prompt: string;
4950 |   /**
4951 |    * JSON schema that should be fulfilled for the response.
4952 |    */
4953 |   guided_json?: object;
4954 |   /**
4955 |    * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
4956 |    */
4957 |   raw?: boolean;
4958 |   /**
4959 |    * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
4960 |    */
4961 |   stream?: boolean;
4962 |   /**
4963 |    * The maximum number of tokens to generate in the response.
4964 |    */
4965 |   max_tokens?: number;
4966 |   /**
4967 |    * Controls the randomness of the output; higher values produce more random results.
4968 |    */
4969 |   temperature?: number;
4970 |   /**
4971 |    * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
4972 |    */
4973 |   top_p?: number;
4974 |   /**
4975 |    * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.
4976 |    */
4977 |   top_k?: number;
4978 |   /**
4979 |    * Random seed for reproducibility of the generation.
4980 |    */
4981 |   seed?: number;
4982 |   /**
4983 |    * Penalty for repeated tokens; higher values discourage repetition.
4984 |    */
4985 |   repetition_penalty?: number;
4986 |   /**
4987 |    * Decreases the likelihood of the model repeating the same lines verbatim.
4988 |    */
4989 |   frequency_penalty?: number;
4990 |   /**
4991 |    * Increases the likelihood of the model introducing new topics.
4992 |    */
4993 |   presence_penalty?: number;
4994 | }
4995 | interface Mistral_Small_3_1_24B_Instruct_Messages {
4996 |   /**
4997 |    * An array of message objects representing the conversation history.
4998 |    */
4999 |   messages: {
5000 |     /**
5001 |      * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
5002 |      */
5003 |     role?: string;
5004 |     /**
5005 |      * The tool call id. Must be supplied for tool calls for Mistral-3. If you don't know what to put here you can fall back to 000000001
5006 |      */
5007 |     tool_call_id?: string;
5008 |     content?:
5009 |       | string
5010 |       | {
5011 |           /**
5012 |            * Type of the content provided
5013 |            */
5014 |           type?: string;
5015 |           text?: string;
5016 |           image_url?: {
5017 |             /**
5018 |              * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted
5019 |              */
5020 |             url?: string;
5021 |           };
5022 |         }[]
5023 |       | {
5024 |           /**
5025 |            * Type of the content provided
5026 |            */
5027 |           type?: string;
5028 |           text?: string;
5029 |           image_url?: {
5030 |             /**
5031 |              * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted
5032 |              */
5033 |             url?: string;
5034 |           };
5035 |         };
5036 |   }[];
5037 |   functions?: {
5038 |     name: string;
5039 |     code: string;
5040 |   }[];
5041 |   /**
5042 |    * A list of tools available for the assistant to use.
5043 |    */
5044 |   tools?: (
5045 |     | {
5046 |         /**
5047 |          * The name of the tool. More descriptive the better.
5048 |          */
5049 |         name: string;
5050 |         /**
5051 |          * A brief description of what the tool does.
5052 |          */
5053 |         description: string;
5054 |         /**
5055 |          * Schema defining the parameters accepted by the tool.
5056 |          */
5057 |         parameters: {
5058 |           /**
5059 |            * The type of the parameters object (usually 'object').
5060 |            */
5061 |           type: string;
5062 |           /**
5063 |            * List of required parameter names.
5064 |            */
5065 |           required?: string[];
5066 |           /**
5067 |            * Definitions of each parameter.
5068 |            */
5069 |           properties: {
5070 |             [k: string]: {
5071 |               /**
5072 |                * The data type of the parameter.
5073 |                */
5074 |               type: string;
5075 |               /**
5076 |                * A description of the expected parameter.
5077 |                */
5078 |               description: string;
5079 |             };
5080 |           };
5081 |         };
5082 |       }
5083 |     | {
5084 |         /**
5085 |          * Specifies the type of tool (e.g., 'function').
5086 |          */
5087 |         type: string;
5088 |         /**
5089 |          * Details of the function tool.
5090 |          */
5091 |         function: {
5092 |           /**
5093 |            * The name of the function.
5094 |            */
5095 |           name: string;
5096 |           /**
5097 |            * A brief description of what the function does.
5098 |            */
5099 |           description: string;
5100 |           /**
5101 |            * Schema defining the parameters accepted by the function.
5102 |            */
5103 |           parameters: {
5104 |             /**
5105 |              * The type of the parameters object (usually 'object').
5106 |              */
5107 |             type: string;
5108 |             /**
5109 |              * List of required parameter names.
5110 |              */
5111 |             required?: string[];
5112 |             /**
5113 |              * Definitions of each parameter.
5114 |              */
5115 |             properties: {
5116 |               [k: string]: {
5117 |                 /**
5118 |                  * The data type of the parameter.
5119 |                  */
5120 |                 type: string;
5121 |                 /**
5122 |                  * A description of the expected parameter.
5123 |                  */
5124 |                 description: string;
5125 |               };
5126 |             };
5127 |           };
5128 |         };
5129 |       }
5130 |   )[];
5131 |   /**
5132 |    * JSON schema that should be fufilled for the response.
5133 |    */
5134 |   guided_json?: object;
5135 |   /**
5136 |    * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
5137 |    */
5138 |   raw?: boolean;
5139 |   /**
5140 |    * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
5141 |    */
5142 |   stream?: boolean;
5143 |   /**
5144 |    * The maximum number of tokens to generate in the response.
5145 |    */
5146 |   max_tokens?: number;
5147 |   /**
5148 |    * Controls the randomness of the output; higher values produce more random results.
5149 |    */
5150 |   temperature?: number;
5151 |   /**
5152 |    * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
5153 |    */
5154 |   top_p?: number;
5155 |   /**
5156 |    * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.
5157 |    */
5158 |   top_k?: number;
5159 |   /**
5160 |    * Random seed for reproducibility of the generation.
5161 |    */
5162 |   seed?: number;
5163 |   /**
5164 |    * Penalty for repeated tokens; higher values discourage repetition.
5165 |    */
5166 |   repetition_penalty?: number;
5167 |   /**
5168 |    * Decreases the likelihood of the model repeating the same lines verbatim.
5169 |    */
5170 |   frequency_penalty?: number;
5171 |   /**
5172 |    * Increases the likelihood of the model introducing new topics.
5173 |    */
5174 |   presence_penalty?: number;
5175 | }
5176 | type Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Output = {
5177 |   /**
5178 |    * The generated text response from the model
5179 |    */
5180 |   response: string;
5181 |   /**
5182 |    * Usage statistics for the inference request
5183 |    */
5184 |   usage?: {
5185 |     /**
5186 |      * Total number of tokens in input
5187 |      */
5188 |     prompt_tokens?: number;
5189 |     /**
5190 |      * Total number of tokens in output
5191 |      */
5192 |     completion_tokens?: number;
5193 |     /**
5194 |      * Total number of input and output tokens
5195 |      */
5196 |     total_tokens?: number;
5197 |   };
5198 |   /**
5199 |    * An array of tool calls requests made during the response generation
5200 |    */
5201 |   tool_calls?: {
5202 |     /**
5203 |      * The arguments passed to be passed to the tool call request
5204 |      */
5205 |     arguments?: object;
5206 |     /**
5207 |      * The name of the tool to be called
5208 |      */
5209 |     name?: string;
5210 |   }[];
5211 | };
5212 | declare abstract class Base_Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct {
5213 |   inputs: Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Input;
5214 |   postProcessedOutputs: Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Output;
5215 | }
5216 | type Ai_Cf_Google_Gemma_3_12B_It_Input =
5217 |   | Google_Gemma_3_12B_It_Prompt
5218 |   | Google_Gemma_3_12B_It_Messages;
5219 | interface Google_Gemma_3_12B_It_Prompt {
5220 |   /**
5221 |    * The input text prompt for the model to generate a response.
5222 |    */
5223 |   prompt: string;
5224 |   /**
5225 |    * JSON schema that should be fufilled for the response.
5226 |    */
5227 |   guided_json?: object;
5228 |   /**
5229 |    * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
5230 |    */
5231 |   raw?: boolean;
5232 |   /**
5233 |    * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
5234 |    */
5235 |   stream?: boolean;
5236 |   /**
5237 |    * The maximum number of tokens to generate in the response.
5238 |    */
5239 |   max_tokens?: number;
5240 |   /**
5241 |    * Controls the randomness of the output; higher values produce more random results.
5242 |    */
5243 |   temperature?: number;
5244 |   /**
5245 |    * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
5246 |    */
5247 |   top_p?: number;
5248 |   /**
5249 |    * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.
5250 |    */
5251 |   top_k?: number;
5252 |   /**
5253 |    * Random seed for reproducibility of the generation.
5254 |    */
5255 |   seed?: number;
5256 |   /**
5257 |    * Penalty for repeated tokens; higher values discourage repetition.
5258 |    */
5259 |   repetition_penalty?: number;
5260 |   /**
5261 |    * Decreases the likelihood of the model repeating the same lines verbatim.
5262 |    */
5263 |   frequency_penalty?: number;
5264 |   /**
5265 |    * Increases the likelihood of the model introducing new topics.
5266 |    */
5267 |   presence_penalty?: number;
5268 | }
5269 | interface Google_Gemma_3_12B_It_Messages {
5270 |   /**
5271 |    * An array of message objects representing the conversation history.
5272 |    */
5273 |   messages: {
5274 |     /**
5275 |      * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
5276 |      */
5277 |     role?: string;
5278 |     content?:
5279 |       | string
5280 |       | {
5281 |           /**
5282 |            * Type of the content provided
5283 |            */
5284 |           type?: string;
5285 |           text?: string;
5286 |           image_url?: {
5287 |             /**
5288 |              * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted
5289 |              */
5290 |             url?: string;
5291 |           };
5292 |         }[]
5293 |       | {
5294 |           /**
5295 |            * Type of the content provided
5296 |            */
5297 |           type?: string;
5298 |           text?: string;
5299 |           image_url?: {
5300 |             /**
5301 |              * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted
5302 |              */
5303 |             url?: string;
5304 |           };
5305 |         };
5306 |   }[];
5307 |   functions?: {
5308 |     name: string;
5309 |     code: string;
5310 |   }[];
5311 |   /**
5312 |    * A list of tools available for the assistant to use.
5313 |    */
5314 |   tools?: (
5315 |     | {
5316 |         /**
5317 |          * The name of the tool. More descriptive the better.
5318 |          */
5319 |         name: string;
5320 |         /**
5321 |          * A brief description of what the tool does.
5322 |          */
5323 |         description: string;
5324 |         /**
5325 |          * Schema defining the parameters accepted by the tool.
5326 |          */
5327 |         parameters: {
5328 |           /**
5329 |            * The type of the parameters object (usually 'object').
5330 |            */
5331 |           type: string;
5332 |           /**
5333 |            * List of required parameter names.
5334 |            */
5335 |           required?: string[];
5336 |           /**
5337 |            * Definitions of each parameter.
5338 |            */
5339 |           properties: {
5340 |             [k: string]: {
5341 |               /**
5342 |                * The data type of the parameter.
5343 |                */
5344 |               type: string;
5345 |               /**
5346 |                * A description of the expected parameter.
5347 |                */
5348 |               description: string;
5349 |             };
5350 |           };
5351 |         };
5352 |       }
5353 |     | {
5354 |         /**
5355 |          * Specifies the type of tool (e.g., 'function').
5356 |          */
5357 |         type: string;
5358 |         /**
5359 |          * Details of the function tool.
5360 |          */
5361 |         function: {
5362 |           /**
5363 |            * The name of the function.
5364 |            */
5365 |           name: string;
5366 |           /**
5367 |            * A brief description of what the function does.
5368 |            */
5369 |           description: string;
5370 |           /**
5371 |            * Schema defining the parameters accepted by the function.
5372 |            */
5373 |           parameters: {
5374 |             /**
5375 |              * The type of the parameters object (usually 'object').
5376 |              */
5377 |             type: string;
5378 |             /**
5379 |              * List of required parameter names.
5380 |              */
5381 |             required?: string[];
5382 |             /**
5383 |              * Definitions of each parameter.
5384 |              */
5385 |             properties: {
5386 |               [k: string]: {
5387 |                 /**
5388 |                  * The data type of the parameter.
5389 |                  */
5390 |                 type: string;
5391 |                 /**
5392 |                  * A description of the expected parameter.
5393 |                  */
5394 |                 description: string;
5395 |               };
5396 |             };
5397 |           };
5398 |         };
5399 |       }
5400 |   )[];
5401 |   /**
5402 |    * JSON schema that should be fufilled for the response.
5403 |    */
5404 |   guided_json?: object;
5405 |   /**
5406 |    * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
5407 |    */
5408 |   raw?: boolean;
5409 |   /**
5410 |    * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
5411 |    */
5412 |   stream?: boolean;
5413 |   /**
5414 |    * The maximum number of tokens to generate in the response.
5415 |    */
5416 |   max_tokens?: number;
5417 |   /**
5418 |    * Controls the randomness of the output; higher values produce more random results.
5419 |    */
5420 |   temperature?: number;
5421 |   /**
5422 |    * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
5423 |    */
5424 |   top_p?: number;
5425 |   /**
5426 |    * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.
5427 |    */
5428 |   top_k?: number;
5429 |   /**
5430 |    * Random seed for reproducibility of the generation.
5431 |    */
5432 |   seed?: number;
5433 |   /**
5434 |    * Penalty for repeated tokens; higher values discourage repetition.
5435 |    */
5436 |   repetition_penalty?: number;
5437 |   /**
5438 |    * Decreases the likelihood of the model repeating the same lines verbatim.
5439 |    */
5440 |   frequency_penalty?: number;
5441 |   /**
5442 |    * Increases the likelihood of the model introducing new topics.
5443 |    */
5444 |   presence_penalty?: number;
5445 | }
5446 | type Ai_Cf_Google_Gemma_3_12B_It_Output = {
5447 |   /**
5448 |    * The generated text response from the model
5449 |    */
5450 |   response: string;
5451 |   /**
5452 |    * Usage statistics for the inference request
5453 |    */
5454 |   usage?: {
5455 |     /**
5456 |      * Total number of tokens in input
5457 |      */
5458 |     prompt_tokens?: number;
5459 |     /**
5460 |      * Total number of tokens in output
5461 |      */
5462 |     completion_tokens?: number;
5463 |     /**
5464 |      * Total number of input and output tokens
5465 |      */
5466 |     total_tokens?: number;
5467 |   };
5468 |   /**
5469 |    * An array of tool calls requests made during the response generation
5470 |    */
5471 |   tool_calls?: {
5472 |     /**
5473 |      * The arguments passed to be passed to the tool call request
5474 |      */
5475 |     arguments?: object;
5476 |     /**
5477 |      * The name of the tool to be called
5478 |      */
5479 |     name?: string;
5480 |   }[];
5481 | };
5482 | declare abstract class Base_Ai_Cf_Google_Gemma_3_12B_It {
5483 |   inputs: Ai_Cf_Google_Gemma_3_12B_It_Input;
5484 |   postProcessedOutputs: Ai_Cf_Google_Gemma_3_12B_It_Output;
5485 | }
5486 | type Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Input =
5487 |   | Ai_Cf_Meta_Llama_4_Prompt
5488 |   | Ai_Cf_Meta_Llama_4_Messages;
5489 | interface Ai_Cf_Meta_Llama_4_Prompt {
5490 |   /**
5491 |    * The input text prompt for the model to generate a response.
5492 |    */
5493 |   prompt: string;
5494 |   /**
5495 |    * JSON schema that should be fulfilled for the response.
5496 |    */
5497 |   guided_json?: object;
5498 |   response_format?: JSONMode;
5499 |   /**
5500 |    * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
5501 |    */
5502 |   raw?: boolean;
5503 |   /**
5504 |    * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
5505 |    */
5506 |   stream?: boolean;
5507 |   /**
5508 |    * The maximum number of tokens to generate in the response.
5509 |    */
5510 |   max_tokens?: number;
5511 |   /**
5512 |    * Controls the randomness of the output; higher values produce more random results.
5513 |    */
5514 |   temperature?: number;
5515 |   /**
5516 |    * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
5517 |    */
5518 |   top_p?: number;
5519 |   /**
5520 |    * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.
5521 |    */
5522 |   top_k?: number;
5523 |   /**
5524 |    * Random seed for reproducibility of the generation.
5525 |    */
5526 |   seed?: number;
5527 |   /**
5528 |    * Penalty for repeated tokens; higher values discourage repetition.
5529 |    */
5530 |   repetition_penalty?: number;
5531 |   /**
5532 |    * Decreases the likelihood of the model repeating the same lines verbatim.
5533 |    */
5534 |   frequency_penalty?: number;
5535 |   /**
5536 |    * Increases the likelihood of the model introducing new topics.
5537 |    */
5538 |   presence_penalty?: number;
5539 | }
5540 | interface Ai_Cf_Meta_Llama_4_Messages {
5541 |   /**
5542 |    * An array of message objects representing the conversation history.
5543 |    */
5544 |   messages: {
5545 |     /**
5546 |      * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
5547 |      */
5548 |     role?: string;
5549 |     /**
5550 |      * The tool call id. If you don't know what to put here you can fall back to 000000001
5551 |      */
5552 |     tool_call_id?: string;
5553 |     content?:
5554 |       | string
5555 |       | {
5556 |           /**
5557 |            * Type of the content provided
5558 |            */
5559 |           type?: string;
5560 |           text?: string;
5561 |           image_url?: {
5562 |             /**
5563 |              * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted
5564 |              */
5565 |             url?: string;
5566 |           };
5567 |         }[]
5568 |       | {
5569 |           /**
5570 |            * Type of the content provided
5571 |            */
5572 |           type?: string;
5573 |           text?: string;
5574 |           image_url?: {
5575 |             /**
5576 |              * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted
5577 |              */
5578 |             url?: string;
5579 |           };
5580 |         };
5581 |   }[];
5582 |   functions?: {
5583 |     name: string;
5584 |     code: string;
5585 |   }[];
5586 |   /**
5587 |    * A list of tools available for the assistant to use.
5588 |    */
5589 |   tools?: (
5590 |     | {
5591 |         /**
5592 |          * The name of the tool. More descriptive the better.
5593 |          */
5594 |         name: string;
5595 |         /**
5596 |          * A brief description of what the tool does.
5597 |          */
5598 |         description: string;
5599 |         /**
5600 |          * Schema defining the parameters accepted by the tool.
5601 |          */
5602 |         parameters: {
5603 |           /**
5604 |            * The type of the parameters object (usually 'object').
5605 |            */
5606 |           type: string;
5607 |           /**
5608 |            * List of required parameter names.
5609 |            */
5610 |           required?: string[];
5611 |           /**
5612 |            * Definitions of each parameter.
5613 |            */
5614 |           properties: {
5615 |             [k: string]: {
5616 |               /**
5617 |                * The data type of the parameter.
5618 |                */
5619 |               type: string;
5620 |               /**
5621 |                * A description of the expected parameter.
5622 |                */
5623 |               description: string;
5624 |             };
5625 |           };
5626 |         };
5627 |       }
5628 |     | {
5629 |         /**
5630 |          * Specifies the type of tool (e.g., 'function').
5631 |          */
5632 |         type: string;
5633 |         /**
5634 |          * Details of the function tool.
5635 |          */
5636 |         function: {
5637 |           /**
5638 |            * The name of the function.
5639 |            */
5640 |           name: string;
5641 |           /**
5642 |            * A brief description of what the function does.
5643 |            */
5644 |           description: string;
5645 |           /**
5646 |            * Schema defining the parameters accepted by the function.
5647 |            */
5648 |           parameters: {
5649 |             /**
5650 |              * The type of the parameters object (usually 'object').
5651 |              */
5652 |             type: string;
5653 |             /**
5654 |              * List of required parameter names.
5655 |              */
5656 |             required?: string[];
5657 |             /**
5658 |              * Definitions of each parameter.
5659 |              */
5660 |             properties: {
5661 |               [k: string]: {
5662 |                 /**
5663 |                  * The data type of the parameter.
5664 |                  */
5665 |                 type: string;
5666 |                 /**
5667 |                  * A description of the expected parameter.
5668 |                  */
5669 |                 description: string;
5670 |               };
5671 |             };
5672 |           };
5673 |         };
5674 |       }
5675 |   )[];
5676 |   response_format?: JSONMode;
5677 |   /**
5678 |    * JSON schema that should be fufilled for the response.
5679 |    */
5680 |   guided_json?: object;
5681 |   /**
5682 |    * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
5683 |    */
5684 |   raw?: boolean;
5685 |   /**
5686 |    * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
5687 |    */
5688 |   stream?: boolean;
5689 |   /**
5690 |    * The maximum number of tokens to generate in the response.
5691 |    */
5692 |   max_tokens?: number;
5693 |   /**
5694 |    * Controls the randomness of the output; higher values produce more random results.
5695 |    */
5696 |   temperature?: number;
5697 |   /**
5698 |    * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
5699 |    */
5700 |   top_p?: number;
5701 |   /**
5702 |    * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.
5703 |    */
5704 |   top_k?: number;
5705 |   /**
5706 |    * Random seed for reproducibility of the generation.
5707 |    */
5708 |   seed?: number;
5709 |   /**
5710 |    * Penalty for repeated tokens; higher values discourage repetition.
5711 |    */
5712 |   repetition_penalty?: number;
5713 |   /**
5714 |    * Decreases the likelihood of the model repeating the same lines verbatim.
5715 |    */
5716 |   frequency_penalty?: number;
5717 |   /**
5718 |    * Increases the likelihood of the model introducing new topics.
5719 |    */
5720 |   presence_penalty?: number;
5721 | }
5722 | type Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Output = {
5723 |   /**
5724 |    * The generated text response from the model
5725 |    */
5726 |   response: string;
5727 |   /**
5728 |    * Usage statistics for the inference request
5729 |    */
5730 |   usage?: {
5731 |     /**
5732 |      * Total number of tokens in input
5733 |      */
5734 |     prompt_tokens?: number;
5735 |     /**
5736 |      * Total number of tokens in output
5737 |      */
5738 |     completion_tokens?: number;
5739 |     /**
5740 |      * Total number of input and output tokens
5741 |      */
5742 |     total_tokens?: number;
5743 |   };
5744 |   /**
5745 |    * An array of tool calls requests made during the response generation
5746 |    */
5747 |   tool_calls?: {
5748 |     /**
5749 |      * The tool call id.
5750 |      */
5751 |     id?: string;
5752 |     /**
5753 |      * Specifies the type of tool (e.g., 'function').
5754 |      */
5755 |     type?: string;
5756 |     /**
5757 |      * Details of the function tool.
5758 |      */
5759 |     function?: {
5760 |       /**
5761 |        * The name of the tool to be called
5762 |        */
5763 |       name?: string;
5764 |       /**
5765 |        * The arguments passed to be passed to the tool call request
5766 |        */
5767 |       arguments?: object;
5768 |     };
5769 |   }[];
5770 | };
5771 | declare abstract class Base_Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct {
5772 |   inputs: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Input;
5773 |   postProcessedOutputs: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Output;
5774 | }
5775 | interface AiModels {
5776 |   "@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification;
5777 |   "@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage;
5778 |   "@cf/runwayml/stable-diffusion-v1-5-inpainting": BaseAiTextToImage;
5779 |   "@cf/runwayml/stable-diffusion-v1-5-img2img": BaseAiTextToImage;
5780 |   "@cf/lykon/dreamshaper-8-lcm": BaseAiTextToImage;
5781 |   "@cf/bytedance/stable-diffusion-xl-lightning": BaseAiTextToImage;
5782 |   "@cf/myshell-ai/melotts": BaseAiTextToSpeech;
5783 |   "@cf/microsoft/resnet-50": BaseAiImageClassification;
5784 |   "@cf/facebook/detr-resnet-50": BaseAiObjectDetection;
5785 |   "@cf/meta/llama-2-7b-chat-int8": BaseAiTextGeneration;
5786 |   "@cf/mistral/mistral-7b-instruct-v0.1": BaseAiTextGeneration;
5787 |   "@cf/meta/llama-2-7b-chat-fp16": BaseAiTextGeneration;
5788 |   "@hf/thebloke/llama-2-13b-chat-awq": BaseAiTextGeneration;
5789 |   "@hf/thebloke/mistral-7b-instruct-v0.1-awq": BaseAiTextGeneration;
5790 |   "@hf/thebloke/zephyr-7b-beta-awq": BaseAiTextGeneration;
5791 |   "@hf/thebloke/openhermes-2.5-mistral-7b-awq": BaseAiTextGeneration;
5792 |   "@hf/thebloke/neural-chat-7b-v3-1-awq": BaseAiTextGeneration;
5793 |   "@hf/thebloke/llamaguard-7b-awq": BaseAiTextGeneration;
5794 |   "@hf/thebloke/deepseek-coder-6.7b-base-awq": BaseAiTextGeneration;
5795 |   "@hf/thebloke/deepseek-coder-6.7b-instruct-awq": BaseAiTextGeneration;
5796 |   "@cf/deepseek-ai/deepseek-math-7b-instruct": BaseAiTextGeneration;
5797 |   "@cf/defog/sqlcoder-7b-2": BaseAiTextGeneration;
5798 |   "@cf/openchat/openchat-3.5-0106": BaseAiTextGeneration;
5799 |   "@cf/tiiuae/falcon-7b-instruct": BaseAiTextGeneration;
5800 |   "@cf/thebloke/discolm-german-7b-v1-awq": BaseAiTextGeneration;
5801 |   "@cf/qwen/qwen1.5-0.5b-chat": BaseAiTextGeneration;
5802 |   "@cf/qwen/qwen1.5-7b-chat-awq": BaseAiTextGeneration;
5803 |   "@cf/qwen/qwen1.5-14b-chat-awq": BaseAiTextGeneration;
5804 |   "@cf/tinyllama/tinyllama-1.1b-chat-v1.0": BaseAiTextGeneration;
5805 |   "@cf/microsoft/phi-2": BaseAiTextGeneration;
5806 |   "@cf/qwen/qwen1.5-1.8b-chat": BaseAiTextGeneration;
5807 |   "@cf/mistral/mistral-7b-instruct-v0.2-lora": BaseAiTextGeneration;
5808 |   "@hf/nousresearch/hermes-2-pro-mistral-7b": BaseAiTextGeneration;
5809 |   "@hf/nexusflow/starling-lm-7b-beta": BaseAiTextGeneration;
5810 |   "@hf/google/gemma-7b-it": BaseAiTextGeneration;
5811 |   "@cf/meta-llama/llama-2-7b-chat-hf-lora": BaseAiTextGeneration;
5812 |   "@cf/google/gemma-2b-it-lora": BaseAiTextGeneration;
5813 |   "@cf/google/gemma-7b-it-lora": BaseAiTextGeneration;
5814 |   "@hf/mistral/mistral-7b-instruct-v0.2": BaseAiTextGeneration;
5815 |   "@cf/meta/llama-3-8b-instruct": BaseAiTextGeneration;
5816 |   "@cf/fblgit/una-cybertron-7b-v2-bf16": BaseAiTextGeneration;
5817 |   "@cf/meta/llama-3-8b-instruct-awq": BaseAiTextGeneration;
5818 |   "@hf/meta-llama/meta-llama-3-8b-instruct": BaseAiTextGeneration;
5819 |   "@cf/meta/llama-3.1-8b-instruct": BaseAiTextGeneration;
5820 |   "@cf/meta/llama-3.1-8b-instruct-fp8": BaseAiTextGeneration;
5821 |   "@cf/meta/llama-3.1-8b-instruct-awq": BaseAiTextGeneration;
5822 |   "@cf/meta/llama-3.2-3b-instruct": BaseAiTextGeneration;
5823 |   "@cf/meta/llama-3.2-1b-instruct": BaseAiTextGeneration;
5824 |   "@cf/deepseek-ai/deepseek-r1-distill-qwen-32b": BaseAiTextGeneration;
5825 |   "@cf/facebook/bart-large-cnn": BaseAiSummarization;
5826 |   "@cf/llava-hf/llava-1.5-7b-hf": BaseAiImageToText;
5827 |   "@cf/baai/bge-base-en-v1.5": Base_Ai_Cf_Baai_Bge_Base_En_V1_5;
5828 |   "@cf/openai/whisper": Base_Ai_Cf_Openai_Whisper;
5829 |   "@cf/meta/m2m100-1.2b": Base_Ai_Cf_Meta_M2M100_1_2B;
5830 |   "@cf/baai/bge-small-en-v1.5": Base_Ai_Cf_Baai_Bge_Small_En_V1_5;
5831 |   "@cf/baai/bge-large-en-v1.5": Base_Ai_Cf_Baai_Bge_Large_En_V1_5;
5832 |   "@cf/unum/uform-gen2-qwen-500m": Base_Ai_Cf_Unum_Uform_Gen2_Qwen_500M;
5833 |   "@cf/openai/whisper-tiny-en": Base_Ai_Cf_Openai_Whisper_Tiny_En;
5834 |   "@cf/openai/whisper-large-v3-turbo": Base_Ai_Cf_Openai_Whisper_Large_V3_Turbo;
5835 |   "@cf/baai/bge-m3": Base_Ai_Cf_Baai_Bge_M3;
5836 |   "@cf/black-forest-labs/flux-1-schnell": Base_Ai_Cf_Black_Forest_Labs_Flux_1_Schnell;
5837 |   "@cf/meta/llama-3.2-11b-vision-instruct": Base_Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct;
5838 |   "@cf/meta/llama-3.3-70b-instruct-fp8-fast": Base_Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast;
5839 |   "@cf/meta/llama-guard-3-8b": Base_Ai_Cf_Meta_Llama_Guard_3_8B;
5840 |   "@cf/baai/bge-reranker-base": Base_Ai_Cf_Baai_Bge_Reranker_Base;
5841 |   "@cf/qwen/qwen2.5-coder-32b-instruct": Base_Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct;
5842 |   "@cf/qwen/qwq-32b": Base_Ai_Cf_Qwen_Qwq_32B;
5843 |   "@cf/mistralai/mistral-small-3.1-24b-instruct": Base_Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct;
5844 |   "@cf/google/gemma-3-12b-it": Base_Ai_Cf_Google_Gemma_3_12B_It;
5845 |   "@cf/meta/llama-4-scout-17b-16e-instruct": Base_Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct;
5846 | }
5847 | type AiOptions = {
5848 |   /**
5849 |    * Send requests as an asynchronous batch job, only works for supported models
5850 |    * https://developers.cloudflare.com/workers-ai/features/batch-api
5851 |    */
5852 |   queueRequest?: boolean;
5853 |   gateway?: GatewayOptions;
5854 |   returnRawResponse?: boolean;
5855 |   prefix?: string;
5856 |   extraHeaders?: object;
5857 | };
5858 | type ConversionResponse = {
5859 |   name: string;
5860 |   mimeType: string;
5861 |   format: "markdown";
5862 |   tokens: number;
5863 |   data: string;
5864 | };
5865 | type AiModelsSearchParams = {
5866 |   author?: string;
5867 |   hide_experimental?: boolean;
5868 |   page?: number;
5869 |   per_page?: number;
5870 |   search?: string;
5871 |   source?: number;
5872 |   task?: string;
5873 | };
5874 | type AiModelsSearchObject = {
5875 |   id: string;
5876 |   source: number;
5877 |   name: string;
5878 |   description: string;
5879 |   task: {
5880 |     id: string;
5881 |     name: string;
5882 |     description: string;
5883 |   };
5884 |   tags: string[];
5885 |   properties: {
5886 |     property_id: string;
5887 |     value: string;
5888 |   }[];
5889 | };
5890 | interface InferenceUpstreamError extends Error {}
5891 | interface AiInternalError extends Error {}
5892 | type AiModelListType = Record<string, any>;
5893 | declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
5894 |   aiGatewayLogId: string | null;
5895 |   gateway(gatewayId: string): AiGateway;
5896 |   autorag(autoragId: string): AutoRAG;
5897 |   run<
5898 |     Name extends keyof AiModelList,
5899 |     Options extends AiOptions,
5900 |     InputOptions extends AiModelList[Name]["inputs"],
5901 |   >(
5902 |     model: Name,
5903 |     inputs: InputOptions,
5904 |     options?: Options,
5905 |   ): Promise<
5906 |     Options extends {
5907 |       returnRawResponse: true;
5908 |     }
5909 |       ? Response
5910 |       : InputOptions extends {
5911 |             stream: true;
5912 |           }
5913 |         ? ReadableStream
5914 |         : AiModelList[Name]["postProcessedOutputs"]
5915 |   >;
5916 |   models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
5917 |   toMarkdown(
5918 |     files: {
5919 |       name: string;
5920 |       blob: Blob;
5921 |     }[],
5922 |     options?: {
5923 |       gateway?: GatewayOptions;
5924 |       extraHeaders?: object;
5925 |     },
5926 |   ): Promise<ConversionResponse[]>;
5927 |   toMarkdown(
5928 |     files: {
5929 |       name: string;
5930 |       blob: Blob;
5931 |     },
5932 |     options?: {
5933 |       gateway?: GatewayOptions;
5934 |       extraHeaders?: object;
5935 |     },
5936 |   ): Promise<ConversionResponse>;
5937 | }
5938 | type GatewayRetries = {
5939 |   maxAttempts?: 1 | 2 | 3 | 4 | 5;
5940 |   retryDelayMs?: number;
5941 |   backoff?: "constant" | "linear" | "exponential";
5942 | };
5943 | type GatewayOptions = {
5944 |   id: string;
5945 |   cacheKey?: string;
5946 |   cacheTtl?: number;
5947 |   skipCache?: boolean;
5948 |   metadata?: Record<string, number | string | boolean | null | bigint>;
5949 |   collectLog?: boolean;
5950 |   eventId?: string;
5951 |   requestTimeoutMs?: number;
5952 |   retries?: GatewayRetries;
5953 | };
5954 | type AiGatewayPatchLog = {
5955 |   score?: number | null;
5956 |   feedback?: -1 | 1 | null;
5957 |   metadata?: Record<string, number | string | boolean | null | bigint> | null;
5958 | };
5959 | type AiGatewayLog = {
5960 |   id: string;
5961 |   provider: string;
5962 |   model: string;
5963 |   model_type?: string;
5964 |   path: string;
5965 |   duration: number;
5966 |   request_type?: string;
5967 |   request_content_type?: string;
5968 |   status_code: number;
5969 |   response_content_type?: string;
5970 |   success: boolean;
5971 |   cached: boolean;
5972 |   tokens_in?: number;
5973 |   tokens_out?: number;
5974 |   metadata?: Record<string, number | string | boolean | null | bigint>;
5975 |   step?: number;
5976 |   cost?: number;
5977 |   custom_cost?: boolean;
5978 |   request_size: number;
5979 |   request_head?: string;
5980 |   request_head_complete: boolean;
5981 |   response_size: number;
5982 |   response_head?: string;
5983 |   response_head_complete: boolean;
5984 |   created_at: Date;
5985 | };
5986 | type AIGatewayProviders =
5987 |   | "workers-ai"
5988 |   | "anthropic"
5989 |   | "aws-bedrock"
5990 |   | "azure-openai"
5991 |   | "google-vertex-ai"
5992 |   | "huggingface"
5993 |   | "openai"
5994 |   | "perplexity-ai"
5995 |   | "replicate"
5996 |   | "groq"
5997 |   | "cohere"
5998 |   | "google-ai-studio"
5999 |   | "mistral"
6000 |   | "grok"
6001 |   | "openrouter"
6002 |   | "deepseek"
6003 |   | "cerebras"
6004 |   | "cartesia"
6005 |   | "elevenlabs"
6006 |   | "adobe-firefly";
6007 | type AIGatewayHeaders = {
6008 |   "cf-aig-metadata":
6009 |     | Record<string, number | string | boolean | null | bigint>
6010 |     | string;
6011 |   "cf-aig-custom-cost":
6012 |     | {
6013 |         per_token_in?: number;
6014 |         per_token_out?: number;
6015 |       }
6016 |     | {
6017 |         total_cost?: number;
6018 |       }
6019 |     | string;
6020 |   "cf-aig-cache-ttl": number | string;
6021 |   "cf-aig-skip-cache": boolean | string;
6022 |   "cf-aig-cache-key": string;
6023 |   "cf-aig-event-id": string;
6024 |   "cf-aig-request-timeout": number | string;
6025 |   "cf-aig-max-attempts": number | string;
6026 |   "cf-aig-retry-delay": number | string;
6027 |   "cf-aig-backoff": string;
6028 |   "cf-aig-collect-log": boolean | string;
6029 |   Authorization: string;
6030 |   "Content-Type": string;
6031 |   [key: string]: string | number | boolean | object;
6032 | };
6033 | type AIGatewayUniversalRequest = {
6034 |   provider: AIGatewayProviders | string; // eslint-disable-line
6035 |   endpoint: string;
6036 |   headers: Partial<AIGatewayHeaders>;
6037 |   query: unknown;
6038 | };
6039 | interface AiGatewayInternalError extends Error {}
6040 | interface AiGatewayLogNotFound extends Error {}
6041 | declare abstract class AiGateway {
6042 |   patchLog(logId: string, data: AiGatewayPatchLog): Promise<void>;
6043 |   getLog(logId: string): Promise<AiGatewayLog>;
6044 |   run(
6045 |     data: AIGatewayUniversalRequest | AIGatewayUniversalRequest[],
6046 |     options?: {
6047 |       gateway?: GatewayOptions;
6048 |       extraHeaders?: object;
6049 |     },
6050 |   ): Promise<Response>;
6051 |   getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
6052 | }
6053 | interface AutoRAGInternalError extends Error {}
6054 | interface AutoRAGNotFoundError extends Error {}
6055 | interface AutoRAGUnauthorizedError extends Error {}
6056 | interface AutoRAGNameNotSetError extends Error {}
6057 | type ComparisonFilter = {
6058 |   key: string;
6059 |   type: "eq" | "ne" | "gt" | "gte" | "lt" | "lte";
6060 |   value: string | number | boolean;
6061 | };
6062 | type CompoundFilter = {
6063 |   type: "and" | "or";
6064 |   filters: ComparisonFilter[];
6065 | };
6066 | type AutoRagSearchRequest = {
6067 |   query: string;
6068 |   filters?: CompoundFilter | ComparisonFilter;
6069 |   max_num_results?: number;
6070 |   ranking_options?: {
6071 |     ranker?: string;
6072 |     score_threshold?: number;
6073 |   };
6074 |   rewrite_query?: boolean;
6075 | };
6076 | type AutoRagAiSearchRequest = AutoRagSearchRequest & {
6077 |   stream?: boolean;
6078 | };
6079 | type AutoRagAiSearchRequestStreaming = Omit<
6080 |   AutoRagAiSearchRequest,
6081 |   "stream"
6082 | > & {
6083 |   stream: true;
6084 | };
6085 | type AutoRagSearchResponse = {
6086 |   object: "vector_store.search_results.page";
6087 |   search_query: string;
6088 |   data: {
6089 |     file_id: string;
6090 |     filename: string;
6091 |     score: number;
6092 |     attributes: Record<string, string | number | boolean | null>;
6093 |     content: {
6094 |       type: "text";
6095 |       text: string;
6096 |     }[];
6097 |   }[];
6098 |   has_more: boolean;
6099 |   next_page: string | null;
6100 | };
6101 | type AutoRagListResponse = {
6102 |   id: string;
6103 |   enable: boolean;
6104 |   type: string;
6105 |   source: string;
6106 |   vectorize_name: string;
6107 |   paused: boolean;
6108 |   status: string;
6109 | }[];
6110 | type AutoRagAiSearchResponse = AutoRagSearchResponse & {
6111 |   response: string;
6112 | };
6113 | declare abstract class AutoRAG {
6114 |   list(): Promise<AutoRagListResponse>;
6115 |   search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>;
6116 |   aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>;
6117 |   aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>;
6118 |   aiSearch(
6119 |     params: AutoRagAiSearchRequest,
6120 |   ): Promise<AutoRagAiSearchResponse | Response>;
6121 | }
6122 | interface BasicImageTransformations {
6123 |   /**
6124 |    * Maximum width in image pixels. The value must be an integer.
6125 |    */
6126 |   width?: number;
6127 |   /**
6128 |    * Maximum height in image pixels. The value must be an integer.
6129 |    */
6130 |   height?: number;
6131 |   /**
6132 |    * Resizing mode as a string. It affects interpretation of width and height
6133 |    * options:
6134 |    *  - scale-down: Similar to contain, but the image is never enlarged. If
6135 |    *    the image is larger than given width or height, it will be resized.
6136 |    *    Otherwise its original size will be kept.
6137 |    *  - contain: Resizes to maximum size that fits within the given width and
6138 |    *    height. If only a single dimension is given (e.g. only width), the
6139 |    *    image will be shrunk or enlarged to exactly match that dimension.
6140 |    *    Aspect ratio is always preserved.
6141 |    *  - cover: Resizes (shrinks or enlarges) to fill the entire area of width
6142 |    *    and height. If the image has an aspect ratio different from the ratio
6143 |    *    of width and height, it will be cropped to fit.
6144 |    *  - crop: The image will be shrunk and cropped to fit within the area
6145 |    *    specified by width and height. The image will not be enlarged. For images
6146 |    *    smaller than the given dimensions it's the same as scale-down. For
6147 |    *    images larger than the given dimensions, it's the same as cover.
6148 |    *    See also trim.
6149 |    *  - pad: Resizes to the maximum size that fits within the given width and
6150 |    *    height, and then fills the remaining area with a background color
6151 |    *    (white by default). Use of this mode is not recommended, as the same
6152 |    *    effect can be more efficiently achieved with the contain mode and the
6153 |    *    CSS object-fit: contain property.
6154 |    *  - squeeze: Stretches and deforms to the width and height given, even if it
6155 |    *    breaks aspect ratio
6156 |    */
6157 |   fit?: "scale-down" | "contain" | "cover" | "crop" | "pad" | "squeeze";
6158 |   /**
6159 |    * When cropping with fit: "cover", this defines the side or point that should
6160 |    * be left uncropped. The value is either a string
6161 |    * "left", "right", "top", "bottom", "auto", or "center" (the default),
6162 |    * or an object {x, y} containing focal point coordinates in the original
6163 |    * image expressed as fractions ranging from 0.0 (top or left) to 1.0
6164 |    * (bottom or right), 0.5 being the center. {fit: "cover", gravity: "top"} will
6165 |    * crop bottom or left and right sides as necessary, but won’t crop anything
6166 |    * from the top. {fit: "cover", gravity: {x:0.5, y:0.2}} will crop each side to
6167 |    * preserve as much as possible around a point at 20% of the height of the
6168 |    * source image.
6169 |    */
6170 |   gravity?:
6171 |     | "left"
6172 |     | "right"
6173 |     | "top"
6174 |     | "bottom"
6175 |     | "center"
6176 |     | "auto"
6177 |     | "entropy"
6178 |     | BasicImageTransformationsGravityCoordinates;
6179 |   /**
6180 |    * Background color to add underneath the image. Applies only to images with
6181 |    * transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…),
6182 |    * hsl(…), etc.)
6183 |    */
6184 |   background?: string;
6185 |   /**
6186 |    * Number of degrees (90, 180, 270) to rotate the image by. width and height
6187 |    * options refer to axes after rotation.
6188 |    */
6189 |   rotate?: 0 | 90 | 180 | 270 | 360;
6190 | }
6191 | interface BasicImageTransformationsGravityCoordinates {
6192 |   x?: number;
6193 |   y?: number;
6194 |   mode?: "remainder" | "box-center";
6195 | }
6196 | /**
6197 |  * In addition to the properties you can set in the RequestInit dict
6198 |  * that you pass as an argument to the Request constructor, you can
6199 |  * set certain properties of a `cf` object to control how Cloudflare
6200 |  * features are applied to that new Request.
6201 |  *
6202 |  * Note: Currently, these properties cannot be tested in the
6203 |  * playground.
6204 |  */
6205 | interface RequestInitCfProperties extends Record<string, unknown> {
6206 |   cacheEverything?: boolean;
6207 |   /**
6208 |    * A request's cache key is what determines if two requests are
6209 |    * "the same" for caching purposes. If a request has the same cache key
6210 |    * as some previous request, then we can serve the same cached response for
6211 |    * both. (e.g. 'some-key')
6212 |    *
6213 |    * Only available for Enterprise customers.
6214 |    */
6215 |   cacheKey?: string;
6216 |   /**
6217 |    * This allows you to append additional Cache-Tag response headers
6218 |    * to the origin response without modifications to the origin server.
6219 |    * This will allow for greater control over the Purge by Cache Tag feature
6220 |    * utilizing changes only in the Workers process.
6221 |    *
6222 |    * Only available for Enterprise customers.
6223 |    */
6224 |   cacheTags?: string[];
6225 |   /**
6226 |    * Force response to be cached for a given number of seconds. (e.g. 300)
6227 |    */
6228 |   cacheTtl?: number;
6229 |   /**
6230 |    * Force response to be cached for a given number of seconds based on the Origin status code.
6231 |    * (e.g. { '200-299': 86400, '404': 1, '500-599': 0 })
6232 |    */
6233 |   cacheTtlByStatus?: Record<string, number>;
6234 |   scrapeShield?: boolean;
6235 |   apps?: boolean;
6236 |   image?: RequestInitCfPropertiesImage;
6237 |   minify?: RequestInitCfPropertiesImageMinify;
6238 |   mirage?: boolean;
6239 |   polish?: "lossy" | "lossless" | "off";
6240 |   r2?: RequestInitCfPropertiesR2;
6241 |   /**
6242 |    * Redirects the request to an alternate origin server. You can use this,
6243 |    * for example, to implement load balancing across several origins.
6244 |    * (e.g.us-east.example.com)
6245 |    *
6246 |    * Note - For security reasons, the hostname set in resolveOverride must
6247 |    * be proxied on the same Cloudflare zone of the incoming request.
6248 |    * Otherwise, the setting is ignored. CNAME hosts are allowed, so to
6249 |    * resolve to a host under a different domain or a DNS only domain first
6250 |    * declare a CNAME record within your own zone’s DNS mapping to the
6251 |    * external hostname, set proxy on Cloudflare, then set resolveOverride
6252 |    * to point to that CNAME record.
6253 |    */
6254 |   resolveOverride?: string;
6255 | }
6256 | interface RequestInitCfPropertiesImageDraw extends BasicImageTransformations {
6257 |   /**
6258 |    * Absolute URL of the image file to use for the drawing. It can be any of
6259 |    * the supported file formats. For drawing of watermarks or non-rectangular
6260 |    * overlays we recommend using PNG or WebP images.
6261 |    */
6262 |   url: string;
6263 |   /**
6264 |    * Floating-point number between 0 (transparent) and 1 (opaque).
6265 |    * For example, opacity: 0.5 makes overlay semitransparent.
6266 |    */
6267 |   opacity?: number;
6268 |   /**
6269 |    * - If set to true, the overlay image will be tiled to cover the entire
6270 |    *   area. This is useful for stock-photo-like watermarks.
6271 |    * - If set to "x", the overlay image will be tiled horizontally only
6272 |    *   (form a line).
6273 |    * - If set to "y", the overlay image will be tiled vertically only
6274 |    *   (form a line).
6275 |    */
6276 |   repeat?: true | "x" | "y";
6277 |   /**
6278 |    * Position of the overlay image relative to a given edge. Each property is
6279 |    * an offset in pixels. 0 aligns exactly to the edge. For example, left: 10
6280 |    * positions left side of the overlay 10 pixels from the left edge of the
6281 |    * image it's drawn over. bottom: 0 aligns bottom of the overlay with bottom
6282 |    * of the background image.
6283 |    *
6284 |    * Setting both left & right, or both top & bottom is an error.
6285 |    *
6286 |    * If no position is specified, the image will be centered.
6287 |    */
6288 |   top?: number;
6289 |   left?: number;
6290 |   bottom?: number;
6291 |   right?: number;
6292 | }
6293 | interface RequestInitCfPropertiesImage extends BasicImageTransformations {
6294 |   /**
6295 |    * Device Pixel Ratio. Default 1. Multiplier for width/height that makes it
6296 |    * easier to specify higher-DPI sizes in <img srcset>.
6297 |    */
6298 |   dpr?: number;
6299 |   /**
6300 |    * Allows you to trim your image. Takes dpr into account and is performed before
6301 |    * resizing or rotation.
6302 |    *
6303 |    * It can be used as:
6304 |    * - left, top, right, bottom - it will specify the number of pixels to cut
6305 |    *   off each side
6306 |    * - width, height - the width/height you'd like to end up with - can be used
6307 |    *   in combination with the properties above
6308 |    * - border - this will automatically trim the surroundings of an image based on
6309 |    *   it's color. It consists of three properties:
6310 |    *    - color: rgb or hex representation of the color you wish to trim (todo: verify the rgba bit)
6311 |    *    - tolerance: difference from color to treat as color
6312 |    *    - keep: the number of pixels of border to keep
6313 |    */
6314 |   trim?:
6315 |     | "border"
6316 |     | {
6317 |         top?: number;
6318 |         bottom?: number;
6319 |         left?: number;
6320 |         right?: number;
6321 |         width?: number;
6322 |         height?: number;
6323 |         border?:
6324 |           | boolean
6325 |           | {
6326 |               color?: string;
6327 |               tolerance?: number;
6328 |               keep?: number;
6329 |             };
6330 |       };
6331 |   /**
6332 |    * Quality setting from 1-100 (useful values are in 60-90 range). Lower values
6333 |    * make images look worse, but load faster. The default is 85. It applies only
6334 |    * to JPEG and WebP images. It doesn’t have any effect on PNG.
6335 |    */
6336 |   quality?: number | "low" | "medium-low" | "medium-high" | "high";
6337 |   /**
6338 |    * Output format to generate. It can be:
6339 |    *  - avif: generate images in AVIF format.
6340 |    *  - webp: generate images in Google WebP format. Set quality to 100 to get
6341 |    *    the WebP-lossless format.
6342 |    *  - json: instead of generating an image, outputs information about the
6343 |    *    image, in JSON format. The JSON object will contain image size
6344 |    *    (before and after resizing), source image’s MIME type, file size, etc.
6345 |    * - jpeg: generate images in JPEG format.
6346 |    * - png: generate images in PNG format.
6347 |    */
6348 |   format?:
6349 |     | "avif"
6350 |     | "webp"
6351 |     | "json"
6352 |     | "jpeg"
6353 |     | "png"
6354 |     | "baseline-jpeg"
6355 |     | "png-force"
6356 |     | "svg";
6357 |   /**
6358 |    * Whether to preserve animation frames from input files. Default is true.
6359 |    * Setting it to false reduces animations to still images. This setting is
6360 |    * recommended when enlarging images or processing arbitrary user content,
6361 |    * because large GIF animations can weigh tens or even hundreds of megabytes.
6362 |    * It is also useful to set anim:false when using format:"json" to get the
6363 |    * response quicker without the number of frames.
6364 |    */
6365 |   anim?: boolean;
6366 |   /**
6367 |    * What EXIF data should be preserved in the output image. Note that EXIF
6368 |    * rotation and embedded color profiles are always applied ("baked in" into
6369 |    * the image), and aren't affected by this option. Note that if the Polish
6370 |    * feature is enabled, all metadata may have been removed already and this
6371 |    * option may have no effect.
6372 |    *  - keep: Preserve most of EXIF metadata, including GPS location if there's
6373 |    *    any.
6374 |    *  - copyright: Only keep the copyright tag, and discard everything else.
6375 |    *    This is the default behavior for JPEG files.
6376 |    *  - none: Discard all invisible EXIF metadata. Currently WebP and PNG
6377 |    *    output formats always discard metadata.
6378 |    */
6379 |   metadata?: "keep" | "copyright" | "none";
6380 |   /**
6381 |    * Strength of sharpening filter to apply to the image. Floating-point
6382 |    * number between 0 (no sharpening, default) and 10 (maximum). 1.0 is a
6383 |    * recommended value for downscaled images.
6384 |    */
6385 |   sharpen?: number;
6386 |   /**
6387 |    * Radius of a blur filter (approximate gaussian). Maximum supported radius
6388 |    * is 250.
6389 |    */
6390 |   blur?: number;
6391 |   /**
6392 |    * Overlays are drawn in the order they appear in the array (last array
6393 |    * entry is the topmost layer).
6394 |    */
6395 |   draw?: RequestInitCfPropertiesImageDraw[];
6396 |   /**
6397 |    * Fetching image from authenticated origin. Setting this property will
6398 |    * pass authentication headers (Authorization, Cookie, etc.) through to
6399 |    * the origin.
6400 |    */
6401 |   "origin-auth"?: "share-publicly";
6402 |   /**
6403 |    * Adds a border around the image. The border is added after resizing. Border
6404 |    * width takes dpr into account, and can be specified either using a single
6405 |    * width property, or individually for each side.
6406 |    */
6407 |   border?:
6408 |     | {
6409 |         color: string;
6410 |         width: number;
6411 |       }
6412 |     | {
6413 |         color: string;
6414 |         top: number;
6415 |         right: number;
6416 |         bottom: number;
6417 |         left: number;
6418 |       };
6419 |   /**
6420 |    * Increase brightness by a factor. A value of 1.0 equals no change, a value
6421 |    * of 0.5 equals half brightness, and a value of 2.0 equals twice as bright.
6422 |    * 0 is ignored.
6423 |    */
6424 |   brightness?: number;
6425 |   /**
6426 |    * Increase contrast by a factor. A value of 1.0 equals no change, a value of
6427 |    * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
6428 |    * ignored.
6429 |    */
6430 |   contrast?: number;
6431 |   /**
6432 |    * Increase exposure by a factor. A value of 1.0 equals no change, a value of
6433 |    * 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.
6434 |    */
6435 |   gamma?: number;
6436 |   /**
6437 |    * Increase contrast by a factor. A value of 1.0 equals no change, a value of
6438 |    * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
6439 |    * ignored.
6440 |    */
6441 |   saturation?: number;
6442 |   /**
6443 |    * Flips the images horizontally, vertically, or both. Flipping is applied before
6444 |    * rotation, so if you apply flip=h,rotate=90 then the image will be flipped
6445 |    * horizontally, then rotated by 90 degrees.
6446 |    */
6447 |   flip?: "h" | "v" | "hv";
6448 |   /**
6449 |    * Slightly reduces latency on a cache miss by selecting a
6450 |    * quickest-to-compress file format, at a cost of increased file size and
6451 |    * lower image quality. It will usually override the format option and choose
6452 |    * JPEG over WebP or AVIF. We do not recommend using this option, except in
6453 |    * unusual circumstances like resizing uncacheable dynamically-generated
6454 |    * images.
6455 |    */
6456 |   compression?: "fast";
6457 | }
6458 | interface RequestInitCfPropertiesImageMinify {
6459 |   javascript?: boolean;
6460 |   css?: boolean;
6461 |   html?: boolean;
6462 | }
6463 | interface RequestInitCfPropertiesR2 {
6464 |   /**
6465 |    * Colo id of bucket that an object is stored in
6466 |    */
6467 |   bucketColoId?: number;
6468 | }
6469 | /**
6470 |  * Request metadata provided by Cloudflare's edge.
6471 |  */
6472 | type IncomingRequestCfProperties<HostMetadata = unknown> =
6473 |   IncomingRequestCfPropertiesBase &
6474 |     IncomingRequestCfPropertiesBotManagementEnterprise &
6475 |     IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> &
6476 |     IncomingRequestCfPropertiesGeographicInformation &
6477 |     IncomingRequestCfPropertiesCloudflareAccessOrApiShield;
6478 | interface IncomingRequestCfPropertiesBase extends Record<string, unknown> {
6479 |   /**
6480 |    * [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request.
6481 |    *
6482 |    * @example 395747
6483 |    */
6484 |   asn: number;
6485 |   /**
6486 |    * The organization which owns the ASN of the incoming request.
6487 |    *
6488 |    * @example "Google Cloud"
6489 |    */
6490 |   asOrganization: string;
6491 |   /**
6492 |    * The original value of the `Accept-Encoding` header if Cloudflare modified it.
6493 |    *
6494 |    * @example "gzip, deflate, br"
6495 |    */
6496 |   clientAcceptEncoding?: string;
6497 |   /**
6498 |    * The number of milliseconds it took for the request to reach your worker.
6499 |    *
6500 |    * @example 22
6501 |    */
6502 |   clientTcpRtt?: number;
6503 |   /**
6504 |    * The three-letter [IATA](https://en.wikipedia.org/wiki/IATA_airport_code)
6505 |    * airport code of the data center that the request hit.
6506 |    *
6507 |    * @example "DFW"
6508 |    */
6509 |   colo: string;
6510 |   /**
6511 |    * Represents the upstream's response to a
6512 |    * [TCP `keepalive` message](https://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html)
6513 |    * from cloudflare.
6514 |    *
6515 |    * For workers with no upstream, this will always be `1`.
6516 |    *
6517 |    * @example 3
6518 |    */
6519 |   edgeRequestKeepAliveStatus: IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus;
6520 |   /**
6521 |    * The HTTP Protocol the request used.
6522 |    *
6523 |    * @example "HTTP/2"
6524 |    */
6525 |   httpProtocol: string;
6526 |   /**
6527 |    * The browser-requested prioritization information in the request object.
6528 |    *
6529 |    * If no information was set, defaults to the empty string `""`
6530 |    *
6531 |    * @example "weight=192;exclusive=0;group=3;group-weight=127"
6532 |    * @default ""
6533 |    */
6534 |   requestPriority: string;
6535 |   /**
6536 |    * The TLS version of the connection to Cloudflare.
6537 |    * In requests served over plaintext (without TLS), this property is the empty string `""`.
6538 |    *
6539 |    * @example "TLSv1.3"
6540 |    */
6541 |   tlsVersion: string;
6542 |   /**
6543 |    * The cipher for the connection to Cloudflare.
6544 |    * In requests served over plaintext (without TLS), this property is the empty string `""`.
6545 |    *
6546 |    * @example "AEAD-AES128-GCM-SHA256"
6547 |    */
6548 |   tlsCipher: string;
6549 |   /**
6550 |    * Metadata containing the [`HELLO`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2) and [`FINISHED`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9) messages from this request's TLS handshake.
6551 |    *
6552 |    * If the incoming request was served over plaintext (without TLS) this field is undefined.
6553 |    */
6554 |   tlsExportedAuthenticator?: IncomingRequestCfPropertiesExportedAuthenticatorMetadata;
6555 | }
6556 | interface IncomingRequestCfPropertiesBotManagementBase {
6557 |   /**
6558 |    * Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot,
6559 |    * represented as an integer percentage between `1` (almost certainly a bot) and `99` (almost certainly human).
6560 |    *
6561 |    * @example 54
6562 |    */
6563 |   score: number;
6564 |   /**
6565 |    * A boolean value that is true if the request comes from a good bot, like Google or Bing.
6566 |    * Most customers choose to allow this traffic. For more details, see [Traffic from known bots](https://developers.cloudflare.com/firewall/known-issues-and-faq/#how-does-firewall-rules-handle-traffic-from-known-bots).
6567 |    */
6568 |   verifiedBot: boolean;
6569 |   /**
6570 |    * A boolean value that is true if the request originates from a
6571 |    * Cloudflare-verified proxy service.
6572 |    */
6573 |   corporateProxy: boolean;
6574 |   /**
6575 |    * A boolean value that's true if the request matches [file extensions](https://developers.cloudflare.com/bots/reference/static-resources/) for many types of static resources.
6576 |    */
6577 |   staticResource: boolean;
6578 |   /**
6579 |    * List of IDs that correlate to the Bot Management heuristic detections made on a request (you can have multiple heuristic detections on the same request).
6580 |    */
6581 |   detectionIds: number[];
6582 | }
6583 | interface IncomingRequestCfPropertiesBotManagement {
6584 |   /**
6585 |    * Results of Cloudflare's Bot Management analysis
6586 |    */
6587 |   botManagement: IncomingRequestCfPropertiesBotManagementBase;
6588 |   /**
6589 |    * Duplicate of `botManagement.score`.
6590 |    *
6591 |    * @deprecated
6592 |    */
6593 |   clientTrustScore: number;
6594 | }
6595 | interface IncomingRequestCfPropertiesBotManagementEnterprise
6596 |   extends IncomingRequestCfPropertiesBotManagement {
6597 |   /**
6598 |    * Results of Cloudflare's Bot Management analysis
6599 |    */
6600 |   botManagement: IncomingRequestCfPropertiesBotManagementBase & {
6601 |     /**
6602 |      * A [JA3 Fingerprint](https://developers.cloudflare.com/bots/concepts/ja3-fingerprint/) to help profile specific SSL/TLS clients
6603 |      * across different destination IPs, Ports, and X509 certificates.
6604 |      */
6605 |     ja3Hash: string;
6606 |   };
6607 | }
6608 | interface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> {
6609 |   /**
6610 |    * Custom metadata set per-host in [Cloudflare for SaaS](https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/).
6611 |    *
6612 |    * This field is only present if you have Cloudflare for SaaS enabled on your account
6613 |    * and you have followed the [required steps to enable it]((https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/domain-support/custom-metadata/)).
6614 |    */
6615 |   hostMetadata: HostMetadata;
6616 | }
6617 | interface IncomingRequestCfPropertiesCloudflareAccessOrApiShield {
6618 |   /**
6619 |    * Information about the client certificate presented to Cloudflare.
6620 |    *
6621 |    * This is populated when the incoming request is served over TLS using
6622 |    * either Cloudflare Access or API Shield (mTLS)
6623 |    * and the presented SSL certificate has a valid
6624 |    * [Certificate Serial Number](https://ldapwiki.com/wiki/Certificate%20Serial%20Number)
6625 |    * (i.e., not `null` or `""`).
6626 |    *
6627 |    * Otherwise, a set of placeholder values are used.
6628 |    *
6629 |    * The property `certPresented` will be set to `"1"` when
6630 |    * the object is populated (i.e. the above conditions were met).
6631 |    */
6632 |   tlsClientAuth:
6633 |     | IncomingRequestCfPropertiesTLSClientAuth
6634 |     | IncomingRequestCfPropertiesTLSClientAuthPlaceholder;
6635 | }
6636 | /**
6637 |  * Metadata about the request's TLS handshake
6638 |  */
6639 | interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata {
6640 |   /**
6641 |    * The client's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal
6642 |    *
6643 |    * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d"
6644 |    */
6645 |   clientHandshake: string;
6646 |   /**
6647 |    * The server's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal
6648 |    *
6649 |    * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d"
6650 |    */
6651 |   serverHandshake: string;
6652 |   /**
6653 |    * The client's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal
6654 |    *
6655 |    * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b"
6656 |    */
6657 |   clientFinished: string;
6658 |   /**
6659 |    * The server's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal
6660 |    *
6661 |    * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b"
6662 |    */
6663 |   serverFinished: string;
6664 | }
6665 | /**
6666 |  * Geographic data about the request's origin.
6667 |  */
6668 | interface IncomingRequestCfPropertiesGeographicInformation {
6669 |   /**
6670 |    * The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from.
6671 |    *
6672 |    * If your worker is [configured to accept TOR connections](https://support.cloudflare.com/hc/en-us/articles/203306930-Understanding-Cloudflare-Tor-support-and-Onion-Routing), this may also be `"T1"`, indicating a request that originated over TOR.
6673 |    *
6674 |    * If Cloudflare is unable to determine where the request originated this property is omitted.
6675 |    *
6676 |    * The country code `"T1"` is used for requests originating on TOR.
6677 |    *
6678 |    * @example "GB"
6679 |    */
6680 |   country?: Iso3166Alpha2Code | "T1";
6681 |   /**
6682 |    * If present, this property indicates that the request originated in the EU
6683 |    *
6684 |    * @example "1"
6685 |    */
6686 |   isEUCountry?: "1";
6687 |   /**
6688 |    * A two-letter code indicating the continent the request originated from.
6689 |    *
6690 |    * @example "AN"
6691 |    */
6692 |   continent?: ContinentCode;
6693 |   /**
6694 |    * The city the request originated from
6695 |    *
6696 |    * @example "Austin"
6697 |    */
6698 |   city?: string;
6699 |   /**
6700 |    * Postal code of the incoming request
6701 |    *
6702 |    * @example "78701"
6703 |    */
6704 |   postalCode?: string;
6705 |   /**
6706 |    * Latitude of the incoming request
6707 |    *
6708 |    * @example "30.27130"
6709 |    */
6710 |   latitude?: string;
6711 |   /**
6712 |    * Longitude of the incoming request
6713 |    *
6714 |    * @example "-97.74260"
6715 |    */
6716 |   longitude?: string;
6717 |   /**
6718 |    * Timezone of the incoming request
6719 |    *
6720 |    * @example "America/Chicago"
6721 |    */
6722 |   timezone?: string;
6723 |   /**
6724 |    * If known, the ISO 3166-2 name for the first level region associated with
6725 |    * the IP address of the incoming request
6726 |    *
6727 |    * @example "Texas"
6728 |    */
6729 |   region?: string;
6730 |   /**
6731 |    * If known, the ISO 3166-2 code for the first-level region associated with
6732 |    * the IP address of the incoming request
6733 |    *
6734 |    * @example "TX"
6735 |    */
6736 |   regionCode?: string;
6737 |   /**
6738 |    * Metro code (DMA) of the incoming request
6739 |    *
6740 |    * @example "635"
6741 |    */
6742 |   metroCode?: string;
6743 | }
6744 | /** Data about the incoming request's TLS certificate */
6745 | interface IncomingRequestCfPropertiesTLSClientAuth {
6746 |   /** Always `"1"`, indicating that the certificate was presented */
6747 |   certPresented: "1";
6748 |   /**
6749 |    * Result of certificate verification.
6750 |    *
6751 |    * @example "FAILED:self signed certificate"
6752 |    */
6753 |   certVerified: Exclude<CertVerificationStatus, "NONE">;
6754 |   /** The presented certificate's revokation status.
6755 |    *
6756 |    * - A value of `"1"` indicates the certificate has been revoked
6757 |    * - A value of `"0"` indicates the certificate has not been revoked
6758 |    */
6759 |   certRevoked: "1" | "0";
6760 |   /**
6761 |    * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html)
6762 |    *
6763 |    * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare"
6764 |    */
6765 |   certIssuerDN: string;
6766 |   /**
6767 |    * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html)
6768 |    *
6769 |    * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare"
6770 |    */
6771 |   certSubjectDN: string;
6772 |   /**
6773 |    * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted)
6774 |    *
6775 |    * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare"
6776 |    */
6777 |   certIssuerDNRFC2253: string;
6778 |   /**
6779 |    * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted)
6780 |    *
6781 |    * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare"
6782 |    */
6783 |   certSubjectDNRFC2253: string;
6784 |   /** The certificate issuer's distinguished name (legacy policies) */
6785 |   certIssuerDNLegacy: string;
6786 |   /** The certificate subject's distinguished name (legacy policies) */
6787 |   certSubjectDNLegacy: string;
6788 |   /**
6789 |    * The certificate's serial number
6790 |    *
6791 |    * @example "00936EACBE07F201DF"
6792 |    */
6793 |   certSerial: string;
6794 |   /**
6795 |    * The certificate issuer's serial number
6796 |    *
6797 |    * @example "2489002934BDFEA34"
6798 |    */
6799 |   certIssuerSerial: string;
6800 |   /**
6801 |    * The certificate's Subject Key Identifier
6802 |    *
6803 |    * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4"
6804 |    */
6805 |   certSKI: string;
6806 |   /**
6807 |    * The certificate issuer's Subject Key Identifier
6808 |    *
6809 |    * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4"
6810 |    */
6811 |   certIssuerSKI: string;
6812 |   /**
6813 |    * The certificate's SHA-1 fingerprint
6814 |    *
6815 |    * @example "6b9109f323999e52259cda7373ff0b4d26bd232e"
6816 |    */
6817 |   certFingerprintSHA1: string;
6818 |   /**
6819 |    * The certificate's SHA-256 fingerprint
6820 |    *
6821 |    * @example "acf77cf37b4156a2708e34c4eb755f9b5dbbe5ebb55adfec8f11493438d19e6ad3f157f81fa3b98278453d5652b0c1fd1d71e5695ae4d709803a4d3f39de9dea"
6822 |    */
6823 |   certFingerprintSHA256: string;
6824 |   /**
6825 |    * The effective starting date of the certificate
6826 |    *
6827 |    * @example "Dec 22 19:39:00 2018 GMT"
6828 |    */
6829 |   certNotBefore: string;
6830 |   /**
6831 |    * The effective expiration date of the certificate
6832 |    *
6833 |    * @example "Dec 22 19:39:00 2018 GMT"
6834 |    */
6835 |   certNotAfter: string;
6836 | }
6837 | /** Placeholder values for TLS Client Authorization */
6838 | interface IncomingRequestCfPropertiesTLSClientAuthPlaceholder {
6839 |   certPresented: "0";
6840 |   certVerified: "NONE";
6841 |   certRevoked: "0";
6842 |   certIssuerDN: "";
6843 |   certSubjectDN: "";
6844 |   certIssuerDNRFC2253: "";
6845 |   certSubjectDNRFC2253: "";
6846 |   certIssuerDNLegacy: "";
6847 |   certSubjectDNLegacy: "";
6848 |   certSerial: "";
6849 |   certIssuerSerial: "";
6850 |   certSKI: "";
6851 |   certIssuerSKI: "";
6852 |   certFingerprintSHA1: "";
6853 |   certFingerprintSHA256: "";
6854 |   certNotBefore: "";
6855 |   certNotAfter: "";
6856 | }
6857 | /** Possible outcomes of TLS verification */
6858 | declare type CertVerificationStatus =
6859 |   /** Authentication succeeded */
6860 |   | "SUCCESS"
6861 |   /** No certificate was presented */
6862 |   | "NONE"
6863 |   /** Failed because the certificate was self-signed */
6864 |   | "FAILED:self signed certificate"
6865 |   /** Failed because the certificate failed a trust chain check */
6866 |   | "FAILED:unable to verify the first certificate"
6867 |   /** Failed because the certificate not yet valid */
6868 |   | "FAILED:certificate is not yet valid"
6869 |   /** Failed because the certificate is expired */
6870 |   | "FAILED:certificate has expired"
6871 |   /** Failed for another unspecified reason */
6872 |   | "FAILED";
6873 | /**
6874 |  * An upstream endpoint's response to a TCP `keepalive` message from Cloudflare.
6875 |  */
6876 | declare type IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus =
6877 |   | 0 /** Unknown */
6878 |   | 1 /** no keepalives (not found) */
6879 |   | 2 /** no connection re-use, opening keepalive connection failed */
6880 |   | 3 /** no connection re-use, keepalive accepted and saved */
6881 |   | 4 /** connection re-use, refused by the origin server (`TCP FIN`) */
6882 |   | 5; /** connection re-use, accepted by the origin server */
6883 | /** ISO 3166-1 Alpha-2 codes */
6884 | declare type Iso3166Alpha2Code =
6885 |   | "AD"
6886 |   | "AE"
6887 |   | "AF"
6888 |   | "AG"
6889 |   | "AI"
6890 |   | "AL"
6891 |   | "AM"
6892 |   | "AO"
6893 |   | "AQ"
6894 |   | "AR"
6895 |   | "AS"
6896 |   | "AT"
6897 |   | "AU"
6898 |   | "AW"
6899 |   | "AX"
6900 |   | "AZ"
6901 |   | "BA"
6902 |   | "BB"
6903 |   | "BD"
6904 |   | "BE"
6905 |   | "BF"
6906 |   | "BG"
6907 |   | "BH"
6908 |   | "BI"
6909 |   | "BJ"
6910 |   | "BL"
6911 |   | "BM"
6912 |   | "BN"
6913 |   | "BO"
6914 |   | "BQ"
6915 |   | "BR"
6916 |   | "BS"
6917 |   | "BT"
6918 |   | "BV"
6919 |   | "BW"
6920 |   | "BY"
6921 |   | "BZ"
6922 |   | "CA"
6923 |   | "CC"
6924 |   | "CD"
6925 |   | "CF"
6926 |   | "CG"
6927 |   | "CH"
6928 |   | "CI"
6929 |   | "CK"
6930 |   | "CL"
6931 |   | "CM"
6932 |   | "CN"
6933 |   | "CO"
6934 |   | "CR"
6935 |   | "CU"
6936 |   | "CV"
6937 |   | "CW"
6938 |   | "CX"
6939 |   | "CY"
6940 |   | "CZ"
6941 |   | "DE"
6942 |   | "DJ"
6943 |   | "DK"
6944 |   | "DM"
6945 |   | "DO"
6946 |   | "DZ"
6947 |   | "EC"
6948 |   | "EE"
6949 |   | "EG"
6950 |   | "EH"
6951 |   | "ER"
6952 |   | "ES"
6953 |   | "ET"
6954 |   | "FI"
6955 |   | "FJ"
6956 |   | "FK"
6957 |   | "FM"
6958 |   | "FO"
6959 |   | "FR"
6960 |   | "GA"
6961 |   | "GB"
6962 |   | "GD"
6963 |   | "GE"
6964 |   | "GF"
6965 |   | "GG"
6966 |   | "GH"
6967 |   | "GI"
6968 |   | "GL"
6969 |   | "GM"
6970 |   | "GN"
6971 |   | "GP"
6972 |   | "GQ"
6973 |   | "GR"
6974 |   | "GS"
6975 |   | "GT"
6976 |   | "GU"
6977 |   | "GW"
6978 |   | "GY"
6979 |   | "HK"
6980 |   | "HM"
6981 |   | "HN"
6982 |   | "HR"
6983 |   | "HT"
6984 |   | "HU"
6985 |   | "ID"
6986 |   | "IE"
6987 |   | "IL"
6988 |   | "IM"
6989 |   | "IN"
6990 |   | "IO"
6991 |   | "IQ"
6992 |   | "IR"
6993 |   | "IS"
6994 |   | "IT"
6995 |   | "JE"
6996 |   | "JM"
6997 |   | "JO"
6998 |   | "JP"
6999 |   | "KE"
7000 |   | "KG"
7001 |   | "KH"
7002 |   | "KI"
7003 |   | "KM"
7004 |   | "KN"
7005 |   | "KP"
7006 |   | "KR"
7007 |   | "KW"
7008 |   | "KY"
7009 |   | "KZ"
7010 |   | "LA"
7011 |   | "LB"
7012 |   | "LC"
7013 |   | "LI"
7014 |   | "LK"
7015 |   | "LR"
7016 |   | "LS"
7017 |   | "LT"
7018 |   | "LU"
7019 |   | "LV"
7020 |   | "LY"
7021 |   | "MA"
7022 |   | "MC"
7023 |   | "MD"
7024 |   | "ME"
7025 |   | "MF"
7026 |   | "MG"
7027 |   | "MH"
7028 |   | "MK"
7029 |   | "ML"
7030 |   | "MM"
7031 |   | "MN"
7032 |   | "MO"
7033 |   | "MP"
7034 |   | "MQ"
7035 |   | "MR"
7036 |   | "MS"
7037 |   | "MT"
7038 |   | "MU"
7039 |   | "MV"
7040 |   | "MW"
7041 |   | "MX"
7042 |   | "MY"
7043 |   | "MZ"
7044 |   | "NA"
7045 |   | "NC"
7046 |   | "NE"
7047 |   | "NF"
7048 |   | "NG"
7049 |   | "NI"
7050 |   | "NL"
7051 |   | "NO"
7052 |   | "NP"
7053 |   | "NR"
7054 |   | "NU"
7055 |   | "NZ"
7056 |   | "OM"
7057 |   | "PA"
7058 |   | "PE"
7059 |   | "PF"
7060 |   | "PG"
7061 |   | "PH"
7062 |   | "PK"
7063 |   | "PL"
7064 |   | "PM"
7065 |   | "PN"
7066 |   | "PR"
7067 |   | "PS"
7068 |   | "PT"
7069 |   | "PW"
7070 |   | "PY"
7071 |   | "QA"
7072 |   | "RE"
7073 |   | "RO"
7074 |   | "RS"
7075 |   | "RU"
7076 |   | "RW"
7077 |   | "SA"
7078 |   | "SB"
7079 |   | "SC"
7080 |   | "SD"
7081 |   | "SE"
7082 |   | "SG"
7083 |   | "SH"
7084 |   | "SI"
7085 |   | "SJ"
7086 |   | "SK"
7087 |   | "SL"
7088 |   | "SM"
7089 |   | "SN"
7090 |   | "SO"
7091 |   | "SR"
7092 |   | "SS"
7093 |   | "ST"
7094 |   | "SV"
7095 |   | "SX"
7096 |   | "SY"
7097 |   | "SZ"
7098 |   | "TC"
7099 |   | "TD"
7100 |   | "TF"
7101 |   | "TG"
7102 |   | "TH"
7103 |   | "TJ"
7104 |   | "TK"
7105 |   | "TL"
7106 |   | "TM"
7107 |   | "TN"
7108 |   | "TO"
7109 |   | "TR"
7110 |   | "TT"
7111 |   | "TV"
7112 |   | "TW"
7113 |   | "TZ"
7114 |   | "UA"
7115 |   | "UG"
7116 |   | "UM"
7117 |   | "US"
7118 |   | "UY"
7119 |   | "UZ"
7120 |   | "VA"
7121 |   | "VC"
7122 |   | "VE"
7123 |   | "VG"
7124 |   | "VI"
7125 |   | "VN"
7126 |   | "VU"
7127 |   | "WF"
7128 |   | "WS"
7129 |   | "YE"
7130 |   | "YT"
7131 |   | "ZA"
7132 |   | "ZM"
7133 |   | "ZW";
7134 | /** The 2-letter continent codes Cloudflare uses */
7135 | declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
7136 | type CfProperties<HostMetadata = unknown> =
7137 |   | IncomingRequestCfProperties<HostMetadata>
7138 |   | RequestInitCfProperties;
7139 | interface D1Meta {
7140 |   duration: number;
7141 |   size_after: number;
7142 |   rows_read: number;
7143 |   rows_written: number;
7144 |   last_row_id: number;
7145 |   changed_db: boolean;
7146 |   changes: number;
7147 |   /**
7148 |    * The region of the database instance that executed the query.
7149 |    */
7150 |   served_by_region?: string;
7151 |   /**
7152 |    * True if-and-only-if the database instance that executed the query was the primary.
7153 |    */
7154 |   served_by_primary?: boolean;
7155 |   timings?: {
7156 |     /**
7157 |      * The duration of the SQL query execution by the database instance. It doesn't include any network time.
7158 |      */
7159 |     sql_duration_ms: number;
7160 |   };
7161 | }
7162 | interface D1Response {
7163 |   success: true;
7164 |   meta: D1Meta & Record<string, unknown>;
7165 |   error?: never;
7166 | }
7167 | type D1Result<T = unknown> = D1Response & {
7168 |   results: T[];
7169 | };
7170 | interface D1ExecResult {
7171 |   count: number;
7172 |   duration: number;
7173 | }
7174 | type D1SessionConstraint =
7175 |   // Indicates that the first query should go to the primary, and the rest queries
7176 |   // using the same D1DatabaseSession will go to any replica that is consistent with
7177 |   // the bookmark maintained by the session (returned by the first query).
7178 |   | "first-primary"
7179 |   // Indicates that the first query can go anywhere (primary or replica), and the rest queries
7180 |   // using the same D1DatabaseSession will go to any replica that is consistent with
7181 |   // the bookmark maintained by the session (returned by the first query).
7182 |   | "first-unconstrained";
7183 | type D1SessionBookmark = string;
7184 | declare abstract class D1Database {
7185 |   prepare(query: string): D1PreparedStatement;
7186 |   batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;
7187 |   exec(query: string): Promise<D1ExecResult>;
7188 |   /**
7189 |    * Creates a new D1 Session anchored at the given constraint or the bookmark.
7190 |    * All queries executed using the created session will have sequential consistency,
7191 |    * meaning that all writes done through the session will be visible in subsequent reads.
7192 |    *
7193 |    * @param constraintOrBookmark Either the session constraint or the explicit bookmark to anchor the created session.
7194 |    */
7195 |   withSession(
7196 |     constraintOrBookmark?: D1SessionBookmark | D1SessionConstraint,
7197 |   ): D1DatabaseSession;
7198 |   /**
7199 |    * @deprecated dump() will be removed soon, only applies to deprecated alpha v1 databases.
7200 |    */
7201 |   dump(): Promise<ArrayBuffer>;
7202 | }
7203 | declare abstract class D1DatabaseSession {
7204 |   prepare(query: string): D1PreparedStatement;
7205 |   batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;
7206 |   /**
7207 |    * @returns The latest session bookmark across all executed queries on the session.
7208 |    *          If no query has been executed yet, `null` is returned.
7209 |    */
7210 |   getBookmark(): D1SessionBookmark | null;
7211 | }
7212 | declare abstract class D1PreparedStatement {
7213 |   bind(...values: unknown[]): D1PreparedStatement;
7214 |   first<T = unknown>(colName: string): Promise<T | null>;
7215 |   first<T = Record<string, unknown>>(): Promise<T | null>;
7216 |   run<T = Record<string, unknown>>(): Promise<D1Result<T>>;
7217 |   all<T = Record<string, unknown>>(): Promise<D1Result<T>>;
7218 |   raw<T = unknown[]>(options: {
7219 |     columnNames: true;
7220 |   }): Promise<[string[], ...T[]]>;
7221 |   raw<T = unknown[]>(options?: { columnNames?: false }): Promise<T[]>;
7222 | }
7223 | // `Disposable` was added to TypeScript's standard lib types in version 5.2.
7224 | // To support older TypeScript versions, define an empty `Disposable` interface.
7225 | // Users won't be able to use `using`/`Symbol.dispose` without upgrading to 5.2,
7226 | // but this will ensure type checking on older versions still passes.
7227 | // TypeScript's interface merging will ensure our empty interface is effectively
7228 | // ignored when `Disposable` is included in the standard lib.
7229 | interface Disposable {}
7230 | /**
7231 |  * An email message that can be sent from a Worker.
7232 |  */
7233 | interface EmailMessage {
7234 |   /**
7235 |    * Envelope From attribute of the email message.
7236 |    */
7237 |   readonly from: string;
7238 |   /**
7239 |    * Envelope To attribute of the email message.
7240 |    */
7241 |   readonly to: string;
7242 | }
7243 | /**
7244 |  * An email message that is sent to a consumer Worker and can be rejected/forwarded.
7245 |  */
7246 | interface ForwardableEmailMessage extends EmailMessage {
7247 |   /**
7248 |    * Stream of the email message content.
7249 |    */
7250 |   readonly raw: ReadableStream<Uint8Array>;
7251 |   /**
7252 |    * An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
7253 |    */
7254 |   readonly headers: Headers;
7255 |   /**
7256 |    * Size of the email message content.
7257 |    */
7258 |   readonly rawSize: number;
7259 |   /**
7260 |    * Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason.
7261 |    * @param reason The reject reason.
7262 |    * @returns void
7263 |    */
7264 |   setReject(reason: string): void;
7265 |   /**
7266 |    * Forward this email message to a verified destination address of the account.
7267 |    * @param rcptTo Verified destination address.
7268 |    * @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
7269 |    * @returns A promise that resolves when the email message is forwarded.
7270 |    */
7271 |   forward(rcptTo: string, headers?: Headers): Promise<void>;
7272 |   /**
7273 |    * Reply to the sender of this email message with a new EmailMessage object.
7274 |    * @param message The reply message.
7275 |    * @returns A promise that resolves when the email message is replied.
7276 |    */
7277 |   reply(message: EmailMessage): Promise<void>;
7278 | }
7279 | /**
7280 |  * A binding that allows a Worker to send email messages.
7281 |  */
7282 | interface SendEmail {
7283 |   send(message: EmailMessage): Promise<void>;
7284 | }
7285 | declare abstract class EmailEvent extends ExtendableEvent {
7286 |   readonly message: ForwardableEmailMessage;
7287 | }
7288 | declare type EmailExportedHandler<Env = unknown> = (
7289 |   message: ForwardableEmailMessage,
7290 |   env: Env,
7291 |   ctx: ExecutionContext,
7292 | ) => void | Promise<void>;
7293 | declare module "cloudflare:email" {
7294 |   let _EmailMessage: {
7295 |     prototype: EmailMessage;
7296 |     new (from: string, to: string, raw: ReadableStream | string): EmailMessage;
7297 |   };
7298 |   export { _EmailMessage as EmailMessage };
7299 | }
7300 | interface Hyperdrive {
7301 |   /**
7302 |    * Connect directly to Hyperdrive as if it's your database, returning a TCP socket.
7303 |    *
7304 |    * Calling this method returns an idential socket to if you call
7305 |    * `connect("host:port")` using the `host` and `port` fields from this object.
7306 |    * Pick whichever approach works better with your preferred DB client library.
7307 |    *
7308 |    * Note that this socket is not yet authenticated -- it's expected that your
7309 |    * code (or preferably, the client library of your choice) will authenticate
7310 |    * using the information in this class's readonly fields.
7311 |    */
7312 |   connect(): Socket;
7313 |   /**
7314 |    * A valid DB connection string that can be passed straight into the typical
7315 |    * client library/driver/ORM. This will typically be the easiest way to use
7316 |    * Hyperdrive.
7317 |    */
7318 |   readonly connectionString: string;
7319 |   /*
7320 |    * A randomly generated hostname that is only valid within the context of the
7321 |    * currently running Worker which, when passed into `connect()` function from
7322 |    * the "cloudflare:sockets" module, will connect to the Hyperdrive instance
7323 |    * for your database.
7324 |    */
7325 |   readonly host: string;
7326 |   /*
7327 |    * The port that must be paired the the host field when connecting.
7328 |    */
7329 |   readonly port: number;
7330 |   /*
7331 |    * The username to use when authenticating to your database via Hyperdrive.
7332 |    * Unlike the host and password, this will be the same every time
7333 |    */
7334 |   readonly user: string;
7335 |   /*
7336 |    * The randomly generated password to use when authenticating to your
7337 |    * database via Hyperdrive. Like the host field, this password is only valid
7338 |    * within the context of the currently running Worker instance from which
7339 |    * it's read.
7340 |    */
7341 |   readonly password: string;
7342 |   /*
7343 |    * The name of the database to connect to.
7344 |    */
7345 |   readonly database: string;
7346 | }
7347 | // Copyright (c) 2024 Cloudflare, Inc.
7348 | // Licensed under the Apache 2.0 license found in the LICENSE file or at:
7349 | //     https://opensource.org/licenses/Apache-2.0
7350 | type ImageInfoResponse =
7351 |   | {
7352 |       format: "image/svg+xml";
7353 |     }
7354 |   | {
7355 |       format: string;
7356 |       fileSize: number;
7357 |       width: number;
7358 |       height: number;
7359 |     };
7360 | type ImageTransform = {
7361 |   width?: number;
7362 |   height?: number;
7363 |   background?: string;
7364 |   blur?: number;
7365 |   border?:
7366 |     | {
7367 |         color?: string;
7368 |         width?: number;
7369 |       }
7370 |     | {
7371 |         top?: number;
7372 |         bottom?: number;
7373 |         left?: number;
7374 |         right?: number;
7375 |       };
7376 |   brightness?: number;
7377 |   contrast?: number;
7378 |   fit?: "scale-down" | "contain" | "pad" | "squeeze" | "cover" | "crop";
7379 |   flip?: "h" | "v" | "hv";
7380 |   gamma?: number;
7381 |   gravity?:
7382 |     | "left"
7383 |     | "right"
7384 |     | "top"
7385 |     | "bottom"
7386 |     | "center"
7387 |     | "auto"
7388 |     | "entropy"
7389 |     | {
7390 |         x?: number;
7391 |         y?: number;
7392 |         mode: "remainder" | "box-center";
7393 |       };
7394 |   rotate?: 0 | 90 | 180 | 270;
7395 |   saturation?: number;
7396 |   sharpen?: number;
7397 |   trim?:
7398 |     | "border"
7399 |     | {
7400 |         top?: number;
7401 |         bottom?: number;
7402 |         left?: number;
7403 |         right?: number;
7404 |         width?: number;
7405 |         height?: number;
7406 |         border?:
7407 |           | boolean
7408 |           | {
7409 |               color?: string;
7410 |               tolerance?: number;
7411 |               keep?: number;
7412 |             };
7413 |       };
7414 | };
7415 | type ImageDrawOptions = {
7416 |   opacity?: number;
7417 |   repeat?: boolean | string;
7418 |   top?: number;
7419 |   left?: number;
7420 |   bottom?: number;
7421 |   right?: number;
7422 | };
7423 | type ImageOutputOptions = {
7424 |   format:
7425 |     | "image/jpeg"
7426 |     | "image/png"
7427 |     | "image/gif"
7428 |     | "image/webp"
7429 |     | "image/avif"
7430 |     | "rgb"
7431 |     | "rgba";
7432 |   quality?: number;
7433 |   background?: string;
7434 | };
7435 | interface ImagesBinding {
7436 |   /**
7437 |    * Get image metadata (type, width and height)
7438 |    * @throws {@link ImagesError} with code 9412 if input is not an image
7439 |    * @param stream The image bytes
7440 |    */
7441 |   info(stream: ReadableStream<Uint8Array>): Promise<ImageInfoResponse>;
7442 |   /**
7443 |    * Begin applying a series of transformations to an image
7444 |    * @param stream The image bytes
7445 |    * @returns A transform handle
7446 |    */
7447 |   input(stream: ReadableStream<Uint8Array>): ImageTransformer;
7448 | }
7449 | interface ImageTransformer {
7450 |   /**
7451 |    * Apply transform next, returning a transform handle.
7452 |    * You can then apply more transformations, draw, or retrieve the output.
7453 |    * @param transform
7454 |    */
7455 |   transform(transform: ImageTransform): ImageTransformer;
7456 |   /**
7457 |    * Draw an image on this transformer, returning a transform handle.
7458 |    * You can then apply more transformations, draw, or retrieve the output.
7459 |    * @param image The image (or transformer that will give the image) to draw
7460 |    * @param options The options configuring how to draw the image
7461 |    */
7462 |   draw(
7463 |     image: ReadableStream<Uint8Array> | ImageTransformer,
7464 |     options?: ImageDrawOptions,
7465 |   ): ImageTransformer;
7466 |   /**
7467 |    * Retrieve the image that results from applying the transforms to the
7468 |    * provided input
7469 |    * @param options Options that apply to the output e.g. output format
7470 |    */
7471 |   output(options: ImageOutputOptions): Promise<ImageTransformationResult>;
7472 | }
7473 | interface ImageTransformationResult {
7474 |   /**
7475 |    * The image as a response, ready to store in cache or return to users
7476 |    */
7477 |   response(): Response;
7478 |   /**
7479 |    * The content type of the returned image
7480 |    */
7481 |   contentType(): string;
7482 |   /**
7483 |    * The bytes of the response
7484 |    */
7485 |   image(): ReadableStream<Uint8Array>;
7486 | }
7487 | interface ImagesError extends Error {
7488 |   readonly code: number;
7489 |   readonly message: string;
7490 |   readonly stack?: string;
7491 | }
7492 | type Params<P extends string = any> = Record<P, string | string[]>;
7493 | type EventContext<Env, P extends string, Data> = {
7494 |   request: Request<unknown, IncomingRequestCfProperties<unknown>>;
7495 |   functionPath: string;
7496 |   waitUntil: (promise: Promise<any>) => void;
7497 |   passThroughOnException: () => void;
7498 |   next: (input?: Request | string, init?: RequestInit) => Promise<Response>;
7499 |   env: Env & {
7500 |     ASSETS: {
7501 |       fetch: typeof fetch;
7502 |     };
7503 |   };
7504 |   params: Params<P>;
7505 |   data: Data;
7506 | };
7507 | type PagesFunction<
7508 |   Env = unknown,
7509 |   Params extends string = any,
7510 |   Data extends Record<string, unknown> = Record<string, unknown>,
7511 | > = (context: EventContext<Env, Params, Data>) => Response | Promise<Response>;
7512 | type EventPluginContext<Env, P extends string, Data, PluginArgs> = {
7513 |   request: Request<unknown, IncomingRequestCfProperties<unknown>>;
7514 |   functionPath: string;
7515 |   waitUntil: (promise: Promise<any>) => void;
7516 |   passThroughOnException: () => void;
7517 |   next: (input?: Request | string, init?: RequestInit) => Promise<Response>;
7518 |   env: Env & {
7519 |     ASSETS: {
7520 |       fetch: typeof fetch;
7521 |     };
7522 |   };
7523 |   params: Params<P>;
7524 |   data: Data;
7525 |   pluginArgs: PluginArgs;
7526 | };
7527 | type PagesPluginFunction<
7528 |   Env = unknown,
7529 |   Params extends string = any,
7530 |   Data extends Record<string, unknown> = Record<string, unknown>,
7531 |   PluginArgs = unknown,
7532 | > = (
7533 |   context: EventPluginContext<Env, Params, Data, PluginArgs>,
7534 | ) => Response | Promise<Response>;
7535 | declare module "assets:*" {
7536 |   export const onRequest: PagesFunction;
7537 | }
7538 | // Copyright (c) 2022-2023 Cloudflare, Inc.
7539 | // Licensed under the Apache 2.0 license found in the LICENSE file or at:
7540 | //     https://opensource.org/licenses/Apache-2.0
7541 | declare module "cloudflare:pipelines" {
7542 |   export abstract class PipelineTransformationEntrypoint<
7543 |     Env = unknown,
7544 |     I extends PipelineRecord = PipelineRecord,
7545 |     O extends PipelineRecord = PipelineRecord,
7546 |   > {
7547 |     protected env: Env;
7548 |     protected ctx: ExecutionContext;
7549 |     constructor(ctx: ExecutionContext, env: Env);
7550 |     /**
7551 |      * run recieves an array of PipelineRecord which can be
7552 |      * transformed and returned to the pipeline
7553 |      * @param records Incoming records from the pipeline to be transformed
7554 |      * @param metadata Information about the specific pipeline calling the transformation entrypoint
7555 |      * @returns A promise containing the transformed PipelineRecord array
7556 |      */
7557 |     public run(records: I[], metadata: PipelineBatchMetadata): Promise<O[]>;
7558 |   }
7559 |   export type PipelineRecord = Record<string, unknown>;
7560 |   export type PipelineBatchMetadata = {
7561 |     pipelineId: string;
7562 |     pipelineName: string;
7563 |   };
7564 |   export interface Pipeline<T extends PipelineRecord = PipelineRecord> {
7565 |     /**
7566 |      * The Pipeline interface represents the type of a binding to a Pipeline
7567 |      *
7568 |      * @param records The records to send to the pipeline
7569 |      */
7570 |     send(records: T[]): Promise<void>;
7571 |   }
7572 | }
7573 | // PubSubMessage represents an incoming PubSub message.
7574 | // The message includes metadata about the broker, the client, and the payload
7575 | // itself.
7576 | // https://developers.cloudflare.com/pub-sub/
7577 | interface PubSubMessage {
7578 |   // Message ID
7579 |   readonly mid: number;
7580 |   // MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT
7581 |   readonly broker: string;
7582 |   // The MQTT topic the message was sent on.
7583 |   readonly topic: string;
7584 |   // The client ID of the client that published this message.
7585 |   readonly clientId: string;
7586 |   // The unique identifier (JWT ID) used by the client to authenticate, if token
7587 |   // auth was used.
7588 |   readonly jti?: string;
7589 |   // A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker
7590 |   // received the message from the client.
7591 |   readonly receivedAt: number;
7592 |   // An (optional) string with the MIME type of the payload, if set by the
7593 |   // client.
7594 |   readonly contentType: string;
7595 |   // Set to 1 when the payload is a UTF-8 string
7596 |   // https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063
7597 |   readonly payloadFormatIndicator: number;
7598 |   // Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays.
7599 |   // You can use payloadFormatIndicator to inspect this before decoding.
7600 |   payload: string | Uint8Array;
7601 | }
7602 | // JsonWebKey extended by kid parameter
7603 | interface JsonWebKeyWithKid extends JsonWebKey {
7604 |   // Key Identifier of the JWK
7605 |   readonly kid: string;
7606 | }
7607 | interface RateLimitOptions {
7608 |   key: string;
7609 | }
7610 | interface RateLimitOutcome {
7611 |   success: boolean;
7612 | }
7613 | interface RateLimit {
7614 |   /**
7615 |    * Rate limit a request based on the provided options.
7616 |    * @see https://developers.cloudflare.com/workers/runtime-apis/bindings/rate-limit/
7617 |    * @returns A promise that resolves with the outcome of the rate limit.
7618 |    */
7619 |   limit(options: RateLimitOptions): Promise<RateLimitOutcome>;
7620 | }
7621 | // Namespace for RPC utility types. Unfortunately, we can't use a `module` here as these types need
7622 | // to referenced by `Fetcher`. This is included in the "importable" version of the types which
7623 | // strips all `module` blocks.
7624 | declare namespace Rpc {
7625 |   // Branded types for identifying `WorkerEntrypoint`/`DurableObject`/`Target`s.
7626 |   // TypeScript uses *structural* typing meaning anything with the same shape as type `T` is a `T`.
7627 |   // For the classes exported by `cloudflare:workers` we want *nominal* typing (i.e. we only want to
7628 |   // accept `WorkerEntrypoint` from `cloudflare:workers`, not any other class with the same shape)
7629 |   export const __RPC_STUB_BRAND: "__RPC_STUB_BRAND";
7630 |   export const __RPC_TARGET_BRAND: "__RPC_TARGET_BRAND";
7631 |   export const __WORKER_ENTRYPOINT_BRAND: "__WORKER_ENTRYPOINT_BRAND";
7632 |   export const __DURABLE_OBJECT_BRAND: "__DURABLE_OBJECT_BRAND";
7633 |   export const __WORKFLOW_ENTRYPOINT_BRAND: "__WORKFLOW_ENTRYPOINT_BRAND";
7634 |   export interface RpcTargetBranded {
7635 |     [__RPC_TARGET_BRAND]: never;
7636 |   }
7637 |   export interface WorkerEntrypointBranded {
7638 |     [__WORKER_ENTRYPOINT_BRAND]: never;
7639 |   }
7640 |   export interface DurableObjectBranded {
7641 |     [__DURABLE_OBJECT_BRAND]: never;
7642 |   }
7643 |   export interface WorkflowEntrypointBranded {
7644 |     [__WORKFLOW_ENTRYPOINT_BRAND]: never;
7645 |   }
7646 |   export type EntrypointBranded =
7647 |     | WorkerEntrypointBranded
7648 |     | DurableObjectBranded
7649 |     | WorkflowEntrypointBranded;
7650 |   // Types that can be used through `Stub`s
7651 |   export type Stubable = RpcTargetBranded | ((...args: any[]) => any);
7652 |   // Types that can be passed over RPC
7653 |   // The reason for using a generic type here is to build a serializable subset of structured
7654 |   //   cloneable composite types. This allows types defined with the "interface" keyword to pass the
7655 |   //   serializable check as well. Otherwise, only types defined with the "type" keyword would pass.
7656 |   type Serializable<T> =
7657 |     // Structured cloneables
7658 |     | BaseType
7659 |     // Structured cloneable composites
7660 |     | Map<
7661 |         T extends Map<infer U, unknown> ? Serializable<U> : never,
7662 |         T extends Map<unknown, infer U> ? Serializable<U> : never
7663 |       >
7664 |     | Set<T extends Set<infer U> ? Serializable<U> : never>
7665 |     | ReadonlyArray<T extends ReadonlyArray<infer U> ? Serializable<U> : never>
7666 |     | {
7667 |         [K in keyof T]: K extends number | string ? Serializable<T[K]> : never;
7668 |       }
7669 |     // Special types
7670 |     | Stub<Stubable>
7671 |     // Serialized as stubs, see `Stubify`
7672 |     | Stubable;
7673 |   // Base type for all RPC stubs, including common memory management methods.
7674 |   // `T` is used as a marker type for unwrapping `Stub`s later.
7675 |   interface StubBase<T extends Stubable> extends Disposable {
7676 |     [__RPC_STUB_BRAND]: T;
7677 |     dup(): this;
7678 |   }
7679 |   export type Stub<T extends Stubable> = Provider<T> & StubBase<T>;
7680 |   // This represents all the types that can be sent as-is over an RPC boundary
7681 |   type BaseType =
7682 |     | void
7683 |     | undefined
7684 |     | null
7685 |     | boolean
7686 |     | number
7687 |     | bigint
7688 |     | string
7689 |     | TypedArray
7690 |     | ArrayBuffer
7691 |     | DataView
7692 |     | Date
7693 |     | Error
7694 |     | RegExp
7695 |     | ReadableStream<Uint8Array>
7696 |     | WritableStream<Uint8Array>
7697 |     | Request
7698 |     | Response
7699 |     | Headers;
7700 |   // Recursively rewrite all `Stubable` types with `Stub`s
7701 |   // prettier-ignore
7702 |   type Stubify<T> = T extends Stubable ? Stub<T> : T extends Map<infer K, infer V> ? Map<Stubify<K>, Stubify<V>> : T extends Set<infer V> ? Set<Stubify<V>> : T extends Array<infer V> ? Array<Stubify<V>> : T extends ReadonlyArray<infer V> ? ReadonlyArray<Stubify<V>> : T extends BaseType ? T : T extends {
7703 |         [key: string | number]: any;
7704 |     } ? {
7705 |         [K in keyof T]: Stubify<T[K]>;
7706 |     } : T;
7707 |   // Recursively rewrite all `Stub<T>`s with the corresponding `T`s.
7708 |   // Note we use `StubBase` instead of `Stub` here to avoid circular dependencies:
7709 |   // `Stub` depends on `Provider`, which depends on `Unstubify`, which would depend on `Stub`.
7710 |   // prettier-ignore
7711 |   type Unstubify<T> = T extends StubBase<infer V> ? V : T extends Map<infer K, infer V> ? Map<Unstubify<K>, Unstubify<V>> : T extends Set<infer V> ? Set<Unstubify<V>> : T extends Array<infer V> ? Array<Unstubify<V>> : T extends ReadonlyArray<infer V> ? ReadonlyArray<Unstubify<V>> : T extends BaseType ? T : T extends {
7712 |         [key: string | number]: unknown;
7713 |     } ? {
7714 |         [K in keyof T]: Unstubify<T[K]>;
7715 |     } : T;
7716 |   type UnstubifyAll<A extends any[]> = {
7717 |     [I in keyof A]: Unstubify<A[I]>;
7718 |   };
7719 |   // Utility type for adding `Provider`/`Disposable`s to `object` types only.
7720 |   // Note `unknown & T` is equivalent to `T`.
7721 |   type MaybeProvider<T> = T extends object ? Provider<T> : unknown;
7722 |   type MaybeDisposable<T> = T extends object ? Disposable : unknown;
7723 |   // Type for method return or property on an RPC interface.
7724 |   // - Stubable types are replaced by stubs.
7725 |   // - Serializable types are passed by value, with stubable types replaced by stubs
7726 |   //   and a top-level `Disposer`.
7727 |   // Everything else can't be passed over PRC.
7728 |   // Technically, we use custom thenables here, but they quack like `Promise`s.
7729 |   // Intersecting with `(Maybe)Provider` allows pipelining.
7730 |   // prettier-ignore
7731 |   type Result<R> = R extends Stubable ? Promise<Stub<R>> & Provider<R> : R extends Serializable<R> ? Promise<Stubify<R> & MaybeDisposable<R>> & MaybeProvider<R> : never;
7732 |   // Type for method or property on an RPC interface.
7733 |   // For methods, unwrap `Stub`s in parameters, and rewrite returns to be `Result`s.
7734 |   // Unwrapping `Stub`s allows calling with `Stubable` arguments.
7735 |   // For properties, rewrite types to be `Result`s.
7736 |   // In each case, unwrap `Promise`s.
7737 |   type MethodOrProperty<V> = V extends (...args: infer P) => infer R
7738 |     ? (...args: UnstubifyAll<P>) => Result<Awaited<R>>
7739 |     : Result<Awaited<V>>;
7740 |   // Type for the callable part of an `Provider` if `T` is callable.
7741 |   // This is intersected with methods/properties.
7742 |   type MaybeCallableProvider<T> = T extends (...args: any[]) => any
7743 |     ? MethodOrProperty<T>
7744 |     : unknown;
7745 |   // Base type for all other types providing RPC-like interfaces.
7746 |   // Rewrites all methods/properties to be `MethodOrProperty`s, while preserving callable types.
7747 |   // `Reserved` names (e.g. stub method names like `dup()`) and symbols can't be accessed over RPC.
7748 |   export type Provider<
7749 |     T extends object,
7750 |     Reserved extends string = never,
7751 |   > = MaybeCallableProvider<T> & {
7752 |     [K in Exclude<
7753 |       keyof T,
7754 |       Reserved | symbol | keyof StubBase<never>
7755 |     >]: MethodOrProperty<T[K]>;
7756 |   };
7757 | }
7758 | declare namespace Cloudflare {
7759 |   interface Env {}
7760 | }
7761 | declare module "cloudflare:workers" {
7762 |   export type RpcStub<T extends Rpc.Stubable> = Rpc.Stub<T>;
7763 |   export const RpcStub: {
7764 |     new <T extends Rpc.Stubable>(value: T): Rpc.Stub<T>;
7765 |   };
7766 |   export abstract class RpcTarget implements Rpc.RpcTargetBranded {
7767 |     [Rpc.__RPC_TARGET_BRAND]: never;
7768 |   }
7769 |   // `protected` fields don't appear in `keyof`s, so can't be accessed over RPC
7770 |   export abstract class WorkerEntrypoint<Env = unknown>
7771 |     implements Rpc.WorkerEntrypointBranded
7772 |   {
7773 |     [Rpc.__WORKER_ENTRYPOINT_BRAND]: never;
7774 |     protected ctx: ExecutionContext;
7775 |     protected env: Env;
7776 |     constructor(ctx: ExecutionContext, env: Env);
7777 |     fetch?(request: Request): Response | Promise<Response>;
7778 |     tail?(events: TraceItem[]): void | Promise<void>;
7779 |     trace?(traces: TraceItem[]): void | Promise<void>;
7780 |     scheduled?(controller: ScheduledController): void | Promise<void>;
7781 |     queue?(batch: MessageBatch<unknown>): void | Promise<void>;
7782 |     test?(controller: TestController): void | Promise<void>;
7783 |   }
7784 |   export abstract class DurableObject<Env = unknown>
7785 |     implements Rpc.DurableObjectBranded
7786 |   {
7787 |     [Rpc.__DURABLE_OBJECT_BRAND]: never;
7788 |     protected ctx: DurableObjectState;
7789 |     protected env: Env;
7790 |     constructor(ctx: DurableObjectState, env: Env);
7791 |     fetch?(request: Request): Response | Promise<Response>;
7792 |     alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;
7793 |     webSocketMessage?(
7794 |       ws: WebSocket,
7795 |       message: string | ArrayBuffer,
7796 |     ): void | Promise<void>;
7797 |     webSocketClose?(
7798 |       ws: WebSocket,
7799 |       code: number,
7800 |       reason: string,
7801 |       wasClean: boolean,
7802 |     ): void | Promise<void>;
7803 |     webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;
7804 |   }
7805 |   export type WorkflowDurationLabel =
7806 |     | "second"
7807 |     | "minute"
7808 |     | "hour"
7809 |     | "day"
7810 |     | "week"
7811 |     | "month"
7812 |     | "year";
7813 |   export type WorkflowSleepDuration =
7814 |     | `${number} ${WorkflowDurationLabel}${"s" | ""}`
7815 |     | number;
7816 |   export type WorkflowDelayDuration = WorkflowSleepDuration;
7817 |   export type WorkflowTimeoutDuration = WorkflowSleepDuration;
7818 |   export type WorkflowRetentionDuration = WorkflowSleepDuration;
7819 |   export type WorkflowBackoff = "constant" | "linear" | "exponential";
7820 |   export type WorkflowStepConfig = {
7821 |     retries?: {
7822 |       limit: number;
7823 |       delay: WorkflowDelayDuration | number;
7824 |       backoff?: WorkflowBackoff;
7825 |     };
7826 |     timeout?: WorkflowTimeoutDuration | number;
7827 |   };
7828 |   export type WorkflowEvent<T> = {
7829 |     payload: Readonly<T>;
7830 |     timestamp: Date;
7831 |     instanceId: string;
7832 |   };
7833 |   export type WorkflowStepEvent<T> = {
7834 |     payload: Readonly<T>;
7835 |     timestamp: Date;
7836 |     type: string;
7837 |   };
7838 |   export abstract class WorkflowStep {
7839 |     do<T extends Rpc.Serializable<T>>(
7840 |       name: string,
7841 |       callback: () => Promise<T>,
7842 |     ): Promise<T>;
7843 |     do<T extends Rpc.Serializable<T>>(
7844 |       name: string,
7845 |       config: WorkflowStepConfig,
7846 |       callback: () => Promise<T>,
7847 |     ): Promise<T>;
7848 |     sleep: (name: string, duration: WorkflowSleepDuration) => Promise<void>;
7849 |     sleepUntil: (name: string, timestamp: Date | number) => Promise<void>;
7850 |     waitForEvent<T extends Rpc.Serializable<T>>(
7851 |       name: string,
7852 |       options: {
7853 |         type: string;
7854 |         timeout?: WorkflowTimeoutDuration | number;
7855 |       },
7856 |     ): Promise<WorkflowStepEvent<T>>;
7857 |   }
7858 |   export abstract class WorkflowEntrypoint<
7859 |     Env = unknown,
7860 |     T extends Rpc.Serializable<T> | unknown = unknown,
7861 |   > implements Rpc.WorkflowEntrypointBranded
7862 |   {
7863 |     [Rpc.__WORKFLOW_ENTRYPOINT_BRAND]: never;
7864 |     protected ctx: ExecutionContext;
7865 |     protected env: Env;
7866 |     constructor(ctx: ExecutionContext, env: Env);
7867 |     run(
7868 |       event: Readonly<WorkflowEvent<T>>,
7869 |       step: WorkflowStep,
7870 |     ): Promise<unknown>;
7871 |   }
7872 |   export const env: Cloudflare.Env;
7873 | }
7874 | interface SecretsStoreSecret {
7875 |   /**
7876 |    * Get a secret from the Secrets Store, returning a string of the secret value
7877 |    * if it exists, or throws an error if it does not exist
7878 |    */
7879 |   get(): Promise<string>;
7880 | }
7881 | declare module "cloudflare:sockets" {
7882 |   function _connect(
7883 |     address: string | SocketAddress,
7884 |     options?: SocketOptions,
7885 |   ): Socket;
7886 |   export { _connect as connect };
7887 | }
7888 | declare namespace TailStream {
7889 |   interface Header {
7890 |     readonly name: string;
7891 |     readonly value: string;
7892 |   }
7893 |   interface FetchEventInfo {
7894 |     readonly type: "fetch";
7895 |     readonly method: string;
7896 |     readonly url: string;
7897 |     readonly cfJson: string;
7898 |     readonly headers: Header[];
7899 |   }
7900 |   interface JsRpcEventInfo {
7901 |     readonly type: "jsrpc";
7902 |     readonly methodName: string;
7903 |   }
7904 |   interface ScheduledEventInfo {
7905 |     readonly type: "scheduled";
7906 |     readonly scheduledTime: Date;
7907 |     readonly cron: string;
7908 |   }
7909 |   interface AlarmEventInfo {
7910 |     readonly type: "alarm";
7911 |     readonly scheduledTime: Date;
7912 |   }
7913 |   interface QueueEventInfo {
7914 |     readonly type: "queue";
7915 |     readonly queueName: string;
7916 |     readonly batchSize: number;
7917 |   }
7918 |   interface EmailEventInfo {
7919 |     readonly type: "email";
7920 |     readonly mailFrom: string;
7921 |     readonly rcptTo: string;
7922 |     readonly rawSize: number;
7923 |   }
7924 |   interface TraceEventInfo {
7925 |     readonly type: "trace";
7926 |     readonly traces: (string | null)[];
7927 |   }
7928 |   interface HibernatableWebSocketEventInfoMessage {
7929 |     readonly type: "message";
7930 |   }
7931 |   interface HibernatableWebSocketEventInfoError {
7932 |     readonly type: "error";
7933 |   }
7934 |   interface HibernatableWebSocketEventInfoClose {
7935 |     readonly type: "close";
7936 |     readonly code: number;
7937 |     readonly wasClean: boolean;
7938 |   }
7939 |   interface HibernatableWebSocketEventInfo {
7940 |     readonly type: "hibernatableWebSocket";
7941 |     readonly info:
7942 |       | HibernatableWebSocketEventInfoClose
7943 |       | HibernatableWebSocketEventInfoError
7944 |       | HibernatableWebSocketEventInfoMessage;
7945 |   }
7946 |   interface Resume {
7947 |     readonly type: "resume";
7948 |     readonly attachment?: any;
7949 |   }
7950 |   interface CustomEventInfo {
7951 |     readonly type: "custom";
7952 |   }
7953 |   interface FetchResponseInfo {
7954 |     readonly type: "fetch";
7955 |     readonly statusCode: number;
7956 |   }
7957 |   type EventOutcome =
7958 |     | "ok"
7959 |     | "canceled"
7960 |     | "exception"
7961 |     | "unknown"
7962 |     | "killSwitch"
7963 |     | "daemonDown"
7964 |     | "exceededCpu"
7965 |     | "exceededMemory"
7966 |     | "loadShed"
7967 |     | "responseStreamDisconnected"
7968 |     | "scriptNotFound";
7969 |   interface ScriptVersion {
7970 |     readonly id: string;
7971 |     readonly tag?: string;
7972 |     readonly message?: string;
7973 |   }
7974 |   interface Trigger {
7975 |     readonly traceId: string;
7976 |     readonly invocationId: string;
7977 |     readonly spanId: string;
7978 |   }
7979 |   interface Onset {
7980 |     readonly type: "onset";
7981 |     readonly dispatchNamespace?: string;
7982 |     readonly entrypoint?: string;
7983 |     readonly executionModel: string;
7984 |     readonly scriptName?: string;
7985 |     readonly scriptTags?: string[];
7986 |     readonly scriptVersion?: ScriptVersion;
7987 |     readonly trigger?: Trigger;
7988 |     readonly info:
7989 |       | FetchEventInfo
7990 |       | JsRpcEventInfo
7991 |       | ScheduledEventInfo
7992 |       | AlarmEventInfo
7993 |       | QueueEventInfo
7994 |       | EmailEventInfo
7995 |       | TraceEventInfo
7996 |       | HibernatableWebSocketEventInfo
7997 |       | Resume
7998 |       | CustomEventInfo;
7999 |   }
8000 |   interface Outcome {
8001 |     readonly type: "outcome";
8002 |     readonly outcome: EventOutcome;
8003 |     readonly cpuTime: number;
8004 |     readonly wallTime: number;
8005 |   }
8006 |   interface Hibernate {
8007 |     readonly type: "hibernate";
8008 |   }
8009 |   interface SpanOpen {
8010 |     readonly type: "spanOpen";
8011 |     readonly name: string;
8012 |     readonly info?: FetchEventInfo | JsRpcEventInfo | Attributes;
8013 |   }
8014 |   interface SpanClose {
8015 |     readonly type: "spanClose";
8016 |     readonly outcome: EventOutcome;
8017 |   }
8018 |   interface DiagnosticChannelEvent {
8019 |     readonly type: "diagnosticChannel";
8020 |     readonly channel: string;
8021 |     readonly message: any;
8022 |   }
8023 |   interface Exception {
8024 |     readonly type: "exception";
8025 |     readonly name: string;
8026 |     readonly message: string;
8027 |     readonly stack?: string;
8028 |   }
8029 |   interface Log {
8030 |     readonly type: "log";
8031 |     readonly level: "debug" | "error" | "info" | "log" | "warn";
8032 |     readonly message: string;
8033 |   }
8034 |   interface Return {
8035 |     readonly type: "return";
8036 |     readonly info?: FetchResponseInfo;
8037 |   }
8038 |   interface Link {
8039 |     readonly type: "link";
8040 |     readonly label?: string;
8041 |     readonly traceId: string;
8042 |     readonly invocationId: string;
8043 |     readonly spanId: string;
8044 |   }
8045 |   interface Attribute {
8046 |     readonly name: string;
8047 |     readonly value:
8048 |       | string
8049 |       | string[]
8050 |       | boolean
8051 |       | boolean[]
8052 |       | number
8053 |       | number[]
8054 |       | bigint
8055 |       | bigint[];
8056 |   }
8057 |   interface Attributes {
8058 |     readonly type: "attributes";
8059 |     readonly info: Attribute[];
8060 |   }
8061 |   interface TailEvent {
8062 |     readonly traceId: string;
8063 |     readonly invocationId: string;
8064 |     readonly spanId: string;
8065 |     readonly timestamp: Date;
8066 |     readonly sequence: number;
8067 |     readonly event:
8068 |       | Onset
8069 |       | Outcome
8070 |       | Hibernate
8071 |       | SpanOpen
8072 |       | SpanClose
8073 |       | DiagnosticChannelEvent
8074 |       | Exception
8075 |       | Log
8076 |       | Return
8077 |       | Link
8078 |       | Attributes;
8079 |   }
8080 |   type TailEventHandler = (event: TailEvent) => void | Promise<void>;
8081 |   type TailEventHandlerName =
8082 |     | "outcome"
8083 |     | "hibernate"
8084 |     | "spanOpen"
8085 |     | "spanClose"
8086 |     | "diagnosticChannel"
8087 |     | "exception"
8088 |     | "log"
8089 |     | "return"
8090 |     | "link"
8091 |     | "attributes";
8092 |   type TailEventHandlerObject = Record<TailEventHandlerName, TailEventHandler>;
8093 |   type TailEventHandlerType = TailEventHandler | TailEventHandlerObject;
8094 | }
8095 | // Copyright (c) 2022-2023 Cloudflare, Inc.
8096 | // Licensed under the Apache 2.0 license found in the LICENSE file or at:
8097 | //     https://opensource.org/licenses/Apache-2.0
8098 | /**
8099 |  * Data types supported for holding vector metadata.
8100 |  */
8101 | type VectorizeVectorMetadataValue = string | number | boolean | string[];
8102 | /**
8103 |  * Additional information to associate with a vector.
8104 |  */
8105 | type VectorizeVectorMetadata =
8106 |   | VectorizeVectorMetadataValue
8107 |   | Record<string, VectorizeVectorMetadataValue>;
8108 | type VectorFloatArray = Float32Array | Float64Array;
8109 | interface VectorizeError {
8110 |   code?: number;
8111 |   error: string;
8112 | }
8113 | /**
8114 |  * Comparison logic/operation to use for metadata filtering.
8115 |  *
8116 |  * This list is expected to grow as support for more operations are released.
8117 |  */
8118 | type VectorizeVectorMetadataFilterOp = "$eq" | "$ne";
8119 | /**
8120 |  * Filter criteria for vector metadata used to limit the retrieved query result set.
8121 |  */
8122 | type VectorizeVectorMetadataFilter = {
8123 |   [field: string]:
8124 |     | Exclude<VectorizeVectorMetadataValue, string[]>
8125 |     | null
8126 |     | {
8127 |         [Op in VectorizeVectorMetadataFilterOp]?: Exclude<
8128 |           VectorizeVectorMetadataValue,
8129 |           string[]
8130 |         > | null;
8131 |       };
8132 | };
8133 | /**
8134 |  * Supported distance metrics for an index.
8135 |  * Distance metrics determine how other "similar" vectors are determined.
8136 |  */
8137 | type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product";
8138 | /**
8139 |  * Metadata return levels for a Vectorize query.
8140 |  *
8141 |  * Default to "none".
8142 |  *
8143 |  * @property all      Full metadata for the vector return set, including all fields (including those un-indexed) without truncation. This is a more expensive retrieval, as it requires additional fetching & reading of un-indexed data.
8144 |  * @property indexed  Return all metadata fields configured for indexing in the vector return set. This level of retrieval is "free" in that no additional overhead is incurred returning this data. However, note that indexed metadata is subject to truncation (especially for larger strings).
8145 |  * @property none     No indexed metadata will be returned.
8146 |  */
8147 | type VectorizeMetadataRetrievalLevel = "all" | "indexed" | "none";
8148 | interface VectorizeQueryOptions {
8149 |   topK?: number;
8150 |   namespace?: string;
8151 |   returnValues?: boolean;
8152 |   returnMetadata?: boolean | VectorizeMetadataRetrievalLevel;
8153 |   filter?: VectorizeVectorMetadataFilter;
8154 | }
8155 | /**
8156 |  * Information about the configuration of an index.
8157 |  */
8158 | type VectorizeIndexConfig =
8159 |   | {
8160 |       dimensions: number;
8161 |       metric: VectorizeDistanceMetric;
8162 |     }
8163 |   | {
8164 |       preset: string; // keep this generic, as we'll be adding more presets in the future and this is only in a read capacity
8165 |     };
8166 | /**
8167 |  * Metadata about an existing index.
8168 |  *
8169 |  * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
8170 |  * See {@link VectorizeIndexInfo} for its post-beta equivalent.
8171 |  */
8172 | interface VectorizeIndexDetails {
8173 |   /** The unique ID of the index */
8174 |   readonly id: string;
8175 |   /** The name of the index. */
8176 |   name: string;
8177 |   /** (optional) A human readable description for the index. */
8178 |   description?: string;
8179 |   /** The index configuration, including the dimension size and distance metric. */
8180 |   config: VectorizeIndexConfig;
8181 |   /** The number of records containing vectors within the index. */
8182 |   vectorsCount: number;
8183 | }
8184 | /**
8185 |  * Metadata about an existing index.
8186 |  */
8187 | interface VectorizeIndexInfo {
8188 |   /** The number of records containing vectors within the index. */
8189 |   vectorCount: number;
8190 |   /** Number of dimensions the index has been configured for. */
8191 |   dimensions: number;
8192 |   /** ISO 8601 datetime of the last processed mutation on in the index. All changes before this mutation will be reflected in the index state. */
8193 |   processedUpToDatetime: number;
8194 |   /** UUIDv4 of the last mutation processed by the index. All changes before this mutation will be reflected in the index state. */
8195 |   processedUpToMutation: number;
8196 | }
8197 | /**
8198 |  * Represents a single vector value set along with its associated metadata.
8199 |  */
8200 | interface VectorizeVector {
8201 |   /** The ID for the vector. This can be user-defined, and must be unique. It should uniquely identify the object, and is best set based on the ID of what the vector represents. */
8202 |   id: string;
8203 |   /** The vector values */
8204 |   values: VectorFloatArray | number[];
8205 |   /** The namespace this vector belongs to. */
8206 |   namespace?: string;
8207 |   /** Metadata associated with the vector. Includes the values of other fields and potentially additional details. */
8208 |   metadata?: Record<string, VectorizeVectorMetadata>;
8209 | }
8210 | /**
8211 |  * Represents a matched vector for a query along with its score and (if specified) the matching vector information.
8212 |  */
8213 | type VectorizeMatch = Pick<Partial<VectorizeVector>, "values"> &
8214 |   Omit<VectorizeVector, "values"> & {
8215 |     /** The score or rank for similarity, when returned as a result */
8216 |     score: number;
8217 |   };
8218 | /**
8219 |  * A set of matching {@link VectorizeMatch} for a particular query.
8220 |  */
8221 | interface VectorizeMatches {
8222 |   matches: VectorizeMatch[];
8223 |   count: number;
8224 | }
8225 | /**
8226 |  * Results of an operation that performed a mutation on a set of vectors.
8227 |  * Here, `ids` is a list of vectors that were successfully processed.
8228 |  *
8229 |  * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
8230 |  * See {@link VectorizeAsyncMutation} for its post-beta equivalent.
8231 |  */
8232 | interface VectorizeVectorMutation {
8233 |   /* List of ids of vectors that were successfully processed. */
8234 |   ids: string[];
8235 |   /* Total count of the number of processed vectors. */
8236 |   count: number;
8237 | }
8238 | /**
8239 |  * Result type indicating a mutation on the Vectorize Index.
8240 |  * Actual mutations are processed async where the `mutationId` is the unique identifier for the operation.
8241 |  */
8242 | interface VectorizeAsyncMutation {
8243 |   /** The unique identifier for the async mutation operation containing the changeset. */
8244 |   mutationId: string;
8245 | }
8246 | /**
8247 |  * A Vectorize Vector Search Index for querying vectors/embeddings.
8248 |  *
8249 |  * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
8250 |  * See {@link Vectorize} for its new implementation.
8251 |  */
8252 | declare abstract class VectorizeIndex {
8253 |   /**
8254 |    * Get information about the currently bound index.
8255 |    * @returns A promise that resolves with information about the current index.
8256 |    */
8257 |   public describe(): Promise<VectorizeIndexDetails>;
8258 |   /**
8259 |    * Use the provided vector to perform a similarity search across the index.
8260 |    * @param vector Input vector that will be used to drive the similarity search.
8261 |    * @param options Configuration options to massage the returned data.
8262 |    * @returns A promise that resolves with matched and scored vectors.
8263 |    */
8264 |   public query(
8265 |     vector: VectorFloatArray | number[],
8266 |     options?: VectorizeQueryOptions,
8267 |   ): Promise<VectorizeMatches>;
8268 |   /**
8269 |    * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
8270 |    * @param vectors List of vectors that will be inserted.
8271 |    * @returns A promise that resolves with the ids & count of records that were successfully processed.
8272 |    */
8273 |   public insert(vectors: VectorizeVector[]): Promise<VectorizeVectorMutation>;
8274 |   /**
8275 |    * Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.
8276 |    * @param vectors List of vectors that will be upserted.
8277 |    * @returns A promise that resolves with the ids & count of records that were successfully processed.
8278 |    */
8279 |   public upsert(vectors: VectorizeVector[]): Promise<VectorizeVectorMutation>;
8280 |   /**
8281 |    * Delete a list of vectors with a matching id.
8282 |    * @param ids List of vector ids that should be deleted.
8283 |    * @returns A promise that resolves with the ids & count of records that were successfully processed (and thus deleted).
8284 |    */
8285 |   public deleteByIds(ids: string[]): Promise<VectorizeVectorMutation>;
8286 |   /**
8287 |    * Get a list of vectors with a matching id.
8288 |    * @param ids List of vector ids that should be returned.
8289 |    * @returns A promise that resolves with the raw unscored vectors matching the id set.
8290 |    */
8291 |   public getByIds(ids: string[]): Promise<VectorizeVector[]>;
8292 | }
8293 | /**
8294 |  * A Vectorize Vector Search Index for querying vectors/embeddings.
8295 |  *
8296 |  * Mutations in this version are async, returning a mutation id.
8297 |  */
8298 | declare abstract class Vectorize {
8299 |   /**
8300 |    * Get information about the currently bound index.
8301 |    * @returns A promise that resolves with information about the current index.
8302 |    */
8303 |   public describe(): Promise<VectorizeIndexInfo>;
8304 |   /**
8305 |    * Use the provided vector to perform a similarity search across the index.
8306 |    * @param vector Input vector that will be used to drive the similarity search.
8307 |    * @param options Configuration options to massage the returned data.
8308 |    * @returns A promise that resolves with matched and scored vectors.
8309 |    */
8310 |   public query(
8311 |     vector: VectorFloatArray | number[],
8312 |     options?: VectorizeQueryOptions,
8313 |   ): Promise<VectorizeMatches>;
8314 |   /**
8315 |    * Use the provided vector-id to perform a similarity search across the index.
8316 |    * @param vectorId Id for a vector in the index against which the index should be queried.
8317 |    * @param options Configuration options to massage the returned data.
8318 |    * @returns A promise that resolves with matched and scored vectors.
8319 |    */
8320 |   public queryById(
8321 |     vectorId: string,
8322 |     options?: VectorizeQueryOptions,
8323 |   ): Promise<VectorizeMatches>;
8324 |   /**
8325 |    * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
8326 |    * @param vectors List of vectors that will be inserted.
8327 |    * @returns A promise that resolves with a unique identifier of a mutation containing the insert changeset.
8328 |    */
8329 |   public insert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
8330 |   /**
8331 |    * Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.
8332 |    * @param vectors List of vectors that will be upserted.
8333 |    * @returns A promise that resolves with a unique identifier of a mutation containing the upsert changeset.
8334 |    */
8335 |   public upsert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
8336 |   /**
8337 |    * Delete a list of vectors with a matching id.
8338 |    * @param ids List of vector ids that should be deleted.
8339 |    * @returns A promise that resolves with a unique identifier of a mutation containing the delete changeset.
8340 |    */
8341 |   public deleteByIds(ids: string[]): Promise<VectorizeAsyncMutation>;
8342 |   /**
8343 |    * Get a list of vectors with a matching id.
8344 |    * @param ids List of vector ids that should be returned.
8345 |    * @returns A promise that resolves with the raw unscored vectors matching the id set.
8346 |    */
8347 |   public getByIds(ids: string[]): Promise<VectorizeVector[]>;
8348 | }
8349 | /**
8350 |  * The interface for "version_metadata" binding
8351 |  * providing metadata about the Worker Version using this binding.
8352 |  */
8353 | type WorkerVersionMetadata = {
8354 |   /** The ID of the Worker Version using this binding */
8355 |   id: string;
8356 |   /** The tag of the Worker Version using this binding */
8357 |   tag: string;
8358 |   /** The timestamp of when the Worker Version was uploaded */
8359 |   timestamp: string;
8360 | };
8361 | interface DynamicDispatchLimits {
8362 |   /**
8363 |    * Limit CPU time in milliseconds.
8364 |    */
8365 |   cpuMs?: number;
8366 |   /**
8367 |    * Limit number of subrequests.
8368 |    */
8369 |   subRequests?: number;
8370 | }
8371 | interface DynamicDispatchOptions {
8372 |   /**
8373 |    * Limit resources of invoked Worker script.
8374 |    */
8375 |   limits?: DynamicDispatchLimits;
8376 |   /**
8377 |    * Arguments for outbound Worker script, if configured.
8378 |    */
8379 |   outbound?: {
8380 |     [key: string]: any;
8381 |   };
8382 | }
8383 | interface DispatchNamespace {
8384 |   /**
8385 |    * @param name Name of the Worker script.
8386 |    * @param args Arguments to Worker script.
8387 |    * @param options Options for Dynamic Dispatch invocation.
8388 |    * @returns A Fetcher object that allows you to send requests to the Worker script.
8389 |    * @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.
8390 |    */
8391 |   get(
8392 |     name: string,
8393 |     args?: {
8394 |       [key: string]: any;
8395 |     },
8396 |     options?: DynamicDispatchOptions,
8397 |   ): Fetcher;
8398 | }
8399 | declare module "cloudflare:workflows" {
8400 |   /**
8401 |    * NonRetryableError allows for a user to throw a fatal error
8402 |    * that makes a Workflow instance fail immediately without triggering a retry
8403 |    */
8404 |   export class NonRetryableError extends Error {
8405 |     public constructor(message: string, name?: string);
8406 |   }
8407 | }
8408 | declare abstract class Workflow<PARAMS = unknown> {
8409 |   /**
8410 |    * Get a handle to an existing instance of the Workflow.
8411 |    * @param id Id for the instance of this Workflow
8412 |    * @returns A promise that resolves with a handle for the Instance
8413 |    */
8414 |   public get(id: string): Promise<WorkflowInstance>;
8415 |   /**
8416 |    * Create a new instance and return a handle to it. If a provided id exists, an error will be thrown.
8417 |    * @param options Options when creating an instance including id and params
8418 |    * @returns A promise that resolves with a handle for the Instance
8419 |    */
8420 |   public create(
8421 |     options?: WorkflowInstanceCreateOptions<PARAMS>,
8422 |   ): Promise<WorkflowInstance>;
8423 |   /**
8424 |    * Create a batch of instances and return handle for all of them. If a provided id exists, an error will be thrown.
8425 |    * `createBatch` is limited at 100 instances at a time or when the RPC limit for the batch (1MiB) is reached.
8426 |    * @param batch List of Options when creating an instance including name and params
8427 |    * @returns A promise that resolves with a list of handles for the created instances.
8428 |    */
8429 |   public createBatch(
8430 |     batch: WorkflowInstanceCreateOptions<PARAMS>[],
8431 |   ): Promise<WorkflowInstance[]>;
8432 | }
8433 | type WorkflowDurationLabel =
8434 |   | "second"
8435 |   | "minute"
8436 |   | "hour"
8437 |   | "day"
8438 |   | "week"
8439 |   | "month"
8440 |   | "year";
8441 | type WorkflowSleepDuration =
8442 |   | `${number} ${WorkflowDurationLabel}${"s" | ""}`
8443 |   | number;
8444 | type WorkflowRetentionDuration = WorkflowSleepDuration;
8445 | interface WorkflowInstanceCreateOptions<PARAMS = unknown> {
8446 |   /**
8447 |    * An id for your Workflow instance. Must be unique within the Workflow.
8448 |    */
8449 |   id?: string;
8450 |   /**
8451 |    * The event payload the Workflow instance is triggered with
8452 |    */
8453 |   params?: PARAMS;
8454 |   /**
8455 |    * The retention policy for Workflow instance.
8456 |    * Defaults to the maximum retention period available for the owner's account.
8457 |    */
8458 |   retention?: {
8459 |     successRetention?: WorkflowRetentionDuration;
8460 |     errorRetention?: WorkflowRetentionDuration;
8461 |   };
8462 | }
8463 | type InstanceStatus = {
8464 |   status:
8465 |     | "queued" // means that instance is waiting to be started (see concurrency limits)
8466 |     | "running"
8467 |     | "paused"
8468 |     | "errored"
8469 |     | "terminated" // user terminated the instance while it was running
8470 |     | "complete"
8471 |     | "waiting" // instance is hibernating and waiting for sleep or event to finish
8472 |     | "waitingForPause" // instance is finishing the current work to pause
8473 |     | "unknown";
8474 |   error?: string;
8475 |   output?: object;
8476 | };
8477 | interface WorkflowError {
8478 |   code?: number;
8479 |   message: string;
8480 | }
8481 | declare abstract class WorkflowInstance {
8482 |   public id: string;
8483 |   /**
8484 |    * Pause the instance.
8485 |    */
8486 |   public pause(): Promise<void>;
8487 |   /**
8488 |    * Resume the instance. If it is already running, an error will be thrown.
8489 |    */
8490 |   public resume(): Promise<void>;
8491 |   /**
8492 |    * Terminate the instance. If it is errored, terminated or complete, an error will be thrown.
8493 |    */
8494 |   public terminate(): Promise<void>;
8495 |   /**
8496 |    * Restart the instance.
8497 |    */
8498 |   public restart(): Promise<void>;
8499 |   /**
8500 |    * Returns the current status of the instance.
8501 |    */
8502 |   public status(): Promise<InstanceStatus>;
8503 |   /**
8504 |    * Send an event to this instance.
8505 |    */
8506 |   public sendEvent({
8507 |     type,
8508 |     payload,
8509 |   }: {
8510 |     type: string;
8511 |     payload: unknown;
8512 |   }): Promise<void>;
8513 | }
8514 | 
```
Page 9/9FirstPrevNextLast