effect-cf 0.51.0 → 0.53.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 +1 -1
- package/dist/AnalyticsEngine.d.mts +2 -2
- package/dist/AnalyticsEngine.mjs +3 -3
- package/dist/CloudflareOtlp.d.mts +3 -3
- package/dist/CloudflareOtlp.mjs +7 -7
- package/dist/D1.d.mts +1 -1
- package/dist/DurableObjectContainer.d.mts +2 -0
- package/dist/DurableObjectContainer.mjs +3 -1
- package/dist/DurableObjectRpcWebSocket.d.mts +3 -3
- package/dist/DurableObjectRpcWebSocket.mjs +3 -3
- package/dist/DurableObjectSqlite.d.mts +1 -1
- package/dist/DurableObjectSqlite.mjs +2 -2
- package/dist/HyperdrivePg.d.mts +1 -1
- package/dist/Mcp.d.mts +3 -3
- package/dist/Mcp.mjs +3 -3
- package/dist/RpcWebSocketClient.d.mts +6 -6
- package/dist/RpcWebSocketClient.mjs +3 -3
- package/dist/Worker.d.mts +2 -2
- package/dist/Worker.mjs +4 -4
- package/dist/internal/Telemetry.mjs +1 -1
- package/package.json +5 -5
- package/src/AnalyticsEngine.ts +4 -4
- package/src/CloudflareOtlp.ts +8 -8
- package/src/D1.ts +1 -1
- package/src/DurableObjectContainer.ts +12 -1
- package/src/DurableObjectRpcWebSocket.ts +3 -3
- package/src/DurableObjectSqlite.ts +2 -2
- package/src/HyperdrivePg.ts +1 -1
- package/src/Mcp.ts +4 -4
- package/src/RpcWebSocketClient.ts +6 -6
- package/src/Worker.ts +4 -4
- package/src/internal/Telemetry.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# effect-cf
|
|
2
2
|
|
|
3
|
+
## 0.53.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#204](https://github.com/danieljvdm/effect-cf/pull/204) [`4b06e14`](https://github.com/danieljvdm/effect-cf/commit/4b06e147b9e0a7927d634e2c576d816ae7b7779b) Thanks [@danieljvdm](https://github.com/danieljvdm)! - Require Effect 4.0 stable and migrate to its public module namespaces. Install `effect@^4.0.0` and, for `effect-cf` SQL adapters, matching stable `@effect/sql-*` drivers; prerelease Effect versions are no longer supported.
|
|
8
|
+
|
|
9
|
+
## 0.52.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#201](https://github.com/danieljvdm/effect-cf/pull/201) [`346d424`](https://github.com/danieljvdm/effect-cf/commit/346d42473a9ef76f85bd2bd7e3ebaa6a1467a87f) Thanks [@danieljvdm](https://github.com/danieljvdm)! - Add `ContainerTcpPort.connectScoped` to close native TCP sockets when their Effect scope ends. Cleanup awaits `socket.close()` on success, failure, or interruption and preserves close failures as `ContainerError` defects. The existing `connect` method remains caller-owned.
|
|
14
|
+
|
|
3
15
|
## 0.51.0
|
|
4
16
|
|
|
5
17
|
### 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
|
|
6
|
+
npm install effect-cf "effect@^4.0.0"
|
|
7
7
|
```
|
|
8
8
|
|
|
9
9
|
The repository tests against workerd `1.20260926.1` and `@cloudflare/workers-types@5.20260926.1`. Use `compatibility_date: "2026-09-26"` in Wrangler.
|
|
@@ -6,9 +6,9 @@ import * as S from "effect/Schema";
|
|
|
6
6
|
import * as Layer$1 from "effect/Layer";
|
|
7
7
|
import * as Config$1 from "effect/Config";
|
|
8
8
|
import * as Option from "effect/Option";
|
|
9
|
-
import * as HttpClient from "effect/
|
|
9
|
+
import * as HttpClient from "effect/http/HttpClient";
|
|
10
10
|
import { Redacted } from "effect";
|
|
11
|
-
import { Headers, HttpClientResponse } from "effect/
|
|
11
|
+
import { Headers, HttpClientResponse } from "effect/http";
|
|
12
12
|
declare namespace AnalyticsEngine_d_exports {
|
|
13
13
|
export { AnalyticsEngineBinding, AnalyticsEngineClient, AnalyticsEngineDataPoint, AnalyticsEngineDataPointSchema, AnalyticsEngineDefinition, AnalyticsEngineFieldValue, AnalyticsEngineFieldValueSchema, AnalyticsEngineInvalidWritePolicy, AnalyticsEngineOperationError, AnalyticsEngineQueryClient, AnalyticsEngineQueryColumn, AnalyticsEngineQueryDefinition, AnalyticsEngineQueryError, AnalyticsEngineQueryOptions, AnalyticsEngineQueryResult, AnalyticsEngineQueryRow, AnalyticsEngineQueryService, AnalyticsEngineService, AnalyticsEngineWriteError, AnalyticsEngineWriteOptions, AnalyticsEngineWritePolicy, AnalyticsEngineWriteValidationError, AnalyticsEngineWriteViolation, BindingNotFoundError, BindingValidationError, LayerOptions, QueryConfigOptions, QueryTag, QueryTagClass, Tag, TagClass, isAnalyticsEngineDataset, layer, layerFetch, layerFetchConfig, make, makeClient, makeQuery, makeQueryClient, queryConfig, queryLayer, queryLayerConfig, writeLimits };
|
|
14
14
|
}
|
package/dist/AnalyticsEngine.mjs
CHANGED
|
@@ -10,9 +10,9 @@ import * as Predicate from "effect/Predicate";
|
|
|
10
10
|
import * as Config from "effect/Config";
|
|
11
11
|
import * as Option from "effect/Option";
|
|
12
12
|
import * as Result from "effect/Result";
|
|
13
|
-
import * as FetchHttpClient from "effect/
|
|
14
|
-
import * as HttpClient from "effect/
|
|
15
|
-
import * as HttpClientRequest from "effect/
|
|
13
|
+
import * as FetchHttpClient from "effect/http/FetchHttpClient";
|
|
14
|
+
import * as HttpClient from "effect/http/HttpClient";
|
|
15
|
+
import * as HttpClientRequest from "effect/http/HttpClientRequest";
|
|
16
16
|
//#region src/AnalyticsEngine.ts
|
|
17
17
|
var AnalyticsEngine_exports = /* @__PURE__ */ __exportAll({
|
|
18
18
|
AnalyticsEngineDataPointSchema: () => AnalyticsEngineDataPointSchema,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { DurableObjectState } from "./DurableObjectState.mjs";
|
|
2
2
|
import * as Layer from "effect/Layer";
|
|
3
|
-
import * as OtlpExporter from "effect/
|
|
4
|
-
import * as OtlpResource from "effect/
|
|
3
|
+
import * as OtlpExporter from "effect/observability/OtlpExporter";
|
|
4
|
+
import * as OtlpResource from "effect/observability/OtlpResource";
|
|
5
5
|
import * as Tracer from "effect/Tracer";
|
|
6
|
-
import { Headers } from "effect/
|
|
6
|
+
import { Headers } from "effect/http";
|
|
7
7
|
declare namespace CloudflareOtlp_d_exports {
|
|
8
8
|
export { DurableObjectLayerOptions, LayerOptions, ResourceOptions, Serialization, Signal, WorkerLayerOptions, layer, layerDurableObject, layerJson, layerProtobuf, layerWorker };
|
|
9
9
|
}
|
package/dist/CloudflareOtlp.mjs
CHANGED
|
@@ -5,13 +5,13 @@ import * as Effect from "effect/Effect";
|
|
|
5
5
|
import * as Layer from "effect/Layer";
|
|
6
6
|
import * as ConfigProvider from "effect/ConfigProvider";
|
|
7
7
|
import * as Option from "effect/Option";
|
|
8
|
-
import * as FetchHttpClient from "effect/
|
|
9
|
-
import * as OtlpExporter from "effect/
|
|
10
|
-
import * as OtlpLogger from "effect/
|
|
11
|
-
import * as OtlpMetrics from "effect/
|
|
12
|
-
import "effect/
|
|
13
|
-
import * as OtlpSerialization from "effect/
|
|
14
|
-
import * as OtlpTracer from "effect/
|
|
8
|
+
import * as FetchHttpClient from "effect/http/FetchHttpClient";
|
|
9
|
+
import * as OtlpExporter from "effect/observability/OtlpExporter";
|
|
10
|
+
import * as OtlpLogger from "effect/observability/OtlpLogger";
|
|
11
|
+
import * as OtlpMetrics from "effect/observability/OtlpMetrics";
|
|
12
|
+
import "effect/observability/OtlpResource";
|
|
13
|
+
import * as OtlpSerialization from "effect/observability/OtlpSerialization";
|
|
14
|
+
import * as OtlpTracer from "effect/observability/OtlpTracer";
|
|
15
15
|
//#region src/CloudflareOtlp.ts
|
|
16
16
|
/**
|
|
17
17
|
* Worker fetch/queue/RPC and Durable Object alarm/RPC handlers schedule a
|
package/dist/D1.d.mts
CHANGED
|
@@ -2,7 +2,7 @@ import { WorkerEnvironment } from "./Environment.mjs";
|
|
|
2
2
|
import { BindingNotFoundError, BindingService, BindingValidationError } from "./Binding.mjs";
|
|
3
3
|
import * as Layer$1 from "effect/Layer";
|
|
4
4
|
import { D1Client } from "@effect/sql-d1";
|
|
5
|
-
import { SqlClient } from "effect/
|
|
5
|
+
import { SqlClient } from "effect/sql";
|
|
6
6
|
import { Config } from "effect";
|
|
7
7
|
declare namespace D1_d_exports {
|
|
8
8
|
export { BindingNotFoundError, BindingValidationError, D1Definition, D1Service, D1SqlLayerOptions, Service, ServiceClass, TypeId, make };
|
|
@@ -92,6 +92,8 @@ interface ContainerTcpPort {
|
|
|
92
92
|
readonly proxy: (request: Request) => Effect.Effect<Response, ContainerError>;
|
|
93
93
|
/** The caller owns the returned socket and must close it. */
|
|
94
94
|
readonly connect: (...args: Parameters<globalThis.Fetcher["connect"]>) => Effect.Effect<ReturnType<globalThis.Fetcher["connect"]>, ContainerError>;
|
|
95
|
+
/** Closes the socket when the scope ends, awaiting cleanup and preserving close failures as defects. */
|
|
96
|
+
readonly connectScoped: (...args: Parameters<globalThis.Fetcher["connect"]>) => Effect.Effect<ReturnType<globalThis.Fetcher["connect"]>, ContainerError, Scope.Scope>;
|
|
95
97
|
}
|
|
96
98
|
/** Direct container control inside a Durable Object; lifecycle policy belongs to the application. */
|
|
97
99
|
interface DurableObjectContainerService {
|
|
@@ -99,6 +99,7 @@ const fromTcpPort = (port) => {
|
|
|
99
99
|
signal: callerSignal === null || callerSignal === void 0 ? signal : AbortSignal.any([callerSignal, signal])
|
|
100
100
|
});
|
|
101
101
|
});
|
|
102
|
+
const connect = (...args) => attempt("getTcpPort.connect", () => port.connect(...args));
|
|
102
103
|
return {
|
|
103
104
|
raw: port,
|
|
104
105
|
fetch,
|
|
@@ -107,7 +108,8 @@ const fromTcpPort = (port) => {
|
|
|
107
108
|
url.protocol = "http:";
|
|
108
109
|
return new Request(url, request);
|
|
109
110
|
}).pipe(Effect.flatMap((forwarded) => fetch(forwarded))),
|
|
110
|
-
connect
|
|
111
|
+
connect,
|
|
112
|
+
connectScoped: (...args) => Effect.acquireRelease(connect(...args), (socket) => attemptPromise("getTcpPort.close", () => socket.close()).pipe(Effect.orDie))
|
|
111
113
|
};
|
|
112
114
|
};
|
|
113
115
|
/** Wraps `ctx.container` without starting it or taking ownership of its lifecycle. */
|
|
@@ -5,9 +5,9 @@ import * as Effect from "effect/Effect";
|
|
|
5
5
|
import * as Schema from "effect/Schema";
|
|
6
6
|
import * as Layer from "effect/Layer";
|
|
7
7
|
import * as Option from "effect/Option";
|
|
8
|
-
import * as RpcMessage from "effect/
|
|
9
|
-
import * as RpcSerialization from "effect/
|
|
10
|
-
import * as RpcServer from "effect/
|
|
8
|
+
import * as RpcMessage from "effect/rpc/RpcMessage";
|
|
9
|
+
import * as RpcSerialization from "effect/rpc/RpcSerialization";
|
|
10
|
+
import * as RpcServer from "effect/rpc/RpcServer";
|
|
11
11
|
declare namespace DurableObjectRpcWebSocket_d_exports {
|
|
12
12
|
export { DurableObjectRpcWebSocket, DurableObjectRpcWebSocketService, HeartbeatPolicy, LayerOptions, NativeWebSocketMessage, ResumableStreamDeclaration, RpcWebSocketAttachment, layer, resumableStream };
|
|
13
13
|
}
|
|
@@ -8,9 +8,9 @@ import * as Layer from "effect/Layer";
|
|
|
8
8
|
import * as Predicate from "effect/Predicate";
|
|
9
9
|
import * as Option from "effect/Option";
|
|
10
10
|
import * as Queue from "effect/Queue";
|
|
11
|
-
import * as RpcMessage from "effect/
|
|
12
|
-
import * as RpcSerialization from "effect/
|
|
13
|
-
import * as RpcServer from "effect/
|
|
11
|
+
import * as RpcMessage from "effect/rpc/RpcMessage";
|
|
12
|
+
import * as RpcSerialization from "effect/rpc/RpcSerialization";
|
|
13
|
+
import * as RpcServer from "effect/rpc/RpcServer";
|
|
14
14
|
//#region src/DurableObjectRpcWebSocket.ts
|
|
15
15
|
var DurableObjectRpcWebSocket_exports = /* @__PURE__ */ __exportAll({
|
|
16
16
|
DurableObjectRpcWebSocket: () => DurableObjectRpcWebSocket,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DurableObjectState } from "./DurableObjectState.mjs";
|
|
2
2
|
import * as Layer from "effect/Layer";
|
|
3
3
|
import { SqliteClient } from "@effect/sql-sqlite-do";
|
|
4
|
-
import { SqlClient } from "effect/
|
|
4
|
+
import { SqlClient } from "effect/sql";
|
|
5
5
|
declare namespace DurableObjectSqlite_d_exports {
|
|
6
6
|
export { SqliteLayerOptions, layer };
|
|
7
7
|
}
|
|
@@ -5,8 +5,8 @@ import * as Effect from "effect/Effect";
|
|
|
5
5
|
import * as Layer from "effect/Layer";
|
|
6
6
|
import * as Scheduler from "effect/Scheduler";
|
|
7
7
|
import { SqliteClient } from "@effect/sql-sqlite-do";
|
|
8
|
-
import * as Reactivity from "effect/
|
|
9
|
-
import { SqlClient } from "effect/
|
|
8
|
+
import * as Reactivity from "effect/reactivity/Reactivity";
|
|
9
|
+
import { SqlClient } from "effect/sql";
|
|
10
10
|
//#region src/DurableObjectSqlite.ts
|
|
11
11
|
var DurableObjectSqlite_exports = /* @__PURE__ */ __exportAll({ layer: () => layer });
|
|
12
12
|
const layer = (options) => Layer.effectContext(Effect.gen(function* () {
|
package/dist/HyperdrivePg.d.mts
CHANGED
|
@@ -2,7 +2,7 @@ import { WorkerEnvironment } from "./Environment.mjs";
|
|
|
2
2
|
import { BindingNotFoundError, BindingValidationError } from "./Binding.mjs";
|
|
3
3
|
import { LayerOptions, TagClass } from "./Hyperdrive.mjs";
|
|
4
4
|
import * as Layer from "effect/Layer";
|
|
5
|
-
import { SqlClient, SqlError } from "effect/
|
|
5
|
+
import { SqlClient, SqlError } from "effect/sql";
|
|
6
6
|
import { PgClient } from "@effect/sql-pg";
|
|
7
7
|
//#region src/HyperdrivePg.d.ts
|
|
8
8
|
type PgLayerOptions = Omit<Parameters<typeof PgClient.makeClient>[0], "url" | "host" | "port" | "path" | "ssl" | "database" | "username" | "password" | "stream">;
|
package/dist/Mcp.d.mts
CHANGED
|
@@ -2,8 +2,8 @@ import { NativeRequest } from "./Worker.mjs";
|
|
|
2
2
|
import * as Effect from "effect/Effect";
|
|
3
3
|
import * as Option from "effect/Option";
|
|
4
4
|
import { CreateMcpHandlerOptions, ServerOptions } from "@modelcontextprotocol/server";
|
|
5
|
-
import * as Tool from "effect/
|
|
6
|
-
import { Toolkit } from "effect/
|
|
5
|
+
import * as Tool from "effect/ai/Tool";
|
|
6
|
+
import { Toolkit } from "effect/ai";
|
|
7
7
|
//#region src/Mcp.d.ts
|
|
8
8
|
/**
|
|
9
9
|
* CORS headers applied to MCP responses.
|
|
@@ -96,7 +96,7 @@ type FromToolkitContext<Tools extends Record<string, Tool.Any>> = NativeRequest
|
|
|
96
96
|
*
|
|
97
97
|
* ```ts
|
|
98
98
|
* import { Effect, Layer, Option } from "effect"
|
|
99
|
-
* import { HttpRouter } from "effect/
|
|
99
|
+
* import { HttpRouter } from "effect/http"
|
|
100
100
|
* import { Worker } from "effect-cf"
|
|
101
101
|
* import * as Mcp from "effect-cf/mcp"
|
|
102
102
|
*
|
package/dist/Mcp.mjs
CHANGED
|
@@ -10,8 +10,8 @@ import * as Exit from "effect/Exit";
|
|
|
10
10
|
import * as Stream from "effect/Stream";
|
|
11
11
|
import { McpServer, createMcpHandler, hostHeaderValidationResponse, localhostAllowedHostnames, localhostAllowedOrigins, originValidationResponse } from "@modelcontextprotocol/server";
|
|
12
12
|
import * as Sink from "effect/Sink";
|
|
13
|
-
import * as AiError from "effect/
|
|
14
|
-
import * as Tool from "effect/
|
|
13
|
+
import * as AiError from "effect/ai/AiError";
|
|
14
|
+
import * as Tool from "effect/ai/Tool";
|
|
15
15
|
//#region src/Mcp.ts
|
|
16
16
|
const DEFAULT_CORS_OPTIONS = {
|
|
17
17
|
origin: "*",
|
|
@@ -214,7 +214,7 @@ const registerToolkitTool = (server, built, tool, run) => {
|
|
|
214
214
|
*
|
|
215
215
|
* ```ts
|
|
216
216
|
* import { Effect, Layer, Option } from "effect"
|
|
217
|
-
* import { HttpRouter } from "effect/
|
|
217
|
+
* import { HttpRouter } from "effect/http"
|
|
218
218
|
* import { Worker } from "effect-cf"
|
|
219
219
|
* import * as Mcp from "effect-cf/mcp"
|
|
220
220
|
*
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as Context from "effect/Context";
|
|
2
2
|
import * as Layer from "effect/Layer";
|
|
3
|
-
import * as RpcSerialization from "effect/
|
|
4
|
-
import * as RpcClient from "effect/
|
|
5
|
-
import * as Socket from "effect/
|
|
6
|
-
import * as Rpc from "effect/
|
|
7
|
-
import { RpcClientError } from "effect/
|
|
8
|
-
import * as RpcGroup from "effect/
|
|
3
|
+
import * as RpcSerialization from "effect/rpc/RpcSerialization";
|
|
4
|
+
import * as RpcClient from "effect/rpc/RpcClient";
|
|
5
|
+
import * as Socket from "effect/socket/Socket";
|
|
6
|
+
import * as Rpc from "effect/rpc/Rpc";
|
|
7
|
+
import { RpcClientError } from "effect/rpc/RpcClientError";
|
|
8
|
+
import * as RpcGroup from "effect/rpc/RpcGroup";
|
|
9
9
|
declare namespace RpcWebSocketClient_d_exports {
|
|
10
10
|
export { LayerOptions, layer };
|
|
11
11
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
|
|
2
2
|
import * as Layer from "effect/Layer";
|
|
3
|
-
import * as RpcSerialization from "effect/
|
|
4
|
-
import * as RpcClient from "effect/
|
|
5
|
-
import * as Socket from "effect/
|
|
3
|
+
import * as RpcSerialization from "effect/rpc/RpcSerialization";
|
|
4
|
+
import * as RpcClient from "effect/rpc/RpcClient";
|
|
5
|
+
import * as Socket from "effect/socket/Socket";
|
|
6
6
|
//#region src/RpcWebSocketClient.ts
|
|
7
7
|
var RpcWebSocketClient_exports = /* @__PURE__ */ __exportAll({ layer: () => layer });
|
|
8
8
|
/**
|
package/dist/Worker.d.mts
CHANGED
|
@@ -10,8 +10,8 @@ import * as Context$1 from "effect/Context";
|
|
|
10
10
|
import * as Effect from "effect/Effect";
|
|
11
11
|
import * as Layer$1 from "effect/Layer";
|
|
12
12
|
import { WorkerEntrypoint } from "cloudflare:workers";
|
|
13
|
-
import * as HttpServerRequest from "effect/
|
|
14
|
-
import * as HttpServerResponse from "effect/
|
|
13
|
+
import * as HttpServerRequest from "effect/http/HttpServerRequest";
|
|
14
|
+
import * as HttpServerResponse from "effect/http/HttpServerResponse";
|
|
15
15
|
import { Cause, Scope } from "effect";
|
|
16
16
|
declare namespace Worker_d_exports {
|
|
17
17
|
export { Api, BindingNotFoundError, BindingValidationError, Definition, ExecutionContext, FetchHandler, FetchWorkerOptions, HandlerEffect, Handlers, LayerOptions, Method, Methods, NativeRequest, NativeSchema, NoReservedMethods, Options, ReservedMethodName, RpcHandlers, RpcSchema, RunOptions, RunSymbol, ServerApi, ServiceBindingFetchError, ServiceBindingRpcError, ServiceCall, ServiceFreeSchema, ServiceRpc, ServiceScopedCall, Tag, TagClass, WorkerClass, WorkerContext, WorkerContextService, WorkerContextWaitUntilOptions, WorkerFetchSuccess, WorkerHandler, WorkerOptions, WorkerRpc, WorkerRpcContract, WorkerRpcHandler, WorkerRpcContract as WorkerRpcShape, implement, isWebSocketUpgrade, make, makeFetchHandler, method, native };
|
package/dist/Worker.mjs
CHANGED
|
@@ -13,10 +13,10 @@ import * as Layer from "effect/Layer";
|
|
|
13
13
|
import { WorkerEntrypoint } from "cloudflare:workers";
|
|
14
14
|
import * as Tracer from "effect/Tracer";
|
|
15
15
|
import * as References from "effect/References";
|
|
16
|
-
import * as HttpEffect from "effect/
|
|
17
|
-
import * as HttpMiddleware from "effect/
|
|
18
|
-
import * as HttpServerRequest from "effect/
|
|
19
|
-
import * as HttpServerResponse from "effect/
|
|
16
|
+
import * as HttpEffect from "effect/http/HttpEffect";
|
|
17
|
+
import * as HttpMiddleware from "effect/http/HttpMiddleware";
|
|
18
|
+
import * as HttpServerRequest from "effect/http/HttpServerRequest";
|
|
19
|
+
import * as HttpServerResponse from "effect/http/HttpServerResponse";
|
|
20
20
|
//#region src/Worker.ts
|
|
21
21
|
var Worker_exports = /* @__PURE__ */ __exportAll({
|
|
22
22
|
ExecutionContext: () => ExecutionContext,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Effect from "effect/Effect";
|
|
2
2
|
import * as Option from "effect/Option";
|
|
3
|
-
import { Flusher } from "effect/
|
|
3
|
+
import { Flusher } from "effect/observability/OtlpExporter";
|
|
4
4
|
//#region src/internal/Telemetry.ts
|
|
5
5
|
/** Maximum event lifetime spent on an internally scheduled telemetry flush. */
|
|
6
6
|
const scheduledFlushTimeout = "2 seconds";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "effect-cf",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.53.0",
|
|
4
4
|
"description": "Effect-native primitives for Cloudflare Workers and bindings.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -100,11 +100,11 @@
|
|
|
100
100
|
"@cloudflare/sandbox": "^0.13.0-next.738.2 || ^1.0.0",
|
|
101
101
|
"@cloudflare/vitest-plugin": "^1.0.0",
|
|
102
102
|
"@cloudflare/workers-types": "^5.20260926.1",
|
|
103
|
-
"@effect/sql-d1": "^4.0.0
|
|
104
|
-
"@effect/sql-pg": "^4.0.0
|
|
105
|
-
"@effect/sql-sqlite-do": "^4.0.0
|
|
103
|
+
"@effect/sql-d1": "^4.0.0",
|
|
104
|
+
"@effect/sql-pg": "^4.0.0",
|
|
105
|
+
"@effect/sql-sqlite-do": "^4.0.0",
|
|
106
106
|
"@modelcontextprotocol/server": "^2.0.0",
|
|
107
|
-
"effect": "^4.0.0
|
|
107
|
+
"effect": "^4.0.0"
|
|
108
108
|
},
|
|
109
109
|
"peerDependenciesMeta": {
|
|
110
110
|
"@cloudflare/computer": {
|
package/src/AnalyticsEngine.ts
CHANGED
|
@@ -8,10 +8,10 @@ import * as Predicate from "effect/Predicate";
|
|
|
8
8
|
import * as Result from "effect/Result";
|
|
9
9
|
import * as S from "effect/Schema";
|
|
10
10
|
import type { Redacted } from "effect";
|
|
11
|
-
import * as FetchHttpClient from "effect/
|
|
12
|
-
import * as HttpClient from "effect/
|
|
13
|
-
import * as HttpClientRequest from "effect/
|
|
14
|
-
import type { Headers, HttpClientResponse } from "effect/
|
|
11
|
+
import * as FetchHttpClient from "effect/http/FetchHttpClient";
|
|
12
|
+
import * as HttpClient from "effect/http/HttpClient";
|
|
13
|
+
import * as HttpClientRequest from "effect/http/HttpClientRequest";
|
|
14
|
+
import type { Headers, HttpClientResponse } from "effect/http";
|
|
15
15
|
|
|
16
16
|
import * as Binding from "./Binding";
|
|
17
17
|
import type { WorkerEnvironment } from "./Environment";
|
package/src/CloudflareOtlp.ts
CHANGED
|
@@ -9,14 +9,14 @@ import * as Effect from "effect/Effect";
|
|
|
9
9
|
import * as Layer from "effect/Layer";
|
|
10
10
|
import * as Option from "effect/Option";
|
|
11
11
|
import type * as Tracer from "effect/Tracer";
|
|
12
|
-
import * as FetchHttpClient from "effect/
|
|
13
|
-
import type { Headers } from "effect/
|
|
14
|
-
import * as OtlpExporter from "effect/
|
|
15
|
-
import * as OtlpLogger from "effect/
|
|
16
|
-
import * as OtlpMetrics from "effect/
|
|
17
|
-
import * as OtlpResource from "effect/
|
|
18
|
-
import * as OtlpSerialization from "effect/
|
|
19
|
-
import * as OtlpTracer from "effect/
|
|
12
|
+
import * as FetchHttpClient from "effect/http/FetchHttpClient";
|
|
13
|
+
import type { Headers } from "effect/http";
|
|
14
|
+
import * as OtlpExporter from "effect/observability/OtlpExporter";
|
|
15
|
+
import * as OtlpLogger from "effect/observability/OtlpLogger";
|
|
16
|
+
import * as OtlpMetrics from "effect/observability/OtlpMetrics";
|
|
17
|
+
import * as OtlpResource from "effect/observability/OtlpResource";
|
|
18
|
+
import * as OtlpSerialization from "effect/observability/OtlpSerialization";
|
|
19
|
+
import * as OtlpTracer from "effect/observability/OtlpTracer";
|
|
20
20
|
|
|
21
21
|
import { DurableObjectState } from "./DurableObjectState";
|
|
22
22
|
import { WorkerConfig, WorkerEnvironment } from "./Environment";
|
package/src/D1.ts
CHANGED
|
@@ -3,7 +3,7 @@ import * as Effect from "effect/Effect";
|
|
|
3
3
|
import * as Layer from "effect/Layer";
|
|
4
4
|
import * as Predicate from "effect/Predicate";
|
|
5
5
|
import type { Config } from "effect";
|
|
6
|
-
import type { SqlClient } from "effect/
|
|
6
|
+
import type { SqlClient } from "effect/sql";
|
|
7
7
|
|
|
8
8
|
import * as Binding from "./Binding";
|
|
9
9
|
import type { WorkerEnvironment } from "./Environment";
|
|
@@ -102,6 +102,10 @@ export interface ContainerTcpPort {
|
|
|
102
102
|
readonly connect: (
|
|
103
103
|
...args: Parameters<globalThis.Fetcher["connect"]>
|
|
104
104
|
) => Effect.Effect<ReturnType<globalThis.Fetcher["connect"]>, ContainerError>;
|
|
105
|
+
/** Closes the socket when the scope ends, awaiting cleanup and preserving close failures as defects. */
|
|
106
|
+
readonly connectScoped: (
|
|
107
|
+
...args: Parameters<globalThis.Fetcher["connect"]>
|
|
108
|
+
) => Effect.Effect<ReturnType<globalThis.Fetcher["connect"]>, ContainerError, Scope.Scope>;
|
|
105
109
|
}
|
|
106
110
|
|
|
107
111
|
/** Direct container control inside a Durable Object; lifecycle policy belongs to the application. */
|
|
@@ -248,6 +252,9 @@ const fromTcpPort = (port: globalThis.Fetcher): ContainerTcpPort => {
|
|
|
248
252
|
});
|
|
249
253
|
});
|
|
250
254
|
|
|
255
|
+
const connect: ContainerTcpPort["connect"] = (...args) =>
|
|
256
|
+
attempt("getTcpPort.connect", () => port.connect(...args));
|
|
257
|
+
|
|
251
258
|
return {
|
|
252
259
|
raw: port,
|
|
253
260
|
fetch,
|
|
@@ -259,7 +266,11 @@ const fromTcpPort = (port: globalThis.Fetcher): ContainerTcpPort => {
|
|
|
259
266
|
|
|
260
267
|
return new Request(url, request);
|
|
261
268
|
}).pipe(Effect.flatMap((forwarded) => fetch(forwarded))),
|
|
262
|
-
connect
|
|
269
|
+
connect,
|
|
270
|
+
connectScoped: (...args) =>
|
|
271
|
+
Effect.acquireRelease(connect(...args), (socket) =>
|
|
272
|
+
attemptPromise("getTcpPort.close", () => socket.close()).pipe(Effect.orDie),
|
|
273
|
+
),
|
|
263
274
|
};
|
|
264
275
|
};
|
|
265
276
|
|
|
@@ -5,9 +5,9 @@ import * as Option from "effect/Option";
|
|
|
5
5
|
import * as Predicate from "effect/Predicate";
|
|
6
6
|
import * as Queue from "effect/Queue";
|
|
7
7
|
import * as Schema from "effect/Schema";
|
|
8
|
-
import * as RpcMessage from "effect/
|
|
9
|
-
import * as RpcSerialization from "effect/
|
|
10
|
-
import * as RpcServer from "effect/
|
|
8
|
+
import * as RpcMessage from "effect/rpc/RpcMessage";
|
|
9
|
+
import * as RpcSerialization from "effect/rpc/RpcSerialization";
|
|
10
|
+
import * as RpcServer from "effect/rpc/RpcServer";
|
|
11
11
|
|
|
12
12
|
import { DurableObjectState } from "./DurableObjectState";
|
|
13
13
|
import {
|
|
@@ -3,8 +3,8 @@ import * as Context from "effect/Context";
|
|
|
3
3
|
import * as Effect from "effect/Effect";
|
|
4
4
|
import * as Layer from "effect/Layer";
|
|
5
5
|
import * as Scheduler from "effect/Scheduler";
|
|
6
|
-
import * as Reactivity from "effect/
|
|
7
|
-
import { SqlClient } from "effect/
|
|
6
|
+
import * as Reactivity from "effect/reactivity/Reactivity";
|
|
7
|
+
import { SqlClient } from "effect/sql";
|
|
8
8
|
|
|
9
9
|
import { DurableObjectState } from "./DurableObjectState";
|
|
10
10
|
|
package/src/HyperdrivePg.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { PgClient } from "@effect/sql-pg";
|
|
|
2
2
|
import * as Effect from "effect/Effect";
|
|
3
3
|
import * as Layer from "effect/Layer";
|
|
4
4
|
import * as Redacted from "effect/Redacted";
|
|
5
|
-
import type { SqlClient, SqlError } from "effect/
|
|
5
|
+
import type { SqlClient, SqlError } from "effect/sql";
|
|
6
6
|
|
|
7
7
|
import type * as Binding from "./Binding";
|
|
8
8
|
import type { WorkerEnvironment } from "./Environment";
|
package/src/Mcp.ts
CHANGED
|
@@ -21,9 +21,9 @@ import * as Schema from "effect/Schema";
|
|
|
21
21
|
import * as Sink from "effect/Sink";
|
|
22
22
|
import * as Stream from "effect/Stream";
|
|
23
23
|
import type { JsonSchema } from "effect";
|
|
24
|
-
import * as AiError from "effect/
|
|
25
|
-
import * as Tool from "effect/
|
|
26
|
-
import type { Toolkit } from "effect/
|
|
24
|
+
import * as AiError from "effect/ai/AiError";
|
|
25
|
+
import * as Tool from "effect/ai/Tool";
|
|
26
|
+
import type { Toolkit } from "effect/ai";
|
|
27
27
|
|
|
28
28
|
import { NativeRequest } from "./Worker";
|
|
29
29
|
import { runNativeCallback } from "./internal/NativeCallback";
|
|
@@ -424,7 +424,7 @@ const registerToolkitTool = <Tools extends Record<string, Tool.Any>>(
|
|
|
424
424
|
*
|
|
425
425
|
* ```ts
|
|
426
426
|
* import { Effect, Layer, Option } from "effect"
|
|
427
|
-
* import { HttpRouter } from "effect/
|
|
427
|
+
* import { HttpRouter } from "effect/http"
|
|
428
428
|
* import { Worker } from "effect-cf"
|
|
429
429
|
* import * as Mcp from "effect-cf/mcp"
|
|
430
430
|
*
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type * as Context from "effect/Context";
|
|
2
2
|
import * as Layer from "effect/Layer";
|
|
3
|
-
import type * as Rpc from "effect/
|
|
4
|
-
import * as RpcClient from "effect/
|
|
5
|
-
import type { RpcClientError } from "effect/
|
|
6
|
-
import type * as RpcGroup from "effect/
|
|
7
|
-
import * as RpcSerialization from "effect/
|
|
8
|
-
import * as Socket from "effect/
|
|
3
|
+
import type * as Rpc from "effect/rpc/Rpc";
|
|
4
|
+
import * as RpcClient from "effect/rpc/RpcClient";
|
|
5
|
+
import type { RpcClientError } from "effect/rpc/RpcClientError";
|
|
6
|
+
import type * as RpcGroup from "effect/rpc/RpcGroup";
|
|
7
|
+
import * as RpcSerialization from "effect/rpc/RpcSerialization";
|
|
8
|
+
import * as Socket from "effect/socket/Socket";
|
|
9
9
|
|
|
10
10
|
export interface LayerOptions {
|
|
11
11
|
readonly socket?: Parameters<typeof Socket.layerWebSocket>[1];
|
package/src/Worker.ts
CHANGED
|
@@ -5,10 +5,10 @@ import * as Layer from "effect/Layer";
|
|
|
5
5
|
import * as References from "effect/References";
|
|
6
6
|
import * as Tracer from "effect/Tracer";
|
|
7
7
|
import type { Cause, ManagedRuntime, Scope } from "effect";
|
|
8
|
-
import * as HttpEffect from "effect/
|
|
9
|
-
import * as HttpMiddleware from "effect/
|
|
10
|
-
import * as HttpServerRequest from "effect/
|
|
11
|
-
import * as HttpServerResponse from "effect/
|
|
8
|
+
import * as HttpEffect from "effect/http/HttpEffect";
|
|
9
|
+
import * as HttpMiddleware from "effect/http/HttpMiddleware";
|
|
10
|
+
import * as HttpServerRequest from "effect/http/HttpServerRequest";
|
|
11
|
+
import * as HttpServerResponse from "effect/http/HttpServerResponse";
|
|
12
12
|
|
|
13
13
|
import { WorkerEnvironment, type WorkerEnv } from "./Environment";
|
|
14
14
|
import { fromMessage, fromMessageBatch, type QueueHandler } from "./Queue";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Effect from "effect/Effect";
|
|
2
2
|
import * as Option from "effect/Option";
|
|
3
|
-
import { Flusher } from "effect/
|
|
3
|
+
import { Flusher } from "effect/observability/OtlpExporter";
|
|
4
4
|
|
|
5
5
|
/** Maximum event lifetime spent on an internally scheduled telemetry flush. */
|
|
6
6
|
const scheduledFlushTimeout = "2 seconds";
|