effect-cf 0.14.0 → 0.15.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,11 @@
1
1
  # effect-cf
2
2
 
3
+ ## 0.15.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#47](https://github.com/danieljvdm/effect-cf/pull/47) [`debc5e1`](https://github.com/danieljvdm/effect-cf/commit/debc5e12cee68c85c5ea99096e2660aa0ec90b6f) Thanks [@owensbla](https://github.com/owensbla)! - Add an Effect-native Cloudflare Send Email binding wrapper. `Email.Tag(...)` now provides a typed client for `send_email` bindings with `send(...)`, `unsafeRaw`, binding validation, and `EmailOperationError` failure mapping.
8
+
3
9
  ## 0.14.0
4
10
 
5
11
  ### Minor Changes
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # effect-cf
2
2
 
3
- Effect-native Cloudflare primitives for Workers, Durable Objects, bindings, KV, D1, Queues, Workflows, and Durable Object storage.
3
+ Effect-native Cloudflare primitives for Workers, Durable Objects, bindings, KV, D1, Queues, Email, Workflows, and Durable Object storage.
4
4
 
5
5
  ## Install
6
6
 
@@ -35,6 +35,7 @@ Runtime creation belongs at Cloudflare entrypoints, not inside binding helpers.
35
35
  - `R2` - typed R2 bucket binding helper with Effect-wrapped object and multipart operations
36
36
  - `Hyperdrive` - typed Hyperdrive binding helper for connection strings and optional Postgres SQL integration
37
37
  - `Images` - typed Cloudflare Images binding helper with transformation APIs and optional hosted image operations
38
+ - `Email` - typed Cloudflare Send Email binding helper for `send_email` bindings
38
39
  - `Queue` - typed Queue producer/consumer tags plus client and error types
39
40
  - `Workflow` - typed Workflow entrypoints, steps, starter clients, and instance types
40
41
  - `Rpc` - Cloudflare RPC type helpers and scoped disposal utilities
@@ -206,6 +207,32 @@ export const resizeAvatar = (image: Images.ImageInputValue) =>
206
207
  });
207
208
  ```
208
209
 
210
+ ## Email Example
211
+
212
+ Email tags expose Cloudflare Send Email bindings as Effect-wrapped `send(...)` operations.
213
+
214
+ ```ts
215
+ import { Effect } from "effect";
216
+ import { Email } from "effect-cf";
217
+
218
+ class TransactionalEmail extends Email.Tag<TransactionalEmail>()("TransactionalEmail") {}
219
+
220
+ export const TransactionalEmailLayer = TransactionalEmail.layer({ binding: "EMAIL" });
221
+
222
+ export const sendWelcomeEmail = (to: string) =>
223
+ Effect.gen(function* () {
224
+ const email = yield* TransactionalEmail;
225
+
226
+ return yield* email.send({
227
+ from: { name: "Example", email: "team@example.com" },
228
+ to,
229
+ subject: "Welcome to Example",
230
+ text: "Welcome to Example",
231
+ html: "<p>Welcome to Example</p>",
232
+ });
233
+ });
234
+ ```
235
+
209
236
  ## Workflow Example
210
237
 
211
238
  Workflow definitions type the payload and result. Runtime handlers can access `Workflow.WorkflowEvent`, use durable `Workflow.step(...)`, and use normal binding services inside steps.