effect-cf 0.39.1 → 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 (166) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +9 -1
  3. package/dist/AiGateway.d.mts +86 -0
  4. package/dist/AiGateway.mjs +178 -0
  5. package/dist/AnalyticsEngine.d.mts +170 -0
  6. package/dist/AnalyticsEngine.mjs +275 -0
  7. package/dist/{Artifacts-B3r3RuTB.d.mts → Artifacts.d.mts} +8 -5
  8. package/dist/{Artifacts-CBxWGeZB.mjs → Artifacts.mjs} +9 -5
  9. package/dist/Binding.d.mts +45 -0
  10. package/dist/{Binding-C82jRhdr.mjs → Binding.mjs} +8 -4
  11. package/dist/BrowserRendering.d.mts +85 -0
  12. package/dist/BrowserRendering.mjs +81 -0
  13. package/dist/Cache.d.mts +40 -0
  14. package/dist/Cache.mjs +51 -0
  15. package/dist/CloudflareOtlp.d.mts +95 -0
  16. package/dist/CloudflareOtlp.mjs +125 -0
  17. package/dist/CloudflareTracer.d.mts +20 -0
  18. package/dist/CloudflareTracer.mjs +69 -0
  19. package/dist/ComputerArtifacts.d.mts +2 -2
  20. package/dist/ComputerArtifacts.mjs +3 -2
  21. package/dist/ComputerWorkspace.d.mts +36 -31
  22. package/dist/ComputerWorkspace.mjs +8 -3
  23. package/dist/ComputerWorkspaceHost.d.mts +1 -1
  24. package/dist/ComputerWorkspaceHost.mjs +1 -1
  25. package/dist/{ContainerNamespace-DbLaeFhN.d.mts → ContainerNamespace.d.mts} +16 -12
  26. package/dist/ContainerNamespace.mjs +165 -0
  27. package/dist/D1.d.mts +33 -0
  28. package/dist/D1.mjs +32 -0
  29. package/dist/DurableObject.d.mts +103 -0
  30. package/dist/DurableObject.mjs +77 -0
  31. package/dist/DurableObjectAlarm.d.mts +187 -0
  32. package/dist/DurableObjectAlarm.mjs +344 -0
  33. package/dist/DurableObjectDefinition.d.mts +87 -0
  34. package/dist/DurableObjectDefinition.mjs +125 -0
  35. package/dist/DurableObjectNamespace.d.mts +154 -0
  36. package/dist/DurableObjectNamespace.mjs +144 -0
  37. package/dist/DurableObjectRpcWebSocket.d.mts +112 -0
  38. package/dist/DurableObjectRpcWebSocket.mjs +547 -0
  39. package/dist/DurableObjectSqlite.d.mts +11 -0
  40. package/dist/DurableObjectSqlite.mjs +16 -0
  41. package/dist/DurableObjectState.d.mts +65 -0
  42. package/dist/DurableObjectState.mjs +47 -0
  43. package/dist/DurableObjectStorage.d.mts +112 -0
  44. package/dist/{DurableObjectState-DLL0YgBd.mjs → DurableObjectStorage.mjs} +19 -157
  45. package/dist/DurableObjectWebSocket.d.mts +83 -0
  46. package/dist/DurableObjectWebSocket.mjs +120 -0
  47. package/dist/Email.d.mts +106 -0
  48. package/dist/Email.mjs +247 -0
  49. package/dist/Environment.d.mts +59 -0
  50. package/dist/{ErrorMessage-Byx2OgNd.mjs → Environment.mjs} +7 -18
  51. package/dist/{Hyperdrive-HrwFlZ6x.d.mts → Hyperdrive.d.mts} +8 -5
  52. package/dist/Hyperdrive.mjs +32 -0
  53. package/dist/HyperdrivePg.d.mts +4 -3
  54. package/dist/HyperdrivePg.mjs +3 -1
  55. package/dist/Images.d.mts +191 -0
  56. package/dist/Images.mjs +112 -0
  57. package/dist/Kv.d.mts +84 -0
  58. package/dist/Kv.mjs +132 -0
  59. package/dist/Mcp.d.mts +5 -3
  60. package/dist/Mcp.mjs +13 -4
  61. package/dist/Queue.d.mts +68 -0
  62. package/dist/Queue.mjs +54 -0
  63. package/dist/QueueBinding.d.mts +42 -0
  64. package/dist/QueueBinding.mjs +69 -0
  65. package/dist/QueueDefinition.d.mts +48 -0
  66. package/dist/QueueDefinition.mjs +63 -0
  67. package/dist/R2.d.mts +89 -0
  68. package/dist/R2.mjs +117 -0
  69. package/dist/Rpc.d.mts +29 -0
  70. package/dist/Rpc.mjs +28 -0
  71. package/dist/RpcDefinition.d.mts +116 -0
  72. package/dist/RpcDefinition.mjs +184 -0
  73. package/dist/RpcTracing.d.mts +52 -0
  74. package/dist/RpcTracing.mjs +77 -0
  75. package/dist/Sandbox.d.mts +10 -5
  76. package/dist/Sandbox.mjs +9 -3
  77. package/dist/ServiceBinding.d.mts +112 -0
  78. package/dist/ServiceBinding.mjs +145 -0
  79. package/dist/Vectorize.d.mts +68 -0
  80. package/dist/Vectorize.mjs +76 -0
  81. package/dist/Vitest.d.mts +6 -4
  82. package/dist/Vitest.mjs +8 -4
  83. package/dist/WebTransport.d.mts +66 -0
  84. package/dist/WebTransport.mjs +63 -0
  85. package/dist/Worker.d.mts +139 -0
  86. package/dist/Worker.mjs +141 -0
  87. package/dist/WorkerDefinition.d.mts +100 -0
  88. package/dist/WorkerDefinition.mjs +103 -0
  89. package/dist/WorkersAi.d.mts +84 -0
  90. package/dist/WorkersAi.mjs +84 -0
  91. package/dist/Workflow.d.mts +91 -0
  92. package/dist/Workflow.mjs +139 -0
  93. package/dist/{WorkflowBinding-DtVykUCz.d.mts → WorkflowBinding.d.mts} +14 -10
  94. package/dist/WorkflowBinding.mjs +100 -0
  95. package/dist/WorkflowDefinition.d.mts +51 -0
  96. package/dist/WorkflowDefinition.mjs +69 -0
  97. package/dist/{rolldown-runtime-D7D4PA-g.mjs → _virtual/_rolldown/runtime.mjs} +1 -1
  98. package/dist/index.d.mts +40 -1800
  99. package/dist/index.mjs +40 -3123
  100. package/dist/{ComputerWorkspaceHostRegistry-CY5Fv4Ng.mjs → internal/ComputerWorkspaceHostRegistry.mjs} +1 -1
  101. package/dist/internal/Entrypoint.mjs +37 -0
  102. package/dist/internal/ErrorMessage.mjs +17 -0
  103. package/dist/internal/NativeCallback.mjs +33 -0
  104. package/dist/internal/RpcInvocation.d.mts +13 -0
  105. package/dist/internal/RpcInvocation.mjs +34 -0
  106. package/dist/internal/Runtime.mjs +31 -0
  107. package/dist/internal/Telemetry.mjs +20 -0
  108. package/dist/{WorkerContext-Yobnfw-K.mjs → internal/WorkerContext.mjs} +4 -31
  109. package/package.json +1 -1
  110. package/src/AiGateway.ts +5 -1
  111. package/src/AnalyticsEngine.ts +14 -19
  112. package/src/Artifacts.ts +6 -1
  113. package/src/Binding.ts +5 -1
  114. package/src/BrowserRendering.ts +5 -1
  115. package/src/Cache.ts +5 -1
  116. package/src/CloudflareOtlp.ts +12 -10
  117. package/src/CloudflareTracer.ts +7 -1
  118. package/src/ComputerArtifacts.ts +2 -1
  119. package/src/ComputerWorkspace.ts +7 -1
  120. package/src/ContainerNamespace.ts +6 -1
  121. package/src/D1.ts +4 -1
  122. package/src/DurableObject.ts +122 -29
  123. package/src/DurableObjectAlarm.ts +185 -52
  124. package/src/DurableObjectDefinition.ts +22 -22
  125. package/src/DurableObjectNamespace.ts +4 -1
  126. package/src/DurableObjectRpcWebSocket.ts +7 -1
  127. package/src/DurableObjectSqlite.ts +2 -1
  128. package/src/DurableObjectState.ts +4 -1
  129. package/src/DurableObjectStorage.ts +11 -13
  130. package/src/DurableObjectWebSocket.ts +5 -1
  131. package/src/Email.ts +5 -1
  132. package/src/Environment.ts +6 -1
  133. package/src/Hyperdrive.ts +4 -1
  134. package/src/HyperdrivePg.ts +3 -1
  135. package/src/Images.ts +7 -1
  136. package/src/Kv.ts +7 -1
  137. package/src/Mcp.ts +13 -13
  138. package/src/Queue.ts +3 -1
  139. package/src/QueueBinding.ts +5 -1
  140. package/src/QueueDefinition.ts +4 -1
  141. package/src/R2.ts +7 -1
  142. package/src/Rpc.ts +4 -1
  143. package/src/RpcDefinition.ts +4 -1
  144. package/src/RpcTracing.ts +9 -1
  145. package/src/Sandbox.ts +7 -1
  146. package/src/ServiceBinding.ts +6 -1
  147. package/src/Vectorize.ts +7 -1
  148. package/src/Vitest.ts +5 -1
  149. package/src/WebTransport.ts +6 -1
  150. package/src/Worker.ts +10 -16
  151. package/src/WorkerDefinition.ts +3 -1
  152. package/src/WorkersAi.ts +7 -1
  153. package/src/Workflow.ts +8 -11
  154. package/src/WorkflowBinding.ts +6 -1
  155. package/src/WorkflowDefinition.ts +4 -1
  156. package/src/internal/Entrypoint.ts +3 -1
  157. package/src/internal/ErrorMessage.ts +1 -1
  158. package/src/internal/NativeCallback.ts +3 -1
  159. package/src/internal/RpcInvocation.ts +5 -1
  160. package/src/internal/Runtime.ts +5 -1
  161. package/src/internal/Telemetry.ts +4 -3
  162. package/src/internal/WorkerContext.ts +3 -1
  163. package/dist/Binding-DKcLrQCM.d.mts +0 -94
  164. package/dist/DurableObjectState-DJ0K-zyd.d.mts +0 -244
  165. package/dist/Worker-XsGJsCJX.mjs +0 -885
  166. package/dist/Worker-gV4mDqIs.d.mts +0 -641
