effect-cf 0.22.0 → 0.23.1
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 +14 -0
- package/README.md +26 -2
- package/dist/index.d.mts +929 -897
- package/dist/index.mjs +92 -53
- package/package.json +1 -1
- package/src/ContainerNamespace.ts +172 -33
- package/src/DurableObjectState.ts +61 -34
- package/src/WorkflowBinding.ts +5 -1
- package/src/internal/WorkerContext.ts +29 -19
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# effect-cf
|
|
2
2
|
|
|
3
|
+
## 0.23.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#80](https://github.com/danieljvdm/effect-cf/pull/80) [`cd83c7c`](https://github.com/danieljvdm/effect-cf/commit/cd83c7cc86bb8edfcd1449c17cca1c26aecc8a06) Thanks [@danieljvdm](https://github.com/danieljvdm)! - Stop failing workflow status reads with `WorkflowResultDecodeError` when Cloudflare reports `output: null` for a non-complete instance. The wrapped `WorkflowInstance.status` now returns the real status (e.g. `errored`) with `Option.none()` output and the preserved `error`, while a completed workflow with a `Schema.Null` result still decodes `null` as `Option.some(null)`.
|
|
8
|
+
|
|
9
|
+
## 0.23.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#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.
|
|
14
|
+
|
|
15
|
+
- [#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.
|
|
16
|
+
|
|
3
17
|
## 0.22.0
|
|
4
18
|
|
|
5
19
|
### 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`, `
|
|
122
|
-
`
|
|
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
|
|