effect-cf 0.40.0 → 0.40.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.
Files changed (165) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/AiGateway.d.mts +86 -0
  3. package/dist/AiGateway.mjs +178 -0
  4. package/dist/AnalyticsEngine.d.mts +170 -0
  5. package/dist/AnalyticsEngine.mjs +275 -0
  6. package/dist/{Artifacts-B3r3RuTB.d.mts → Artifacts.d.mts} +8 -5
  7. package/dist/{Artifacts-CBxWGeZB.mjs → Artifacts.mjs} +9 -5
  8. package/dist/Binding.d.mts +45 -0
  9. package/dist/{Binding-C82jRhdr.mjs → Binding.mjs} +8 -4
  10. package/dist/BrowserRendering.d.mts +85 -0
  11. package/dist/BrowserRendering.mjs +81 -0
  12. package/dist/Cache.d.mts +40 -0
  13. package/dist/Cache.mjs +51 -0
  14. package/dist/CloudflareOtlp.d.mts +95 -0
  15. package/dist/CloudflareOtlp.mjs +125 -0
  16. package/dist/CloudflareTracer.d.mts +20 -0
  17. package/dist/CloudflareTracer.mjs +69 -0
  18. package/dist/ComputerArtifacts.d.mts +2 -2
  19. package/dist/ComputerArtifacts.mjs +3 -2
  20. package/dist/ComputerWorkspace.d.mts +36 -31
  21. package/dist/ComputerWorkspace.mjs +8 -3
  22. package/dist/ComputerWorkspaceHost.d.mts +1 -1
  23. package/dist/ComputerWorkspaceHost.mjs +1 -1
  24. package/dist/{ContainerNamespace-DbLaeFhN.d.mts → ContainerNamespace.d.mts} +16 -12
  25. package/dist/ContainerNamespace.mjs +165 -0
  26. package/dist/D1.d.mts +33 -0
  27. package/dist/D1.mjs +32 -0
  28. package/dist/DurableObject.d.mts +103 -0
  29. package/dist/DurableObject.mjs +77 -0
  30. package/dist/DurableObjectAlarm.d.mts +187 -0
  31. package/dist/DurableObjectAlarm.mjs +344 -0
  32. package/dist/DurableObjectDefinition.d.mts +87 -0
  33. package/dist/DurableObjectDefinition.mjs +125 -0
  34. package/dist/DurableObjectNamespace.d.mts +154 -0
  35. package/dist/DurableObjectNamespace.mjs +144 -0
  36. package/dist/DurableObjectRpcWebSocket.d.mts +112 -0
  37. package/dist/DurableObjectRpcWebSocket.mjs +547 -0
  38. package/dist/DurableObjectSqlite.d.mts +11 -0
  39. package/dist/DurableObjectSqlite.mjs +16 -0
  40. package/dist/DurableObjectState.d.mts +65 -0
  41. package/dist/DurableObjectState.mjs +47 -0
  42. package/dist/DurableObjectStorage.d.mts +112 -0
  43. package/dist/{DurableObjectState-DLL0YgBd.mjs → DurableObjectStorage.mjs} +19 -157
  44. package/dist/DurableObjectWebSocket.d.mts +83 -0
  45. package/dist/DurableObjectWebSocket.mjs +120 -0
  46. package/dist/Email.d.mts +106 -0
  47. package/dist/Email.mjs +247 -0
  48. package/dist/Environment.d.mts +59 -0
  49. package/dist/{ErrorMessage-Byx2OgNd.mjs → Environment.mjs} +7 -18
  50. package/dist/{Hyperdrive-HrwFlZ6x.d.mts → Hyperdrive.d.mts} +8 -5
  51. package/dist/Hyperdrive.mjs +32 -0
  52. package/dist/HyperdrivePg.d.mts +4 -3
  53. package/dist/HyperdrivePg.mjs +3 -1
  54. package/dist/Images.d.mts +191 -0
  55. package/dist/Images.mjs +112 -0
  56. package/dist/Kv.d.mts +84 -0
  57. package/dist/Kv.mjs +132 -0
  58. package/dist/Mcp.d.mts +5 -3
  59. package/dist/Mcp.mjs +13 -4
  60. package/dist/Queue.d.mts +68 -0
  61. package/dist/Queue.mjs +54 -0
  62. package/dist/QueueBinding.d.mts +42 -0
  63. package/dist/QueueBinding.mjs +69 -0
  64. package/dist/QueueDefinition.d.mts +48 -0
  65. package/dist/QueueDefinition.mjs +63 -0
  66. package/dist/R2.d.mts +89 -0
  67. package/dist/R2.mjs +117 -0
  68. package/dist/Rpc.d.mts +29 -0
  69. package/dist/Rpc.mjs +28 -0
  70. package/dist/RpcDefinition.d.mts +116 -0
  71. package/dist/RpcDefinition.mjs +184 -0
  72. package/dist/RpcTracing.d.mts +52 -0
  73. package/dist/RpcTracing.mjs +77 -0
  74. package/dist/Sandbox.d.mts +10 -5
  75. package/dist/Sandbox.mjs +9 -3
  76. package/dist/ServiceBinding.d.mts +112 -0
  77. package/dist/ServiceBinding.mjs +145 -0
  78. package/dist/Vectorize.d.mts +68 -0
  79. package/dist/Vectorize.mjs +76 -0
  80. package/dist/Vitest.d.mts +6 -4
  81. package/dist/Vitest.mjs +8 -4
  82. package/dist/WebTransport.d.mts +66 -0
  83. package/dist/WebTransport.mjs +63 -0
  84. package/dist/Worker.d.mts +139 -0
  85. package/dist/Worker.mjs +141 -0
  86. package/dist/WorkerDefinition.d.mts +100 -0
  87. package/dist/WorkerDefinition.mjs +103 -0
  88. package/dist/WorkersAi.d.mts +84 -0
  89. package/dist/WorkersAi.mjs +84 -0
  90. package/dist/Workflow.d.mts +91 -0
  91. package/dist/Workflow.mjs +139 -0
  92. package/dist/{WorkflowBinding-DtVykUCz.d.mts → WorkflowBinding.d.mts} +14 -10
  93. package/dist/WorkflowBinding.mjs +100 -0
  94. package/dist/WorkflowDefinition.d.mts +51 -0
  95. package/dist/WorkflowDefinition.mjs +69 -0
  96. package/dist/{rolldown-runtime-D7D4PA-g.mjs → _virtual/_rolldown/runtime.mjs} +1 -1
  97. package/dist/index.d.mts +40 -1839
  98. package/dist/index.mjs +40 -3161
  99. package/dist/{ComputerWorkspaceHostRegistry-CY5Fv4Ng.mjs → internal/ComputerWorkspaceHostRegistry.mjs} +1 -1
  100. package/dist/internal/Entrypoint.mjs +37 -0
  101. package/dist/internal/ErrorMessage.mjs +17 -0
  102. package/dist/internal/NativeCallback.mjs +33 -0
  103. package/dist/internal/RpcInvocation.d.mts +13 -0
  104. package/dist/internal/RpcInvocation.mjs +34 -0
  105. package/dist/internal/Runtime.mjs +31 -0
  106. package/dist/internal/Telemetry.mjs +20 -0
  107. package/dist/{WorkerContext-Yobnfw-K.mjs → internal/WorkerContext.mjs} +4 -31
  108. package/package.json +1 -1
  109. package/src/AiGateway.ts +5 -1
  110. package/src/AnalyticsEngine.ts +14 -19
  111. package/src/Artifacts.ts +6 -1
  112. package/src/Binding.ts +5 -1
  113. package/src/BrowserRendering.ts +5 -1
  114. package/src/Cache.ts +5 -1
  115. package/src/CloudflareOtlp.ts +12 -10
  116. package/src/CloudflareTracer.ts +7 -1
  117. package/src/ComputerArtifacts.ts +2 -1
  118. package/src/ComputerWorkspace.ts +7 -1
  119. package/src/ContainerNamespace.ts +6 -1
  120. package/src/D1.ts +4 -1
  121. package/src/DurableObject.ts +4 -1
  122. package/src/DurableObjectAlarm.ts +10 -12
  123. package/src/DurableObjectDefinition.ts +3 -1
  124. package/src/DurableObjectNamespace.ts +4 -1
  125. package/src/DurableObjectRpcWebSocket.ts +7 -1
  126. package/src/DurableObjectSqlite.ts +2 -1
  127. package/src/DurableObjectState.ts +4 -1
  128. package/src/DurableObjectStorage.ts +11 -13
  129. package/src/DurableObjectWebSocket.ts +5 -1
  130. package/src/Email.ts +5 -1
  131. package/src/Environment.ts +6 -1
  132. package/src/Hyperdrive.ts +4 -1
  133. package/src/HyperdrivePg.ts +3 -1
  134. package/src/Images.ts +7 -1
  135. package/src/Kv.ts +7 -1
  136. package/src/Mcp.ts +13 -13
  137. package/src/Queue.ts +3 -1
  138. package/src/QueueBinding.ts +5 -1
  139. package/src/QueueDefinition.ts +4 -1
  140. package/src/R2.ts +7 -1
  141. package/src/Rpc.ts +4 -1
  142. package/src/RpcDefinition.ts +4 -1
  143. package/src/RpcTracing.ts +9 -1
  144. package/src/Sandbox.ts +7 -1
  145. package/src/ServiceBinding.ts +6 -1
  146. package/src/Vectorize.ts +7 -1
  147. package/src/Vitest.ts +5 -1
  148. package/src/WebTransport.ts +6 -1
  149. package/src/Worker.ts +10 -16
  150. package/src/WorkerDefinition.ts +3 -1
  151. package/src/WorkersAi.ts +7 -1
  152. package/src/Workflow.ts +8 -11
  153. package/src/WorkflowBinding.ts +6 -1
  154. package/src/WorkflowDefinition.ts +4 -1
  155. package/src/internal/Entrypoint.ts +3 -1
  156. package/src/internal/ErrorMessage.ts +1 -1
  157. package/src/internal/NativeCallback.ts +3 -1
  158. package/src/internal/RpcInvocation.ts +5 -1
  159. package/src/internal/Runtime.ts +5 -1
  160. package/src/internal/Telemetry.ts +4 -3
  161. package/src/internal/WorkerContext.ts +3 -1
  162. package/dist/Binding-DKcLrQCM.d.mts +0 -94
  163. package/dist/DurableObjectState-DJ0K-zyd.d.mts +0 -244
  164. package/dist/Worker-XsGJsCJX.mjs +0 -885
  165. package/dist/Worker-gV4mDqIs.d.mts +0 -641