@@ -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";
package/src/Images.ts CHANGED
@@ -21,7 +21,13 @@ import type {
21
21
  Response as CloudflareResponse,
22
22
  TextOptions as CloudflareTextOptions,
23
23
  } from "@cloudflare/workers-types";
24
- import { Context, Data, Effect, Function, Option, Predicate, type Layer } from "effect";
24
+ import * as Context from "effect/Context";
25
+ import * as Data from "effect/Data";
26
+ import * as Effect from "effect/Effect";
27
+ import * as Function from "effect/Function";
28
+ import * as Option from "effect/Option";
29
+ import * as Predicate from "effect/Predicate";
30
+ import type { Layer } from "effect";
25
31
 
26
32
  import * as Binding from "./Binding";
27
33
  import type { WorkerEnvironment } from "./Environment";
package/src/Kv.ts CHANGED
@@ -2,7 +2,13 @@ import type {
2
2
  KVNamespaceListOptions as CloudflareKVNamespaceListOptions,
3
3
  KVNamespacePutOptions as CloudflareKVNamespacePutOptions,
4
4
  } from "@cloudflare/workers-types";
5
- import { Context, Data, Effect, Option, Predicate, Schema as S, type Layer } from "effect";
5
+ import * as Context from "effect/Context";
6
+ import * as Data from "effect/Data";
7
+ import * as Effect from "effect/Effect";
8
+ import * as Option from "effect/Option";
9
+ import * as Predicate from "effect/Predicate";
10
+ import * as S from "effect/Schema";
11
+ import type { Layer } from "effect";
6
12
 
