effect-cf 0.22.0 → 0.23.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,13 @@
1
1
  # effect-cf
2
2
 
3
+ ## 0.23.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#78](https://github.com/danieljvdm/effect-cf/pull/78) [`f753742`](https://github.com/danieljvdm/effect-cf/commit/f753742500603ea604f4f11d4c7840a41efb849b) Thanks [@danieljvdm](https://github.com/danieljvdm)! - Extend the `ContainerNamespace` client with the remaining caller-side Container primitives: `waitForPort` (preserving the native retry-count result), the runtime host-policy operations (`setAllowedHosts`, `setDeniedHosts`, `allowHost`, `denyHost`, `removeAllowedHost`, `removeDeniedHost`), and numeric stop signals alongside the named ones. `ContainerNamespace.Tag` now accepts an optional exact native namespace type (for example `DurableObjectNamespace<CodexSandbox>`) so `rawUnsafe` on the namespace and on named instances preserves the exact native namespace and stub types, including extra subclass methods. Existing consumers compile unchanged via default type parameters.
8
+
9
+ - [#78](https://github.com/danieljvdm/effect-cf/pull/78) [`f753742`](https://github.com/danieljvdm/effect-cf/commit/f753742500603ea604f4f11d4c7840a41efb849b) Thanks [@danieljvdm](https://github.com/danieljvdm)! - `DurableObjectState.waitUntil` now also accepts an Effect, running it in the background with the caller's Effect context and the same failure modes as `WorkerContext.waitUntil` (`"observe"` logs or routes failures to `onFailure`; `"propagate"` also rejects the native `waitUntil` promise). The existing Promise form is unchanged, so Durable Objects no longer need to capture a Context and call `Effect.runPromiseWith` to schedule background Effects.
10
+
3
11
  ## 0.22.0
4
12
 
5
13
  ### Minor Changes
package/README.md CHANGED
@@ -87,6 +87,12 @@ export const readCounter = Effect.gen(function* () {
87
87
 
88
88
  Define Wrangler bindings and migrations in the consuming application. Durable Object namespace bindings are provided with `YourObject.layer({ binding })`, and consumers use `const namespace = yield* YourObject`.
89
89
 
90
+ `DurableObjectState.waitUntil` accepts either a raw Promise or an Effect. The
91
+ Effect form runs in the background with the caller's Effect context and the
92
+ same failure modes as `WorkerContext.waitUntil`, so Durable Objects can
93
+ schedule background Effects (for example a pump consuming an outbound
94
+ WebSocket) without capturing a Context and calling `Effect.runPromiseWith`.
95
+
90
96
  ## Container Example
91
97
 
92
98
  Container entrypoints remain owned by `@cloudflare/containers`; `effect-cf`
@@ -118,12 +124,30 @@ export default Worker.make(RenderersLive, {
118
124
  ```
119
125
 
120
126
  The instance client exposes `state`, `fetch`, `start`,
121
- `startAndWaitForPorts`, `stop`, `destroy`, and the Effect-valued native
122
- `rawUnsafe` stub.
127
+ `startAndWaitForPorts`, `waitForPort`, `stop` (named or numeric signals),
128
+ `destroy`, the runtime host-policy operations (`setAllowedHosts`,
129
+ `setDeniedHosts`, `allowHost`, `denyHost`, `removeAllowedHost`,
130
+ `removeDeniedHost`), and the Effect-valued native `rawUnsafe` stub.
131
+ Host-policy operations only forward the native remote calls; applications
132
+ continue to own hostname policy and outbound handlers.
123
133
  Responses are returned unchanged, including non-2xx and WebSocket upgrade
124
134
  responses. If the Container uses outbound interception, also export
125
135
  `ContainerProxy` from `@cloudflare/containers`.
126
136
 
137
+ `ContainerNamespace.Tag` accepts an optional second type parameter carrying
138
+ the exact native namespace type. `rawUnsafe` on the namespace and on named
139
+ instances then preserves that exact type, including extra subclass methods,
140
+ instead of the minimal structural shape:
141
+
142
+ ```ts
143
+ class Sandboxes extends ContainerNamespace.Tag<Sandboxes, DurableObjectNamespace<CodexSandbox>>()(
144
+ "Sandboxes",
145
+ ) {}
146
+
147
+ // Effect<DurableObjectStub<CodexSandbox>, ContainerOperationError, Sandboxes>
148
+ const stub = Sandboxes.byName("codex").rawUnsafe;
149
+ ```
150
+
127
151
  See [`examples/containers/README.md`](../../examples/containers/README.md) for
128
152
  the corresponding Wrangler configuration and entrypoint responsibilities.
129
153