effect-cf 0.32.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 +12 -0
- package/README.md +16 -9
- package/dist/ComputerWorkspace.d.mts +1 -1
- package/dist/ComputerWorkspace.mjs +1 -1
- package/dist/{DurableObjectState-B0A0Y1ef.d.mts → DurableObjectState-BpRjz6-q.d.mts} +4 -2
- package/dist/{DurableObjectState-D1Ibr6k0.mjs → DurableObjectState-CVLLse69.mjs} +1 -1
- package/dist/Vitest.d.mts +2 -2
- package/dist/Vitest.mjs +1 -1
- package/dist/{WorkflowBinding-B9_S8tX2.d.mts → WorkflowBinding-lBR4_-op.d.mts} +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -5
- package/package.json +2 -2
- package/src/DurableObjectRpcWebSocket.ts +1 -5
- package/src/DurableObjectState.ts +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# effect-cf
|
|
2
2
|
|
|
3
|
+
## 0.33.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#125](https://github.com/danieljvdm/effect-cf/pull/125) [`3821343`](https://github.com/danieljvdm/effect-cf/commit/3821343214de0ab2b05178001cf299488378760a) Thanks [@danieljvdm](https://github.com/danieljvdm)! - Expose `DurableObjectState.abort(reason, { retryAlarm: false })` so alarm handlers can reset the object without retrying the current alarm. The package now targets workerd `1.20260825.1` and recommends `compatibility_date` `2026-08-25`.
|
|
8
|
+
|
|
9
|
+
## 0.32.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#124](https://github.com/danieljvdm/effect-cf/pull/124) [`a37b2b9`](https://github.com/danieljvdm/effect-cf/commit/a37b2b955421d7f274985a4f93b8485fc1f99bbf) Thanks [@danieljvdm](https://github.com/danieljvdm)! - Close hibernatable Durable Object RPC WebSockets with code 1012 after protocol errors so pending calls fail instead of hanging.
|
|
14
|
+
|
|
3
15
|
## 0.32.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -4,8 +4,8 @@ Effect-native Cloudflare primitives for Workers, Durable Objects, Containers, bi
|
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
|
-
`effect-cf` targets Effect `^4.0.0-beta.105` and Cloudflare workerd `1.
|
|
8
|
-
(`@cloudflare/workers-types@5.
|
|
7
|
+
`effect-cf` targets Effect `^4.0.0-beta.105` and Cloudflare workerd `1.20260825.1`
|
|
8
|
+
(`@cloudflare/workers-types@5.20260825.1`, recommended `compatibility_date` `2026-08-25`).
|
|
9
9
|
|
|
10
10
|
```bash
|
|
11
11
|
bun add effect-cf "effect@^4.0.0-beta.105"
|
|
@@ -274,6 +274,10 @@ same failure modes as `WorkerContext.waitUntil`, so Durable Objects can
|
|
|
274
274
|
schedule background Effects (for example a pump consuming an outbound
|
|
275
275
|
WebSocket) without capturing a Context and calling `Effect.runPromiseWith`.
|
|
276
276
|
|
|
277
|
+
`DurableObjectState.abort(reason, { retryAlarm: false })` resets the current
|
|
278
|
+
Durable Object without retrying the alarm that triggered the reset. The option
|
|
279
|
+
has no effect outside an alarm handler and defaults to retrying the alarm.
|
|
280
|
+
|
|
277
281
|
## Container Example
|
|
278
282
|
|
|
279
283
|
Container entrypoints remain owned by `@cloudflare/containers`; `effect-cf`
|
|
@@ -729,16 +733,19 @@ export const resizeAvatar = (image: Images.ImageInputValue) =>
|
|
|
729
733
|
`effect-cf` develops and tests against a fixed Cloudflare Workers runtime stack. Keep consumer
|
|
730
734
|
`compatibility_date` and optional `@cloudflare/workers-types` peers at or above this pin:
|
|
731
735
|
|
|
732
|
-
| Pin | Version
|
|
733
|
-
| ------------------------------------------- |
|
|
734
|
-
| workerd | `1.
|
|
735
|
-
| `@cloudflare/workers-types` (optional peer) | `5.
|
|
736
|
-
|
|
|
737
|
-
|
|
|
736
|
+
| Pin | Version |
|
|
737
|
+
| ------------------------------------------- | -------------------- |
|
|
738
|
+
| workerd | `1.20260825.1` |
|
|
739
|
+
| `@cloudflare/workers-types` (optional peer) | `5.20260825.1` |
|
|
740
|
+
| miniflare (repo override / tests) | `5.20260825.0-alpha` |
|
|
741
|
+
| wrangler (repo catalog / examples) | `4.126.0` |
|
|
742
|
+
| Recommended `compatibility_date` | `2026-08-25` |
|
|
738
743
|
|
|
739
744
|
The date in the `workerd` / `@cloudflare/workers-types` version is the API surface this package wraps.
|
|
740
745
|
Repo catalog pins live in the root `package.json` `catalog` field (`@cloudflare/workers-types`, `wrangler`).
|
|
741
|
-
`wrangler@4.
|
|
746
|
+
`wrangler@4.126.0` pulls `workerd@1.20260825.1` and peers `@cloudflare/workers-types@^5.20260825.1`.
|
|
747
|
+
The Miniflare and Wrangler overrides keep worker tests on the same runtime when
|
|
748
|
+
`@cloudflare/vitest-plugin` lags the repo catalog.
|
|
742
749
|
|
|
743
750
|
## Email Example
|
|
744
751
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComputerArtifactsClient } from "./ComputerArtifacts.mjs";
|
|
2
|
-
import { t as DurableObjectState } from "./DurableObjectState-
|
|
2
|
+
import { t as DurableObjectState } from "./DurableObjectState-BpRjz6-q.mjs";
|
|
3
3
|
import { Context, Effect, Layer, Schema, Scope, Stream } from "effect";
|
|
4
4
|
import { CommitView, GitClient, GitCloneOptions, GitCommitOptions, GitDiffOptions, GitFetchOptions, GitLogOptions, GitUpdateRefOptions } from "@cloudflare/computer/git";
|
|
5
5
|
import { ExecSyncResult, RuntimeExecOptions, RuntimeGetOptions, RuntimeKillOptions, ShellValue, SkippedEntry, ThinkWorkspaceCompatibility, WorkspaceClient, WorkspaceRuntimeResult, WorkspaceRuntimeValue as WorkspaceRuntimeValue$1 } from "@cloudflare/computer";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as DurableObjectState } from "./DurableObjectState-
|
|
1
|
+
import { t as DurableObjectState } from "./DurableObjectState-CVLLse69.mjs";
|
|
2
2
|
import { fromClient } from "./ComputerArtifacts.mjs";
|
|
3
3
|
import { t as lookup } from "./ComputerWorkspaceHostRegistry-CY5Fv4Ng.mjs";
|
|
4
4
|
import { Context, Effect, Layer, Predicate, Schema, Stream } from "effect";
|
|
@@ -1026,9 +1026,11 @@ interface DurableObjectStateService {
|
|
|
1026
1026
|
/**
|
|
1027
1027
|
* Forcibly resets the Durable Object. Cloudflare logs an uncaught Error using
|
|
1028
1028
|
* the optional reason, and the method is not available in `wrangler dev` local
|
|
1029
|
-
* development according to the Durable Object State docs.
|
|
1029
|
+
* development according to the Durable Object State docs. Set
|
|
1030
|
+
* `retryAlarm: false` to prevent the current alarm invocation from retrying;
|
|
1031
|
+
* this option has no effect outside an alarm handler.
|
|
1030
1032
|
*/
|
|
1031
|
-
abort(reason?: string): Effect.Effect<void>;
|
|
1033
|
+
abort(reason?: string, options?: globalThis.DurableObjectAbortOptions): Effect.Effect<void>;
|
|
1032
1034
|
}
|
|
1033
1035
|
declare const DurableObjectState_base: Context.ServiceClass<DurableObjectState, "effect-cf/DurableObjectState", DurableObjectStateService>;
|
|
1034
1036
|
/**
|
|
@@ -343,7 +343,7 @@ const fromDurableObjectState = (state) => {
|
|
|
343
343
|
setHibernatableWebSocketEventTimeout: (timeoutMs) => Effect.sync(() => state.setHibernatableWebSocketEventTimeout(timeoutMs)),
|
|
344
344
|
getHibernatableWebSocketEventTimeout: Effect.sync(() => state.getHibernatableWebSocketEventTimeout()),
|
|
345
345
|
getTags: (ws) => Effect.sync(() => state.getTags(ws.raw)),
|
|
346
|
-
abort: (reason) => Effect.sync(() => state.abort(reason))
|
|
346
|
+
abort: (reason, options) => Effect.sync(() => state.abort(reason, options))
|
|
347
347
|
};
|
|
348
348
|
};
|
|
349
349
|
const runPromiseExitPreservingTypedFailures = async (context, effect) => {
|
package/dist/Vitest.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { c as WorkerEnvironment, s as WorkerEnv } from "./Binding-xJJJPmiD.mjs";
|
|
2
|
-
import { n as DurableObjectStateService, t as DurableObjectState } from "./DurableObjectState-
|
|
3
|
-
import { o as WorkflowInstanceStatusName } from "./WorkflowBinding-
|
|
2
|
+
import { n as DurableObjectStateService, t as DurableObjectState } from "./DurableObjectState-BpRjz6-q.mjs";
|
|
3
|
+
import { o as WorkflowInstanceStatusName } from "./WorkflowBinding-lBR4_-op.mjs";
|
|
4
4
|
import { Effect, Layer, Schema } from "effect";
|
|
5
5
|
import { DurableObject } from "cloudflare:workers";
|
|
6
6
|
import { adminSecretsStore as adminSecretsStore$1, getQueueResult, introspectWorkflow as introspectWorkflow$1, introspectWorkflowInstance as introspectWorkflowInstance$1 } from "cloudflare:test";
|
package/dist/Vitest.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as WorkerEnvironment, i as WorkerConfig } from "./ErrorMessage-BM0K-Nik.mjs";
|
|
2
|
-
import { r as fromDurableObjectState, t as DurableObjectState } from "./DurableObjectState-
|
|
2
|
+
import { r as fromDurableObjectState, t as DurableObjectState } from "./DurableObjectState-CVLLse69.mjs";
|
|
3
3
|
import { ConfigProvider, Effect, Exit, Layer } from "effect";
|
|
4
4
|
import { env } from "cloudflare:workers";
|
|
5
5
|
import { abortAllDurableObjects as abortAllDurableObjects$1, adminSecretsStore as adminSecretsStore$1, applyD1Migrations as applyD1Migrations$1, createExecutionContext, createMessageBatch, createPagesEventContext, createScheduledController, evictAllDurableObjects as evictAllDurableObjects$1, evictDurableObject as evictDurableObject$1, getQueueResult, introspectWorkflow as introspectWorkflow$1, introspectWorkflowInstance as introspectWorkflowInstance$1, listDurableObjectIds as listDurableObjectIds$1, reset as reset$1, runDurableObjectAlarm as runDurableObjectAlarm$1, runInDurableObject as runInDurableObject$1, waitOnExecutionContext } from "cloudflare:test";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as WorkerEnvironment, r as BindingValidationError, t as BindingNotFoundError } from "./Binding-xJJJPmiD.mjs";
|
|
2
|
-
import { x as ServiceFreeSchema } from "./DurableObjectState-
|
|
2
|
+
import { x as ServiceFreeSchema } from "./DurableObjectState-BpRjz6-q.mjs";
|
|
3
3
|
import { Context, Effect, Option, Schema } from "effect";
|
|
4
4
|
declare namespace WorkflowBinding_d_exports {
|
|
5
5
|
export { WorkflowBindingClient, WorkflowBindingDefinition, WorkflowInstance, WorkflowInstanceCreateBatchOptions, WorkflowInstanceCreateOptions, WorkflowInstanceEvent, WorkflowInstanceLocationHint, WorkflowInstanceRestartOptions, WorkflowInstanceStatus, WorkflowInstanceStatusName, WorkflowInstanceTerminateOptions, WorkflowOperationError, WorkflowResultDecodeError, isWorkflow, layer, makeClient };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { a as Environment_d_exports, c as WorkerEnvironment, i as Binding_d_exports, n as BindingService, o as WorkerConfig, r as BindingValidationError, s as WorkerEnv, t as BindingNotFoundError } from "./Binding-xJJJPmiD.mjs";
|
|
2
2
|
import { l as Artifacts_d_exports } from "./Artifacts-DnHQA-Ax.mjs";
|
|
3
|
-
import { A as StorageOperationError, C as Rpc_d_exports, D as DurableWebSocket, E as DurableObjectWebSocket_d_exports, O as DurableWebSocketAttachmentError, S as Provider, T as AcceptedUpgrade, _ as Definition$4, a as NativeRequest, b as RpcDefinition_d_exports, c as WorkerDefinition_d_exports, d as AsyncMethodCloudflareReturn, f as AsyncMethodKey, g as QueueBinding_d_exports, h as QueueDefinition_d_exports, i as ExecutionContext, k as DurableObjectStorage_d_exports, l as ServiceBinding_d_exports, m as Queue_d_exports, o as WorkerContext, p as AsyncMethodSuccess, r as DurableObjectState_d_exports, s as Worker_d_exports, t as DurableObjectState, u as AsyncMethodArgs, v as Method$2, w as AcceptUpgradeOptions, x as ServiceFreeSchema$1, y as ReservedMethodName$2 } from "./DurableObjectState-
|
|
3
|
+
import { A as StorageOperationError, C as Rpc_d_exports, D as DurableWebSocket, E as DurableObjectWebSocket_d_exports, O as DurableWebSocketAttachmentError, S as Provider, T as AcceptedUpgrade, _ as Definition$4, a as NativeRequest, b as RpcDefinition_d_exports, c as WorkerDefinition_d_exports, d as AsyncMethodCloudflareReturn, f as AsyncMethodKey, g as QueueBinding_d_exports, h as QueueDefinition_d_exports, i as ExecutionContext, k as DurableObjectStorage_d_exports, l as ServiceBinding_d_exports, m as Queue_d_exports, o as WorkerContext, p as AsyncMethodSuccess, r as DurableObjectState_d_exports, s as Worker_d_exports, t as DurableObjectState, u as AsyncMethodArgs, v as Method$2, w as AcceptUpgradeOptions, x as ServiceFreeSchema$1, y as ReservedMethodName$2 } from "./DurableObjectState-BpRjz6-q.mjs";
|
|
4
4
|
import { t as Hyperdrive_d_exports } from "./Hyperdrive-z-9fFz15.mjs";
|
|
5
5
|
import { t as ContainerNamespace_d_exports } from "./ContainerNamespace-CFjiLw8b.mjs";
|
|
6
|
-
import { a as WorkflowInstanceCreateOptions, i as WorkflowInstanceCreateBatchOptions, n as WorkflowBinding_d_exports, r as WorkflowInstance, s as WorkflowOperationError, t as WorkflowBindingClient } from "./WorkflowBinding-
|
|
6
|
+
import { a as WorkflowInstanceCreateOptions, i as WorkflowInstanceCreateBatchOptions, n as WorkflowBinding_d_exports, r as WorkflowInstance, s as WorkflowOperationError, t as WorkflowBindingClient } from "./WorkflowBinding-lBR4_-op.mjs";
|
|
7
7
|
import { Cause, Config, Context, Data, DateTime, Duration, Effect, Layer, Option, Predicate, Redacted, Schema, Scope } from "effect";
|
|
8
8
|
import { Headers as Headers$1, HttpClient, HttpClientResponse } from "effect/unstable/http";
|
|
9
9
|
import { OtlpExporter, OtlpResource } from "effect/unstable/observability";
|
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
|
2
2
|
import { a as WorkerEnvironment, i as WorkerConfig, n as violationsMessage, r as Environment_exports, t as causeMessage } from "./ErrorMessage-BM0K-Nik.mjs";
|
|
3
3
|
import { n as Service$2, r as layer$19, t as Binding_exports } from "./Binding-pfilNJmP.mjs";
|
|
4
4
|
import { n as Artifacts_exports } from "./Artifacts-CSIk1Oml.mjs";
|
|
5
|
-
import { a as DurableObjectWebSocket_exports, c as DurableObjectStorage_exports, i as fromExecutionContext, n as DurableObjectState_exports, o as DurableWebSocketAttachmentError, r as fromDurableObjectState, s as fromWebSocket, t as DurableObjectState } from "./DurableObjectState-
|
|
5
|
+
import { a as DurableObjectWebSocket_exports, c as DurableObjectStorage_exports, i as fromExecutionContext, n as DurableObjectState_exports, o as DurableWebSocketAttachmentError, r as fromDurableObjectState, s as fromWebSocket, t as DurableObjectState } from "./DurableObjectState-CVLLse69.mjs";
|
|
6
6
|
import { Cause, Clock, Config, ConfigProvider, Context, Data, DateTime, Duration, Effect, Exit, Function as Function$1, Layer, ManagedRuntime, Option, Predicate, Queue, Result, Schema } from "effect";
|
|
7
7
|
import { FetchHttpClient, HttpClient, HttpClientRequest, HttpEffect, HttpServerRequest, HttpServerResponse } from "effect/unstable/http";
|
|
8
8
|
import { OtlpExporter, OtlpLogger, OtlpMetrics, OtlpSerialization, OtlpTracer } from "effect/unstable/observability";
|
|
@@ -2931,10 +2931,7 @@ const layer$8 = (options = {}) => Layer.effectContext(Effect.gen(function* () {
|
|
|
2931
2931
|
return Predicate.isTagged(cause, "MaxBufferSizeExceeded") ? Effect.ignore(connection.socket.close(1009, String(cause))) : send(connection, RpcMessage.ResponseDefectEncoded(cause));
|
|
2932
2932
|
})),
|
|
2933
2933
|
close: unregister,
|
|
2934
|
-
error:
|
|
2935
|
-
yield* Effect.logDebug("Durable Object RPC websocket error", cause);
|
|
2936
|
-
yield* unregister(socket);
|
|
2937
|
-
}),
|
|
2934
|
+
error: resetSocket,
|
|
2938
2935
|
checkpoint
|
|
2939
2936
|
});
|
|
2940
2937
|
return Context.mergeAll(Context.make(RpcServer.Protocol, protocol), Context.make(DurableObjectRpcWebSocket, service));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "effect-cf",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.33.0",
|
|
4
4
|
"description": "Effect-native primitives for Cloudflare Workers and bindings.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"@cloudflare/computer": "^0.2.0",
|
|
86
86
|
"@cloudflare/sandbox": "^0.13.0-next.738.2",
|
|
87
87
|
"@cloudflare/vitest-plugin": "^1.0.0",
|
|
88
|
-
"@cloudflare/workers-types": "^5.
|
|
88
|
+
"@cloudflare/workers-types": "^5.20260825.1",
|
|
89
89
|
"@effect/sql-d1": "^4.0.0-rc.110",
|
|
90
90
|
"@effect/sql-pg": "^4.0.0-rc.110",
|
|
91
91
|
"@effect/sql-sqlite-do": "^4.0.0-rc.110",
|
|
@@ -1059,11 +1059,7 @@ export const layer = (
|
|
|
1059
1059
|
}),
|
|
1060
1060
|
),
|
|
1061
1061
|
close: unregister,
|
|
1062
|
-
error:
|
|
1063
|
-
Effect.gen(function* () {
|
|
1064
|
-
yield* Effect.logDebug("Durable Object RPC websocket error", cause);
|
|
1065
|
-
yield* unregister(socket);
|
|
1066
|
-
}),
|
|
1062
|
+
error: resetSocket,
|
|
1067
1063
|
checkpoint,
|
|
1068
1064
|
});
|
|
1069
1065
|
|
|
@@ -66,9 +66,11 @@ export interface DurableObjectStateService {
|
|
|
66
66
|
/**
|
|
67
67
|
* Forcibly resets the Durable Object. Cloudflare logs an uncaught Error using
|
|
68
68
|
* the optional reason, and the method is not available in `wrangler dev` local
|
|
69
|
-
* development according to the Durable Object State docs.
|
|
69
|
+
* development according to the Durable Object State docs. Set
|
|
70
|
+
* `retryAlarm: false` to prevent the current alarm invocation from retrying;
|
|
71
|
+
* this option has no effect outside an alarm handler.
|
|
70
72
|
*/
|
|
71
|
-
abort(reason?: string): Effect.Effect<void>;
|
|
73
|
+
abort(reason?: string, options?: globalThis.DurableObjectAbortOptions): Effect.Effect<void>;
|
|
72
74
|
}
|
|
73
75
|
|
|
74
76
|
/**
|
|
@@ -136,7 +138,8 @@ export const fromDurableObjectState = (
|
|
|
136
138
|
state.getHibernatableWebSocketEventTimeout(),
|
|
137
139
|
),
|
|
138
140
|
getTags: (ws: DurableWebSocket) => Effect.sync(() => state.getTags(ws.raw)),
|
|
139
|
-
abort: (reason?: string
|
|
141
|
+
abort: (reason?: string, options?: globalThis.DurableObjectAbortOptions) =>
|
|
142
|
+
Effect.sync(() => state.abort(reason, options)),
|
|
140
143
|
};
|
|
141
144
|
};
|
|
142
145
|
|