Skip to content

Commit aac5ff5

Browse files
committed
[DO] Squashing commits
1 parent e0a6369 commit aac5ff5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+248
-682
lines changed

public/_redirects

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -407,32 +407,39 @@
407407

408408
# Durable Objects
409409
/durable-objects/examples/durable-object-example/ /durable-objects/examples/durable-object-in-memory-state/ 301
410-
/durable-objects/api/hibernatable-websockets-api/ /durable-objects/best-practices/websockets/ 301
410+
/durable-objects/api/hibernatable-websockets-api/ /durable-objects/features/websockets/ 301
411411
/durable-objects/api/alarms-in-durable-objects/ /durable-objects/api/alarms/ 301
412-
/durable-objects/api/websockets/ /durable-objects/best-practices/websockets/ 301
412+
/durable-objects/api/websockets/ /durable-objects/features/websockets/ 301
413+
/durable-objects/best-practices/ /durable-objects/features/ 301
414+
/durable-objects/best-practices/create-durable-object-stubs-and-send-requests/ /durable-objects/features/create-durable-object-stubs-and-send-requests/ 301
415+
/durable-objects/best-practices/access-durable-objects-storage/ /durable-objects/features/access-durable-objects-storage/ 301
416+
/durable-objects/best-practices/error-handling/ /durable-objects/features/error-handling/ 301
417+
/durable-objects/best-practices/websockets/ /durable-objects/features/websockets/ 301
413418
/durable-objects/platform/data-location/ /durable-objects/reference/data-location/ 301
414419
/durable-objects/platform/environments/ /durable-objects/reference/environments/ 301
415420
/durable-objects/platform/graphql-analytics/ /durable-objects/observability/graphql-analytics/ 301
416421
/durable-objects/platform/troubleshooting/ /durable-objects/observability/troubleshooting/ 301
417422
/durable-objects/learning/ /durable-objects/reference/ 301
418423
/durable-objects/learning/in-memory-state/ /durable-objects/reference/in-memory-state/ 301
419424
/durable-objects/learning/durable-objects-migrations/ /durable-objects/reference/durable-objects-migrations/ 301
420-
/durable-objects/learning/websockets/ /durable-objects/best-practices/websockets/ 301
425+
/durable-objects/learning/websockets/ /durable-objects/features/websockets/ 301
421426
/durable-objects/examples/durable-object-location-example/ /durable-objects/examples/durable-object-in-memory-state/ 301
422-
/durable-objects/how-to/ /durable-objects/best-practices/ 301
423-
/durable-objects/how-to/access-durable-object-from-a-worker/ /durable-objects/best-practices/access-durable-objects-from-a-worker/ 301
424-
/durable-objects/how-to/create-durable-object-stubs/ /durable-objects/best-practices/create-durable-object-stubs-and-send-requests/ 301
425-
/durable-objects/configuration/access-durable-object-from-a-worker/ /durable-objects/best-practices/access-durable-objects-from-a-worker/ 301
426-
/durable-objects/configuration/create-durable-object-stubs/ /durable-objects/best-practices/create-durable-object-stubs-and-send-requests/ 301
427-
/durable-objects/reference/error-handling/ /durable-objects/best-practices/error-handling/ 301
427+
/durable-objects/how-to/ /durable-objects/features/ 301
428+
/durable-objects/how-to/access-durable-object-from-a-worker/ /durable-objects/features/access-durable-objects-from-a-worker/ 301
429+
/durable-objects/how-to/create-durable-object-stubs/ /durable-objects/features/create-durable-object-stubs-and-send-requests/ 301
430+
/durable-objects/configuration/access-durable-object-from-a-worker/ /durable-objects/features/access-durable-objects-from-a-worker/ 301
431+
/durable-objects/configuration/create-durable-object-stubs/ /durable-objects/features/create-durable-object-stubs-and-send-requests/ 301
432+
/durable-objects/reference/error-handling/ /durable-objects/features/error-handling/ 301
428433
/durable-objects/reference/troubleshooting/ /durable-objects/observability/troubleshooting/ 301
429434
/durable-objects/reference/graphql-analytics/ /durable-objects/observability/graphql-analytics/ 301
430-
/durable-objects/reference/websockets/ /durable-objects/best-practices/websockets/ 301
435+
/durable-objects/reference/websockets/ /durable-objects/features/websockets/ 301
431436
/durable-objects/api/transactional-storage-api/ /durable-objects/api/storage-api/ 301
432437
/durable-objects/platform/changelog/ /durable-objects/release-notes/ 301
433438
/durable-objects/changelog/ /durable-objects/release-notes/ 301
434439
/durable-objects/glossary/ /durable-objects/reference/glossary/ 301
435-
/durable-objects/get-started/walkthrough/ /durable-objects/get-started/tutorial/ 301
440+
/durable-objects/get-started/walkthrough/ /durable-objects/get-started/ 301
441+
/durable-objects/get-started/tutorial/ /durable-objects/get-started/ 301
442+
/durable-objects/get-started/tutorial-with-sql-api/ /durable-objects/get-started/ 301
436443
/durable-objects/get-started/video-series/intro/ /durable-objects/video-tutorials/ 301
437444
/durable-objects/get-started/video-series/app-frontend/ /durable-objects/video-tutorials/ 301
438445
/durable-objects/get-started/video-series/deploy-app/ /durable-objects/video-tutorials/ 301