7
13
  import * as Binding from "./Binding";
8
14
  import type { WorkerEnvironment } from "./Environment";
package/src/Mcp.ts CHANGED
@@ -11,19 +11,19 @@ import {
11
11
  type ServerOptions,
12
12
  type StandardSchemaWithJSON,
13
13
  } from "@modelcontextprotocol/server";
14
- import {
15
- Cause,
16
- Context,
17
- Effect,
18
- Exit,
19
- type JsonSchema,
20
- Option,
21
- Predicate,
22
- Schema,
23
- Sink,
24
- Stream,
25
- } from "effect";
26
- import { AiError, Tool, type Toolkit } from "effect/unstable/ai";
14
+ import * as Cause from "effect/Cause";
15
+ import * as Context from "effect/Context";
16
+ import * as Effect from "effect/Effect";
17
+ import * as Exit from "effect/Exit";
18
+ import * as Option from "effect/Option";
19
+ import * as Predicate from "effect/Predicate";
20
+ import * as Schema from "effect/Schema";
21
+ import * as Sink from "effect/Sink";
22
+ import * as Stream from "effect/Stream";
23
+ import type { JsonSchema } from "effect";
24
+ import * as AiError from "effect/unstable/ai/AiError";
25
+ import * as Tool from "effect/unstable/ai/Tool";
26
+ import type { Toolkit } from "effect/unstable/ai";
27
27
 
