effect-cf 0.38.0 → 0.39.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 CHANGED
@@ -1,5 +1,21 @@
1
1
  # effect-cf
2
2
 
3
+ ## 0.39.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#142](https://github.com/danieljvdm/effect-cf/pull/142) [`4ecf192`](https://github.com/danieljvdm/effect-cf/commit/4ecf192733193f4c3b5869abd992c1658f5ad7a6) Thanks [@danieljvdm](https://github.com/danieljvdm)! - Rebuild with Vite+ 0.3.0 and apply its formatter's source layout updates. Public APIs and runtime behavior are unchanged.
8
+
9
+ ## 0.39.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#140](https://github.com/danieljvdm/effect-cf/pull/140) [`3013c49`](https://github.com/danieljvdm/effect-cf/commit/3013c495a6e4392446a5661777f5eb0ffe4a828f) Thanks [@danieljvdm](https://github.com/danieljvdm)! - Require the Effect 4.0.0-rc.112 family. Both packages now declare `effect@^4.0.0-rc.112`; effect-cf's SQL peers require the matching rc.112 line. Upgrade these dependencies together.
14
+
15
+ Fix Durable Object WebSocket RPC server startup with rc.112 and preserve the selected serialization's schema codecs for payloads, replies, and transport errors. JSON consumers can keep `RpcSerialization.layerJson`; no wire-format migration is required. The protocol also declares its existing ability to send server notifications. Hibernation attachments, resumable stream checkpoints, acknowledgements, and tracing behavior are unchanged.
16
+
17
+ The WebTransport socket adapter continues to use Effect's built-in RPC protocols and a framed serialization such as NDJSON. Its runtime API is unchanged.
18
+
3
19
  ## 0.38.0
4
20
 
5
21
  ### Minor Changes
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  Cloudflare entrypoints and bindings as Effect services.
4
4
 
5
5
  ```sh
6
- npm install effect-cf "effect@^4.0.0-rc.110"
6
+ npm install effect-cf "effect@^4.0.0-rc.112"
7
7
  ```
8
8
 
9
9
  The repository tests against workerd `1.20260825.1` and `@cloudflare/workers-types@5.20260825.1`. Use `compatibility_date: "2026-08-25"` in Wrangler.
@@ -1,5 +1,5 @@
1
1
  import { ComputerArtifactsClient } from "./ComputerArtifacts.mjs";