src/content/docs/browser-rendering/workers-binding-api/browser-rendering-with-DO.mdx

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,15 @@ Create a new Worker project named `browser-worker` by running:
3333
args={"browser-worker"}
3434
/>
3535

36-
## 2. Enable Durable Objects in the dashboard
37-
38-
To enable Durable Objects, you will need to purchase the Workers Paid plan:
39-
40-
1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/), and select your account.
41-
2. Go to **Workers & Pages** > **Plans**.
42-
3. Select **Purchase Workers Paid** and complete the payment process to enable Durable Objects.
43-
44-
## 3. Install Puppeteer
36+
## 2. Install Puppeteer
4537

4638
In your `browser-worker` directory, install Cloudflare’s [fork of Puppeteer](/browser-rendering/platform/puppeteer/):
4739

4840
```sh
4941
npm install @cloudflare/puppeteer --save-dev
5042
```
5143

52-
## 4. Create a R2 bucket
44+
## 3. Create a R2 bucket
5345

5446
Create two R2 buckets, one for production, and one for development.
5547

@@ -68,7 +60,7 @@ wrangler r2 bucket list
6860

6961
After running the `list` command, you will see all bucket names, including the ones you have just created.
7062

71-
## 5. Configure your Wrangler configuration file
63+
## 4. Configure your Wrangler configuration file
7264

7365
Configure your `browser-worker` project's [Wrangler configuration file](/workers/wrangler/configuration/) by adding a browser [binding](/workers/runtime-apis/bindings/) and a [Node.js compatibility flag](/workers/configuration/compatibility-flags/#nodejs-compatibility-flag). Browser bindings allow for communication between a Worker and a headless browser which allows you to do actions such as taking a screenshot, generating a PDF and more.
7466

@@ -106,7 +98,7 @@ new_classes = ["Browser"] # Array of new classes
10698

10799
</WranglerConfig>
108100

109-
## 6. Code
101+
## 5. Code
110102

111103
The code below uses Durable Object to instantiate a browser using Puppeteer. It then opens a series of web pages with different resolutions, takes a screenshot of each, and uploads it to R2.
112104

@@ -219,11 +211,11 @@ export class Browser {
219211
}
220212
```
221213

222-
## 7. Test
214+
## 6. Test
223215

224216
Run [`npx wrangler dev --remote`](/workers/wrangler/commands/#dev) to test your Worker remotely before deploying to Cloudflare's global network. Local mode support does not exist for Browser Rendering so `--remote` is required.
225217

226-
## 8. Deploy
218+
## 7. Deploy
227219

228220
Run [`npx wrangler deploy`](/workers/wrangler/commands/#deploy) to deploy your Worker to the Cloudflare global network.
229221

src/content/docs/durable-objects/api/base.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ sidebar:
77

88
import { Render, Tabs, TabItem, GlossaryTooltip, Type, MetaInfo, TypeScriptExample } from "~/components";
99

10-
The `DurableObject` base class is an abstract class which all Durable Objects inherit from. This base class provides a set of optional methods, frequently referred to as handler methods, which can respond to events, for example a webSocketMessage when using the [WebSocket Hibernation API](/durable-objects/best-practices/websockets/#websocket-hibernation-api). To provide a concrete example, here is a Durable Object `MyDurableObject` which extends `DurableObject` and implements the fetch handler to return "Hello, World!" to the calling Worker.
10+
The `DurableObject` base class is an abstract class which all Durable Objects inherit from. This base class provides a set of optional methods, frequently referred to as handler methods, which can respond to events, for example a webSocketMessage when using the [WebSocket Hibernation API](/durable-objects/features/websockets/#websocket-hibernation-api). To provide a concrete example, here is a Durable Object `MyDurableObject` which extends `DurableObject` and implements the fetch handler to return "Hello, World!" to the calling Worker.
1111

1212
<TypeScriptExample>
1313
```ts
@@ -87,4 +87,4 @@ A list of bindings which are available to the Durable Object.
8787

8888
## Related resources
8989

90-
- Refer to [Use WebSockets](/durable-objects/best-practices/websockets/) for more information on examples of WebSocket methods and best practices.
90+
- Refer to [Use WebSockets](/durable-objects/features/websockets/) for more information on examples of WebSocket methods and best practices.