28
28
  import { NativeRequest } from "./Worker";
29
29
  import { runNativeCallback } from "./internal/NativeCallback";
package/src/Queue.ts CHANGED
@@ -1,4 +1,6 @@
1
- import { Data, Effect, type Scope } from "effect";
1
+ import * as Data from "effect/Data";
2
+ import * as Effect from "effect/Effect";
3
+ import type { Scope } from "effect";
2
4
 
3
5
  import type { ExecutionContext, WorkerContext } from "./Worker";
4
6
  import type { WorkerEnvironment } from "./Environment";
@@ -7,7 +7,11 @@ import type {
7
7
  QueueSendOptions as CloudflareQueueSendOptions,
8
8
  QueueSendResponse as CloudflareQueueSendResponse,
9
9
  } from "@cloudflare/workers-types";
10
- import { type Context, Data, Effect, Predicate, Schema as S } from "effect";
10
+ import * as Data from "effect/Data";
11
+ import * as Effect from "effect/Effect";
12
+ import * as Predicate from "effect/Predicate";
13
+ import * as S from "effect/Schema";
14
+ import type { Context } from "effect";
11
15
 
12
16
  import * as Binding from "./Binding";
13
17
  import type * as RpcDefinition from "./RpcDefinition";
@@ -1,4 +1,7 @@
1
- import { Context, Effect, Schema as S, type Layer, type Scope } from "effect";
1
+ import * as Context from "effect/Context";
2
+ import * as Effect from "effect/Effect";
3
+ import * as S from "effect/Schema";
4
+ import type { Layer, Scope } from "effect";
2
5
 
3
6
  import type * as Binding from "./Binding";
4
7
  import type { WorkerEnvironment } from "./Environment";
package/src/R2.ts CHANGED
@@ -12,7 +12,13 @@ import type {
12
12
  R2UploadPartOptions as CloudflareR2UploadPartOptions,
13
13
  R2UploadedPart as CloudflareR2UploadedPart,
14
14
  } from "@cloudflare/workers-types";
15
- import { Context, Data, Effect, Option, Predicate, Schema, type Layer } from "effect";
15
+ import * as Context from "effect/Context";
16
+ import * as Data from "effect/Data";
17
+ import * as Effect from "effect/Effect";
18
+ import * as Option from "effect/Option";
19
+ import * as Predicate from "effect/Predicate";
20
+ import * as Schema from "effect/Schema";
21
+ import type { Layer } from "effect";
16
22
 
17
23
  import * as Binding from "./Binding";
18
24
  import type { WorkerEnvironment } from "./Environment";
package/src/Rpc.ts CHANGED
@@ -1,5 +1,8 @@
1
1
  import { RpcStub, RpcTarget } from "cloudflare:workers";
2
- import { Effect, Predicate, Schema, type Scope } from "effect";
2
+ import * as Effect from "effect/Effect";
3
+ import * as Predicate from "effect/Predicate";
4
+ import * as Schema from "effect/Schema";
5
+ import type { Scope } from "effect";
3
6
 
4
7
  import { decodeWireError } from "./RpcDefinition";
5
8
 
@@ -1,4 +1,7 @@
1
- import { Data, Effect, Predicate, Schema as S } 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 * as S from "effect/Schema";
2
5
 
3
6
  import type * as Rpc from "./Rpc";
4
7
  import * as ErrorMessage from "./internal/ErrorMessage";
package/src/RpcTracing.ts CHANGED
@@ -1,4 +1,12 @@
1
- import { Cause, Clock, Context, Effect, Exit, Option, References, Schema, Tracer } from "effect";
1
+ import * as Cause from "effect/Cause";
2
+ import * as Clock from "effect/Clock";
3
+ import * as Context from "effect/Context";
4
+ import * as Effect from "effect/Effect";
5
+ import * as Exit from "effect/Exit";
6
+ import * as Option from "effect/Option";
7
+ import * as References from "effect/References";
8
+ import * as Schema from "effect/Schema";
9
+ import * as Tracer from "effect/Tracer";
2
10
 