2
- import { t as DurableObjectState } from "./DurableObjectState-CpgAmFqo.mjs";
2
+ import { t as DurableObjectState } from "./DurableObjectState-DJ0K-zyd.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";
@@ -581,7 +581,8 @@ var ComputerWorkspace = class ComputerWorkspace extends Context.Service()("effec
581
581
  * releases its RPC client when the layer scope closes.
582
582
  */
583
583
  static layer = Layer.effect(ComputerWorkspace, Effect.gen(function* () {
584
- const host = lookup((yield* DurableObjectState).raw);
584
+ const state = yield* DurableObjectState;
585
+ const host = lookup(state.raw);
585
586
  if (host === void 0) return yield* Effect.die("ComputerWorkspace.layer requires a Durable Object class built with withComputerWorkspace");
586
587
  const computer = yield* Effect.tryPromise({
587
588
  try: () => import("@cloudflare/computer"),
@@ -1,4 +1,4 @@
1
- import { i as WorkerContextWaitUntilOptions } from "./Worker-Dl6_Pijl.mjs";
1
+ import { i as WorkerContextWaitUntilOptions } from "./Worker-gV4mDqIs.mjs";
2
2
  import { Cause, Context, Duration, Effect, Option, Schema } from "effect";
3
3
  declare namespace DurableObjectStorage_d_exports {
4
4
  export { DurableObjectStorage, DurableObjectTransaction, SchemaBackedSyncKvStorage, SqlCursor, SqlStorage, SqlStorageValue, StorageOperationError, SyncKvDefinition, SyncKvStorage, fromDurableObjectStorage };
package/dist/Mcp.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { n as NativeRequest } from "./Worker-Dl6_Pijl.mjs";
1
+ import { n as NativeRequest } from "./Worker-gV4mDqIs.mjs";
2
2
  import { Effect, Option } from "effect";
3
3
  import { CreateMcpHandlerOptions, ServerOptions } from "@modelcontextprotocol/server";
4
4
  import { Tool, Toolkit } from "effect/unstable/ai";
package/dist/Vitest.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { c as WorkerEnvironment, s as WorkerEnv } from "./Binding-DKcLrQCM.mjs";
2
- import { n as DurableObjectStateService, t as DurableObjectState } from "./DurableObjectState-CpgAmFqo.mjs";
3
- import { o as WorkflowInstanceStatusName } from "./WorkflowBinding-CvJT9hB5.mjs";
2
+ import { n as DurableObjectStateService, t as DurableObjectState } from "./DurableObjectState-DJ0K-zyd.mjs";
3
+ import { o as WorkflowInstanceStatusName } from "./WorkflowBinding-DtVykUCz.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";
@@ -330,14 +330,14 @@ interface ServiceFetcher {
330
330
  type RpcClient<Api> = { readonly [Key in keyof Api as Key extends string ? Api[Key] extends ((...args: Array<any>) => any) ? Key : never : never]: Api[Key]; };
331
331
  type ReservedMethodName$2 = ReservedMethodName$1 | "fetch";
332
332
  type ServiceBindingClient<Api extends object> = ServiceFetcher & RpcClient<Provider<Api, ReservedMethodName$2>>;
333
- type ApiFromDefinition<Definition$12> = Definition$12 extends Definition.Any ? ServerApi$1<Definition$12> : never;
333
+ type ApiFromDefinition<Definition$4> = Definition$4 extends Definition.Any ? ServerApi$1<Definition$4> : never;
334
334
  type ApiOrDefinition<Api extends object, Definition> = [Api] extends [never] ? ApiFromDefinition<Definition> : Api;
335
335
  /**
336
336
  * Binding metadata used to create an Effect service from a Worker binding.
337
337
  */
338
- interface ServiceBindingDefinition<Definition$7 extends Definition.Any | undefined = undefined> {
338
+ interface ServiceBindingDefinition<Definition$5 extends Definition.Any | undefined = undefined> {
339
339
  readonly binding: string;
340
- readonly definition?: Definition$7;
340
+ readonly definition?: Definition$5;
341
341
  /** Append live trace context only when the receiver also enables rpcTracing. */
342
342
  readonly rpcTracing?: boolean;
343
343
  }
@@ -371,9 +371,9 @@ type ServiceMethodArgs<Api, Method extends keyof Api> = AsyncMethodArgs<Api, Met
371
371
  type ServiceMethodSuccess<Api, Method extends keyof Api> = AsyncMethodSuccess<Api, Method>;
372
372
  type ServiceMethodCloudflareReturn<Api, Method extends keyof Api> = AsyncMethodCloudflareReturn<Api, Method>;
373
373
  type ServiceCall<R, Api> = <Method extends ServiceMethodKey<Api>>(method: Method, ...args: ServiceMethodArgs<Api, Method>) => Effect.Effect<ServiceMethodSuccess<Api, Method>, ServiceBindingRpcError, R>;
374
- type DefinitionDirectMethods<R, Definition$4 extends Definition.Any> = { readonly [Method in Definition$3.MethodNames<Definition$4>]: (...args: Method$2.Args<Definition$4["methods"][Method]>) => Effect.Effect<Method$2.Success<Definition$4["methods"][Method]>, ServiceBindingRpcError, R>; };
375
- type DirectMethods<R, Definition$13> = Definition$13 extends Definition.Any ? DefinitionDirectMethods<R, Definition$13> : {};
376
- type ServiceBindingEffectClient<Api extends object, Definition$8 extends Definition.Any | undefined = undefined> = DirectMethods<never, Definition$8> & {
374
+ type DefinitionDirectMethods<R, Definition$9 extends Definition.Any> = { readonly [Method in Definition$3.MethodNames<Definition$9>]: (...args: Method$2.Args<Definition$9["methods"][Method]>) => Effect.Effect<Method$2.Success<Definition$9["methods"][Method]>, ServiceBindingRpcError, R>; };
375
+ type DirectMethods<R, Definition$12> = Definition$12 extends Definition.Any ? DefinitionDirectMethods<R, Definition$12> : {};
376
+ type ServiceBindingEffectClient<Api extends object, Definition$10 extends Definition.Any | undefined = undefined> = DirectMethods<never, Definition$10> & {
377
377
  readonly fetch: (input: RequestInfo | URL, init?: RequestInit) => Effect.Effect<globalThis.Response, ServiceBindingFetchError>;
378
378
  /**
379
379
  * Invokes a Worker RPC method and returns Cloudflare's raw RPC result.
@@ -402,7 +402,7 @@ type ServiceBindingEffectClient<Api extends object, Definition$8 extends Definit
402
402
  */
403
403
  readonly scopedCall: <Method extends ServiceMethodKey<Api>>(method: Method, ...args: ServiceMethodArgs<Api, Method>) => Effect.Effect<Awaited<ServiceMethodSuccess<Api, Method>>, ServiceBindingRpcError, Scope.Scope>;
404
404
  };
405
- type ServiceBindingStaticClient<R, Api extends object, Definition$5 extends Definition.Any | undefined = undefined> = DirectMethods<R, Definition$5> & {
405
+ type ServiceBindingStaticClient<R, Api extends object, Definition$11 extends Definition.Any | undefined = undefined> = DirectMethods<R, Definition$11> & {
406
406
  readonly fetch: (input: RequestInfo | URL, init?: RequestInit) => Effect.Effect<globalThis.Response, ServiceBindingFetchError, R>;
407
407
  readonly rpc: <Method extends ServiceMethodKey<Api>>(method: Method, ...args: ServiceMethodArgs<Api, Method>) => Effect.Effect<ServiceMethodCloudflareReturn<Api, Method>, ServiceBindingRpcError, R>;
408
408
  readonly call: <Method extends ServiceMethodKey<Api>>(method: Method, ...args: ServiceMethodArgs<Api, Method>) => Effect.Effect<ServiceMethodSuccess<Api, Method>, ServiceBindingRpcError, R>;
@@ -410,17 +410,17 @@ type ServiceBindingStaticClient<R, Api extends object, Definition$5 extends Defi
410
410
  };
411
411
  type ServiceBindingValue = Schema.Schema.Type<typeof Schema.Unknown>;
412
412
  declare const isServiceBindingClient: <Api extends object>(value: ServiceBindingValue) => value is ServiceBindingClient<Api>;
413
- declare const makeClient: <Api extends object, const Definition$10 extends Definition.Any | undefined = undefined>(definition: ServiceBindingDefinition<Definition$10>) => ((service: ServiceBindingClient<Api>) => ServiceBindingEffectClient<Api, Definition$10>);
414
- declare const layer: <Self, Api extends object, const Definition$11 extends Definition.Any | undefined = undefined>(tag: Context.Service<Self, ServiceBindingEffectClient<Api, Definition$11>>, definition: ServiceBindingDefinition<Definition$11>) => import("effect/Layer").Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
415
- declare const Service: <Self, Api extends object = never>() => <Id extends string, const Definition$6 extends Definition.Any | undefined = undefined>(id: Id, definition: ServiceBindingDefinition<Definition$6>) => BindingService<Self, Id, ServiceBindingEffectClient<ApiOrDefinition<Api, Definition$6>, Definition$6>> & DirectMethods<Self, Definition$6> & {
413
+ declare const makeClient: <Api extends object, const Definition$6 extends Definition.Any | undefined = undefined>(definition: ServiceBindingDefinition<Definition$6>) => ((service: ServiceBindingClient<Api>) => ServiceBindingEffectClient<Api, Definition$6>);
414
+ declare const layer: <Self, Api extends object, const Definition$13 extends Definition.Any | undefined = undefined>(tag: Context.Service<Self, ServiceBindingEffectClient<Api, Definition$13>>, definition: ServiceBindingDefinition<Definition$13>) => import("effect/Layer").Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
415
+ declare const Service: <Self, Api extends object = never>() => <Id extends string, const Definition$8 extends Definition.Any | undefined = undefined>(id: Id, definition: ServiceBindingDefinition<Definition$8>) => BindingService<Self, Id, ServiceBindingEffectClient<ApiOrDefinition<Api, Definition$8>, Definition$8>> & DirectMethods<Self, Definition$8> & {
416
416
  readonly [TypeId]: typeof TypeId;
417
- readonly definition: ServiceBindingDefinition<Definition$6>;
417
+ readonly definition: ServiceBindingDefinition<Definition$8>;
418
418
  readonly fetch: (input: URL | RequestInfo<unknown, CfProperties<unknown>>, init?: RequestInit<CfProperties<unknown>> | undefined) => Effect.Effect<Response, ServiceBindingFetchError, Self>;
419
- readonly rpc: <Method extends ServiceMethodKey<ApiOrDefinition<Api, Definition$6>>>(method: Method, ...args: AsyncMethodArgs<ApiOrDefinition<Api, Definition$6>, Method>) => Effect.Effect<Result$1<AsyncMethodSuccess<ApiOrDefinition<Api, Definition$6>, Method>>, ServiceBindingRpcError, Self>;
420
- readonly call: <Method extends ServiceMethodKey<ApiOrDefinition<Api, Definition$6>>>(method: Method, ...args: AsyncMethodArgs<ApiOrDefinition<Api, Definition$6>, Method>) => Effect.Effect<AsyncMethodSuccess<ApiOrDefinition<Api, Definition$6>, Method>, ServiceBindingRpcError, Self>;
421
- readonly scopedCall: <Method extends ServiceMethodKey<ApiOrDefinition<Api, Definition$6>>>(method: Method, ...args: AsyncMethodArgs<ApiOrDefinition<Api, Definition$6>, Method>) => Effect.Effect<Awaited<AsyncMethodSuccess<ApiOrDefinition<Api, Definition$6>, Method>>, ServiceBindingRpcError, Self | Scope.Scope>;
419
+ readonly rpc: <Method extends ServiceMethodKey<ApiOrDefinition<Api, Definition$8>>>(method: Method, ...args: AsyncMethodArgs<ApiOrDefinition<Api, Definition$8>, Method>) => Effect.Effect<Result$1<AsyncMethodSuccess<ApiOrDefinition<Api, Definition$8>, Method>>, ServiceBindingRpcError, Self>;
420
+ readonly call: <Method extends ServiceMethodKey<ApiOrDefinition<Api, Definition$8>>>(method: Method, ...args: AsyncMethodArgs<ApiOrDefinition<Api, Definition$8>, Method>) => Effect.Effect<AsyncMethodSuccess<ApiOrDefinition<Api, Definition$8>, Method>, ServiceBindingRpcError, Self>;
421
+ readonly scopedCall: <Method extends ServiceMethodKey<ApiOrDefinition<Api, Definition$8>>>(method: Method, ...args: AsyncMethodArgs<ApiOrDefinition<Api, Definition$8>, Method>) => Effect.Effect<Awaited<AsyncMethodSuccess<ApiOrDefinition<Api, Definition$8>, Method>>, ServiceBindingRpcError, Self | Scope.Scope>;
422
422
  };
423
- declare const makeDirectMethods: <R, Api, Definition$9 extends Definition.Any | undefined>(rpcDefinition: Definition$9 | undefined, call: ServiceCall<R, Api>) => DirectMethods<R, Definition$9>;
423
+ declare const makeDirectMethods: <R, Api, Definition$7 extends Definition.Any | undefined>(rpcDefinition: Definition$7 | undefined, call: ServiceCall<R, Api>) => DirectMethods<R, Definition$7>;
424
424
  declare namespace WorkerDefinition_d_exports {
425
425
  export { Api, Definition, HandlerEffect, Handlers, LayerOptions, Method$1 as Method, Methods, NoReservedMethods, Options, ReservedMethodName$1 as ReservedMethodName, ServerApi$1 as ServerApi, ServiceFreeSchema, Tag, TagClass, Worker, implement, make$1 as make, method };
426
426
  }
@@ -1,5 +1,5 @@
1
1
  import { c as WorkerEnvironment, r as BindingValidationError, t as BindingNotFoundError } from "./Binding-DKcLrQCM.mjs";
2
- import { S as ServiceFreeSchema } from "./Worker-Dl6_Pijl.mjs";
2
+ import { S as ServiceFreeSchema } from "./Worker-gV4mDqIs.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,10 +1,10 @@
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-DKcLrQCM.mjs";
2
2
  import { l as Artifacts_d_exports } from "./Artifacts-B3r3RuTB.mjs";
3
- import { a as AcceptedUpgrade, c as DurableWebSocketAttachmentError, i as AcceptUpgradeOptions, l as DurableObjectStorage_d_exports, o as DurableObjectWebSocket_d_exports, r as DurableObjectState_d_exports, s as DurableWebSocket, t as DurableObjectState, u as StorageOperationError } from "./DurableObjectState-CpgAmFqo.mjs";
4
- import { C as Provider, S as ServiceFreeSchema$1, _ as QueueBinding_d_exports, a as Worker_d_exports, b as ReservedMethodName$2, c as AsyncMethodArgs, d as AsyncMethodSuccess, f as ReceiverOptions, g as QueueDefinition_d_exports, h as Queue_d_exports, l as AsyncMethodCloudflareReturn, m as RpcTracing_d_exports, n as NativeRequest, o as WorkerDefinition_d_exports, p as RpcInvocationInfo, r as WorkerContext, s as ServiceBinding_d_exports, t as ExecutionContext, u as AsyncMethodKey, v as Definition$4, w as Rpc_d_exports, x as RpcDefinition_d_exports, y as Method$2 } from "./Worker-Dl6_Pijl.mjs";
3
+ import { a as AcceptedUpgrade, c as DurableWebSocketAttachmentError, i as AcceptUpgradeOptions, l as DurableObjectStorage_d_exports, o as DurableObjectWebSocket_d_exports, r as DurableObjectState_d_exports, s as DurableWebSocket, t as DurableObjectState, u as StorageOperationError } from "./DurableObjectState-DJ0K-zyd.mjs";
4
+ import { C as Provider, S as ServiceFreeSchema$1, _ as QueueBinding_d_exports, a as Worker_d_exports, b as ReservedMethodName$2, c as AsyncMethodArgs, d as AsyncMethodSuccess, f as ReceiverOptions, g as QueueDefinition_d_exports, h as Queue_d_exports, l as AsyncMethodCloudflareReturn, m as RpcTracing_d_exports, n as NativeRequest, o as WorkerDefinition_d_exports, p as RpcInvocationInfo, r as WorkerContext, s as ServiceBinding_d_exports, t as ExecutionContext, u as AsyncMethodKey, v as Definition$4, w as Rpc_d_exports, x as RpcDefinition_d_exports, y as Method$2 } from "./Worker-gV4mDqIs.mjs";
5
5
  import { t as Hyperdrive_d_exports } from "./Hyperdrive-HrwFlZ6x.mjs";
6
6
  import { t as ContainerNamespace_d_exports } from "./ContainerNamespace-DbLaeFhN.mjs";
7
- import { a as WorkflowInstanceCreateOptions, i as WorkflowInstanceCreateBatchOptions, n as WorkflowBinding_d_exports, r as WorkflowInstance, s as WorkflowOperationError, t as WorkflowBindingClient } from "./WorkflowBinding-CvJT9hB5.mjs";
7
+ import { a as WorkflowInstanceCreateOptions, i as WorkflowInstanceCreateBatchOptions, n as WorkflowBinding_d_exports, r as WorkflowInstance, s as WorkflowOperationError, t as WorkflowBindingClient } from "./WorkflowBinding-DtVykUCz.mjs";
8
8
  import { Cause, Config, Context, Data, DateTime, Duration, Effect, Layer, Option, Predicate, Redacted, Schema, Scope } from "effect";
9
9
  import { Headers as Headers$1, HttpClient, HttpClientResponse } from "effect/unstable/http";
10
10
  import { OtlpExporter, OtlpResource } from "effect/unstable/observability";
package/dist/index.mjs CHANGED
@@ -288,7 +288,7 @@ const writeLimits = {
288
288
  maxBlobs: 20,
289
289
  maxDoubles: 20,
290
290
  maxIndexes: 1,
291
- maxBlobBytes: 16 * 1024,
291
+ maxBlobBytes: 16384,
292
292
  maxIndexBytes: 96,
293
293
  maxDataPointsPerInvocation: 250
294
294
  };
@@ -1039,7 +1039,8 @@ const makeClient$7 = (definition) => {
1039
1039
  method: methodName,
1040
1040
  cause
1041
1041
  })));
1042
- return yield* invokeRpcMethod(stub, method, definition.rpcTracing ? yield* withRpcTraceContext(encodedArgs) : encodedArgs, (cause) => new DurableObjectRpcError({
1042
+ const nativeArgs = definition.rpcTracing ? yield* withRpcTraceContext(encodedArgs) : encodedArgs;
1043
+ return yield* invokeRpcMethod(stub, method, nativeArgs, (cause) => new DurableObjectRpcError({
1043
1044
  binding: definition.binding,
1044
1045
  method: methodName,
1045
1046
  cause
@@ -1064,7 +1065,8 @@ const makeClient$7 = (definition) => {
1064
1065
  }, (effect, ...args) => withRpcClientSpan(effect, definition.binding, String(args[1])));
1065
1066
  const scopedCall = Effect.fnUntraced(function* (stub, method, ...args) {
1066
1067
  const methodName = String(method);
1067
- const value = yield* scoped(yield* rpc(stub, method, ...args)).pipe(Effect.mapError((cause) => new DurableObjectRpcError({
1068
+ const result = yield* rpc(stub, method, ...args);
1069
+ const value = yield* scoped(result).pipe(Effect.mapError((cause) => new DurableObjectRpcError({
1068
1070
  binding: definition.binding,
1069
1071
  method: methodName,
1070
1072
  cause
@@ -1633,6 +1635,7 @@ const layer$8 = (options = {}) => Layer.effectContext(Effect.gen(function* () {
1633
1635
  const declarations = options.resumableStreams ?? [];
1634
1636
  const durableObjectState = yield* DurableObjectState;
1635
1637
  const serialization = yield* RpcSerialization.RpcSerialization;
1638
+ const encodeDefect = Schema.encodeSync(serialization.codecFor(Schema.Defect()));
1636
1639
  const disconnects = yield* Queue.make();
1637
1640
  const connectionsBySocket = /* @__PURE__ */ new Map();
1638
1641
  const connectionsById = /* @__PURE__ */ new Map();
@@ -1931,7 +1934,7 @@ const layer$8 = (options = {}) => Layer.effectContext(Effect.gen(function* () {
1931
1934
  connection.socket.raw.send(encoded);
1932
1935
  return true;
1933
1936
  } catch (cause) {
1934
- delivered = RpcMessage.ResponseDefectEncoded(cause);
1937
+ delivered = RpcMessage.ResponseDefectEncoded(encodeDefect(cause));
1935
1938
  const encoded = connection.parser.encode(delivered);
1936
1939
  if (encoded === void 0) return false;
1937
1940
  connection.socket.raw.send(encoded);
@@ -1961,7 +1964,9 @@ const layer$8 = (options = {}) => Layer.effectContext(Effect.gen(function* () {
1961
1964
  initialMessage: Effect.succeedNone,
1962
1965
  supportsAck: true,
1963
1966
  supportsTransferables: false,
1964
- supportsSpanPropagation: true
1967
+ supportsSpanPropagation: true,
1968
+ supportsNotifications: true,
1969
+ codecFor: serialization.codecFor
1965
1970
  });
1966
1971
  });
1967
1972
  const replay = writeRequest;
@@ -2029,7 +2034,7 @@ const layer$8 = (options = {}) => Layer.effectContext(Effect.gen(function* () {
2029
2034
  });
2030
2035
  const run = writeRequest;
2031
2036
  if (run === void 0) {
2032
- yield* send(connection, RpcMessage.ResponseDefectEncoded("RPC server is not ready"));
2037
+ yield* send(connection, RpcMessage.ResponseDefectEncoded(encodeDefect("RPC server is not ready")));
2033
2038
  return;
2034
2039
  }
2035
2040
  for (const current of decoded) {
@@ -2044,7 +2049,7 @@ const layer$8 = (options = {}) => Layer.effectContext(Effect.gen(function* () {
2044
2049
  }
2045
2050
  }).pipe(Effect.catch((cause) => {
2046
2051
  const connection = register(socket);
2047
- return Predicate.isTagged(cause, "MaxBufferSizeExceeded") ? Effect.ignore(connection.socket.close(1009, String(cause))) : send(connection, RpcMessage.ResponseDefectEncoded(cause));
2052
+ return Predicate.isTagged(cause, "MaxBufferSizeExceeded") ? Effect.ignore(connection.socket.close(1009, String(cause))) : send(connection, RpcMessage.ResponseDefectEncoded(encodeDefect(cause)));
2048
2053
  })),
2049
2054
  close: unregister,
2050
2055
  error: resetSocket,
@@ -2142,10 +2147,10 @@ const textEncoder = new TextEncoder();
2142
2147
  const sendLimits = {
2143
2148
  maxRecipients: 50,
2144
2149
  maxAttachments: 32,
2145
- maxMessageBytes: 5 * 1024 * 1024,
2150
+ maxMessageBytes: 5242880,
2146
2151
  maxHeaderNameBytes: 100,
2147
2152
  maxHeaderValueBytes: 2048,
2148
- maxHeadersBytes: 16 * 1024,
2153
+ maxHeadersBytes: 16384,
2149
2154
  maxAllowlistHeaders: 20
2150
2155
  };
2151
2156
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "effect-cf",
3
- "version": "0.38.0",
3
+ "version": "0.39.1",
4
4
  "description": "Effect-native primitives for Cloudflare Workers and bindings.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -75,7 +75,7 @@
75
75
  "@cloudflare/sandbox": "0.13.0-next.738.2",
76
76
  "@cloudflare/vitest-plugin": "catalog:",
77
77
  "@cloudflare/workers-types": "catalog:",
78
- "@effect/platform-node": "^4.0.0-rc.110",
78
+ "@effect/platform-node": "catalog:",
79
79
  "@effect/sql-d1": "catalog:",
80
80
  "@effect/sql-pg": "catalog:",
81
81
  "@effect/sql-sqlite-do": "catalog:",
@@ -94,11 +94,11 @@
94
94
  "@cloudflare/sandbox": "^0.13.0-next.738.2",
95
95
  "@cloudflare/vitest-plugin": "^1.0.0",
96
96
  "@cloudflare/workers-types": "^5.20260825.1",
97
- "@effect/sql-d1": "^4.0.0-rc.110",
98
- "@effect/sql-pg": "^4.0.0-rc.110",
99
- "@effect/sql-sqlite-do": "^4.0.0-rc.110",
97
+ "@effect/sql-d1": "^4.0.0-rc.112",
98
+ "@effect/sql-pg": "^4.0.0-rc.112",
99
+ "@effect/sql-sqlite-do": "^4.0.0-rc.112",
100
100
  "@modelcontextprotocol/server": "^2.0.0",
101
- "effect": "^4.0.0-rc.110"
101
+ "effect": "^4.0.0-rc.112"
102
102
  },
103
103
  "peerDependenciesMeta": {
104
104
  "@cloudflare/computer": {
@@ -65,15 +65,17 @@ export type DurableObjectRpcApi<Rpc extends DurableObjectRpc<ROut>, ROut> = {
65
65
  };
66
66
 
67
67
  export type RpcHandlers<ROut, Api> = {
68
- readonly [Key in keyof Api as Key extends keyof CloudflareDurableObject<WorkerEnv>
69
- ? never
70
- : Key extends string
71
- ? [Api[Key]] extends [never]
72
- ? never
73
- : Api[Key] extends (...args: Array<any>) => Promise<any>
74
- ? Key
75
- : never
76
- : never]: Api[Key] extends (...args: infer Args) => Promise<infer A>
68
+ readonly [
69
+ Key in keyof Api as Key extends keyof CloudflareDurableObject<WorkerEnv>
70
+ ? never
71
+ : Key extends string
72
+ ? [Api[Key]] extends [never]
73
+ ? never
74
+ : Api[Key] extends (...args: Array<any>) => Promise<any>
75
+ ? Key
76
+ : never
77
+ : never
78
+ ]: Api[Key] extends (...args: infer Args) => Promise<infer A>
77
79
  ? (...args: Args) => DurableObjectHandler<ROut, A>
78
80
  : never;
79
81
  };
@@ -17,11 +17,13 @@ interface DurableObjectFetcher {
17
17
  }
18
18
 
19
19
  type RpcClient<Api> = {
20
- readonly [Key in keyof Api as Key extends string
21
- ? Api[Key] extends (...args: Array<any>) => any
22
- ? Key
20
+ readonly [
21
+ Key in keyof Api as Key extends string
22
+ ? Api[Key] extends (...args: Array<any>) => any
23
+ ? Key
24
+ : never
23
25
  : never
24
- : never]: Api[Key];
26
+ ]: Api[Key];
25
27
  };
26
28
 
27
29
  type ReservedMethodName = DurableObjectDefinition.ReservedMethodName | "fetch";
@@ -227,6 +227,7 @@ export const layer = (
227
227
  const declarations = options.resumableStreams ?? [];
228
228
  const durableObjectState = yield* DurableObjectState;
229
229
  const serialization = yield* RpcSerialization.RpcSerialization;
230
+ const encodeDefect = Schema.encodeSync(serialization.codecFor(Schema.Defect()));
230
231
  const disconnects = yield* Queue.make<number>();
231
232
  const connectionsBySocket = new Map<WebSocket, RpcConnection>();
232
233
  const connectionsById = new Map<number, RpcConnection>();
@@ -777,7 +778,7 @@ export const layer = (
777
778
 
778
779
  return true;
779
780
  } catch (cause) {
780
- delivered = RpcMessage.ResponseDefectEncoded(cause);
781
+ delivered = RpcMessage.ResponseDefectEncoded(encodeDefect(cause));
781
782
  const encoded = connection.parser.encode(delivered);
782
783
 
783
784
  if (encoded === undefined) {
@@ -834,6 +835,8 @@ export const layer = (
834
835
  supportsAck: true,
835
836
  supportsTransferables: false,
836
837
  supportsSpanPropagation: true,
838
+ supportsNotifications: true,
839
+ codecFor: serialization.codecFor,
837
840
  });
838
841
  });
839
842
 
@@ -976,7 +979,10 @@ export const layer = (
976
979
  const run = writeRequest;
977
980
 
978
981
  if (run === undefined) {
979
- yield* send(connection, RpcMessage.ResponseDefectEncoded("RPC server is not ready"));
982
+ yield* send(
983
+ connection,
984
+ RpcMessage.ResponseDefectEncoded(encodeDefect("RPC server is not ready")),
985
+ );
980
986
 
981
987
  return;
982
988
  }
@@ -1021,7 +1027,7 @@ export const layer = (
1021
1027
 
1022
1028
  return Predicate.isTagged(cause, "MaxBufferSizeExceeded")
1023
1029
  ? Effect.ignore(connection.socket.close(1009, String(cause)))
1024
- : send(connection, RpcMessage.ResponseDefectEncoded(cause));
1030
+ : send(connection, RpcMessage.ResponseDefectEncoded(encodeDefect(cause)));
1025
1031
  }),
1026
1032
  ),
1027
1033
  close: unregister,
@@ -399,11 +399,10 @@ export const fromDurableObjectStorage = (
399
399
  throw exit;
400
400
  }),
401
401
  ).pipe(
402
- Effect.catch(
403
- (cause): Effect.Effect<never, E | StorageOperationError> =>
404
- aborted !== undefined && cause === aborted && Exit.isFailure(aborted)
405
- ? Effect.failCause(aborted.cause)
406
- : Effect.fail(storageError("transaction", cause)),
402
+ Effect.catch((cause): Effect.Effect<never, E | StorageOperationError> =>
403
+ aborted !== undefined && cause === aborted && Exit.isFailure(aborted)
404
+ ? Effect.failCause(aborted.cause)
405
+ : Effect.fail(storageError("transaction", cause)),
407
406
  ),
408
407
  );
409
408
  }),
package/src/Images.ts CHANGED
@@ -207,19 +207,15 @@ export const empty: Steps = makeSteps([]);
207
207
  export const transform: {
208
208
  (transform: ImageTransform): (steps: Steps) => Steps;
209
209
  (steps: Steps, transform: ImageTransform): Steps;
210
- } = Function.dual(
211
- 2,
212
- (steps: Steps, transformValue: ImageTransform): Steps =>
213
- makeSteps([...steps.steps, Step.Transform({ transform: transformValue })]),
210
+ } = Function.dual(2, (steps: Steps, transformValue: ImageTransform): Steps =>
211
+ makeSteps([...steps.steps, Step.Transform({ transform: transformValue })]),
214
212
  );
215
213
 
216
214
  export const draw: {
217
215
  (draw: DrawStepOptions): (steps: Steps) => Steps;
218
216
  (steps: Steps, draw: DrawStepOptions): Steps;
219
- } = Function.dual(
220
- 2,
221
- (steps: Steps, drawValue: DrawStepOptions): Steps =>
222
- makeSteps([...steps.steps, Step.Draw(drawValue)]),
217
+ } = Function.dual(2, (steps: Steps, drawValue: DrawStepOptions): Steps =>
218
+ makeSteps([...steps.steps, Step.Draw(drawValue)]),
223
219
  );
224
220
 
225
221
  const imagesError = (binding: string, operation: string, cause: unknown) =>
@@ -16,11 +16,13 @@ export interface ServiceFetcher {
16
16
  }
17
17
 
18
18
  type RpcClient<Api> = {
19
- readonly [Key in keyof Api as Key extends string
20
- ? Api[Key] extends (...args: Array<any>) => any
21
- ? Key
19
+ readonly [
20
+ Key in keyof Api as Key extends string
21
+ ? Api[Key] extends (...args: Array<any>) => any
22
+ ? Key
23
+ : never
22
24
  : never
23
- : never]: Api[Key];
25
+ ]: Api[Key];
24
26
  };
25
27
 
26
28
  type ReservedMethodName = WorkerDefinition.ReservedMethodName | "fetch";
package/src/Worker.ts CHANGED
@@ -139,17 +139,19 @@ export type WorkerRpcContract<Rpc extends WorkerRpc<ROut>, ROut> = {
139
139
  };
140
140
 
141
141
  export type RpcHandlers<ROut, Api> = {
142
- readonly [Key in keyof Api as Key extends keyof CloudflareWorkerEntrypoint
143
- ? never
144
- : Key extends string
145
- ? Key extends ReservedMethodName
146
- ? never
147
- : [Api[Key]] extends [never]
142
+ readonly [
143
+ Key in keyof Api as Key extends keyof CloudflareWorkerEntrypoint
144
+ ? never
145
+ : Key extends string
146
+ ? Key extends ReservedMethodName
148
147
  ? never
149
- : Api[Key] extends (...args: Array<any>) => Promise<any>
150
- ? Key
151
- : never
152
- : never]: Api[Key] extends (...args: infer Args) => Promise<infer A>
148
+ : [Api[Key]] extends [never]
149
+ ? never
150
+ : Api[Key] extends (...args: Array<any>) => Promise<any>
151
+ ? Key
152
+ : never
153
+ : never
154
+ ]: Api[Key] extends (...args: infer Args) => Promise<infer A>
153
155
  ? (...args: Args) => WorkerRpcHandler<ROut, A>
154
156
  : never;
155
157
  };