diff --git a/src/content/docs/kv/concepts/kv-namespaces.mdx b/src/content/docs/kv/concepts/kv-namespaces.mdx index 43a2cb3f1708dd..7fae7c5a2848b4 100644 --- a/src/content/docs/kv/concepts/kv-namespaces.mdx +++ b/src/content/docs/kv/concepts/kv-namespaces.mdx @@ -5,6 +5,7 @@ sidebar: order: 7 --- +import { Type, MetaInfo } from "~/components"; A KV namespace is a key-value database replicated to Cloudflare’s global network. @@ -20,15 +21,15 @@ KV namespace IDs are public and bound to your account. To bind KV namespaces to your Worker, assign an array of the below object to the `kv_namespaces` key. -* `binding` string required +* `binding` * The binding name used to refer to the KV namespace. -* `id` string required +* `id` * The ID of the KV namespace. -* `preview_id` string optional +* `preview_id` * The ID of the KV namespace used during `wrangler dev`. diff --git a/src/content/docs/pages/functions/wrangler-configuration.mdx b/src/content/docs/pages/functions/wrangler-configuration.mdx index 85d1ab723c66e3..d64cb386b46a68 100644 --- a/src/content/docs/pages/functions/wrangler-configuration.mdx +++ b/src/content/docs/pages/functions/wrangler-configuration.mdx @@ -5,7 +5,7 @@ sidebar: order: 6 --- -import { Render, TabItem, Tabs } from "~/components"; +import { Render, TabItem, Tabs, Type, MetaInfo } from "~/components"; :::caution @@ -278,15 +278,15 @@ API_KEY = "6567875fvgt" Inheritable keys are configurable at the top-level, and can be inherited (or overridden) by environment-specific configuration. -- `name` string required +- `name` - The name of your Pages project. Alphanumeric and dashes only. -- `pages_build_output_dir` string required +- `pages_build_output_dir` - The path to your project's build output folder. For example: `./dist`. -- `compatibility_date` string required +- `compatibility_date` - A date in the form `yyyy-mm-dd`, which will be used to determine which version of the Workers runtime is used. Refer to [Compatibility dates](/workers/configuration/compatibility-dates/). @@ -294,7 +294,7 @@ Inheritable keys are configurable at the top-level, and can be inherited (or ove - A list of flags that enable features from upcoming features of the Workers runtime, usually used together with `compatibility_date`. Refer to [compatibility dates](/workers/configuration/compatibility-dates/). -- `send_metrics` boolean optional +- `send_metrics` - Whether Wrangler should send usage metrics to Cloudflare for this project. @@ -335,47 +335,47 @@ API_KEY = "8901234bfgd" This will work for local development, but will fail to validate when you try to deploy. -- `vars` object optional +- `vars` - A map of environment variables to set when deploying your Function. Refer to [Environment variables](/pages/functions/bindings/#environment-variables). -- `d1_databases` object optional +- `d1_databases` - A list of D1 databases that your Function should be bound to. Refer to [D1 databases](/pages/functions/bindings/#d1-databases). -- `durable_objects` object optional +- `durable_objects` - A list of Durable Objects that your Function should be bound to. Refer to [Durable Objects](/pages/functions/bindings/#durable-objects). -- `hyperdrive` object optional +- `hyperdrive` - Specifies Hyperdrive configs that your Function should be bound to. Refer to [Hyperdrive](/pages/functions/bindings/#r2-buckets). -- `kv_namespaces` object optional +- `kv_namespaces` - A list of KV namespaces that your Function should be bound to. Refer to [KV namespaces](/pages/functions/bindings/#kv-namespaces). -- `queues.producers` object optional +- `queues.producers` - Specifies Queues Producers that are bound to this Function. Refer to [Queues Producers](/queues/get-started/#4-set-up-your-producer-worker). -- `r2_buckets` object optional +- `r2_buckets` - A list of R2 buckets that your Function should be bound to. Refer to [R2 buckets](/pages/functions/bindings/#r2-buckets). -- `vectorize` object optional +- `vectorize` - A list of Vectorize indexes that your Function should be bound to. Refer to [Vectorize indexes](/vectorize/get-started/intro/#3-bind-your-worker-to-your-index). -- `services` object optional +- `services` - A list of service bindings that your Function should be bound to. Refer to [service bindings](/pages/functions/bindings/#service-bindings). -- `analytics_engine_datasets` object optional +- `analytics_engine_datasets` - Specifies analytics engine datasets that are bound to this Function. Refer to [Workers Analytics Engine](/analytics/analytics-engine/get-started/). -- `ai` object optional +- `ai` - Specifies an AI binding to this Function. Refer to [Workers AI](/pages/functions/bindings/#workers-ai). diff --git a/src/content/docs/pages/get-started/c3.mdx b/src/content/docs/pages/get-started/c3.mdx index b3716abe541449..65085069600c82 100644 --- a/src/content/docs/pages/get-started/c3.mdx +++ b/src/content/docs/pages/get-started/c3.mdx @@ -10,7 +10,7 @@ description: Use C3 (`create-cloudflare` CLI) to set up and deploy new deployment. --- -import { Render, TabItem, Tabs } from "~/components"; +import { Render, TabItem, Tabs, Type, MetaInfo } from "~/components"; Cloudflare provides a CLI command for creating new Workers and Pages projects — `npm create cloudflare`, powered by the [`create-cloudflare` package](https://www.npmjs.com/package/create-cloudflare). @@ -90,7 +90,7 @@ bun create cloudflare@latest [--] [] [OPTIONS] [-- ] -- `DIRECTORY` string optional +- `DIRECTORY` - The directory where the application should be created. The name of the application is taken from the directory name. @@ -98,7 +98,7 @@ bun create cloudflare@latest [--] [] [OPTIONS] [-- ] - CLI arguments to pass to eventual third party CLIs C3 might invoke (in the case of full-stack applications). -- `--category` string optional +- `--category` - The kind of templates that should be created. @@ -109,7 +109,7 @@ bun create cloudflare@latest [--] [] [OPTIONS] [-- ] - `demo`: Application Starter - `remote-template`: Template from a GitHub repo -- `--type` string optional +- `--type` - The type of application that should be created. @@ -123,7 +123,7 @@ bun create cloudflare@latest [--] [] [OPTIONS] [-- ] - `openapi`: A Worker implementing an OpenAPI REST endpoint. - `pre-existing`: Fetch a Worker initialized from the Cloudflare dashboard. -- `--framework` string optional +- `--framework` - The type of framework to use to create a web application (when using this option, `--type` is ignored). @@ -143,7 +143,7 @@ bun create cloudflare@latest [--] [] [OPTIONS] [-- ] - `svelte` - `vue` -- `--template` string optional +- `--template` - Create a new project via an external template hosted in a git repository @@ -194,13 +194,13 @@ bun create cloudflare@latest [--] [] [OPTIONS] [-- ] - Open with your browser the deployed application (this option is ignored if the application is not deployed). -- `--existing-script` string optional +- `--existing-script` - The name of an existing Cloudflare Workers script to clone locally. When using this option, `--type` is coerced to `pre-existing`. - When `--existing-script` is specified, `deploy` will be ignored. -- `-y`, `--accept-defaults` boolean optional +- `-y`, `--accept-defaults` - Use all the default C3 options each can also be overridden by specifying it. @@ -208,11 +208,11 @@ bun create cloudflare@latest [--] [] [OPTIONS] [-- ] - Automatically uses the latest version of C3. -- `-v`, `--version` boolean optional +- `-v`, `--version` - Show version number. -- `-h`, `--help` boolean optional +- `-h`, `--help` - Show a help message. diff --git a/src/content/docs/workers-ai/configuration/bindings.mdx b/src/content/docs/workers-ai/configuration/bindings.mdx index 4024b7115ae7f6..6fe530a57adc75 100644 --- a/src/content/docs/workers-ai/configuration/bindings.mdx +++ b/src/content/docs/workers-ai/configuration/bindings.mdx @@ -6,6 +6,8 @@ sidebar: --- +import { Type, MetaInfo } from "~/components"; + ## Workers [Workers](/workers/) provides a serverless execution environment that allows you to create new applications or augment existing ones. @@ -41,13 +43,13 @@ const answer = await env.AI.run('@cf/meta/llama-3.1-8b-instruct', { -* `model` string required +* `model` * The model to run. **Supported options** - * `stream` boolean optional + * `stream` * Returns a stream of results as they are available. diff --git a/src/content/docs/workers/configuration/multipart-upload-metadata.mdx b/src/content/docs/workers/configuration/multipart-upload-metadata.mdx index 205042e9afb825..374269d940a3eb 100644 --- a/src/content/docs/workers/configuration/multipart-upload-metadata.mdx +++ b/src/content/docs/workers/configuration/multipart-upload-metadata.mdx @@ -4,6 +4,8 @@ title: Multipart upload metadata --- +import { Type, MetaInfo } from "~/components"; + If you're using the [Workers Script Upload API](/api/operations/worker-script-upload-worker-module) or [Version Upload API](/api/operations/worker-versions-upload-version) directly, `multipart/form-data` uploads require you to specify a `metadata` part. This metadata defines the Worker's configuration in JSON format, analogue to the [wrangler.toml file](/workers/wrangler/configuration/). ## Sample `metadata` @@ -33,7 +35,7 @@ At a minimum, the `main_module` key is required to upload a Worker. -* `main_module` string required +* `main_module` * The part name that contains the module entry point of the Worker that will be executed. For example, `main.js`. @@ -41,12 +43,12 @@ At a minimum, the `main_module` key is required to upload a Worker. * [Bindings](#bindings) to expose in the Worker. -* `placement` object optional +* `placement` * [Smart placement](/workers/configuration/smart-placement/) object for the Worker. * `mode` field only supports `smart` for automatic placement. -* `compatibility_date` string optional +* `compatibility_date` * [Compatibility Date](/workers/configuration/compatibility-dates/#setting-compatibility-date) indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker. Highly recommended to set a `compatibility_date`, otherwise if on upload via the API, it defaults to the oldest compatibility date before any flags took effect (2021-11-02). @@ -54,7 +56,7 @@ At a minimum, the `main_module` key is required to upload a Worker. * [Compatibility Flags](/workers/configuration/compatibility-dates/#setting-compatibility-flags) that enable or disable certain features in the Workers runtime. Used to enable upcoming features or opt in or out of specific changes not included in a `compatibility_date`. -* `usage_model` string optional +* `usage_model` * Usage model to apply to invocations, only allowed value is `standard`. @@ -75,7 +77,7 @@ These attributes are **not available** for version uploads. * [Durable Objects migrations](/durable-objects/reference/durable-objects-migrations/) to apply. -* `logpush` boolean optional +* `logpush` * Whether [Logpush](/cloudflare-for-platforms/cloudflare-for-saas/hostname-analytics/#logpush) is turned on for the Worker. @@ -100,7 +102,7 @@ These attributes are **not available** for immediately deployed uploads. -* `annotations` object optional +* `annotations` * Annotations object specific to the Worker version. * `workers/message` specifies a custom message for the version. diff --git a/src/content/docs/workers/runtime-apis/request.mdx b/src/content/docs/workers/runtime-apis/request.mdx index 6b2769aece9951..fdd95875cf0a49 100644 --- a/src/content/docs/workers/runtime-apis/request.mdx +++ b/src/content/docs/workers/runtime-apis/request.mdx @@ -6,6 +6,8 @@ description: Interface that represents an HTTP request. --- +import { Type, MetaInfo } from "~/components"; + The [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request) interface represents an HTTP request and is part of the [Fetch API](/workers/runtime-apis/fetch/). ## Background @@ -66,7 +68,7 @@ An object containing properties that you want to apply to the request. * Cloudflare-specific properties that can be set on the `Request` that control how Cloudflare’s global network handles the request. -* `method` string optional +* `method` * The HTTP request method. The default is `GET`. In Workers, all [HTTP request methods](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods) are supported, except for [`CONNECT`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/CONNECT). @@ -79,7 +81,7 @@ An object containing properties that you want to apply to the request. * The request body, if any. * Note that a request using the GET or HEAD method cannot have a body. -* `redirect` string optional +* `redirect` * The redirect mode to use: `follow`, `error`, or `manual`. The default for a new `Request` object is `follow`. Note, however, that the incoming `Request` property of a `FetchEvent` will have redirect mode `manual`. @@ -98,16 +100,16 @@ Invalid or incorrectly-named keys in the `cf` object will be silently ignored. C -* `apps` boolean optional +* `apps` * Whether [Cloudflare Apps](https://www.cloudflare.com/apps/) should be enabled for this request. Defaults to `true`. -* `cacheEverything` boolean optional +* `cacheEverything` * Treats all content as static and caches all [file types](/cache/concepts/default-cache-behavior#default-cached-file-extensions) beyond the Cloudflare default cached content. Respects cache headers from the origin web server. This is equivalent to setting the Page Rule [**Cache Level** (to **Cache Everything**)](/rules/page-rules/reference/settings/). Defaults to `false`. This option applies to `GET` and `HEAD` request methods only. -* `cacheKey` string optional +* `cacheKey` * A request’s cache key is what determines if two requests are the same for caching purposes. If a request has the same cache key as some previous request, then Cloudflare can serve the same cached response for both. @@ -115,7 +117,7 @@ Invalid or incorrectly-named keys in the `cf` object will be silently ignored. C * This option appends additional [**Cache-Tag**](/cache/how-to/purge-cache/purge-by-tags/) headers to the response from the origin server. This allows for purges of cached content based on tags provided by the Worker, without modifications to the origin server. This is performed using the [**Purge by Tag**](/cache/how-to/purge-cache/purge-by-tags/#purge-using-cache-tags) feature, which is currently only available to Enterprise zones. If this option is used in a non-Enterprise zone, the additional headers will not be appended. -* `cacheTtl` number optional +* `cacheTtl` * This option forces Cloudflare to cache the response for this request, regardless of what headers are seen on the response. This is equivalent to setting two Page Rules: [**Edge Cache TTL**](/cache/how-to/edge-browser-cache-ttl/) and [**Cache Level** (to **Cache Everything**)](/rules/page-rules/reference/settings/). The value must be zero or a positive number. A value of `0` indicates that the cache asset expires immediately. This option applies to `GET` and `HEAD` request methods only. @@ -127,23 +129,23 @@ Invalid or incorrectly-named keys in the `cf` object will be silently ignored. C * Enables [Image Resizing](/images/transform-images/) for this request. The possible values are described in [Transform images via Workers](/images/transform-images/transform-via-workers/) documentation. -* `mirage` boolean optional +* `mirage` * Whether [Mirage](https://www.cloudflare.com/website-optimization/mirage/) should be enabled for this request, if otherwise configured for this zone. Defaults to `true`. -* `polish` string optional +* `polish` * Sets [Polish](https://blog.cloudflare.com/introducing-polish-automatic-image-optimizati/) mode. The possible values are `lossy`, `lossless` or `off`. -* `resolveOverride` string optional +* `resolveOverride` * Directs the request to an alternate origin server by overriding the DNS lookup. The value of `resolveOverride` specifies an alternate hostname which will be used when determining the origin IP address, instead of using the hostname specified in the URL. The `Host` header of the request will still match what is in the URL. Thus, `resolveOverride` allows a request to be sent to a different server than the URL / `Host` header specifies. However, `resolveOverride` will only take effect if both the URL host and the host specified by `resolveOverride` are within your zone. If either specifies a host from a different zone / domain, then the option will be ignored for security reasons. If you need to direct a request to a host outside your zone (while keeping the `Host` header pointing within your zone), first create a CNAME record within your zone pointing to the outside host, and then set `resolveOverride` to point at the CNAME record. Note that, for security reasons, it is not possible to set the `Host` header to specify a host outside of your zone unless the request is actually being sent to that host. -* `scrapeShield` boolean optional +* `scrapeShield` * Whether [ScrapeShield](https://blog.cloudflare.com/introducing-scrapeshield-discover-defend-dete/) should be enabled for this request, if otherwise configured for this zone. Defaults to `true`. -* `webp` boolean optional +* `webp` * Enables or disables [WebP](https://blog.cloudflare.com/a-very-webp-new-year-from-cloudflare/) image format in [Polish](/images/polish/). diff --git a/src/content/docs/workers/wrangler/api.mdx b/src/content/docs/workers/wrangler/api.mdx index a0bd2126fa2717..52ecf4e9c63bf9 100644 --- a/src/content/docs/workers/wrangler/api.mdx +++ b/src/content/docs/workers/wrangler/api.mdx @@ -9,7 +9,7 @@ description: A set of programmatic APIs that can be integrated with local --- -import { Render, TabItem, Tabs } from "~/components" +import { Render, TabItem, Tabs, Type, MetaInfo } from "~/components" Wrangler offers APIs to programmatically interact with your Cloudflare Workers. @@ -48,7 +48,7 @@ const worker = await unstable_dev(script, options) * A string containing a path to your Worker script, relative to your Worker project's root directory. -* `options` object optional +* `options` * Optional options object containing `wrangler dev` configuration settings. * Include an `experimental` object inside `options` to access experimental features such as `disableExperimentalWarning`. @@ -257,7 +257,7 @@ const platform = await getPlatformProxy(options); -* `options` object optional +* `options` * Optional options object containing preferences for the bindings: diff --git a/src/content/docs/workers/wrangler/commands.mdx b/src/content/docs/workers/wrangler/commands.mdx index d1e65300ade0e0..a64c1adb150719 100644 --- a/src/content/docs/workers/wrangler/commands.mdx +++ b/src/content/docs/workers/wrangler/commands.mdx @@ -7,7 +7,7 @@ head: description: Create, develop, and deploy your Cloudflare Workers with Wrangler commands. --- -import { TabItem, Tabs, Render } from "~/components"; +import { TabItem, Tabs, Render, Type, MetaInfo } from "~/components"; Wrangler offers a number of commands to manage your Cloudflare Workers. @@ -45,13 +45,13 @@ Wrangler offers a number of commands to manage your Cloudflare Workers. The following global flags work on every command, with some exceptions for `pages` commands. -- `--help` boolean +- `--help` - Show help. -- `--version` boolean +- `--version` - Show version number. -- `--config` string (not supported by Pages) +- `--config` (not supported by Pages) - Path to `.toml` configuration file. -- `--experimental-json-config` boolean (not supported by Pages) +- `--experimental-json-config` (not supported by Pages) - ⚠️ This is an experimental command. Read configuration from a `wrangler.json` file, instead of `wrangler.toml`. `wrangler.json` is a [JSONC](https://code.visualstudio.com/docs/languages/json#_json-with-comments) file. ::: @@ -133,7 +133,7 @@ Open the Cloudflare developer documentation in your default browser. wrangler docs [] ``` -- `COMMAND` string optional +- `COMMAND` - The Wrangler command you want to learn more about. This opens your default browser to the section of the documentation that describes the command. ## `init` @@ -144,11 +144,11 @@ Create a new project via the [create-cloudflare-cli (C3) tool](/workers/get-star wrangler init [] [OPTIONS] ``` -- `NAME` string optional (default: name of working directory) +- `NAME` - The name of the Workers project. This is both the directory name and `name` property in the generated `wrangler.toml` [configuration](/workers/wrangler/configuration/) file. -- `--yes` boolean optional +- `--yes` - Answer yes to any prompts for new projects. -- `--from-dash` string optional +- `--from-dash` - Fetch a Worker initialized from the dashboard. This is done by passing the flag and the Worker name. `wrangler init --from-dash `. - The `--from-dash` command will not automatically sync changes made to the dashboard after the command is used. Therefore, it is recommended that you continue using the CLI. @@ -168,9 +168,9 @@ Create a new project using an existing [Workers template](https://github.com/clo wrangler generate [] [TEMPLATE] ``` -- `NAME` string optional (default: name of working directory) +- `NAME` - The name of the Workers project. This is both the directory name and `name` property in the generated `wrangler.toml` [configuration](/workers/wrangler/configuration/) file. -- `TEMPLATE` string optional +- `TEMPLATE` - The URL of a GitHub template, with a default [worker-template](https://github.com/cloudflare/worker-template). Browse a list of available templates on the [cloudflare/workers-sdk](https://github.com/cloudflare/workers-sdk/tree/main/templates#usage) repository. --- @@ -192,9 +192,9 @@ Creates a new D1 database, and provides the binding and UUID that you will put i wrangler d1 create [OPTIONS] ``` -- `DATABASE_NAME` string required +- `DATABASE_NAME` - The name of the new D1 database. -- `--location` string optional +- `--location` - Provide an optional [location hint](/d1/configuration/data-location/) for your database leader. - Available options include `weur` (Western Europe), `eeur` (Eastern Europe), `apac` (Asia Pacific), `oc` (Oceania), `wnam` (Western North America), and `enam` (Eastern North America). @@ -206,9 +206,9 @@ Get information about a D1 database, including the current database size and sta wrangler d1 info [OPTIONS] ``` -- `DATABASE_NAME` string required +- `DATABASE_NAME` - The name of the D1 database to get information about. -- `--json` boolean optional +- `--json` - Return output as JSON rather than a table. ### `list` @@ -219,7 +219,7 @@ List all D1 databases in your account. wrangler d1 list [OPTIONS] ``` -- `--json` boolean optional +- `--json` - Return output as JSON rather than a table. ### `delete` @@ -230,9 +230,9 @@ Delete a D1 database. wrangler d1 delete [OPTIONS] ``` -- `DATABASE_NAME` string required +- `DATABASE_NAME` - The name of the D1 database to delete. -- `-y, --skip-confirmation` boolean optional +- `-y, --skip-confirmation` - Skip deletion confirmation prompt. ### `execute` @@ -249,25 +249,25 @@ You must provide either `--command` or `--file` for this command to run successf ::: -- `DATABASE_NAME` string required +- `DATABASE_NAME` - The name of the D1 database to execute a query on. -- `--command` string optional +- `--command` - The SQL query you wish to execute. -- `--file` string optional +- `--file` - Path to the SQL file you wish to execute. -- `-y, --yes` boolean optional +- `-y, --yes` - Answer `yes` to any prompts. -- `--local` boolean(default: true) optional +- `--local` - Execute commands/files against a local database for use with [wrangler dev](#dev). -- `--remote` boolean (default: false) optional +- `--remote` - Execute commands/files against a remote D1 database for use with [wrangler dev --remote](#dev). -- `--persist-to` string optional +- `--persist-to` - Specify directory to use for local persistence (for use in combination with `--local`). -- `--json` boolean optional +- `--json` - Return output as JSON rather than a table. -- `--preview` boolean optional +- `--preview` - Execute commands/files against a preview D1 database (as defined by `preview_database_id` in [Wrangler.toml](/workers/wrangler/configuration/#d1-databases)). -- `--batch-size` number optional +- `--batch-size` - Number of queries to send in a single batch. ### `export` @@ -285,17 +285,17 @@ Export a D1 database or table's schema and/or content to a `.sql` file. wrangler d1 export [OPTIONS] ``` -- `DATABASE_NAME` string required +- `DATABASE_NAME` - The name of the D1 database to export. -- `--remote` boolean (default: false) optional +- `--remote` - Execute commands/files against a remote D1 database for use with [wrangler dev --remote](#dev). -- `--output` string optional +- `--output` - Path to the SQL file for your export. -- `--table` string optional +- `--table` - The name of the table within a D1 database to export. -- `--no-data` boolean (default: false) optional +- `--no-data` - Controls whether export SQL file contains database data. Note that `--no-data=true` is not recommended due to a known wrangler limitation that intreprets the value as false. -- `--no-schema` boolean (default: false) optional +- `--no-schema` - Controls whether export SQL file contains database schema. Note that `--no-schema=true` is not recommended due to a known wrangler limitation that intreprets the value as false. ### `time-travel restore` @@ -306,13 +306,13 @@ Restore a database to a specific point-in-time using [Time Travel](/d1/reference wrangler d1 time-travel restore [OPTIONS] ``` -- `DATABASE_NAME` string required +- `DATABASE_NAME` - The name of the D1 database to execute a query on. -- `--bookmark` string optional +- `--bookmark` - A D1 bookmark representing the state of a database at a specific point in time. -- `--timestamp` string optional +- `--timestamp` - A UNIX timestamp or JavaScript date-time `string` within the last 30 days. -- `--json` boolean optional +- `--json` - Return output as JSON rather than a table. ### `time-travel info` @@ -323,11 +323,11 @@ Inspect the current state of a database for a specific point-in-time using [Time wrangler d1 time-travel info [OPTIONS] ``` -- `DATABASE_NAME` string required +- `DATABASE_NAME` - The name of the D1 database to execute a query on. -- `--timestamp` string optional +- `--timestamp` - A UNIX timestamp or JavaScript date-time `string` within the last 30 days. -- `--json` boolean optional +- `--json` b - Return output as JSON rather than a table. ### `backup create` @@ -345,7 +345,7 @@ Initiate a D1 backup. wrangler d1 backup create ``` -- `DATABASE_NAME` string required +- `DATABASE_NAME` - The name of the D1 database to backup. ### `backup list` @@ -363,7 +363,7 @@ List all available backups. wrangler d1 backup list ``` -- `DATABASE_NAME` string required +- `DATABASE_NAME` - The name of the D1 database to list the backups of. ### `backup restore` @@ -381,9 +381,9 @@ Restore a backup into a D1 database. wrangler d1 backup restore ``` -- `DATABASE_NAME` string required +- `DATABASE_NAME` - The name of the D1 database to restore the backup into. -- `BACKUP_ID` string required +- `BACKUP_ID` - The ID of the backup you wish to restore. ### `backup download` @@ -401,11 +401,11 @@ Download existing data to your local machine. wrangler d1 backup download ``` -- `DATABASE_NAME` string required +- `DATABASE_NAME` - The name of the D1 database you wish to download the backup of. -- `BACKUP_ID` string required +- `BACKUP_ID` - The ID of the backup you wish to download. -- `--output` string optional +- `--output` - The `.sqlite3` file to write to (defaults to `'..sqlite3'`). ### `migrations create` @@ -422,9 +422,9 @@ The filename will include a version number and the migration name you specify be wrangler d1 migrations create ``` -- `DATABASE_NAME` string required +- `DATABASE_NAME` - The name of the D1 database you wish to create a migration for. -- `MIGRATION_NAME` string required +- `MIGRATION_NAME` - A descriptive name for the migration you wish to create. ### `migrations list` @@ -435,13 +435,13 @@ View a list of unapplied migration files. wrangler d1 migrations list [OPTIONS] ``` -- `DATABASE_NAME` string required +- `DATABASE_NAME` - The name of the D1 database you wish to list unapplied migrations for. -- `--local` boolean optional +- `--local` - Show the list of unapplied migration files on your locally persisted D1 database. -- `--persist-to` string optional +- `--persist-to` - Specify directory to use for local persistence (for use in combination with `--local`). -- `--preview` boolean optional +- `--preview` - Show the list of unapplied migration files on your preview D1 database (as defined by `preview_database_id` in [`wrangler.toml`](/workers/wrangler/configuration/#d1-databases)). ### `migrations apply` @@ -460,17 +460,17 @@ If applying a migration results in an error, this migration will be rolled back, wrangler d1 migrations apply [OPTIONS] ``` -- `DATABASE_NAME` string required +- `DATABASE_NAME` - The name of the D1 database you wish to apply your migrations on. -- `--local` boolean (default: true)optional +- `--local` - Execute any unapplied migrations on your locally persisted D1 database. -- `--remote` boolean (default: false) optional +- `--remote` - Execute any unapplied migrations on your remote D1 database. -- `--persist-to` string optional +- `--persist-to` - Specify directory to use for local persistence (for use in combination with `--local`). -- `--preview` boolean optional +- `--preview` - Execute any unapplied migrations on your preview D1 database (as defined by `preview_database_id` in [`wrangler.toml`](/workers/wrangler/configuration/#d1-databases)). -- `--batch-size` number optional +- `--batch-size` - Number of queries to send in a single batch. --- @@ -500,15 +500,15 @@ Creates a new vector index, and provides the binding and name that you will put npx wrangler vectorize create [--dimensions=] [--metric=] [--description=] ``` -- `INDEX_NAME` string required +- `INDEX_NAME` - The name of the new index to create. Must be unique for an account and cannot be changed after creation or reused after the deletion of an index. -- `--dimensions` number required +- `--dimensions` - The vector dimension width to configure the index for. Cannot be changed after creation. -- `--metric` string required +- `--metric` - The distance metric to use for calculating vector distance. Must be one of `cosine`, `euclidean`, or `dot-product`. -- `--description` string optional +- `--description` - A description for your index. -- `--deprecated-v1` boolean optional +- `--deprecated-v1` - Create a legacy Vectorize index. Please note that legacy Vectorize indexes are on a [deprecation path](/vectorize/reference/transition-vectorize-legacy). ### `list` @@ -519,7 +519,7 @@ List all Vectorize indexes in your account, including the configured dimensions npx wrangler vectorize list ``` -- `--deprecated-v1` boolean optional +- `--deprecated-v1` - List legacy Vectorize indexes. Please note that legacy Vectorize indexes are on a [deprecation path](/vectorize/reference/transition-vectorize-legacy). ### `get` @@ -530,9 +530,9 @@ Get details about an individual index, including its configuration. npx wrangler vectorize get ``` -- `INDEX_NAME` string required +- `INDEX_NAME` - The name of the index to fetch details for. -- `--deprecated-v1` boolean optional +- `--deprecated-v1` - Get a legacy Vectorize index. Please note that legacy Vectorize indexes are on a [deprecation path](/vectorize/reference/transition-vectorize-legacy). ### `info` @@ -543,7 +543,7 @@ Get some additional information about an individual index, including the vector npx wrangler vectorize info ``` -- `INDEX_NAME` string required +- `INDEX_NAME` - The name of the index to fetch details for. ### `delete` @@ -554,11 +554,11 @@ Delete a Vectorize index. npx wrangler vectorize delete [OPTIONS] ``` -- `INDEX_NAME` string required +- `INDEX_NAME` - The name of the Vectorize index to delete. -- `--force` boolean optional +- `--force` - Skip confirmation when deleting the index (Note: This is not a recoverable operation). -- `--deprecated-v1` boolean optional +- `--deprecated-v1` - Delete a legacy Vectorize index. Please note that legacy Vectorize indexes are on a [deprecation path](/vectorize/reference/transition-vectorize-legacy). ### `insert` @@ -569,13 +569,13 @@ Insert vectors into an index. npx wrangler vectorize insert [OPTIONS] ``` -- `INDEX_NAME` string required +- `INDEX_NAME` - The name of the Vectorize index to upsert vectors in. -- `--file` string required +- `--file` - A file containing the vectors to insert in newline-delimited JSON (JSON) format. -- `--batch-size` number optional +- `--batch-size` - The number of vectors to insert at a time (default: `1000`). -- `--deprecated-v1` boolean optional +- `--deprecated-v1` - Insert into a legacy Vectorize index. Please note that legacy Vectorize indexes are on a [deprecation path](/vectorize/reference/transition-vectorize-legacy). ### `upsert` @@ -586,11 +586,11 @@ Upsert vectors into an index. Existing vectors in the index would be overwritten npx wrangler vectorize upsert [OPTIONS] ``` -- `INDEX_NAME` string required +- `INDEX_NAME` - The name of the Vectorize index to upsert vectors in. -- `--file` string required +- `--file` - A file containing the vectors to insert in newline-delimited JSON (JSON) format. -- `--batch-size` number optional +- `--batch-size` - The number of vectors to insert at a time (default: `5000`). ### `query` @@ -601,19 +601,19 @@ Query a Vectorize index for similar vectors. npx wrangler vectorize query [OPTIONS] ``` -- `INDEX_NAME` string required +- `INDEX_NAME` - The name of the Vectorize index to query. -- `--vector` array required +- `--vector` - Vector against which the Vectorize index is queried. -- `--top-k` number optional +- `--top-k` - The number of vectors to query (default: `5`). -- `--return-values` boolean optional +- `--return-values` - Enable to return vector values in the response (default: `false`). -- `--return-metadata` string optional +- `--return-metadata` - Enable to return vector metadata in the response. Must be one of `none`, `indexed`, or `all` (default: `none`). -- `--namespace` string optional +- `--namespace` - Query response to only include vectors from this namespace. -- `--filter` string optional +- `--filter` - Filter vectors based on this metadata filter. Example: `'{ 'p1': 'abc', 'p2': { '$ne': true }, 'p3': 10, 'p4': false, 'nested.p5': 'abcd' }'` ### `get-vectors` @@ -624,9 +624,9 @@ Fetch vectors from a Vectorize index using the provided ids. npx wrangler vectorize get-vectors [OPTIONS] ``` -- `INDEX_NAME` string required +- `INDEX_NAME` - The name of the Vectorize index from which vectors need to be fetched. -- `--ids` array required +- `--ids` - List of ids for which vectors must be fetched. ### `delete-vectors` @@ -637,9 +637,9 @@ Delete vectors in a Vectorize index using the provided ids. npx wrangler vectorize delete-vectors [OPTIONS] ``` -- `INDEX_NAME` string required +- `INDEX_NAME` - The name of the Vectorize index from which vectors need to be deleted. -- `--ids` array required +- `--ids` - List of ids corresponding to the vectors that must be deleted. ### `create-metadata-index` @@ -650,11 +650,11 @@ Enable metadata filtering on the specified property. npx wrangler vectorize create-metadata-index [OPTIONS] ``` -- `INDEX_NAME` string required +- `INDEX_NAME` - The name of the Vectorize index for which metadata index needs to be created. -- `--property-name` string required +- `--property-name` - Metadata property for which metadata filtering should be enabled. -- `--type` string required +- `--type` - Data type of the property. Must be one of `string`, `number`, or `boolean`. ### `list-metadata-index` @@ -665,7 +665,7 @@ List metadata properties on which metadata filtering is enabled. npx wrangler vectorize list-metadata-index [OPTIONS] ``` -- `INDEX_NAME` string required +- `INDEX_NAME` - The name of the Vectorize index for which metadata indexes needs to be fetched. ### `delete-metadata-index` @@ -676,9 +676,9 @@ Disable metadata filtering on the specified property. npx wrangler vectorize delete-metadata-index [OPTIONS] ``` -- `INDEX_NAME` string required +- `INDEX_NAME` - The name of the Vectorize index for which metadata index needs to be disabled. -- `--property-name` string required +- `--property-name` - Metadata property for which metadata filtering should be disabled. --- @@ -703,78 +703,78 @@ As of Wrangler v3.2.0, `wrangler dev` is supported by any Linux distributions pr ::: -- `SCRIPT` string +- `SCRIPT` - The path to an entry point for your Worker. Only required if your `wrangler.toml` does not include a `main` key (for example, `main = "index.js"`). -- `--name` string optional +- `--name` - Name of the Worker. -- `--no-bundle` boolean (default: false) optional +- `--no-bundle` - Skip Wrangler's build steps. Particularly useful when using custom builds. Refer to [Bundling](https://developers.cloudflare.com/workers/wrangler/bundling/) for more information. -- `--env` string optional +- `--env` - Perform on a specific environment. -- `--compatibility-date` string optional +- `--compatibility-date` - A date in the form yyyy-mm-dd, which will be used to determine which version of the Workers runtime is used. -- `--compatibility-flags`, `--compatibility-flag` string\[] optional +- `--compatibility-flags`, `--compatibility-flag` - Flags to use for compatibility checks. -- `--latest` boolean (default: true) optional +- `--latest` - Use the latest version of the Workers runtime. -- `--ip` string optional +- `--ip` - IP address to listen on, defaults to `localhost`. -- `--port` number optional +- `--port` - Port to listen on. -- `--inspector-port` number optional +- `--inspector-port` - Port for devtools to connect to. -- `--routes`, `--route` string\[] optional +- `--routes`, `--route` - Routes to upload. - For example: `--route example.com/*`. -- `--host` string optional +- `--host` - Host to forward requests to, defaults to the zone of project. -- `--local-protocol` "http"|"https" (default: http) optional +- `--local-protocol` - Protocol to listen to requests on. -- `--https-key-path` string optional +- `--https-key-path` - Path to a custom certificate key. -- `--https-cert-path` string optional +- `--https-cert-path` - Path to a custom certificate. -- `--local-upstream` string optional +- `--local-upstream` - Host to act as origin in local mode, defaults to `dev.host` or route. -- `--legacy-assets` string optional experimental +- `--legacy-assets` - Root folder of static assets to be served. - Use in combination with `--name` and `--latest` for basic static file hosting. For example: `wrangler dev --name personal_blog --legacy-assets dist/ --latest`. -- `--assets` string optional experimental +- `--assets` - Root folder of static assets to be served. :::caution This is an experimental feature and its behavior will be changing soon. Use `--legacy-assets` instead to ensure that you get consistent behavior when this option changes. ::: -- `--site` string optional +- `--site` - Root folder of static assets for Workers Sites. -- `--site-include` string\[] optional +- `--site-include` - Array of `.gitignore`-style patterns that match file or directory names from the sites directory. Only matched items will be uploaded. -- `--site-exclude` string\[] optional +- `--site-exclude` - Array of `.gitignore`-style patterns that match file or directory names from the sites directory. Matched items will not be uploaded. -- `--upstream-protocol` "http"|"https" (default: https) optional +- `--upstream-protocol` - Protocol to forward requests to host on. -- `--var` key:value\[] optional +- `--var` - Array of `key:value` pairs to inject as variables into your code. The value will always be passed as a string to your Worker. - For example, `--var git_hash:$(git rev-parse HEAD) test:123` makes the `git_hash` and `test` variables available in your Worker's `env`. - This flag is an alternative to defining [`vars`](/workers/wrangler/configuration/#non-inheritable-keys) in your `wrangler.toml`. If defined in both places, this flag's values will be used. -- `--define` key:value\[] optional +- `--define` - Array of `key:value` pairs to replace global identifiers in your code. - For example, `--define GIT_HASH:$(git rev-parse HEAD)` will replace all uses of `GIT_HASH` with the actual value at build time. - This flag is an alternative to defining [`define`](/workers/wrangler/configuration/#non-inheritable-keys) in your `wrangler.toml`. If defined in both places, this flag's values will be used. -- `--tsconfig` string optional +- `--tsconfig` - Path to a custom `tsconfig.json` file. -- `--minify` boolean optional +- `--minify` - Minify the Worker. -- `--node-compat` boolean optional +- `--node-compat` - Enable Node.js compatibility. -- `--persist-to` string optional +- `--persist-to` - Specify directory to use for local persistence. -- `--remote` boolean (default: false) optional +- `--remote` - Develop against remote resources and data stored on Cloudflare's network. -- `--test-scheduled` boolean (default: false) optional +- `--test-scheduled` - Exposes a `/__scheduled` fetch route which will trigger a scheduled event (Cron Trigger) for testing during development. To simulate different cron patterns, a `cron` query parameter can be passed in: `/__scheduled?cron=*+*+*+*+*`. -- `--log-level` "debug"|"info"|"log"|"warn"|"error"|"none" (default: log) optional +- `--log-level` - Specify Wrangler's logging level. -- `--show-interactive-dev-session` boolean (default: true if the terminal supports interactivity) optional +- `--show-interactive-dev-session` - Show the interactive dev session. - `--alias` `Array` - Specify modules to alias using [module aliasing](/workers/wrangler/configuration/#module-aliasing). @@ -797,61 +797,61 @@ None of the options for this command are required. Also, many can be set in your ::: -- `SCRIPT` string +- `SCRIPT` - The path to an entry point for your Worker. Only required if your `wrangler.toml` does not include a `main` key (for example, `main = "index.js"`). -- `--name` string optional +- `--name` - Name of the Worker. -- `--no-bundle` boolean (default: false) optional +- `--no-bundle` - Skip Wrangler's build steps. Particularly useful when using custom builds. Refer to [Bundling](https://developers.cloudflare.com/workers/wrangler/bundling/) for more information. -- `--env` string optional +- `--env` - Perform on a specific environment. -- `--outdir` string optional +- `--outdir` - Path to directory where Wrangler will write the bundled Worker files. -- `--compatibility-date` string optional +- `--compatibility-date` - A date in the form yyyy-mm-dd, which will be used to determine which version of the Workers runtime is used. -- `--compatibility-flags`, `--compatibility-flag` string\[] optional +- `--compatibility-flags`, `--compatibility-flag` - Flags to use for compatibility checks. -- `--latest` boolean (default: true) optional +- `--latest` - Use the latest version of the Workers runtime. -- `--legacy-assets` string optional experimental +- `--legacy-assets` - Root folder of static assets to be served. - Use in combination with `--name` and `--latest` for basic static file hosting. For example: `wrangler dev --name personal_blog --legacy-assets dist/ --latest`. -- `--assets` string optional experimental +- `--assets` - Root folder of static assets to be served. :::caution This is an experimental feature and its behavior will be changing soon. Use `--legacy-assets` instead to ensure that you get consistent behavior when this option changes. ::: -- `--site` string optional +- `--site` - Root folder of static assets for Workers Sites. -- `--site-include` string\[] optional +- `--site-include` - Array of `.gitignore`-style patterns that match file or directory names from the sites directory. Only matched items will be uploaded. -- `--site-exclude` string\[] optional +- `--site-exclude` - Array of `.gitignore`-style patterns that match file or directory names from the sites directory. Matched items will not be uploaded. -- `--var` key:value\[] optional +- `--var` - Array of `key:value` pairs to inject as variables into your code. The value will always be passed as a string to your Worker. - For example, `--var git_hash:$(git rev-parse HEAD) test:123` makes the `git_hash` and `test` variables available in your Worker's `env`. - This flag is an alternative to defining [`vars`](/workers/wrangler/configuration/#non-inheritable-keys) in your `wrangler.toml`. If defined in both places, this flag's values will be used. -- `--define` key:value\[] optional +- `--define` - Array of `key:value` pairs to replace global identifiers in your code. - For example, `--define GIT_HASH:$(git rev-parse HEAD)` will replace all uses of `GIT_HASH` with the actual value at build time. - This flag is an alternative to defining [`define`](/workers/wrangler/configuration/#non-inheritable-keys) in your `wrangler.toml`. If defined in both places, this flag's values will be used. -- `--triggers`, `--schedule`, `--schedules` string\[] optional +- `--triggers`, `--schedule`, `--schedules` - Cron schedules to attach to the deployed Worker. Refer to [Cron Trigger Examples](/workers/configuration/cron-triggers/#examples). - `--routes`, `--route` string\[] optional - Routes where this Worker will be deployed. - For example: `--route example.com/*`. -- `--tsconfig` string optional +- `--tsconfig` - Path to a custom `tsconfig.json` file. -- `--minify` boolean optional +- `--minify` - Minify the bundled Worker before deploying. -- `--node-compat` boolean optional +- `--node-compat` - Enable node.js compatibility. -- `--dry-run` boolean (default: false) optional +- `--dry-run` - Compile a project without actually deploying to live servers. Combined with `--outdir`, this is also useful for testing the output of `npx wrangler deploy`. It also gives developers a chance to upload our generated sourcemap to a service like Sentry, so that errors from the Worker can be mapped against source code, but before the service goes live. -- `--keep-vars` boolean (default: false) optional +- `--keep-vars` - It is recommended best practice to treat your Wrangler developer environment as a source of truth for your Worker configuration, and avoid making changes via the Cloudflare dashboard. - If you change your environment variables or bindings in the Cloudflare dashboard, Wrangler will override them the next time you deploy. If you want to disable this behaviour set `keep-vars` to `true`. -- `--dispatch-namespace` string optional +- `--dispatch-namespace` - Specify the [Workers for Platforms dispatch namespace](/cloudflare-for-platforms/workers-for-platforms/get-started/configuration/#2-create-a-dispatch-namespace) to upload this Worker to. --- @@ -880,13 +880,13 @@ Delete your Worker and all associated Cloudflare developer platform resources. wrangler delete [