3
11
  /**
4
12
  * Live native RPC metadata. Opted-in receivers reserve a valid trailing value
package/src/Sandbox.ts CHANGED
@@ -32,7 +32,13 @@ import type {
32
32
  WaitForPortOptions,
33
33
  WatchOptions,
34
34
  } from "@cloudflare/sandbox";
35
- import { Context, Data, Effect, Option, Predicate, Stream, type Layer } from "effect";
35
+ import * as Context from "effect/Context";
36
+ import * as Data from "effect/Data";
37
+ import * as Effect from "effect/Effect";
38
+ import * as Option from "effect/Option";
39
+ import * as Predicate from "effect/Predicate";
40
+ import * as Stream from "effect/Stream";
41
+ import type { Layer } from "effect";
36
42
 
37
43
  import * as Binding from "./Binding";
38
44
  import type { ContainerStartOptions, ContainerStopSignal } from "./ContainerNamespace";
@@ -1,4 +1,9 @@
1
- import { Data, Effect, Option, Predicate, Schema, type Context, type Scope } 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 Predicate from "effect/Predicate";
5
+ import * as Schema from "effect/Schema";
6
+ import type { Context, Scope } from "effect";
2
7
 
3
8
  import * as Binding from "./Binding";
4
9
  import * as CloudflareRpc from "./Rpc";
package/src/Vectorize.ts CHANGED
@@ -1,4 +1,10 @@
1
- import { Context, Data, Effect, Option, Predicate, Schema, 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 Option from "effect/Option";
5
+ import * as Predicate from "effect/Predicate";
6
+ import * as Schema from "effect/Schema";
7
+ import type { Layer } from "effect";
2
8
  import type {
3
9
  Vectorize as CloudflareVectorize,
4
10
  VectorizeAsyncMutation as CloudflareVectorizeAsyncMutation,
package/src/Vitest.ts CHANGED
@@ -24,7 +24,11 @@ import {
24
24
  runInDurableObject as runInDurableObjectPromise,
25
25
  waitOnExecutionContext,
26
26
  } from "cloudflare:test";
27
- import { ConfigProvider, Effect, Exit, Layer, Schema } from "effect";
27
+ import * as ConfigProvider from "effect/ConfigProvider";
28
+ import * as Effect from "effect/Effect";
29
+ import * as Exit from "effect/Exit";
30
+ import * as Layer from "effect/Layer";
31
+ import * as Schema from "effect/Schema";
28
32
 
29
33
  import {
30
34
  DurableObjectState,
@@ -30,7 +30,12 @@
30
30
  * the edge does provide.
31
31
  */
32
32
  import type { Request as CloudflareRequest } from "@cloudflare/workers-types";
33
- import { Data, Effect, Option, Predicate, Result, Schema as S } from "effect";
33
+ import * as Data from "effect/Data";
34
+ import * as Effect from "effect/Effect";
35
+ import * as Option from "effect/Option";
36
+ import * as Predicate from "effect/Predicate";
37
+ import * as Result from "effect/Result";
38
+ import * as S from "effect/Schema";
34
39
 
