effect-cf 0.2.0 → 0.4.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,17 @@
1
1
  # effect-cf
2
2
 
3
+ ## 0.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#12](https://github.com/danieljvdm/effect-cf/pull/12) [`c2af5df`](https://github.com/danieljvdm/effect-cf/commit/c2af5dff03ce0ebc5357a42b0ad7484d4bd23f4c) Thanks [@danieljvdm](https://github.com/danieljvdm)! - Add reusable KV definitions with Queue-style binding helpers so packages can share typed KV schemas without choosing concrete Cloudflare binding names.
8
+
9
+ ## 0.3.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#10](https://github.com/danieljvdm/effect-cf/pull/10) [`a0e3f43`](https://github.com/danieljvdm/effect-cf/commit/a0e3f436df695b8ea3908fbb7813efea099ccd13) Thanks [@danieljvdm](https://github.com/danieljvdm)! - Type Durable Object websocket lifecycle handlers with `DurableWebSocket` instead of raw `WebSocket`, so handlers can use the Effect-native durable socket API without manually wrapping Cloudflare sockets.
14
+
3
15
  ## 0.2.0
4
16
 
5
17
  ### Minor Changes
package/README.md CHANGED
@@ -144,7 +144,7 @@ Durable Object application sockets should use the hibernation-compatible state A
144
144
 
145
145
  ```ts
146
146
  import { Effect, Schema as S } from "effect";
147
- import { DurableObjectState, DurableObjectWebSocket, Worker } from "effect-cf";
147
+ import { DurableObject, DurableObjectState, DurableObjectWebSocket, Worker } from "effect-cf";
148
148
 
149
149
  const ConnectionAttachment = S.Struct({
150
150
  id: S.String,
@@ -173,6 +173,17 @@ export const fetch = Effect.gen(function* () {
173
173
 
174
174
  `DurableWebSocket` keeps the native socket available as `socket.raw`, while `send`, `close`, `serializeAttachment`, and `deserializeAttachment` return typed `Effect` failures. Use `state.getWebSockets(tag)` to retrieve wrapped sockets for broadcast and rehydration.
175
175
 
176
+ `DurableObject.make` lifecycle handlers receive wrapped sockets automatically:
177
+
178
+ ```ts
179
+ export const RoomLive = DurableObject.make(layer, {
180
+ webSocketMessage: (socket, message) =>
181
+ Effect.gen(function* () {
182
+ yield* socket.send(message);
183
+ }),
184
+ });
185
+ ```
186
+
176
187
  Schema-backed attachments can rehydrate hibernated sockets:
177
188
 
178
189
  ```ts