@sproutboat/runtime 0.31.0 → 0.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,57 @@
1
1
  # @sproutboat/runtime
2
2
 
3
+ ## 0.33.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 90434e0: WebSockets, from compatibility date `2026-10-30`, as in workerd:
8
+
9
+ - **`WebSocketPair` and `WebSocket`.** `accept()`, `send()` (text, `ArrayBuffer` or a typed array), `close(code, reason)`, `readyState`, `binaryType` (binary messages are `Blob`s unless it is `"arraybuffer"`, workerd's standard binary type), `addEventListener` and `on<type>`. Messages sent before the other end accepts wait for it; each message is delivered in its own turn, so a reply reaches the other end before the next message, as in workerd. A close is answered automatically; invalid close codes throw `InvalidAccessError`, reasons over 123 bytes `SyntaxError`. Checked against workerd 1.20260730 (`test/native-websockets.ts`).
10
+ - **`new Response(null, { status: 101, webSocket })`** and `response.webSocket` (`null` when there is none). Any other status with a `webSocket` throws `RangeError`, as in workerd.
11
+ - **Durable Objects: the hibernation API.** `ctx.acceptWebSocket(ws, tags)`, `getWebSockets(tag)`, `getTags(ws)`, `setWebSocketAutoResponse` / `getWebSocketAutoResponse` with `WebSocketRequestResponsePair`, `serializeAttachment` / `deserializeAttachment`, and the `webSocketMessage` / `webSocketClose` handlers, run through the object's input gate.
12
+ - **Client sockets.** The client end of a 101 response becomes a real socket on a host that carries it (sproutd, which sets the runtime's `sb_ws_hook`). A standalone or platform sprout answers such a response with `501` for now; a pair whose ends both stay in the worker (a Worker and its Durable Object) works everywhere.
13
+
14
+ Before `2026-10-30` nothing is defined and `response.webSocket` stays `undefined`.
15
+
16
+ ## 0.32.0
17
+
18
+ ### Minor Changes
19
+
20
+ - 482a55c: Queues like Cloudflare's, from compatibility date 2026-10-31, with queue names and consumer
21
+ settings in `sproutboat.jsonc` at every date.
22
+
23
+ - **Config (`@sproutboat/config`):** a `queues` entry may be `{ "binding": "QUEUE", "queue": "q",
24
+ "max_batch_size": 10, "max_batch_timeout": 1, "max_retries": 3, "retry_delay": 0,
25
+ "dead_letter_queue": "dlq" }`, the settings named as in wrangler's `queues.consumers`; `id`
26
+ is optional there. `queueSettings()` normalizes the entries for the build, and `pinBindingId`
27
+ adds an id to such an object.
28
+ - **Names and settings, at every date (opt-in):** `batch.queue` is the queue's name (the binding
29
+ name when unset). `max_batch_size` (1 to 100, default 10) and `max_batch_timeout` (0 to 60 s,
30
+ default 0: delivered at once, where Cloudflare waits up to 5 s) shape batches; `max_retries`,
31
+ `retry_delay` and `dead_letter_queue` decide what a retry does. A dead letter queue the worker
32
+ doesn't bind keeps its messages until one does.
33
+ - **From 2026-10-31:**
34
+ - `send()` and `sendBatch()` return Promises of `{ metadata: { metrics } }`, the queue's backlog
35
+ after the send as Cloudflare documents it (miniflare answers zeros); `metrics()` is added.
36
+ - Bodies keep their content type: `json` (the default), `text`, `bytes` (arrives as an
37
+ ArrayBuffer) and `v8` (structured clone). A string that looks like JSON or a number arrives as
38
+ the same string.
39
+ - workerd's argument errors: an undefined or BigInt `json` body, a `text` body that isn't a
40
+ string, an unknown content type, a body over 128 KiB, an empty batch, more than 100 messages
41
+ or 256 KiB in a batch, a batch that isn't iterable.
42
+ - A message is `{ id, timestamp, body, attempts }`, `timestamp` a Date of when it was sent, with
43
+ `ack()` and `retry({ delaySeconds })` on its prototype; a batch has `queue`, `messages` and
44
+ `metadata`, with `ackAll()` and `retryAll({ delaySeconds })`. The first of `ack()` and `retry()`
45
+ wins, and a message's own call wins over `ackAll()`/`retryAll()`, as Cloudflare documents
46
+ (miniflare lets a later `retryAll()` win).
47
+ - By default a message is retried at once, 3 times, then dropped or sent to the dead letter
48
+ queue. Earlier dates keep 5 s between attempts and 5 attempts.
49
+ - **Stores (embedded transport and `@sproutboat/wire`'s broker):** messages keep their send time
50
+ (an additive `sent_at` column), `queue.send` answers the backlog when asked, `queue.metrics` is
51
+ new, and a batch's outcome may carry retry delays and messages for the dead letter queue. An
52
+ older broker ignores those and retries as before; bodies sent from 2026-10-31 are tagged text, so
53
+ they travel through it unchanged.
54
+
3
55
  ## 0.31.0
4
56
 
5
57
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sproutboat/runtime",
3
- "version": "0.31.0",
3
+ "version": "0.33.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",