35
40
  /**
36
41
  * Metadata Cloudflare's edge reports about the inbound client connection.
package/src/Worker.ts CHANGED
@@ -1,20 +1,14 @@
1
1
  import { WorkerEntrypoint as CloudflareWorkerEntrypoint } from "cloudflare:workers";
2
- import {
3
- type Cause,
4
- Context,
5
- Effect,
6
- Layer,
7
- type ManagedRuntime,
8
- References,
9
- type Scope,
10
- Tracer,
11
- } from "effect";
12
- import {
13
- HttpEffect,
14
- HttpMiddleware,
15
- HttpServerRequest,
16
- HttpServerResponse,
17
- } from "effect/unstable/http";
2
+ import * as Context from "effect/Context";
3
+ import * as Effect from "effect/Effect";
4
+ import * as Layer from "effect/Layer";
5
+ import * as References from "effect/References";
6
+ import * as Tracer from "effect/Tracer";
7
+ import type { Cause, ManagedRuntime, Scope } from "effect";
8
+ import * as HttpEffect from "effect/unstable/http/HttpEffect";
9
+ import * as HttpMiddleware from "effect/unstable/http/HttpMiddleware";
10
+ import * as HttpServerRequest from "effect/unstable/http/HttpServerRequest";
11
+ import * as HttpServerResponse from "effect/unstable/http/HttpServerResponse";
18
12
 
19
13
  import { WorkerEnvironment, type WorkerEnv } from "./Environment";
20
14
  import { fromMessage, fromMessageBatch, type QueueHandler } from "./Queue";
@@ -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 type { WorkerEnvironment } from "./Environment";
package/src/WorkersAi.ts CHANGED
@@ -1,4 +1,10 @@
1
- import { Context, Data, Effect, Option, 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 Option from "effect/Option";
5
+ import * as Predicate from "effect/Predicate";
6
+ import * as S from "effect/Schema";
7
+ import type { Layer } from "effect";
2
8
  import type {
3
9
  Ai as CloudflareAi,
4
10
  AiAsyncBatchResponse,
package/src/Workflow.ts CHANGED
@@ -9,17 +9,14 @@ import {
9
9
  type WorkflowTimeoutDuration,
10
10
  } from "cloudflare:workers";
11
11
  import { NonRetryableError as CloudflareNonRetryableError } from "cloudflare:workflows";
12
- import {
13
- Cause,
14
- Context,
15
- Data,
16
- Effect,
17
- FiberSet,
18
- Layer,
19
- type ManagedRuntime,
20
- Option,
21
- type Scope,
22
- } from "effect";
12
+ import * as Cause from "effect/Cause";
13
+ import * as Context from "effect/Context";
14
+ import * as Data from "effect/Data";
15
+ import * as Effect from "effect/Effect";
16
+ import * as FiberSet from "effect/FiberSet";
17
+ import * as Layer from "effect/Layer";
18
+ import * as Option from "effect/Option";
19
+ import type { ManagedRuntime, Scope } from "effect";
23
20
 
24
21
  import { WorkerEnvironment, type WorkerEnv } from "./Environment";
25
22
  import { ExecutionContext, WorkerContext } from "./Worker";
@@ -7,7 +7,12 @@ import type {
7
7
  WorkflowInstanceRestartOptions as CloudflareWorkflowInstanceRestartOptions,
8
8
  WorkflowInstanceTerminateOptions as CloudflareWorkflowInstanceTerminateOptions,
9
9
  } from "@cloudflare/workers-types";
10
- import { type Context, Data, Effect, Option, Predicate, Schema as S } from "effect";
10
+ import * as Data from "effect/Data";
11
+ import * as Effect from "effect/Effect";
12
+ import * as Option from "effect/Option";
13
+ import * as Predicate from "effect/Predicate";
14
+ import * as S from "effect/Schema";
15
+ import type { Context } from "effect";
11
16
 
12
17
  import * as Binding from "./Binding";
13
18
  import type * as RpcDefinition from "./RpcDefinition";
@@ -1,4 +1,7 @@
1
- import { Context, Effect, Schema as S, type Layer } from "effect";
1
+ import * as Context from "effect/Context";
2
+ import * as Effect from "effect/Effect";
3
+ import * as S from "effect/Schema";
4
+ import type { Layer } from "effect";
2
5
 
3
6
  import type * as Binding from "./Binding";
4
7
  import type { WorkerEnvironment } from "./Environment";
@@ -1,4 +1,6 @@
1
- import { Effect, Layer, Schema } from "effect";
1
+ import * as Effect from "effect/Effect";
2
+ import * as Layer from "effect/Layer";
3
+ import * as Schema from "effect/Schema";
2
4
 
3
5
  import * as RpcDefinition from "../RpcDefinition";
4
6
  import { RpcTraceContext, type ReceiverOptions, type RpcInvocationInfo } from "../RpcTracing";
@@ -21,4 +21,4 @@ export const causeMessage = (cause: unknown): string => {
21
21
  export const violationsMessage = (
22
22
  violations: ReadonlyArray<{ readonly path: string; readonly message: string }>,
23
23
  ): string => violations.map((violation) => `${violation.path}: ${violation.message}`).join("; ");
24
- import { Predicate } from "effect";
24
+ import * as Predicate from "effect/Predicate";
@@ -1,4 +1,6 @@
1
- import { Effect, Exit, FiberSet } from "effect";
1
+ import * as Effect from "effect/Effect";
2
+ import * as Exit from "effect/Exit";
3
+ import * as FiberSet from "effect/FiberSet";
2
4
 
3
5
  type RunCallback<A, E, R> = (effect: Effect.Effect<A, E, R>) => Promise<Exit.Exit<A, E>>;
4
6
 
@@ -1,4 +1,8 @@
1
- import { Context, Effect, Option, Predicate, Schema } from "effect";
1
+ import * as Context from "effect/Context";
2
+ import * as Effect from "effect/Effect";
3
+ import * as Option from "effect/Option";
4
+ import * as Predicate from "effect/Predicate";
5
+ import * as Schema from "effect/Schema";
2
6
 
3
7
  import type * as CloudflareRpc from "../Rpc";
4
8
  import type { RpcInvocationInfo } from "../RpcTracing";
@@ -1,4 +1,8 @@
1
- import { ConfigProvider, Effect, Layer, ManagedRuntime, type Scope, type Tracer } from "effect";
1
+ import * as ConfigProvider from "effect/ConfigProvider";
2
+ import * as Effect from "effect/Effect";
3
+ import * as Layer from "effect/Layer";
4
+ import * as ManagedRuntime from "effect/ManagedRuntime";
5
+ import type { Scope, Tracer } from "effect";
2
6
 
3
7
  import { WorkerConfig, WorkerEnvironment, type WorkerEnv } from "../Environment";
4
8
  import { provideEntrypointServices } from "./Entrypoint";
@@ -1,5 +1,6 @@
1
- import { Effect, Option } from "effect";
2
- import { OtlpExporter } from "effect/unstable/observability";
1
+ import * as Effect from "effect/Effect";
2
+ import * as Option from "effect/Option";
3
+ import { Flusher } from "effect/unstable/observability/OtlpExporter";
3
4
 
4
5
  /** Maximum event lifetime spent on an internally scheduled telemetry flush. */