@@ -5,4 +5,4 @@ const register = (state, host) => {
5
5
  };
6
6
  const lookup = (state) => hosts.get(state);
7
7
  //#endregion
8
- export { register as n, lookup as t };
8
+ export { lookup, register };
@@ -0,0 +1,37 @@
1
+ import { assertNoReservedMethods, encodeWireError } from "../RpcDefinition.mjs";
2
+ import { RpcTraceContext } from "../RpcTracing.mjs";
3
+ import { CurrentInvocation } from "./RpcInvocation.mjs";
4
+ import * as Effect from "effect/Effect";
5
+ import * as Schema from "effect/Schema";
6
+ import * as Layer from "effect/Layer";
7
+ //#region src/internal/Entrypoint.ts
8
+ const isRpcTraceContext = Schema.is(RpcTraceContext);
9
+ const invokeEntrypointRpcMethod = (self, method, args, run, onExit, service, key, rpcTracing) => {
10
+ const last = args.at(-1);
11
+ const parent = rpcTracing !== void 0 && isRpcTraceContext(last) ? last : void 0;
12
+ const handlerArgs = parent === void 0 ? args : args.slice(0, -1);
13
+ const invocation = {
14
+ service: rpcTracing?.service ?? service,
15
+ method: key,
16
+ args: handlerArgs,
17
+ parent
18
+ };
19
+ const handler = Effect.suspend(() => method(...handlerArgs)).pipe(Effect.provideService(CurrentInvocation, invocation), Effect.mapError(encodeWireError));
20
+ return run(self, onExit === void 0 ? handler : handler.pipe(Effect.onExit(() => onExit(self))), invocation);
21
+ };
22
+ const provideEntrypointServices = (layer, services) => layer.pipe(Layer.provideMerge(services));
23
+ const defineEntrypointRpcMethods = (target, prototype, rpc, reservedMethodNames, run, onExit, rpcTracing) => {
24
+ const methods = rpc ?? {};
25
+ assertNoReservedMethods(target, methods, reservedMethodNames);
26
+ for (const [key, method] of Object.entries(methods)) Object.defineProperty(prototype, key, {
27
+ enumerable: true,
28
+ value(...args) {
29
+ return invokeEntrypointRpcMethod(this, method, args, run, onExit, target, key, rpcTracing);
30
+ }
31
+ });
32
+ };
33
+ const assumeEntrypointClass = (entrypoint) => {
34
+ return entrypoint;
35
+ };
36
+ //#endregion
37
+ export { assumeEntrypointClass, defineEntrypointRpcMethods, provideEntrypointServices };
@@ -0,0 +1,17 @@
1
+ import * as Predicate from "effect/Predicate";
2
+ //#region src/internal/ErrorMessage.ts
3
+ /**
4
+ * Renders the most useful human-readable description of an unknown `cause`
5
+ * for use in tagged error `message` getters.
6
+ */
7
+ const causeMessage = (cause) => {
8
+ if (Predicate.hasProperty(cause, "message") && Predicate.isString(cause.message) && cause.message.length > 0) return cause.message;
9
+ try {
10
+ return String(cause);
11
+ } catch {
12
+ return "unknown cause";
13
+ }
14
+ };
15
+ const violationsMessage = (violations) => violations.map((violation) => `${violation.path}: ${violation.message}`).join("; ");
16
+ //#endregion
17
+ export { causeMessage, violationsMessage };
@@ -0,0 +1,33 @@
1
+ import * as Effect from "effect/Effect";
2
+ import "effect/Exit";
3
+ import * as FiberSet from "effect/FiberSet";
4
+ //#region src/internal/NativeCallback.ts
5
+ /**
6
+ * Runs an Effect callback owned by a native Promise operation.
7
+ *
8
+ * The callback keeps the caller's context, while a private scope owns its
9
+ * fiber. Closing that scope interrupts and joins the callback before awaiting
10
+ * the native operation's settlement.
11
+ */
12
+ const runNativeCallback = Effect.fnUntraced(function* (operation) {
13
+ const callerContext = yield* Effect.context();
14
+ return yield* Effect.scoped(Effect.gen(function* () {
15
+ let nativePromise;
16
+ yield* Effect.addFinalizer(() => {
17
+ const promise = nativePromise;
18
+ return promise === void 0 ? Effect.void : Effect.promise(() => promise.then(() => void 0, () => void 0));
19
+ });
20
+ const runPromise = yield* FiberSet.makeRuntimePromise();
21
+ return yield* Effect.callback((resume) => {
22
+ try {
23
+ nativePromise = operation((effect) => runPromise(Effect.provideContext(Effect.exit(effect), callerContext)));
24
+ } catch (cause) {
25
+ resume(Effect.fail(cause));
26
+ return;
27
+ }
28
+ nativePromise.then((value) => resume(Effect.succeed(value)), (cause) => resume(Effect.fail(cause)));
29
+ });
30
+ }));
31
+ });
32
+ //#endregion
33
+ export { runNativeCallback };
@@ -0,0 +1,13 @@
1
+ import { Result } from "../Rpc.mjs";
2
+ import "../RpcTracing.mjs";
3
+ import "effect/Context";
4
+ import "effect/Effect";
5
+ import "effect/Schema";
6
+ //#region src/internal/RpcInvocation.d.ts
7
+ type AnyArgs = Array<any>;
8
+ type AsyncMethodKey<Api> = { [Key in keyof Api]-?: Key extends string ? Api[Key] extends ((...args: AnyArgs) => Promise<any>) ? Key : never : never; }[keyof Api];
9
+ type AsyncMethodArgs<Api, Method extends keyof Api> = Api[Method] extends ((...args: infer Args) => Promise<any>) ? Args : never;
10
+ type AsyncMethodSuccess<Api, Method extends keyof Api> = Api[Method] extends ((...args: AnyArgs) => Promise<infer A>) ? A : never;
11
+ type AsyncMethodCloudflareReturn<Api, Method extends keyof Api> = Result<AsyncMethodSuccess<Api, Method>>;
12
+ //#endregion
13
+ export { AsyncMethodArgs, AsyncMethodCloudflareReturn, AsyncMethodKey, AsyncMethodSuccess };
@@ -0,0 +1,34 @@
1
+ import * as Context from "effect/Context";
2
+ import * as Effect from "effect/Effect";
3
+ import "effect/Schema";
4
+ import * as Predicate from "effect/Predicate";
5
+ import * as Option from "effect/Option";
6
+ //#region src/internal/RpcInvocation.ts
7
+ /** Scoped to the incoming event effect, never the instance runtime or storage. */
8
+ var CurrentInvocation = class extends Context.Service()("effect-cf/internal/RpcInvocation") {};
9
+ const recordDecodedArgs = (args) => Effect.map(Effect.serviceOption(CurrentInvocation), (invocation) => {
10
+ if (Option.isSome(invocation)) invocation.value.decodedArgs = args;
11
+ });
12
+ const invokeWithReceiver = (value, receiver, args) => {
13
+ return Function.prototype.apply.call(value, receiver, args);
14
+ };
15
+ const lookupRpcMethod = (target, method, makeError) => Effect.try({
16
+ try: () => {
17
+ if (!Predicate.isObjectKeyword(target)) throw new TypeError(`RPC target is not object-like`);
18
+ const receiver = target;
19
+ const value = receiver[method];
20
+ if (!Predicate.isFunction(value)) throw new TypeError(`RPC method "${String(method)}" is not callable`);
21
+ const callable = value;
22
+ return (...args) => invokeWithReceiver(callable, receiver, args);
23
+ },
24
+ catch: makeError
25
+ });
26
+ const invokeRpcMethod = Effect.fnUntraced(function* (target, method, args, makeError) {
27
+ const fn = yield* lookupRpcMethod(target, method, makeError);
28
+ return yield* Effect.try({
29
+ try: () => fn(...args),
30
+ catch: makeError
31
+ });
32
+ });
33
+ //#endregion
34
+ export { CurrentInvocation, invokeRpcMethod, lookupRpcMethod, recordDecodedArgs };
@@ -0,0 +1,31 @@
1
+ import { WorkerConfig, WorkerEnvironment } from "../Environment.mjs";
2
+ import { provideEntrypointServices } from "./Entrypoint.mjs";
3
+ import * as Effect from "effect/Effect";
4
+ import * as Layer from "effect/Layer";
5
+ import * as ConfigProvider from "effect/ConfigProvider";
6
+ import * as ManagedRuntime from "effect/ManagedRuntime";
7
+ //#region src/internal/Runtime.ts
8
+ /**
9
+ * Assembles the shared `ManagedRuntime` used by the Cloudflare entrypoint
10
+ * classes (Worker, Durable Object, Workflow).
11
+ *
12
+ * The entrypoint-specific services are merged with the env-backed
13
+ * `ConfigProvider` and `WorkerEnvironment`, then provided to the user-supplied
14
+ * layer so the resulting runtime satisfies both the user services and the
15
+ * platform services.
16
+ */
17
+ const makeEntrypointRuntime = (layer, env, services) => {
18
+ const entrypointServices = Layer.mergeAll(services, ConfigProvider.layer(WorkerConfig.providerFromEnv(env)), Layer.succeed(WorkerEnvironment, env));
19
+ return ManagedRuntime.make(provideEntrypointServices(layer, entrypointServices));
20
+ };
21
+ function runEventPromise(...args) {
22
+ const [runtime, effect, eventLayer, parent] = args;
23
+ if (eventLayer === void 0) {
24
+ const event = Effect.scoped(effect);
25
+ return runtime.runPromise(parent === void 0 ? event : Effect.withParentSpan(event, parent));
26
+ }
27
+ const event = Effect.scoped(effect.pipe(Effect.provide(eventLayer, { local: true })));
28
+ return runtime.runPromise(parent === void 0 ? event : Effect.withParentSpan(event, parent));
29
+ }
30
+ //#endregion
31
+ export { makeEntrypointRuntime, runEventPromise };
@@ -0,0 +1,20 @@
1
+ import * as Effect from "effect/Effect";
2
+ import * as Option from "effect/Option";
3
+ import { Flusher } from "effect/unstable/observability/OtlpExporter";
4
+ //#region src/internal/Telemetry.ts
5
+ /** Maximum event lifetime spent on an internally scheduled telemetry flush. */
6
+ const scheduledFlushTimeout = "2 seconds";
7
+ /**
8
+ * Schedules a configured OTLP flusher through the current Cloudflare event.
9
+ *
10
+ * The handed-off effect is best-effort: it settles within two seconds and
11
+ * silently absorbs every failure cause so telemetry cannot extend or fail the
12
+ * user event, or recursively log through an unhealthy exporter.
13
+ */
14
+ const scheduleTelemetryFlush = (waitUntil) => Effect.gen(function* () {
15
+ const flusher = yield* Effect.serviceOption(Flusher);
16
+ if (Option.isNone(flusher)) return;
17
+ yield* waitUntil(flusher.value.flush.pipe(Effect.timeoutOption(scheduledFlushTimeout), Effect.ignoreCause, Effect.asVoid));
18
+ }).pipe(Effect.ignoreCause);
19
+ //#endregion
20
+ export { scheduleTelemetryFlush };
@@ -1,33 +1,6 @@
1
- import { Cause, Effect, Exit, FiberSet } from "effect";
2
- //#region src/internal/NativeCallback.ts
3
- /**
4
- * Runs an Effect callback owned by a native Promise operation.
5
- *
6
- * The callback keeps the caller's context, while a private scope owns its
7
- * fiber. Closing that scope interrupts and joins the callback before awaiting
8
- * the native operation's settlement.
9
- */
10
- const runNativeCallback = Effect.fnUntraced(function* (operation) {
11
- const callerContext = yield* Effect.context();
12
- return yield* Effect.scoped(Effect.gen(function* () {
13
- let nativePromise;
14
- yield* Effect.addFinalizer(() => {
15
- const promise = nativePromise;
16
- return promise === void 0 ? Effect.void : Effect.promise(() => promise.then(() => void 0, () => void 0));
17
- });
18
- const runPromise = yield* FiberSet.makeRuntimePromise();
19
- return yield* Effect.callback((resume) => {
20
- try {
21
- nativePromise = operation((effect) => runPromise(Effect.provideContext(Effect.exit(effect), callerContext)));
22
- } catch (cause) {
23
- resume(Effect.fail(cause));
24
- return;
25
- }
26
- nativePromise.then((value) => resume(Effect.succeed(value)), (cause) => resume(Effect.fail(cause)));
27
- });
28
- }));
29
- });
30
- //#endregion
1
+ import * as Effect from "effect/Effect";
2
+ import * as Cause from "effect/Cause";
3
+ import * as Exit from "effect/Exit";
31
4
  //#region src/internal/WorkerContext.ts
