Wrangler to cf reference·续1
</details>
<details>
<summary>Counter: exports.durableObject({ storage: "sqlite" }), (durableObject, storage reference)</summary>
<code>durableObject</code>Builder<a href="#durable-object-tombstones-exports-durableobject-created">Link to durableObject</a>
<code>durableObject<TContainer extends ContainerDefinition | undefined = undefined>(options: DurableObjectCreatedExportOptions<TContainer>): DurableObjectCreatedExport<TContainer>;</code>
Declares a Durable Object class defined by this Worker. For more information about Durable Objects, see the documentation at <a href="https://developers.cloudflare.com/workers/learning/using-durable-objects">https://developers.cloudflare.com/workers/learning/using-durable-objects</a> For reference, see <a href="https://developers.cloudflare.com/workers/wrangler/configuration/#durable-objects">https://developers.cloudflare.com/workers/wrangler/configuration/#durable-objects</a>
<details>
<summary>Options (4)</summary>
<dl>
<dt><code>state?: "created"</code></dt> <dd></dd>
<dt><code>storage: "sqlite"</code></dt> <dd>Selects the SQLite-backed storage engine (recommended for new classes).</dd>
<dt><code>container?: TContainer</code></dt> <dd>Attach a Container application to this Durable Object by config reference.</dd>
<dt><code>storage: "legacy-kv"</code></dt> <dd>Selects the legacy key-value storage engine.</dd></dl></details>
<code>storage</code>Required<a href="#durable-object-tombstones-exports-durableobject-created">Link to storage</a>
<code>storage: "sqlite" | "legacy-kv"</code>
Selects the SQLite-backed storage engine (recommended for new classes). Selects the legacy key-value storage engine.
</details>
<details>
<summary>OldCounter: exports.durableObject({ (durableObject reference)</summary>
<code>durableObject</code>Builder<a href="#durable-object-tombstones-exports-durableobject-renamed">Link to durableObject</a>
<code>durableObject(options: DurableObjectRenamedExportOptions): DurableObjectRenamedExport;</code>
Rename a provisioned Durable Object namespace's class.
<details>
<summary>Options (2)</summary>
<dl>
<dt><code>state: "renamed"</code></dt> <dd></dd>
<dt><code>renamedTo: string</code></dt> <dd>The destination class name. Must be a valid JavaScript identifier and must appear as a live (<code>state: "created"</code>) <code>durableObject</code> entry in the same <code>exports</code> map.</dd></dl></details>
</details>
<details>
<summary>state: "renamed", (state reference)</summary>
<code>state</code>Required<a href="#durable-object-tombstones-exports-durableobject-renamed-state">Link to state</a>
<code>state: "renamed"</code>
The type definition does not include a description.
</details>
<details>
<summary>renamedTo: "Counter", (renamedTo reference)</summary>
<code>renamedTo</code>Required<a href="#durable-object-tombstones-exports-durableobject-renamed-renamedto">Link to renamedTo</a>
<code>renamedTo: string</code>
The destination class name. Must be a valid JavaScript identifier and must appear as a live (<code>state: "created"</code>) <code>durableObject</code> entry in the same <code>exports</code> map.
</details>
}),
<details>
<summary>UnusedCounter: exports.durableObject({ state: "deleted" }), (durableObject, state reference)</summary>
<code>durableObject</code>Builder<a href="#durable-object-tombstones-exports-durableobject-deleted">Link to durableObject</a>
<code>durableObject(options: DurableObjectDeletedExportOptions): DurableObjectDeletedExport;</code>
Retire a provisioned Durable Object namespace whose class has been removed from code.
<details>
<summary>Options (1)</summary>
<dl>
<dt><code>state: "deleted"</code></dt> <dd></dd>
</dl></details>
<code>state</code>Required<a href="#durable-object-tombstones-exports-durableobject-deleted">Link to state</a>
<code>state: "deleted"</code>
The type definition does not include a description.
</details>
},
},
});
Keep a tombstone until a deployment response reports that it is stale, then remove it. Use cf deploy, rather than a version upload, for a version that creates, deletes, renames, or transfers a Durable Object class. You cannot roll back a Durable Object lifecycle change to a version from before the change.
For transfers between Workers and the full list of states, refer to Manage Durable Object lifecycle.
Complete example
This example finishes the migration of orders-api, the Worker used in Migrate a Wrangler project. It has a D1 database, a queue, a cron trigger, a route, and a Durable Object. After cf migrate and the follow-up steps, cloudflare.config.ts is:
Select a highlighted line to show its type and description below it.
cloudflare.config.ts
Expand allCopy
import { bindings, defineConfig, exports, triggers } from "cf/config";
import * as entrypoint from "./src/index.ts" with { type: "cf-worker" };
type Job = { orderId: string };
<details>
<summary>export default defineConfig({ (defineConfig reference)</summary>
<code>defineConfig</code>Function<a href="#orders-api-config-defineconfig">Link to defineConfig</a>
<code>defineConfig<T extends ConfigInput<CloudflareConfig>>(config: T): T;</code>
Defines the default export of <code>cloudflare.config.ts</code>. Pass a configuration object, a promise that resolves to one, or a function that receives the config context (<code>isPreview</code> and <code>mode</code>) and returns either.
<details>
<summary>Options (4)</summary>
<dl>
<dt><code>accountId?: string</code></dt> <dd>This is the ID of the account associated with your zone. It can also be specified through the <code>CLOUDFLARE_ACCOUNT_ID</code> environment variable.</dd>
<dt><code>complianceRegion?: "public" | "fedramp-high"</code></dt> <dd>The compliance boundary in which commands should operate. When omitted, this can be supplied through <code>CLOUDFLARE_COMPLIANCE_REGION</code>.</dd>
<dt><code>worker?: ConfigInput<WorkerConfig></code></dt> <dd>The Worker defined by this configuration.</dd>
<dt><code>containers?: ConfigInput<ContainerConfig>[]</code></dt> <dd>Container applications defined by this configuration.</dd></dl></details>
</details>
<details>
<summary>accountId: "<ACCOUNT_ID>", (accountId reference)</summary>
<code>accountId</code>Optional<a href="#orders-api-config-settings-accountid">Link to accountId</a>
<code>accountId?: string</code>
This is the ID of the account associated with your zone. It can also be specified through the <code>CLOUDFLARE_ACCOUNT_ID</code> environment variable.
</details>
<details>
<summary>worker: { (worker reference)</summary>
<code>worker</code>Optional<a href="#orders-api-config-cloudflareconfig-worker">Link to worker</a>
<code>worker?: ConfigInput<WorkerConfig></code>
The Worker defined by this configuration.
</details>
<details>
<summary>name: "orders-api", (name reference)</summary>
<code>name</code>Required<a href="#orders-api-config-workerconfig-name">Link to name</a>
<code>name: string</code>
The name of your Worker.
</details>
<details>
<summary>entrypoint, (entrypoint reference)</summary>
<code>entrypoint</code>Optional<a href="#orders-api-config-workerconfig-entrypoint">Link to entrypoint</a>
<code>entrypoint?: string | WorkerModule</code>
The entrypoint module that will be executed. May be either a path string (e.g. <code>"./src/index.ts"</code>) or a module namespace imported with the <code>cf-worker</code> import attribute.
</details>
<details>
<summary>compatibilityDate: "2026-08-24", (compatibilityDate reference)</summary>
<code>compatibilityDate</code>Required<a href="#orders-api-config-workerconfig-compatibilitydate">Link to compatibilityDate</a>
<code>compatibilityDate: string</code>
A date in the form yyyy-mm-dd, which will be used to determine which version of the Workers runtime is used. More details at <a href="https://developers.cloudflare.com/workers/configuration/compatibility-dates">https://developers.cloudflare.com/workers/configuration/compatibility-dates</a>
</details>
<details>
<summary>compatibilityFlags: ["nodejs_compat"], (compatibilityFlags reference)</summary>
<code>compatibilityFlags</code>Optional<a href="#orders-api-config-workerconfig-compatibilityflags">Link to compatibilityFlags</a>
<code>compatibilityFlags?: string[]</code>
A list of flags that enable features from upcoming features of the Workers runtime, usually used together with <code>compatibilityDate</code>. More details at <a href="https://developers.cloudflare.com/workers/configuration/compatibility-flags/">https://developers.cloudflare.com/workers/configuration/compatibility-flags/</a>
Default: <code>[]</code>
</details>
<details>
<summary>env: { (env reference)</summary>
<code>env</code>Optional<a href="#orders-api-config-workerconfig-env">Link to env</a>
<code>env?: Record<string, Binding | false | null | undefined></code>
Bindings exposed on the Worker's <code>env</code> object. Construct entries with <code>bindings.kv(...)</code>, <code>bindings.r2(...)</code>, etc. Entries set to <code>false</code>, <code>null</code>, or <code>undefined</code> are omitted, which allows bindings to be included conditionally.
</details>
<details>
<summary>ENVIRONMENT: bindings.text("production"), (text reference)</summary>
<code>text</code>Builder<a href="#orders-api-config-bindings-text-default">Link to text</a>
<code>text<T$1 extends string>(value: T$1): TextBinding<T$1>;</code>
Inline string value made available to the Worker on <code>env</code> under the binding name. For reference, see <a href="https://developers.cloudflare.com/workers/wrangler/configuration/#environment-variables">https://developers.cloudflare.com/workers/wrangler/configuration/#environment-variables</a>
</details>
<details>
<summary>DB: bindings.d1({ (d1 reference)</summary>
<code>d1</code>Builder<a href="#orders-api-config-bindings-d1-default">Link to d1</a>
<code>d1(options?: D1BindingOptions): D1Binding;</code>
Binding to a D1 database. For reference, see <a href="https://developers.cloudflare.com/workers/wrangler/configuration/#d1-databases">https://developers.cloudflare.com/workers/wrangler/configuration/#d1-databases</a>
<details>
<summary>Options (3)</summary>
<dl>
<dt><code>id?: string</code></dt> <dd>The UUID of this D1 database (not required).</dd>
<dt><code>name?: string</code></dt> <dd>The name of this D1 database.</dd>
<dt><code>dev?: BindingDevOptions</code></dt> <dd>Options that only apply during local development.</dd></dl></details>
</details>
<details>
<summary>name: "orders-db", (name reference)</summary>
<code>name</code>Optional<a href="#orders-api-config-bindings-d1-default-name">Link to name</a>
<code>name?: string</code>
The name of this D1 database.
</details>
<details>
<summary>id: "<DATABASE_ID>", (id reference)</summary>
<code>id</code>Optional<a href="#orders-api-config-bindings-d1-default-id">Link to id</a>
<code>id?: string</code>
The UUID of this D1 database (not required).
</details>
}),
<details>
<summary>JOBS: bindings.queue<Job>({ name: "orders-jobs" }), (queue, name reference)</summary>
<code>queue</code>Builder<a href="#orders-api-config-bindings-queue-default">Link to queue</a>
<code>queue<TBody = unknown>(options?: QueueBindingOptions): TypedQueueBinding<TBody>;</code>
Producer binding to a Cloudflare Queue. For reference, see <a href="https://developers.cloudflare.com/workers/wrangler/configuration/#queues">https://developers.cloudflare.com/workers/wrangler/configuration/#queues</a>
<details>
<summary>Options (3)</summary>
<dl>
<dt><code>name?: string</code></dt> <dd>The name of this Queue.</dd>
<dt><code>deliveryDelay?: number</code></dt> <dd>The number of seconds to wait before delivering a message.</dd>
<dt><code>dev?: BindingDevOptions</code></dt> <dd>Options that only apply during local development.</dd></dl></details>
<code>name</code>Optional<a href="#orders-api-config-bindings-queue-default">Link to name</a>
<code>name?: string</code>
The name of this Queue.
</details>
<details>
<summary>COUNTERS: bindings.durableObject({ (durableObject reference)</summary>
<code>durableObject</code>Builder<a href="#orders-api-config-bindings-durableobject-all">Link to durableObject</a>
<code>durableObject<TWorker$1 extends WorkerReference, TExportName$1 extends DurableObjectExportName<TWorker$1>>(options: DurableObjectBindingOptions<TWorker$1, TExportName$1>): DurableObjectBinding<TWorker$1, TExportName$1>;</code>
Binding to a Durable Object class. <code>worker</code> is the name or config of the Worker that defines the class; <code>exportName</code> is the exported class name. For reference, see <a href="https://developers.cloudflare.com/workers/wrangler/configuration/#durable-objects">https://developers.cloudflare.com/workers/wrangler/configuration/#durable-objects</a>
<details>