5
6
  const scheduledFlushTimeout = "2 seconds";
@@ -15,7 +16,7 @@ export const scheduleTelemetryFlush = <R>(
15
16
  waitUntil: (flush: Effect.Effect<void>) => Effect.Effect<void, never, R>,
16
17
  ): Effect.Effect<void, never, R> =>
17
18
  Effect.gen(function* () {
18
- const flusher = yield* Effect.serviceOption(OtlpExporter.Flusher);
19
+ const flusher = yield* Effect.serviceOption(Flusher);
19
20
 
20
21
  if (Option.isNone(flusher)) {
21
22
  return;
@@ -1,4 +1,6 @@
1
- import { Cause, Effect, Exit } from "effect";
1
+ import * as Cause from "effect/Cause";
2
+ import * as Effect from "effect/Effect";
3
+ import * as Exit from "effect/Exit";
2
4
 
3
5
  import type { WorkerContextService, WorkerContextWaitUntilOptions } from "../Worker";
4
6
 
@@ -1,94 +0,0 @@
1
- import { Config, ConfigProvider, Context, Effect, Layer, Predicate } from "effect";
2
- declare namespace Environment_d_exports {
3
- export { WorkerConfig, WorkerEnv, WorkerEnvironment };
4
- }
5
- type WorkerEnv = Cloudflare.Env;
6
- declare const WorkerEnvironment_base: Context.ServiceClass<WorkerEnvironment, "effect-cf/WorkerEnvironment", Cloudflare.Env>;
7
- /**
8
- * Context service for reading worker bindings from the current `env` object.
9
- */
10
- declare class WorkerEnvironment extends WorkerEnvironment_base {}
11
- type ScalarConfigValue = string | number | boolean;
12
- type ScalarConfigKey = Extract<{ readonly [Key in keyof Cloudflare.Env]-?: NonNullable<Cloudflare.Env[Key]> extends ScalarConfigValue ? Key : never; }[keyof Cloudflare.Env], string>;
13
- declare namespace WorkerConfig {
14
- type Scalar = ScalarConfigValue;
15
- type Key = ScalarConfigKey;
16
- /** Read a scalar Cloudflare var or secret as a string. */
17
- const string: <const Name extends Key>(name: Name) => Config.Config<string>;
18
- /** Read a scalar Cloudflare secret as a redacted string. */
19
- const redacted: <const Name extends Key>(name: Name) => Config.Config<import("effect/Redacted").Redacted<string>>;
20
- /** Read a scalar Cloudflare var or secret as a number. */
21
- const number: <const Name extends Key>(name: Name) => Config.Config<number>;
22
- /** Read a scalar Cloudflare var or secret as an integer. */
23
- const integer: <const Name extends Key>(name: Name) => Config.Config<number>;
24
- /** Read a scalar Cloudflare var or secret as a boolean. */
25
- const boolean: <const Name extends Key>(name: Name) => Config.Config<boolean>;
26
- interface ProviderOptions {
27
- /**
28
- * Keep empty-string env values as explicit `""` config values.
29
- *
30
- * By default (absent or `false`), empty strings are treated as missing
31
- * config, matching `ConfigProvider.fromEnvRecord`.
32
- */
33
- readonly preserveEmptyStrings?: boolean;
34
- }
35
- /**
36
- * Build a `ConfigProvider` from a Cloudflare worker `env` object.
37
- *
38
- * Scalar vars and secrets use Effect's environment-record semantics;
39
- * Cloudflare binding objects are ignored.
40
- *
41
- * Empty-string values are treated as missing config by default; pass
42
- * `{ preserveEmptyStrings: true }` to keep them as explicit values.
43
- */
44
- const providerFromEnv: (env: WorkerEnv, options?: ProviderOptions) => ConfigProvider.ConfigProvider;
45
- const providerWith: (makeProvider: (env: WorkerEnv) => ConfigProvider.ConfigProvider) => Effect.Effect<ConfigProvider.ConfigProvider, never, WorkerEnvironment>;
46
- const provider: Effect.Effect<ConfigProvider.ConfigProvider, never, WorkerEnvironment>;
47
- /**
48
- * Replace the active Effect `ConfigProvider` with one backed by the current
49
- * Cloudflare worker `env` object.
50
- */
51
- const providerLayer: Layer.Layer<never, never, WorkerEnvironment>;
52
- const layerWith: (makeProvider: (env: WorkerEnv) => ConfigProvider.ConfigProvider) => Layer.Layer<never, never, WorkerEnvironment>;
53
- }
54
- declare namespace Binding_d_exports {
55
- export { BindingNotFoundError, BindingService, BindingValidationError, Service, TypeId, ValidationOptions, layer };
56
- }
57
- declare const TypeId: "~effect-cf/Binding";
58
- type TypeId = typeof TypeId;
59
- declare const BindingNotFoundError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
60
- readonly _tag: "BindingNotFoundError";
61
- } & Readonly<A>;
62
- /** Error raised when a configured binding does not exist on `env`. */
63
- declare class BindingNotFoundError extends BindingNotFoundError_base<{
64
- readonly binding: string;
65
- readonly message: string;
66
- }> {}
67
- declare const BindingValidationError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
68
- readonly _tag: "BindingValidationError";
69
- } & Readonly<A>;
70
- /** Error raised when a binding exists but does not match the expected shape. */
71
- declare class BindingValidationError extends BindingValidationError_base<{
72
- readonly binding: string;
73
- readonly expected: string;
74
- readonly actual: string;
75
- readonly message: string;
76
- }> {}
77
- interface ValidationOptions {
78
- readonly expected?: string;
79
- }
80
- type BindingCandidate = Parameters<typeof Predicate.isUnknown>[0];
81
- interface BindingService<Self, Id extends string, Service> extends Context.ServiceClass<Self, `effect-cf/Binding/${Id}`, Service> {
82
- readonly [TypeId]: TypeId;
83
- readonly id: Id;
84
- readonly binding: string;
85
- readonly layer: Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
86
- }
87
- declare function layer<Self, Resource>(tag: Context.Service<Self, Resource>, binding: string, isResource: (value: BindingCandidate) => value is Resource, wrap?: undefined, options?: ValidationOptions): Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
88
- declare function layer<Self, Resource, Service>(tag: Context.Service<Self, Service>, binding: string, isResource: (value: BindingCandidate) => value is Resource, wrap: (resource: Resource) => Service, options?: ValidationOptions): Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
89
- declare const Service: <Self>() => {
90
- <Id extends string, Resource>(id: Id, binding: string, isResource: (value: BindingCandidate) => value is Resource, wrap?: undefined, options?: ValidationOptions): BindingService<Self, Id, Resource>;
91
- <Id extends string, Resource, Service>(id: Id, binding: string, isResource: (value: BindingCandidate) => value is Resource, wrap: (resource: Resource) => Service, options?: ValidationOptions): BindingService<Self, Id, Service>;
92
- };
93
- //#endregion
94
- export { Environment_d_exports as a, WorkerEnvironment as c, Binding_d_exports as i, BindingService as n, WorkerConfig as o, BindingValidationError as r, WorkerEnv as s, BindingNotFoundError as t };