Skip to content

Commit 93b4287

Browse files
authored
Fixing broken <code> syntax (#24907)
1 parent 3c70987 commit 93b4287

File tree

2 files changed

+41
-124
lines changed

2 files changed

+41
-124
lines changed

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

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,7 @@ Alarms can be used to build distributed primitives, like queues or batching of w
3939

4040
### `setAlarm`
4141

42-
- <code>
43-
{" "}
44-
setAlarm(scheduledTimeMs <Type text="number" />)
45-
</code>
46-
: <Type text="void" />
42+
- <code> setAlarm(scheduledTimeMs <Type text="number" />) </code>: <Type text="void" />
4743

4844
- Set the time for the alarm to run. Specify the time as the number of milliseconds elapsed since the UNIX epoch.
4945
- If you call `setAlarm` when there is already one scheduled, it will override the existing alarm.
@@ -66,11 +62,7 @@ This is due to the fact that, if the Durable Object wakes up after being inactiv
6662

6763
### `alarm`
6864

69-
- <code>
70-
alarm(`alarmInfo`
71-
<Type text="Object" />)
72-
</code>
73-
: <Type text="void" />
65+
- <code>alarm(alarmInfo <Type text="Object" />)</code>: <Type text="void" />
7466

7567
- Called by the system when a scheduled alarm time is reached.
7668

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

Lines changed: 39 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,7 @@ export class MyDurableObject extends DurableObject {
113113

114114
### `exec`
115115

116-
<code>
117-
exec(query: <Type text="string" />, ...bindings: <Type text="any[]" />)
118-
</code>
119-
: <Type text="SqlStorageCursor" />
116+
<code>exec(query: <Type text="string" />, ...bindings: <Type text="any[]" />)</code>: <Type text="SqlStorageCursor" />
120117

121118
#### Parameters
122119

@@ -199,19 +196,13 @@ The PITR API represents points in time using 'bookmarks'. A bookmark is a mostly
199196

200197
### `getBookmarkForTime`
201198

202-
<code>
203-
ctx.storage.getBookmarkForTime(timestamp: <Type text="number | Date" />)
204-
</code>
205-
: <Type text="Promise<string>" />
199+
<code>ctx.storage.getBookmarkForTime(timestamp: <Type text="number | Date" />)</code>: <Type text="Promise<string>" />
206200

207201
- Returns a bookmark representing approximately the given point in time, which must be within the last 30 days. If the timestamp is represented as a number, it is converted to a date as if using `new Date(timestamp)`.
208202

209203
### `onNextSessionRestoreBookmark`
210204

211-
<code>
212-
ctx.storage.onNextSessionRestoreBookmark(bookmark: <Type text="string" />)
213-
</code>
214-
: <Type text="Promise<string>" />
205+
<code>ctx.storage.onNextSessionRestoreBookmark(bookmark: <Type text="string" />)</code>: <Type text="Promise<string>" />
215206

216207
- Configures the Durable Object so that the next time it restarts, it should restore its storage to exactly match what the storage contained at the given bookmark. After calling this, the application should typically invoke `ctx.abort()` to restart the Durable Object, thus completing the point-in-time recovery.
217208

@@ -228,25 +219,11 @@ ctx.storage.onNextSessionRestoreBookmark(bookmark);
228219

229220
### `get`
230221

231-
- <code>
232-
get(key <Type text="string" />, options <Type text="Object" />{" "}
233-
<MetaInfo text="optional" />)
234-
</code>
235-
: <Type text="Promise<any>" />- Retrieves the value associated with the given
236-
key. The type of the returned value will be whatever was previously written
237-
for the key, or undefined if the key does not exist.
238-
239-
- <code>
240-
get(keys <Type text="Array<string>" />, options <Type text="Object" />{" "}
241-
<MetaInfo text="optional" />)
242-
</code>
243-
: <Type text="Promise<Map<string, any>>" />- Retrieves the values associated
244-
with each of the provided keys. The type of each returned value in the
245-
[`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map)
246-
will be whatever was previously written for the corresponding key. Results in
247-
the `Map` will be sorted in increasing order of their UTF-8 encodings, with
248-
any requested keys that do not exist being omitted. Supports up to 128 keys at
249-
a time.
222+
- <code>ctx.storage.get(key <Type text="string" />, options <Type text="Object" />{" "}<MetaInfo text="optional" />)</code>: <Type text="Promise<any>" />
223+
- Retrieves the value associated with the given key. The type of the returned value will be whatever was previously written for the key, or undefined if the key does not exist.
224+
225+
- <code>ctx.storage.get(keys <Type text="Array<string>" />, options <Type text="Object" /> <MetaInfo text="optional" />)</code>: <Type text="Promise<Map<string, any>>" />
226+
- Retrieves the values associated with each of the provided keys. The type of each returned value in the [`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) will be whatever was previously written for the corresponding key. Results in the `Map` will be sorted in increasing order of their UTF-8 encodings, with any requested keys that do not exist being omitted. Supports up to 128 keys at a time.
250227

251228
#### Supported options
252229

@@ -258,50 +235,27 @@ ctx.storage.onNextSessionRestoreBookmark(bookmark);
258235

259236
### `put`
260237

261-
- <code>
262-
put(key <Type text="string" />, value <Type text="any" />, options{" "}
263-
<Type text="Object" /> <MetaInfo text="optional" />)
264-
</code>
265-
: <Type text="Promise" />- Stores the value and associates it with the given
266-
key. The value can be any type supported by the [structured clone
267-
algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm),
268-
which is true of most types.
269-
270-
The size of keys and values have different limits depending on the Durable Object storage backend you are using. Refer to either:
271-
- [SQLite-backed Durable Object limits](/durable-objects/platform/limits/#sqlite-backed-durable-objects-general-limits)
272-
- [KV-backed Durable Object limits](/durable-objects/platform/limits/#key-value-backed-durable-objects-general-limits).<br/><br/>
273-
274-
- <code>
275-
put(entries <Type text="Object" />, options <Type text="Object" />{" "}
276-
<MetaInfo text="optional" />)
277-
</code>
278-
: <Type text="Promise" />- Takes an Object and stores each of its keys and
279-
values to storage. - Each value can be any type supported by the [structured
280-
clone
281-
algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm),
282-
which is true of most types. - Supports up to 128 key-value pairs at a time.
283-
The size of keys and values have different limits depending on the flavor of
284-
Durable Object you are using. Refer to either: - [SQLite-backed Durable Object
285-
limits](/durable-objects/platform/limits/#sqlite-backed-durable-objects-general-limits)
286-
- [KV-backed Durable Object
287-
limits](/durable-objects/platform/limits/#key-value-backed-durable-objects-general-limits)
238+
- <code>put(key <Type text="string" />, value <Type text="any" />, options <Type text="Object" /> <MetaInfo text="optional" />)</code>: <Type text="Promise" />
239+
- Stores the value and associates it with the given key. The value can be any type supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm), which is true of most types.
240+
241+
The size of keys and values have different limits depending on the Durable Object storage backend you are using. Refer to either:
242+
- [SQLite-backed Durable Object limits](/durable-objects/platform/limits/#sqlite-backed-durable-objects-general-limits)
243+
- [KV-backed Durable Object limits](/durable-objects/platform/limits/#key-value-backed-durable-objects-general-limits).<br/><br/>
244+
245+
- <code>put(entries <Type text="Object" />, options <Type text="Object" /> <MetaInfo text="optional" />)</code>: <Type text="Promise" />
246+
- Takes an Object and stores each of its keys and values to storage.
247+
- Each value can be any type supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm), which is true of most types.
248+
- Supports up to 128 key-value pairs at a time. The size of keys and values have different limits depending on the flavor of Durable Object you are using. Refer to either:
249+
- [SQLite-backed Durable Object limits](/durable-objects/platform/limits/#sqlite-backed-durable-objects-general-limits)
250+
- [KV-backed Durable Object limits](/durable-objects/platform/limits/#key-value-backed-durable-objects-general-limits)
288251

289252
### `delete`
290253

291-
- <code>
292-
delete(key <Type text="string" />, options <Type text="Object" />{" "}
293-
<MetaInfo text="optional" />)
294-
</code>
295-
: <Type text="Promise<boolean>" />- Deletes the key and associated value.
296-
Returns `true` if the key existed or `false` if it did not.
297-
298-
- <code>
299-
delete(keys <Type text="Array<string>" />, options <Type text="Object" />{" "}
300-
<MetaInfo text="optional" />)
301-
</code>
302-
: <Type text="Promise<number>" />- Deletes the provided keys and their
303-
associated values. Supports up to 128 keys at a time. Returns a count of the
304-
number of key-value pairs deleted.
254+
- <code>delete(key <Type text="string" />, options <Type text="Object" /> <MetaInfo text="optional" />)</code>: <Type text="Promise<boolean>" />
255+
- Deletes the key and associated value. Returns `true` if the key existed or `false` if it did not.
256+
257+
- <code>delete(keys <Type text="Array<string>" />, options <Type text="Object" /> <MetaInfo text="optional" />)</code>: <Type text="Promise<number>" />
258+
- Deletes the provided keys and their associated values. Supports up to 128 keys at a time. Returns a count of the number of key-value pairs deleted.
305259

306260
#### Supported options
307261

@@ -335,12 +289,8 @@ The `put()` method returns a `Promise`, but most applications can discard this p
335289

336290
### `list`
337291

338-
- <code>
339-
list(options <Type text="Object" /> <MetaInfo text="optional" />)
340-
</code>
341-
: <Type text="Promise<Map<string, any>>" />- Returns all keys and values
342-
associated with the current Durable Object in ascending sorted order based on
343-
the keys' UTF-8 encodings.
292+
- <code>list(options <Type text="Object" /> <MetaInfo text="optional" />)</code>: <Type text="Promise<Map<string, any>>" />
293+
- Returns all keys and values associated with the current Durable Object in ascending sorted order based on the keys' UTF-8 encodings.
344294
- The type of each returned value in the [`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) will be whatever was previously written for the corresponding key.
345295

346296
- Be aware of how much data may be stored in your Durable Object before calling this version of `list` without options because all the data will be loaded into the Durable Object's memory, potentially hitting its [limit](/durable-objects/platform/limits/). If that is a concern, pass options to `list` as documented below.
@@ -376,36 +326,24 @@ The `put()` method returns a `Promise`, but most applications can discard this p
376326

377327
### `getAlarm`
378328

379-
- <code>
380-
getAlarm(options <Type text="Object" /> <MetaInfo text="optional" />)
381-
</code>
382-
: <Type text="Promise<Number | null>" />- Retrieves the current alarm time (if
383-
set) as integer milliseconds since epoch. The alarm is considered to be set if
384-
it has not started, or if it has failed and any retry has not begun. If no
385-
alarm is set, `getAlarm()` returns `null`.
329+
- <code>getAlarm(options <Type text="Object" /> <MetaInfo text="optional" />)</code>: <Type text="Promise<Number | null>" />
330+
- Retrieves the current alarm time (if set) as integer milliseconds since epoch. The alarm is considered to be set if it has not started, or if it has failed and any retry has not begun. If no alarm is set, `getAlarm()` returns `null`.
386331

387332
#### Supported options
388333

389334
- Same options as [`get()`](/durable-objects/api/storage-api/#get), but without `noCache`.
390335

391336
### `setAlarm`
392337

393-
- <code>
394-
setAlarm(scheduledTime <Type text="Date | number" />, options{" "}
395-
<Type text="Object" /> <MetaInfo text="optional" />)
396-
</code>
397-
: <Type text="Promise" />- Sets the current alarm time, accepting either a
398-
JavaScript `Date`, or integer milliseconds since epoch.
338+
- <code>setAlarm(scheduledTime <Type text="Date | number" />, options <Type text="Object" /> <MetaInfo text="optional" />)</code>: <Type text="Promise" />
339+
- Sets the current alarm time, accepting either a JavaScript `Date`, or integer milliseconds since epoch.
399340

400341
If `setAlarm()` is called with a time equal to or before `Date.now()`, the alarm will be scheduled for asynchronous execution in the immediate future. If the alarm handler is currently executing in this case, it will not be canceled. Alarms can be set to millisecond granularity and will usually execute within a few milliseconds after the set time, but can be delayed by up to a minute due to maintenance or failures while failover takes place.
401342

402343
### `deleteAlarm`
403344

404-
- <code>
405-
deleteAlarm(options <Type text="Object" /> <MetaInfo text="optional" />)
406-
</code>
407-
: <Type text="Promise" />- Deletes the alarm if one exists. Does not cancel
408-
the alarm handler if it is currently executing.
345+
- <code>deleteAlarm(options <Type text="Object" /> <MetaInfo text="optional" />)</code>: <Type text="Promise" />
346+
- Deletes the alarm if one exists. Does not cancel the alarm handler if it is currently executing.
409347

410348
#### Supported options
411349

@@ -415,23 +353,10 @@ The `put()` method returns a `Promise`, but most applications can discard this p
415353

416354
### `deleteAll`
417355

418-
- <code>
419-
deleteAll(options <Type text="Object" /> <MetaInfo text="optional" />)
420-
</code>
421-
: <Type text="Promise" />- Deletes all stored data, effectively deallocating
422-
all storage used by the Durable Object. For Durable Objects with a key-value
423-
storage backend, `deleteAll()` removes all keys and associated values for an
424-
individual Durable Object. For Durable Objects with a [SQLite storage
425-
backend](/durable-objects/best-practices/access-durable-objects-storage/#create-sqlite-backed-durable-object-class),
426-
`deleteAll()` removes the entire contents of a Durable Object's private SQLite
427-
database, including both SQL data and key-value data. - For Durable Objects
428-
with a key-value storage backend, an in-progress `deleteAll()` operation can
429-
fail, which may leave a subset of data undeleted. Durable Objects with a
430-
SQLite storage backend do not have a partial `deleteAll()` issue because
431-
`deleteAll()` operations are atomic (all or nothing). - `deleteAll()` does not
432-
proactively delete [alarms](/durable-objects/api/alarms/). Use
433-
[`deleteAlarm()`](/durable-objects/api/alarms/#deletealarm) to delete an
434-
alarm.
356+
- <code>deleteAll(options <Type text="Object" /> <MetaInfo text="optional" />)</code>: <Type text="Promise" />
357+
- Deletes all stored data, effectively deallocating all storage used by the Durable Object. For Durable Objects with a key-value storage backend, `deleteAll()` removes all keys and associated values for an individual Durable Object. For Durable Objects with a [SQLite storage backend](/durable-objects/best-practices/access-durable-objects-storage/#create-sqlite-backed-durable-object-class), `deleteAll()` removes the entire contents of a Durable Object's private SQLite database, including both SQL data and key-value data.
358+
- For Durable Objects with a key-value storage backend, an in-progress `deleteAll()` operation can fail, which may leave a subset of data undeleted. Durable Objects with a SQLite storage backend do not have a partial `deleteAll()` issue because `deleteAll()` operations are atomic (all or nothing).
359+
- `deleteAll()` does not proactively delete [alarms](/durable-objects/api/alarms/). Use [`deleteAlarm()`](/durable-objects/api/alarms/#deletealarm) to delete an alarm.
435360

436361
### `transactionSync`
437362

@@ -470,6 +395,6 @@ The `put()` method returns a `Promise`, but most applications can discard this p
470395

471396
## Related resources
472397

473-
- [Durable Objects: Easy, Fast, Correct Choose Three](https://blog.cloudflare.com/durable-objects-easy-fast-correct-choose-three/)
398+
- [Durable Objects: Easy, Fast, Correct Choose Three](https://blog.cloudflare.com/durable-objects-easy-fast-correct-choose-three/)
474399
- [Zero-latency SQLite storage in every Durable Object blog](https://blog.cloudflare.com/sqlite-in-durable-objects/)
475400
- [WebSockets API](/durable-objects/best-practices/websockets/)

0 commit comments

Comments
 (0)