32
5
  const causeError = (cause) => {
33
6
  const squashed = Cause.squash(cause);
@@ -57,4 +30,4 @@ const fromExecutionContext = (ctx, runPromiseExit = (effect) => Effect.runPromis
57
30
  };
58
31
  };
59
32
  //#endregion
60
- export { makeWaitUntilScheduler as n, runNativeCallback as r, fromExecutionContext as t };
33
+ export { fromExecutionContext, makeWaitUntilScheduler };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "effect-cf",
3
- "version": "0.40.0",
3
+ "version": "0.40.1",
4
4
  "description": "Effect-native primitives for Cloudflare Workers and bindings.",
5
5
  "license": "MIT",
6
6
  "repository": {
package/src/AiGateway.ts CHANGED
@@ -1,4 +1,8 @@
1
- import { Context, Data, Effect, type Layer, Schema as S } from "effect";
1
+ import * as Context from "effect/Context";
2
+ import * as Data from "effect/Data";
3
+ import * as Effect from "effect/Effect";
4
+ import * as S from "effect/Schema";
5
+ import type { Layer } from "effect";
2
6
  import type { AiGateway as CloudflareAiGateway } from "@cloudflare/workers-types";
3
7
 
4
8
  import * as Binding from "./Binding";
@@ -2,25 +2,20 @@ import type {
2
2
  AnalyticsEngineDataPoint as CloudflareAnalyticsEngineDataPoint,
3
3
  AnalyticsEngineDataset as CloudflareAnalyticsEngineDataset,
4
4
  } from "@cloudflare/workers-types";
5
- import {
6
- type Redacted,
7
- Config,
8
- Context,
9
- Data,
10
- Effect,
11
- Layer,
12
- Option,
13
- Predicate,
14
- Result,
15
- Schema as S,
16
- } from "effect";
17
- import {
18
- FetchHttpClient,
19
- type Headers,
20
- HttpClient,
21
- type HttpClientResponse,
22
- HttpClientRequest,
23
- } from "effect/unstable/http";
5
+ import * as Config from "effect/Config";
6
+ import * as Context from "effect/Context";
7
+ import * as Data from "effect/Data";
8
+ import * as Effect from "effect/Effect";
9
+ import * as Layer from "effect/Layer";
10
+ import * as Option from "effect/Option";
11
+ import * as Predicate from "effect/Predicate";
12
+ import * as Result from "effect/Result";
13
+ import * as S from "effect/Schema";
14
+ import type { Redacted } from "effect";
15
+ import * as FetchHttpClient from "effect/unstable/http/FetchHttpClient";
16
+ import * as HttpClient from "effect/unstable/http/HttpClient";
17
+ import * as HttpClientRequest from "effect/unstable/http/HttpClientRequest";
18
+ import type { Headers, HttpClientResponse } from "effect/unstable/http";
24
19
 
25
20
  import * as Binding from "./Binding";
26
21
  import type { WorkerEnvironment } from "./Environment";
package/src/Artifacts.ts CHANGED
@@ -6,7 +6,12 @@ import type {
6
6
  ArtifactsTokenInfo as CloudflareArtifactsTokenInfo,
7
7
  ArtifactsTokenListResult as CloudflareArtifactsTokenListResult,
8
8
  } from "@cloudflare/workers-types";
9
- import { Context, Data, Effect, type Layer, Predicate, Schema } from "effect";
9
+ import * as Context from "effect/Context";
10
+ import * as Data from "effect/Data";
11
+ import * as Effect from "effect/Effect";
12
+ import * as Predicate from "effect/Predicate";
13
+ import * as Schema from "effect/Schema";
14
+ import type { Layer } from "effect";
10
15
 
11
16
  import * as Binding from "./Binding";
12
17
  import type { WorkerEnvironment } from "./Environment";
package/src/Binding.ts CHANGED
@@ -1,4 +1,8 @@
1
- import { Context, Data, Effect, Layer, Predicate } from "effect";
1
+ import * as Context from "effect/Context";
2
+ import * as Data from "effect/Data";
3
+ import * as Effect from "effect/Effect";
4
+ import * as Layer from "effect/Layer";
5
+ import * as Predicate from "effect/Predicate";
2
6
 
3
7
  import { WorkerEnvironment, type WorkerEnv } from "./Environment";
4
8
 
@@ -1,4 +1,8 @@
1
- import { Context, Data, Effect, type Layer, Predicate } from "effect";
1
+ import * as Context from "effect/Context";
2
+ import * as Data from "effect/Data";
3
+ import * as Effect from "effect/Effect";
4
+ import * as Predicate from "effect/Predicate";
5
+ import type { Layer } from "effect";
2
6
 
3
7
  import * as Binding from "./Binding";
4
8
  import type { WorkerEnvironment } from "./Environment";
package/src/Cache.ts CHANGED
@@ -4,7 +4,11 @@ import type {
4
4
  CacheStorage as CloudflareCacheStorage,
5
5
  RequestInfo as CloudflareRequestInfo,
6
6
  } from "@cloudflare/workers-types";
7
- import { Context, Data, Effect, Layer, Option } from "effect";
7
+ import * as Context from "effect/Context";
8
+ import * as Data from "effect/Data";
9
+ import * as Effect from "effect/Effect";
10
+ import * as Layer from "effect/Layer";
11
+ import * as Option from "effect/Option";
8
12
 
9
13
  import * as ErrorMessage from "./internal/ErrorMessage";
10
14
 
@@ -4,17 +4,19 @@
4
4
  * flush explicitly. Scheduled flush failures cannot fail user events. Exporter
5
5
  * layer finalizers run separately and follow their configured shutdown timeout.
6
6
  */
7
- import { ConfigProvider, Effect, Layer, Option } from "effect";
7
+ import * as ConfigProvider from "effect/ConfigProvider";
8
+ import * as Effect from "effect/Effect";
9
+ import * as Layer from "effect/Layer";
10
+ import * as Option from "effect/Option";
8
11
  import type * as Tracer from "effect/Tracer";
9
- import { FetchHttpClient, type Headers } from "effect/unstable/http";
10
- import {
11
- OtlpExporter,
12
- OtlpLogger,
13
- OtlpMetrics,
14
- OtlpResource,
15
- OtlpSerialization,
16
- OtlpTracer,
17
- } from "effect/unstable/observability";
12
+ import * as FetchHttpClient from "effect/unstable/http/FetchHttpClient";
13
+ import type { Headers } from "effect/unstable/http";
14
+ import * as OtlpExporter from "effect/unstable/observability/OtlpExporter";
15
+ import * as OtlpLogger from "effect/unstable/observability/OtlpLogger";
16
+ import * as OtlpMetrics from "effect/unstable/observability/OtlpMetrics";
17
+ import * as OtlpResource from "effect/unstable/observability/OtlpResource";
18
+ import * as OtlpSerialization from "effect/unstable/observability/OtlpSerialization";
19
+ import * as OtlpTracer from "effect/unstable/observability/OtlpTracer";
18
20
 
19
21
  import { DurableObjectState } from "./DurableObjectState";
20
22
  import { WorkerConfig, WorkerEnvironment } from "./Environment";
@@ -1,6 +1,12 @@
1
1
  import { AsyncLocalStorage } from "node:async_hooks";
2
2
  import { tracing } from "cloudflare:workers";
3
- import { Cause, Effect, Exit, Layer, Option, Predicate, Tracer } from "effect";
3
+ import * as Cause from "effect/Cause";
4
+ import * as Effect from "effect/Effect";
5
+ import * as Exit from "effect/Exit";
6
+ import * as Layer from "effect/Layer";
7
+ import * as Option from "effect/Option";
8
+ import * as Predicate from "effect/Predicate";
9
+ import * as Tracer from "effect/Tracer";
4
10
 
5
11
  type SpanOptions = Parameters<Tracer.Tracer["span"]>[0];
6
12
  type RunInContext = ReturnType<typeof AsyncLocalStorage.snapshot>;
@@ -8,7 +8,8 @@ import type {
8
8
  ArtifactsCLIResult as CloudflareComputerArtifactsCliResult,
9
9
  RemoteAddFn as CloudflareComputerRemoteAdd,
10
10
  } from "@cloudflare/computer/artifacts";
11
- import { Effect, Predicate } from "effect";
11
+ import * as Effect from "effect/Effect";
12
+ import * as Predicate from "effect/Predicate";
12
13
 
13
14
  import * as Artifacts from "./Artifacts";
14
15
 
@@ -27,7 +27,13 @@ import type {
27
27
  GitLogOptions as CloudflareGitLogOptions,
28
28
  GitUpdateRefOptions as CloudflareGitUpdateRefOptions,
29
29
  } from "@cloudflare/computer/git";
30
- import { Context, Effect, Layer, Predicate, Schema, type Scope, Stream } from "effect";
30
+ import * as Context from "effect/Context";
31
+ import * as Effect from "effect/Effect";
32
+ import * as Layer from "effect/Layer";
33
+ import * as Predicate from "effect/Predicate";
34
+ import * as Schema from "effect/Schema";
35
+ import * as Stream from "effect/Stream";
36
+ import type { Scope } from "effect";
31
37
 
32
38
  import * as ComputerArtifacts from "./ComputerArtifacts";
33
39
  import { DurableObjectState } from "./DurableObjectState";
@@ -1,4 +1,9 @@
1
- import { Context, Data, Effect, Predicate, Schema as S, type Layer } from "effect";
1
+ import * as Context from "effect/Context";
2
+ import * as Data from "effect/Data";
3
+ import * as Effect from "effect/Effect";
4
+ import * as Predicate from "effect/Predicate";
5
+ import * as S from "effect/Schema";
6
+ import type { Layer } from "effect";
2
7
 
3
8
  import * as Binding from "./Binding";
4
9
  import type { WorkerEnvironment } from "./Environment";
package/src/D1.ts CHANGED
@@ -1,5 +1,8 @@
1
1
  import { D1Client } from "@effect/sql-d1";
2
- import { Effect, Layer, Predicate, type Config } from "effect";
2
+ import * as Effect from "effect/Effect";
3
+ import * as Layer from "effect/Layer";
4
+ import * as Predicate from "effect/Predicate";
5
+ import type { Config } from "effect";
3
6
  import type { SqlClient } from "effect/unstable/sql";
4
7
 
5
8
  import * as Binding from "./Binding";
@@ -1,5 +1,8 @@
1
1
  import { DurableObject as CloudflareDurableObject } from "cloudflare:workers";
2
- import { Effect, Layer, type ManagedRuntime, type Scope, Tracer } from "effect";
2
+ import * as Effect from "effect/Effect";
3
+ import * as Layer from "effect/Layer";
4
+ import * as Tracer from "effect/Tracer";
5
+ import type { ManagedRuntime, Scope } from "effect";
3
6
 
4
7
  import { NativeRequest } from "./Worker";
5
8
  import { WorkerEnvironment, type WorkerEnv } from "./Environment";
@@ -1,15 +1,13 @@
1
- import {
2
- Clock,
3
- Context,
4
- Data,
5
- DateTime,
6
- Duration,
7
- Effect,
8
- Exit,
9
- Layer,
10
- Predicate,
11
- Schema as S,
12
- } from "effect";
1
+ import * as Clock from "effect/Clock";
2
+ import * as Context from "effect/Context";
3
+ import * as Data from "effect/Data";
4
+ import * as DateTime from "effect/DateTime";
5
+ import * as Duration from "effect/Duration";
6
+ import * as Effect from "effect/Effect";
7
+ import * as Exit from "effect/Exit";
8
+ import * as Layer from "effect/Layer";
9
+ import * as Predicate from "effect/Predicate";
10
+ import * as S from "effect/Schema";
13
11
 
14
12
  import { DurableObjectState } from "./DurableObjectState";
15
13
  import { type SqlStorageValue, StorageOperationError } from "./DurableObjectStorage";
@@ -1,4 +1,6 @@
1
- import { Context, Effect, type Layer, type Schema as S } from "effect";
1
+ import * as Context from "effect/Context";
2
+ import * as Effect from "effect/Effect";
3
+ import type { Layer, Schema as S } from "effect";
2
4
 
3
5
  import type * as Binding from "./Binding";
4
6
  import * as DurableObjectEntrypoint from "./DurableObject";
@@ -1,4 +1,7 @@
1
- import { Data, Effect, Predicate, type Context, type Layer, type Scope } from "effect";
1
+ import * as Data from "effect/Data";
2
+ import * as Effect from "effect/Effect";
3
+ import * as Predicate from "effect/Predicate";
4
+ import type { Context, Layer, Scope } from "effect";
2
5
 
3
6
  import * as Binding from "./Binding";
4
7
  import type { WorkerEnvironment } from "./Environment";
@@ -1,4 +1,10 @@
1
- import { Context, Effect, Layer, Option, Predicate, Queue, Schema } from "effect";
1
+ import * as Context from "effect/Context";
2
+ import * as Effect from "effect/Effect";
3
+ import * as Layer from "effect/Layer";
4
+ import * as Option from "effect/Option";
5
+ import * as Predicate from "effect/Predicate";
6
+ import * as Queue from "effect/Queue";
7
+ import * as Schema from "effect/Schema";
2
8
  import * as RpcMessage from "effect/unstable/rpc/RpcMessage";
3
9
  import * as RpcSerialization from "effect/unstable/rpc/RpcSerialization";
4
10
  import * as RpcServer from "effect/unstable/rpc/RpcServer";
@@ -1,5 +1,6 @@
1
1
  import { SqliteClient } from "@effect/sql-sqlite-do";
2
- import { Effect, Layer } from "effect";
2
+ import * as Effect from "effect/Effect";
3
+ import * as Layer from "effect/Layer";
3
4
  import type { SqlClient } from "effect/unstable/sql";
4
5
 
5
6
  import { DurableObjectState } from "./DurableObjectState";
@@ -1,4 +1,7 @@
1
- import { Cause, Context, Effect, Exit } from "effect";
1
+ import * as Cause from "effect/Cause";
2
+ import * as Context from "effect/Context";
3
+ import * as Effect from "effect/Effect";
4
+ import * as Exit from "effect/Exit";
2
5
 
3
6
  import { fromDurableObjectStorage, type DurableObjectStorage } from "./DurableObjectStorage";
4
7
  import { fromWebSocket, type DurableWebSocket } from "./DurableObjectWebSocket";
@@ -1,16 +1,14 @@
1
- import {
2
- Cause,
3
- Clock,
4
- Data,
5
- Duration,
6
- Effect,
7
- Exit,
8
- Fiber,
9
- Option,
10
- Predicate,
11
- Result,
12
- Schema as S,
13
- } from "effect";
1
+ import * as Cause from "effect/Cause";
2
+ import * as Clock from "effect/Clock";
3
+ import * as Data from "effect/Data";
4
+ import * as Duration from "effect/Duration";
5
+ import * as Effect from "effect/Effect";
6
+ import * as Exit from "effect/Exit";
7
+ import * as Fiber from "effect/Fiber";
8
+ import * as Option from "effect/Option";
9
+ import * as Predicate from "effect/Predicate";
10
+ import * as Result from "effect/Result";
11
+ import * as S from "effect/Schema";
14
12
 
15
13
  import * as ErrorMessage from "./internal/ErrorMessage";
16
14
  import { runNativeCallback } from "./internal/NativeCallback";
@@ -1,4 +1,8 @@
1
- import { Data, Effect, Option, Result, Schema as S } from "effect";
1
+ import * as Data from "effect/Data";
2
+ import * as Effect from "effect/Effect";
3
+ import * as Option from "effect/Option";
4
+ import * as Result from "effect/Result";
5
+ import * as S from "effect/Schema";
2
6
 
3
7
  import { DurableObjectState } from "./DurableObjectState";
4
8
  import * as ErrorMessage from "./internal/ErrorMessage";
package/src/Email.ts CHANGED
@@ -4,7 +4,11 @@ import type {
4
4
  EmailSendResult as CloudflareEmailSendResult,
5
5
  SendEmail as CloudflareSendEmail,
6
6
  } from "@cloudflare/workers-types";
7
- import { Context, Data, Effect, type Layer, Predicate } from "effect";
7
+ import * as Context from "effect/Context";
8
+ import * as Data from "effect/Data";
9
+ import * as Effect from "effect/Effect";
10
+ import * as Predicate from "effect/Predicate";
11
+ import type { Layer } from "effect";
8
12
 
9
13
  import * as Binding from "./Binding";
10
14
  import type { WorkerEnvironment } from "./Environment";
@@ -1,4 +1,9 @@
1
- import { Config, ConfigProvider, Context, Effect, type Layer, Predicate } from "effect";
1
+ import * as Config from "effect/Config";
2
+ import * as ConfigProvider from "effect/ConfigProvider";
3
+ import * as Context from "effect/Context";
4
+ import * as Effect from "effect/Effect";
5
+ import * as Predicate from "effect/Predicate";
6
+ import type { Layer } from "effect";
2
7
 
3
8
  export type WorkerEnv = Cloudflare.Env;
4
9
 
package/src/Hyperdrive.ts CHANGED
@@ -1,4 +1,7 @@
1
- import { Context, Effect, type Layer, Predicate } from "effect";
1
+ import * as Context from "effect/Context";
2
+ import * as Effect from "effect/Effect";
3
+ import * as Predicate from "effect/Predicate";
4
+ import type { Layer } from "effect";
2
5
 
3
6
  import * as Binding from "./Binding";
4
7
  import type { WorkerEnvironment } from "./Environment";
@@ -1,5 +1,7 @@
1
1
  import { PgClient } from "@effect/sql-pg";
2
- import { Effect, Layer, Redacted } from "effect";
2
+ import * as Effect from "effect/Effect";
3
+ import * as Layer from "effect/Layer";
4
+ import * as Redacted from "effect/Redacted";
3
5
  import type { SqlClient, SqlError } from "effect/unstable/sql";
4
6
 
5
7
  import type * as Binding from "./Binding";