Skip to content

Commit 58213f6

Browse files
committed
Fixed data types in queues js api docs
1 parent eef3a0c commit 58213f6

File tree

1 file changed

+21
-18
lines changed

1 file changed

+21
-18
lines changed

src/content/docs/queues/configuration/javascript-apis.mdx

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ head:
99

1010
---
1111

12+
import { Type } from "~/components";
13+
1214
Cloudflare Queues is integrated with [Cloudflare Workers](/workers). To send and receive messages, you must use a Worker.
1315

1416
A Worker that can send messages to a Queue is a producer Worker, while a Worker that can receive messages from a Queue is a consumer Worker. It is possible for the same Worker to be a producer and consumer, if desired.
@@ -62,12 +64,12 @@ interface Queue<Body = unknown> {
6264

6365

6466

65-
* `send(bodyunknown, options?{ contentType?: QueuesContentType })`: `Promise<void>`
67+
* `send(bodyunknown, options?{ contentType?: QueuesContentType })` <Type text="Promise<void>" />
6668

6769
* Sends a message to the Queue. The body 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#supported_types), as long as its size is less than 128 KB.
6870
* When the promise resolves, the message is confirmed to be written to disk.
6971

70-
* `sendBatch(bodyIterable<MessageSendRequest<unknown>>)`: `Promise<void>`
72+
* `sendBatch(bodyIterable<MessageSendRequest<unknown>>)` <Type text="Promise<void>" />
7173

7274
* Sends a batch of messages to the Queue. Each item in the provided [Iterable](https://www.typescriptlang.org/docs/handbook/iterators-and-generators.html) must be supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types). A batch can contain up to 100 messages, though items are limited to 128 KB each, and the total size of the array cannot exceed 256 KB.
7375
* When the promise resolves, the messages are confirmed to be written to disk.
@@ -87,12 +89,12 @@ type MessageSendRequest<Body = unknown> = {
8789

8890

8991

90-
* <code>body</code> unknown
92+
* <code>body</code> <Type text="unknown" />
9193

9294
* The body of the message.
9395
* The body 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#supported_types), as long as its size is less than 128 KB.
9496

95-
* <code>optionsQueueSendOptions</code>
97+
* <code>options</code> <Type text="QueueSendOptions" />
9698

9799
* Options to apply to the current message, including content type and message delay settings.
98100

@@ -102,13 +104,13 @@ type MessageSendRequest<Body = unknown> = {
102104

103105
Optional configuration that applies when sending a message to a queue.
104106

105-
* <code>contentTypeQueuesContentType</code>
107+
* <code>contentType</code> <Type text="QueuesContentType" />
106108

107109
* The explicit content type of a message so it can be previewed correctly with the [List messages from the dashboard](/queues/examples/list-messages-from-dash/) feature. Optional argument.
108110
* As of now, this option is for internal use. In the future, `contentType` will be used by alternative consumer types to explicitly mark messages as serialized so they can be consumed in the desired type.
109111
* See [QueuesContentType](#queuescontenttype) for possible values.
110112

111-
* <code>delaySecondsnumber</code>
113+
* <code>delaySeconds</code> <Type text="number" />
112114

113115
* The number of seconds to [delay a message](/queues/configuration/batching-retries/) for within the queue, before it can be delivered to a consumer.
114116
* Must be an integer between 0 and 43200 (12 hours). Setting this value to zero will explicitly prevent the message from being delayed, even if there is a global (default) delay at the queue level.
@@ -117,7 +119,7 @@ Optional configuration that applies when sending a message to a queue.
117119

118120
Optional configuration that applies when sending a batch of messages to a queue.
119121

120-
* <code>delaySecondsnumber</code>
122+
* <code>delaySeconds</code> <Type text="number" />
121123

122124
* The number of seconds to [delay messages](/queues/configuration/batching-retries/) for within the queue, before it can be delivered to a consumer.
123125
* Must be a positive integer.
@@ -217,19 +219,20 @@ interface MessageBatch<Body = unknown> {
217219

218220

219221

220-
* <code>queue</code> string
222+
* <code>queue</code> <Type text="string" />
221223

222224
* The name of the Queue that belongs to this batch.
223225

224-
* <code>messages</code> Message\[]
226+
* <code>messages</code> <Type text="Message[]" />
225227

226228
* An array of messages in the batch. Ordering of messages is best effort -- not guaranteed to be exactly the same as the order in which they were published. If you are interested in guaranteed FIFO ordering, please [email the Queues team](mailto:[email protected]).
227229

228-
* <code>ackAll()</code> void
230+
* <code>ackAll()</code> <Type text="void" />
231+
229232

230233
* Marks every message as successfully delivered, regardless of whether your `queue()` consumer handler returns successfully or not.
231234

232-
* <code>retryAll(options?: QueueRetryOptions)</code> void
235+
* <code>retryAll(options?: QueueRetryOptions)</code> <Type text="void" />
233236

234237
* Marks every message to be retried in the next batch.
235238
* Supports an optional `options` object.
@@ -253,28 +256,28 @@ interface Message<Body = unknown> {
253256

254257

255258

256-
* <code>id</code> string
259+
* <code>id</code> <Type text="string" />
257260

258261
* A unique, system-generated ID for the message.
259262

260-
* <code>timestamp</code> Date
263+
* <code>timestamp</code> <Type text="Date" />
261264

262265
* A timestamp when the message was sent.
263266

264-
* <code>body</code> unknown
267+
* <code>body</code> <Type text="unknown" />
265268

266269
* The body of the message.
267270
* The body 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#supported_types), as long as its size is less than 128 KB.
268271

269-
* <code>attempts</code> number
272+
* <code>attempts</code> <Type text="number" />
270273

271274
* The number of times the consumer has attempted to process this message. Starts at 1.
272275

273-
* <code>ack()</code> void
276+
* <code>ack()</code> <Type text="void" />
274277

275278
* Marks a message as successfully delivered, regardless of whether your `queue()` consumer handler returns successfully or not.
276279

277-
* <code>retry(options?: QueueRetryOptions)</code> void
280+
* <code>retry(options?: QueueRetryOptions)</code> <Type text="void" />
278281

279282
* Marks a message to be retried in the next batch.
280283
* Supports an optional `options` object.
@@ -291,7 +294,7 @@ declare interface QueueRetryOptions {
291294
}
292295
```
293296

294-
* <code>delaySecondsnumber</code>
297+
* <code>delaySeconds</code> <Type text="number" />
295298

296299
* The number of seconds to [delay a message](/queues/configuration/batching-retries/) for within the queue, before it can be delivered to a consumer.
297300
* Must be a positive integer.

0 commit comments

Comments
 (0)