src/content/docs/durable-objects/api/sql-storage.mdx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
2-
title: SQL Storage
2+
title: SQL storage
33
pcx_content_type: concept
44
sidebar:
5-
order: 6
5+
order: 7
66

77
---
88

@@ -33,12 +33,12 @@ export class MyDurableObject extends DurableObject {
3333
}
3434
```
3535

36-
:::note[SQLite in Durable Objects Beta]
36+
:::note[SQLite in Durable Objects]
3737
SQL API methods accessed with `ctx.storage.sql` are only allowed on [Durable Object classes with SQLite storage backend](/durable-objects/reference/durable-objects-migrations/#enable-sqlite-storage-backend-on-new-durable-object-class-migration) and will return an error if called on Durable Object classes with a key-value storage backend.
3838
:::
3939

4040
:::note[Writing to indexes or virtual tables]
41-
When writing data, every index counts as an additional row. However, indexes may be beneficial for read-heavy use cases. Refer to [Index for SQLite Durable Objects](/durable-objects/best-practices/access-durable-objects-storage/#index-for-sqlite-durable-objects).
41+
When writing data, every index counts as an additional row. However, indexes may be beneficial for read-heavy use cases. Refer to [Index for SQLite Durable Objects](/durable-objects/features/access-durable-objects-storage/#index-for-sqlite-durable-objects).
4242

4343
Writing data to [SQLite virtual tables](https://www.sqlite.org/vtab.html) also counts towards rows written.
4444
:::
@@ -47,6 +47,8 @@ Specifically for Durable Object classes with SQLite storage backend, KV operatio
4747

4848
## Methods
4949

50+
<Render file="storage-intro-text"/>
51+
5052
### `exec`
5153

5254
<code>exec(query: <Type text='string'/>, ...bindings: <Type text='any[]'/>)</code>: <Type text='SqlStorageCursor' />
@@ -161,7 +163,7 @@ Providing a type parameter does _not_ validate that the query result matches you
161163

162164
Your type must conform to the shape of a TypeScript [Record](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type) type representing the name (`string`) of the column and the type of the column. The column type must be a valid `SqlStorageValue`: one of `ArrayBuffer | string | number | null`.
163165

164-
For example,
166+
For example,
165167

166168
```ts
167169
type User = {

src/content/docs/durable-objects/api/state.mdx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,11 @@ export class MyDurableObject extends DurableObject {
106106

107107
### `acceptWebSocket`
108108

109-
`acceptWebSocket` is part of the [WebSocket Hibernation API](/durable-objects/best-practices/websockets/#websocket-hibernation-api), which allows a Durable Object to be removed from memory to save costs while keeping its WebSockets connected.
109+
`acceptWebSocket` is part of the [WebSocket Hibernation API](/durable-objects/features/websockets/#websocket-hibernation-api), which allows a Durable Object to be removed from memory to save costs while keeping its WebSockets connected.
110110

111111
`acceptWebSocket` adds a WebSocket to the set of WebSockets attached to the Durable Object. Once called, any incoming messages will be delivered by calling the Durable Object's `webSocketMessage` handler, and `webSocketClose` will be invoked upon disconnect. After calling `acceptWebSocket`, the WebSocket is accepted and its `send` and `close` methods can be used.
112112

113-
The [WebSocket Hibernation API](/durable-objects/best-practices/websockets/#websocket-hibernation-api) takes the place of the standard [WebSockets API](/workers/runtime-apis/websockets/). Therefore, `ws.accept` must not have been called separately and `ws.addEventListener` method will not receive events as they will instead be delivered to the Durable Object.
113+
The [WebSocket Hibernation API](/durable-objects/features/websockets/#websocket-hibernation-api) takes the place of the standard [WebSockets API](/workers/runtime-apis/websockets/). Therefore, `ws.accept` must not have been called separately and `ws.addEventListener` method will not receive events as they will instead be delivered to the Durable Object.
114114

115115
The WebSocket Hibernation API permits a maximum of 32,768 WebSocket connections per Durable Object, but the CPU and memory usage of a given workload may further limit the practical number of simultaneous connections.
116116

@@ -125,7 +125,7 @@ The WebSocket Hibernation API permits a maximum of 32,768 WebSocket connections
125125

126126
### `getWebSockets`
127127

128-
`getWebSockets` is part of the [WebSocket Hibernation API](/durable-objects/best-practices/websockets/#websocket-hibernation-api), which allows a Durable Object to be removed from memory to save costs while keeping its WebSockets connected.
128+
`getWebSockets` is part of the [WebSocket Hibernation API](/durable-objects/features/websockets/#websocket-hibernation-api), which allows a Durable Object to be removed from memory to save costs while keeping its WebSockets connected.
129129

130130
`getWebSockets` returns an `Array<WebSocket>` which is the set of WebSockets attached to the Durable Object. An optional tag argument can be used to filter the list according to tags supplied when calling [`DurableObjectState::acceptWebSocket`](/durable-objects/api/state/#acceptwebsocket).
131131

@@ -145,7 +145,7 @@ Disconnected WebSockets are not returned by this method, but `getWebSockets` may
145145

146146
### `setWebSocketAutoResponse`
147147

148-
`setWebSocketAutoResponse` is part of the [WebSocket Hibernation API](/durable-objects/best-practices/websockets/#websocket-hibernation-api), which allows a Durable Object to be removed from memory to save costs while keeping its WebSockets connected.
148+
`setWebSocketAutoResponse` is part of the [WebSocket Hibernation API](/durable-objects/features/websockets/#websocket-hibernation-api), which allows a Durable Object to be removed from memory to save costs while keeping its WebSockets connected.
149149

150150
`setWebSocketAutoResponse` sets an automatic response, auto-response, for the request provided for all WebSockets attached to the Durable Object. If a request is received matching the provided request then the auto-response will be returned without waking WebSockets in hibernation and incurring billable duration charges.
151151

@@ -179,7 +179,7 @@ Disconnected WebSockets are not returned by this method, but `getWebSockets` may
179179

180180
### `getWebSocketAutoResponseTimestamp`
181181

182-
`getWebSocketAutoResponseTimestamp` is part of the [WebSocket Hibernation API](/durable-objects/best-practices/websockets/#websocket-hibernation-api), which allows a Durable Object to be removed from memory to save costs while keeping its WebSockets connected.
182+
`getWebSocketAutoResponseTimestamp` is part of the [WebSocket Hibernation API](/durable-objects/features/websockets/#websocket-hibernation-api), which allows a Durable Object to be removed from memory to save costs while keeping its WebSockets connected.
183183

184184
`getWebSocketAutoResponseTimestamp` gets the most recent `Date` on which the given WebSocket sent an auto-response, or null if the given WebSocket never sent an auto-response.
185185

@@ -193,7 +193,7 @@ Disconnected WebSockets are not returned by this method, but `getWebSockets` may
193193

194194
### `setHibernatableWebSocketEventTimeout`
195195

196-
`setHibernatableWebSocketEventTimeout` is part of the [WebSocket Hibernation API](/durable-objects/best-practices/websockets/#websocket-hibernation-api), which allows a Durable Object to be removed from memory to save costs while keeping its WebSockets connected.
196+
`setHibernatableWebSocketEventTimeout` is part of the [WebSocket Hibernation API](/durable-objects/features/websockets/#websocket-hibernation-api), which allows a Durable Object to be removed from memory to save costs while keeping its WebSockets connected.
197197

198198
`setHibernatableWebSocketEventTimeout` sets the maximum amount of time in milliseconds that a WebSocket event can run for.
199199

@@ -209,7 +209,7 @@ If no parameter or a parameter of `0` is provided and a timeout has been previou
209209

210210
### `getHibernatableWebSocketEventTimeout`
211211

212-
`getHibernatableWebSocketEventTimeout` is part of the [WebSocket Hibernation API](/durable-objects/best-practices/websockets/#websocket-hibernation-api), which allows a Durable Object to be removed from memory to save costs while keeping its WebSockets connected.
212+
`getHibernatableWebSocketEventTimeout` is part of the [WebSocket Hibernation API](/durable-objects/features/websockets/#websocket-hibernation-api), which allows a Durable Object to be removed from memory to save costs while keeping its WebSockets connected.
213213

214214
`getHibernatableWebSocketEventTimeout` gets the currently set hibernatable WebSocket event timeout if one has been set via [`DurableObjectState::setHibernatableWebSocketEventTimeout`](/durable-objects/api/state/#sethibernatablewebsocketeventtimeout).
215215

@@ -223,7 +223,7 @@ If no parameter or a parameter of `0` is provided and a timeout has been previou
223223

224224
### `getTags`
225225

226-
`getTags` is part of the [WebSocket Hibernation API](/durable-objects/best-practices/websockets/#websocket-hibernation-api), which allows a Durable Object to be removed from memory to save costs while keeping its WebSockets connected.
226+
`getTags` is part of the [WebSocket Hibernation API](/durable-objects/features/websockets/#websocket-hibernation-api), which allows a Durable Object to be removed from memory to save costs while keeping its WebSockets connected.
227227

228228
`getTags` returns tags associated with a given WebSocket. This method throws an exception if the WebSocket has not been associated with the Durable Object via [`DurableObjectState::acceptWebSocket`](/durable-objects/api/state/#acceptwebsocket).
229229

0 commit comments

Comments
 (0)