effect-cf 0.40.0 → 0.40.2

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 +14 -0
  2. package/README.md +2 -0
  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 +64 -0
  62. package/dist/Queue.mjs +52 -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 +86 -0
  92. package/dist/Workflow.mjs +137 -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 -1839
  99. package/dist/index.mjs +40 -3161
  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 +4 -1
  123. package/src/DurableObjectAlarm.ts +10 -12
  124. package/src/DurableObjectDefinition.ts +3 -1
  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 +5 -11
  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 +10 -25
  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
package/dist/index.d.mts CHANGED
@@ -1,1840 +1,41 @@
1
- import { a as Environment_d_exports, c as WorkerEnvironment, i as Binding_d_exports, n as BindingService, o as WorkerConfig, r as BindingValidationError, s as WorkerEnv, t as BindingNotFoundError } from "./Binding-DKcLrQCM.mjs";
2
- import { l as Artifacts_d_exports } from "./Artifacts-B3r3RuTB.mjs";
3
- import { a as AcceptedUpgrade, c as DurableWebSocketAttachmentError, i as AcceptUpgradeOptions, l as DurableObjectStorage_d_exports, o as DurableObjectWebSocket_d_exports, r as DurableObjectState_d_exports, s as DurableWebSocket, t as DurableObjectState, u as StorageOperationError } from "./DurableObjectState-DJ0K-zyd.mjs";
4
- import { C as Provider, S as ServiceFreeSchema$1, _ as QueueBinding_d_exports, a as Worker_d_exports, b as ReservedMethodName$2, c as AsyncMethodArgs, d as AsyncMethodSuccess, f as ReceiverOptions, g as QueueDefinition_d_exports, h as Queue_d_exports, l as AsyncMethodCloudflareReturn, m as RpcTracing_d_exports, n as NativeRequest, o as WorkerDefinition_d_exports, p as RpcInvocationInfo, r as WorkerContext, s as ServiceBinding_d_exports, t as ExecutionContext, u as AsyncMethodKey, v as Definition$4, w as Rpc_d_exports, x as RpcDefinition_d_exports, y as Method$2 } from "./Worker-gV4mDqIs.mjs";
5
- import { t as Hyperdrive_d_exports } from "./Hyperdrive-HrwFlZ6x.mjs";
6
- import { t as ContainerNamespace_d_exports } from "./ContainerNamespace-DbLaeFhN.mjs";
7
- import { a as WorkflowInstanceCreateOptions, i as WorkflowInstanceCreateBatchOptions, n as WorkflowBinding_d_exports, r as WorkflowInstance, s as WorkflowOperationError, t as WorkflowBindingClient } from "./WorkflowBinding-DtVykUCz.mjs";
8
- import { Cause, Config, Context, Data, DateTime, Duration, Effect, Layer, Option, Predicate, Redacted, Schema, Scope } from "effect";
9
- import { Headers as Headers$1, HttpClient, HttpClientResponse } from "effect/unstable/http";
10
- import { OtlpExporter, OtlpResource } from "effect/unstable/observability";
11
- import { DurableObject, WorkflowEntrypoint, WorkflowEvent, WorkflowSleepDuration, WorkflowStep, WorkflowStepConfig, WorkflowStepContext, WorkflowStepEvent, WorkflowTimeoutDuration } from "cloudflare:workers";
12
- import { D1Client } from "@effect/sql-d1";
13
- import * as RpcMessage from "effect/unstable/rpc/RpcMessage";
14
- import * as RpcSerialization from "effect/unstable/rpc/RpcSerialization";
15
- import * as RpcServer from "effect/unstable/rpc/RpcServer";
16
- import { SqliteClient } from "@effect/sql-sqlite-do";
17
- import { SqlClient } from "effect/unstable/sql";
18
- import * as Tracer$1 from "effect/Tracer";
19
- declare namespace WorkersAi_d_exports {
20
- export { LayerOptions$13 as LayerOptions, Tag$12 as Tag, TagClass$11 as TagClass, WorkersAiAsyncBatchResponse, WorkersAiBinding, WorkersAiClient, WorkersAiDefinition, WorkersAiEmbeddingInput, WorkersAiEmbeddingResponse, WorkersAiModelsSearchObject, WorkersAiModelsSearchParams, WorkersAiOperationError, WorkersAiOptions, WorkersAiService, embeddingResponse, isWorkersAiBinding, layer$14 as layer, make$12 as make, makeClient$10 as makeClient };
21
- }
22
- declare const WorkersAiOperationError_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 & {
23
- readonly _tag: "WorkersAiOperationError";
24
- } & Readonly<A>;
25
- declare class WorkersAiOperationError extends WorkersAiOperationError_base<{
26
- readonly binding: string;
27
- readonly operation: string;
28
- readonly cause: unknown;
29
- }> {
30
- get message(): string;
31
- }
32
- interface WorkersAiDefinition {
33
- readonly binding: string;
34
- }
35
- type WorkersAiBinding<ModelList extends AiModelListType = AiModels> = CloudflareAi<ModelList>;
36
- type WorkersAiOptions = AiOptions;
37
- type WorkersAiModelsSearchParams = AiModelsSearchParams;
38
- type WorkersAiModelsSearchObject = AiModelsSearchObject;
39
- type WorkersAiAsyncBatchResponse = AiAsyncBatchResponse;
40
- type WorkersAiEmbeddingInput = AiTextEmbeddingsInput | Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Input | Parameters<WorkersAiBinding["run"]>[1];
41
- declare const embeddingDimensionsKey = "shape";
42
- interface WorkersAiEmbeddingResponse {
43
- readonly data: ReadonlyArray<ReadonlyArray<number>>;
44
- readonly [embeddingDimensionsKey]: ReadonlyArray<number>;
45
- }
46
- interface WorkersAiClient<ModelList extends AiModelListType = AiModels> {
47
- readonly aiGatewayLogId: Effect.Effect<string | null, WorkersAiOperationError>;
48
- readonly run: {
49
- <Name extends keyof ModelList>(model: Name, input: {
50
- readonly requests: ReadonlyArray<ModelList[Name]["inputs"]>;
51
- }, options: WorkersAiOptions & {
52
- readonly queueRequest: true;
53
- }): Effect.Effect<WorkersAiAsyncBatchResponse, WorkersAiOperationError>;
54
- <Name extends keyof ModelList>(model: Name, input: ModelList[Name]["inputs"], options: WorkersAiOptions & {
55
- readonly returnRawResponse: true;
56
- }): Effect.Effect<Response, WorkersAiOperationError>;
57
- <Name extends keyof ModelList>(model: Name, input: ModelList[Name]["inputs"], options: WorkersAiOptions & {
58
- readonly websocket: true;
59
- }): Effect.Effect<Response, WorkersAiOperationError>;
60
- <Name extends keyof ModelList>(model: Name, input: ModelList[Name]["inputs"] & {
61
- readonly stream: true;
62
- }, options?: WorkersAiOptions): Effect.Effect<ReadableStream, WorkersAiOperationError>;
63
- <Name extends keyof ModelList>(model: Name, input: ModelList[Name]["inputs"], options?: WorkersAiOptions): Effect.Effect<ModelList[Name]["postProcessedOutputs"], WorkersAiOperationError>;
64
- <Input extends Parameters<WorkersAiBinding["run"]>[1], Output = Awaited<ReturnType<WorkersAiBinding["run"]>>>(model: string, input: Input, options?: WorkersAiOptions): Effect.Effect<Output, WorkersAiOperationError>;
65
- };
66
- readonly runEmbedding: <Input extends WorkersAiEmbeddingInput>(model: string, input: Input, options?: WorkersAiOptions) => Effect.Effect<WorkersAiEmbeddingResponse, WorkersAiOperationError>;
67
- readonly models: (params?: WorkersAiModelsSearchParams) => Effect.Effect<ReadonlyArray<WorkersAiModelsSearchObject>, WorkersAiOperationError>;
68
- readonly gateway: (gatewayId: string) => Effect.Effect<CloudflareAiGateway, WorkersAiOperationError>;
69
- readonly rawUnsafe: Effect.Effect<WorkersAiBinding<ModelList>>;
70
- readonly definition: WorkersAiDefinition;
71
- }
72
- declare const WorkersAiServiceTypeId: unique symbol;
73
- interface WorkersAiService<Id extends string> {
74
- readonly [WorkersAiServiceTypeId]: {
75
- readonly id: Id;
76
- };
77
- }
78
- type LayerOptions$13 = {
79
- readonly binding: string;
80
- };
81
- interface TagClass$11<Self, Id extends string, ModelList extends AiModelListType = AiModels> extends Context.ServiceClass<Self, Id, WorkersAiClient<ModelList>> {
82
- readonly id: Id;
83
- readonly layer: (options: LayerOptions$13) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
84
- }
85
- type WorkersAiBindingValue = Schema.Schema.Type<typeof Schema.Unknown>;
86
- declare const isWorkersAiBinding: (value: WorkersAiBindingValue) => value is WorkersAiBinding;
87
- declare const embeddingResponse: (value: {
88
- readonly data?: ReadonlyArray<ReadonlyArray<number>>;
89
- readonly [embeddingDimensionsKey]?: ReadonlyArray<number>;
90
- }) => WorkersAiEmbeddingResponse;
91
- declare const makeClient$10: <ModelList extends AiModelListType = AiModels>(definition: WorkersAiDefinition) => (ai: WorkersAiBinding<ModelList>) => WorkersAiClient<ModelList>;
92
- declare const layer$14: <Self, ModelList extends AiModelListType = AiModels>(tag: Context.Service<Self, WorkersAiClient<ModelList>>, definition: WorkersAiDefinition) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
93
- declare const make$12: <Id extends string>(id: Id) => TagClass$11<WorkersAiService<Id>, Id, AiModels>;
94
- declare const Tag$12: <Self>() => <Id extends string, ModelList extends AiModelListType = AiModels>(id: Id) => TagClass$11<Self, Id, ModelList>;
95
- declare namespace AiGateway_d_exports {
96
- export { AiGatewayBinding, AiGatewayClient, AiGatewayDefinition, AiGatewayFetchOptions, AiGatewayHeaders, AiGatewayLog, AiGatewayOperationError, AiGatewayPatchLog, AiGatewayProvider, AiGatewayRunOptions, AiGatewayService, AiGatewayUniversalRequest, LayerOptions$12 as LayerOptions, Tag$11 as Tag, TagClass$10 as TagClass, isAiGatewayBinding, layer$13 as layer, make$11 as make, makeClient$9 as makeClient, makeClientFromAi, makeHttpClient };
97
- }
98
- declare const AiGatewayOperationError_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 & {
99
- readonly _tag: "AiGatewayOperationError";
100
- } & Readonly<A>;
101
- declare class AiGatewayOperationError extends AiGatewayOperationError_base<{
102
- readonly binding: string;
103
- readonly operation: string;
104
- readonly cause: unknown;
105
- }> {
106
- get message(): string;
107
- }
108
- interface AiGatewayDefinition {
109
- readonly binding: string;
110
- readonly gatewayId: string;
111
- readonly accountId?: string;
112
- }
113
- type AiGatewayBinding = CloudflareAiGateway;
114
- type AiGatewayRunData = Parameters<AiGatewayBinding["run"]>[0];
115
- type AiGatewayPatchLog = Parameters<AiGatewayBinding["patchLog"]>[1];
116
- type AiGatewayLog = Awaited<ReturnType<AiGatewayBinding["getLog"]>>;
117
- type AiGatewayProvider = NonNullable<Parameters<AiGatewayBinding["getUrl"]>[0]>;
118
- type AiGatewayUniversalRequest = Exclude<AiGatewayRunData, ReadonlyArray<unknown>>;
119
- type AiGatewayHeaders = NonNullable<AiGatewayUniversalRequest["headers"]>;
120
- type AiGatewayRunOptions = Parameters<CloudflareAiGateway["run"]>[1];
121
- type AiGatewayBindingCandidate = Parameters<typeof isWorkersAiBinding>[0];
122
- interface AiGatewayFetchOptions {
123
- readonly provider?: AiGatewayProvider;
124
- readonly path?: string;
125
- readonly init?: RequestInit;
126
- }
127
- interface AiGatewayClient {
128
- readonly run: (data: AiGatewayUniversalRequest | ReadonlyArray<AiGatewayUniversalRequest>, options?: AiGatewayRunOptions) => Effect.Effect<Response, AiGatewayOperationError>;
129
- readonly getUrl: (provider?: AiGatewayProvider) => Effect.Effect<string, AiGatewayOperationError>;
130
- readonly fetch: (options: AiGatewayFetchOptions) => Effect.Effect<Response, AiGatewayOperationError>;
131
- readonly patchLog: (logId: string, data: AiGatewayPatchLog) => Effect.Effect<void, AiGatewayOperationError>;
132
- readonly getLog: (logId: string) => Effect.Effect<AiGatewayLog, AiGatewayOperationError>;
133
- readonly rawUnsafe: Effect.Effect<AiGatewayBinding, AiGatewayOperationError>;
134
- readonly definition: AiGatewayDefinition;
135
- }
136
- declare const AiGatewayServiceTypeId: unique symbol;
137
- interface AiGatewayService<Id extends string> {
138
- readonly [AiGatewayServiceTypeId]: {
139
- readonly id: Id;
140
- };
141
- }
142
- type LayerOptions$12 = {
143
- readonly binding: string;
144
- readonly gatewayId: string;
145
- readonly accountId?: string;
146
- };
147
- interface TagClass$10<Self, Id extends string> extends Context.ServiceClass<Self, Id, AiGatewayClient> {
148
- readonly id: Id;
149
- readonly layer: (options: LayerOptions$12) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError | AiGatewayOperationError, WorkerEnvironment>;
150
- }
151
- declare const isAiGatewayBinding: (value: AiGatewayBindingCandidate) => value is WorkersAiBinding;
152
- declare const makeClient$9: (definition: AiGatewayDefinition, gateway: AiGatewayBinding) => {
153
- definition: AiGatewayDefinition;
154
- run: (data: import("@cloudflare/workers-types").AIGatewayUniversalRequest | readonly import("@cloudflare/workers-types").AIGatewayUniversalRequest[], options?: {
155
- gateway?: import("@cloudflare/workers-types").UniversalGatewayOptions;
156
- extraHeaders?: object;
157
- signal?: import("@cloudflare/workers-types").AbortSignal;
158
- } | undefined) => Effect.Effect<import("@cloudflare/workers-types").Response, AiGatewayOperationError, never>;
159
- getUrl: (provider?: string | undefined) => Effect.Effect<string, AiGatewayOperationError, never>;
160
- fetch: (options: AiGatewayFetchOptions) => Effect.Effect<Response, AiGatewayOperationError, never>;
161
- patchLog: (logId: string, data: import("@cloudflare/workers-types").AiGatewayPatchLog) => Effect.Effect<void, AiGatewayOperationError, never>;
162
- getLog: (logId: string) => Effect.Effect<import("@cloudflare/workers-types").AiGatewayLog, AiGatewayOperationError, never>;
163
- rawUnsafe: Effect.Effect<CloudflareAiGateway, never, never>;
164
- };
165
- declare const makeClientFromAi: (definition: AiGatewayDefinition, ai: WorkersAiBinding) => AiGatewayClient;
166
- declare const makeHttpClient: (definition: Omit<AiGatewayDefinition, "binding"> & {
167
- readonly accountId: string;
168
- readonly binding?: string;
169
- }, request?: typeof fetch) => AiGatewayClient;
170
- declare const layer$13: <Self>(tag: Context.Service<Self, AiGatewayClient>, definition: AiGatewayDefinition) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
171
- declare const make$11: <Id extends string>(id: Id) => TagClass$10<AiGatewayService<Id>, Id>;
172
- declare const Tag$11: <Self>() => <Id extends string>(id: Id) => TagClass$10<Self, Id>;
173
- declare namespace AnalyticsEngine_d_exports {
174
- export { AnalyticsEngineBinding, AnalyticsEngineClient, AnalyticsEngineDataPoint, AnalyticsEngineDataPointSchema, AnalyticsEngineDefinition, AnalyticsEngineFieldValue, AnalyticsEngineFieldValueSchema, AnalyticsEngineInvalidWritePolicy, AnalyticsEngineOperationError, AnalyticsEngineQueryClient, AnalyticsEngineQueryColumn, AnalyticsEngineQueryDefinition, AnalyticsEngineQueryError, AnalyticsEngineQueryOptions, AnalyticsEngineQueryResult, AnalyticsEngineQueryRow, AnalyticsEngineQueryService, AnalyticsEngineService, AnalyticsEngineWriteError, AnalyticsEngineWriteOptions, AnalyticsEngineWritePolicy, AnalyticsEngineWriteValidationError, AnalyticsEngineWriteViolation, LayerOptions$11 as LayerOptions, QueryConfigOptions, QueryTag, QueryTagClass, Tag$10 as Tag, TagClass$9 as TagClass, isAnalyticsEngineDataset, layer$12 as layer, layerFetch, layerFetchConfig, make$10 as make, makeClient$8 as makeClient, makeQuery, makeQueryClient, queryConfig, queryLayer, queryLayerConfig, writeLimits };
175
- }
176
- declare const writeLimits: {
177
- readonly maxBlobs: 20;
178
- readonly maxDoubles: 20;
179
- readonly maxIndexes: 1;
180
- readonly maxBlobBytes: number;
181
- readonly maxIndexBytes: 96;
182
- readonly maxDataPointsPerInvocation: 250;
183
- };
184
- declare const queryColumnSchema: Schema.Struct<{
185
- readonly name: Schema.String;
186
- readonly type: Schema.String;
187
- }>;
188
- declare const queryRowSchema: Schema.$Record<Schema.String, Schema.Unknown>;
189
- declare const AnalyticsEngineFieldValueSchema: Schema.NullOr<Schema.Union<readonly [Schema.String, Schema.instanceOf<ArrayBuffer, unknown>]>>;
190
- declare const AnalyticsEngineDataPointSchema: Schema.Struct<{
191
- readonly indexes: Schema.optional<Schema.$Array<Schema.NullOr<Schema.Union<readonly [Schema.String, Schema.instanceOf<ArrayBuffer, unknown>]>>>>;
192
- readonly doubles: Schema.optional<Schema.$Array<Schema.Finite>>;
193
- readonly blobs: Schema.optional<Schema.$Array<Schema.NullOr<Schema.Union<readonly [Schema.String, Schema.instanceOf<ArrayBuffer, unknown>]>>>>;
194
- }>;
195
- declare const AnalyticsEngineOperationError_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 & {
196
- readonly _tag: "AnalyticsEngineOperationError";
197
- } & Readonly<A>;
198
- declare class AnalyticsEngineOperationError extends AnalyticsEngineOperationError_base<{
199
- readonly binding: string;
200
- readonly operation: string;
201
- readonly cause: unknown;
202
- }> {
203
- get message(): string;
204
- }
205
- interface AnalyticsEngineWriteViolation {
206
- readonly path: string;
207
- readonly message: string;
208
- readonly limit?: number;
209
- readonly actual?: number;
210
- }
211
- declare const AnalyticsEngineWriteValidationError_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 & {
212
- readonly _tag: "AnalyticsEngineWriteValidationError";
213
- } & Readonly<A>;
214
- declare class AnalyticsEngineWriteValidationError extends AnalyticsEngineWriteValidationError_base<{
215
- readonly binding: string;
216
- readonly operation: string;
217
- readonly violations: ReadonlyArray<AnalyticsEngineWriteViolation>;
218
- readonly cause?: unknown;
219
- }> {
220
- get message(): string;
221
- }
222
- declare const AnalyticsEngineQueryError_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 & {
223
- readonly _tag: "AnalyticsEngineQueryError";
224
- } & Readonly<A>;
225
- declare class AnalyticsEngineQueryError extends AnalyticsEngineQueryError_base<{
226
- readonly operation: string;
227
- readonly accountId: string;
228
- readonly message: string;
229
- readonly status?: number;
230
- readonly body?: string;
231
- readonly cause?: unknown;
232
- }> {}
233
- interface AnalyticsEngineDefinition {
234
- readonly binding: string;
235
- }
236
- type AnalyticsEngineBinding = CloudflareAnalyticsEngineDataset;
237
- type AnalyticsEngineDataPoint = CloudflareAnalyticsEngineDataPoint;
238
- type AnalyticsEngineFieldValue = ArrayBuffer | string | null;
239
- type AnalyticsEngineWriteError = AnalyticsEngineOperationError | AnalyticsEngineWriteValidationError;
240
- type AnalyticsEngineInvalidWritePolicy = "error" | "drop";
241
- type AnalyticsEngineQueryColumn = Schema.Schema.Type<typeof queryColumnSchema>;
242
- type AnalyticsEngineQueryRow = Schema.Schema.Type<typeof queryRowSchema>;
243
- interface AnalyticsEngineWriteOptions {
244
- /**
245
- * Controls invalid write behavior. The default is `"error"`, which fails with
246
- * `AnalyticsEngineWriteValidationError`. `"drop"` skips invalid points.
247
- */
248
- readonly onInvalid?: AnalyticsEngineInvalidWritePolicy;
249
- }
250
- type AnalyticsEngineWritePolicy = AnalyticsEngineWriteOptions;
251
- interface AnalyticsEngineQueryResult<Row = AnalyticsEngineQueryRow> {
252
- readonly meta: ReadonlyArray<AnalyticsEngineQueryColumn>;
253
- readonly data: ReadonlyArray<Row>;
254
- readonly rows: number;
255
- }
256
- interface AnalyticsEngineQueryDefinition {
257
- readonly accountId: string;
258
- /** API token with Account Analytics Read permission. */
259
- readonly apiToken: Redacted.Redacted<string>;
260
- readonly apiBaseUrl?: string | URL;
261
- }
262
- interface AnalyticsEngineQueryOptions {
263
- /** Additional request headers. Authorization is always derived from `apiToken`. */
264
- readonly headers?: Headers$1.Input;
265
- }
266
- interface AnalyticsEngineClient {
267
- readonly writeDataPoint: (dataPoint?: AnalyticsEngineDataPoint, options?: AnalyticsEngineWriteOptions) => Effect.Effect<void, AnalyticsEngineWriteError>;
268
- readonly writeDataPoints: (dataPoints: ReadonlyArray<AnalyticsEngineDataPoint>, options?: AnalyticsEngineWriteOptions) => Effect.Effect<void, AnalyticsEngineWriteError>;
269
- readonly rawUnsafe: Effect.Effect<AnalyticsEngineBinding>;
270
- readonly definition: AnalyticsEngineDefinition;
271
- }
272
- interface AnalyticsEngineQueryClient {
273
- readonly query: (sql: string, options?: AnalyticsEngineQueryOptions) => Effect.Effect<AnalyticsEngineQueryResult, AnalyticsEngineQueryError | Schema.SchemaError>;
274
- readonly queryResult: <Row>(row: Schema.Codec<Row, unknown>, sql: string, options?: AnalyticsEngineQueryOptions) => Effect.Effect<AnalyticsEngineQueryResult<Row>, AnalyticsEngineQueryError | Schema.SchemaError>;
275
- readonly queryRows: <Row>(row: Schema.Codec<Row, unknown>, sql: string, options?: AnalyticsEngineQueryOptions) => Effect.Effect<ReadonlyArray<Row>, AnalyticsEngineQueryError | Schema.SchemaError>;
276
- readonly queryOne: <Row>(row: Schema.Codec<Row, unknown>, sql: string, options?: AnalyticsEngineQueryOptions) => Effect.Effect<Option.Option<Row>, AnalyticsEngineQueryError | Schema.SchemaError>;
277
- readonly queryText: (sql: string, options?: AnalyticsEngineQueryOptions) => Effect.Effect<string, AnalyticsEngineQueryError>;
278
- readonly raw: (sql: string, options?: AnalyticsEngineQueryOptions) => Effect.Effect<HttpClientResponse.HttpClientResponse, AnalyticsEngineQueryError>;
279
- readonly definition: AnalyticsEngineQueryDefinition;
280
- }
281
- declare const AnalyticsEngineServiceTypeId: unique symbol;
282
- declare const AnalyticsEngineQueryServiceTypeId: unique symbol;
283
- interface AnalyticsEngineService<Id extends string> {
284
- readonly [AnalyticsEngineServiceTypeId]: {
285
- readonly id: Id;
286
- };
287
- }
288
- interface AnalyticsEngineQueryService<Id extends string> {
289
- readonly [AnalyticsEngineQueryServiceTypeId]: {
290
- readonly id: Id;
291
- };
292
- }
293
- type LayerOptions$11 = {
294
- readonly binding: string;
295
- readonly write?: AnalyticsEngineWritePolicy;
296
- };
297
- type QueryConfigOptions = {
298
- readonly accountId?: Config.Config<string>;
299
- readonly apiToken?: Config.Config<Redacted.Redacted<string>>;
300
- readonly apiBaseUrl?: Config.Config<string>;
301
- };
302
- interface TagClass$9<Self, Id extends string> extends Context.ServiceClass<Self, Id, AnalyticsEngineClient> {
303
- readonly id: Id;
304
- readonly layer: (options: LayerOptions$11) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
305
- }
306
- interface QueryTagClass<Self, Id extends string> extends Context.ServiceClass<Self, Id, AnalyticsEngineQueryClient> {
307
- readonly id: Id;
308
- readonly layer: (definition: AnalyticsEngineQueryDefinition) => Layer.Layer<Self, never, HttpClient.HttpClient>;
309
- readonly layerFetch: (definition: AnalyticsEngineQueryDefinition) => Layer.Layer<Self>;
310
- readonly layerConfig: (config?: Config.Config<AnalyticsEngineQueryDefinition>) => Layer.Layer<Self, Config.ConfigError, HttpClient.HttpClient>;
311
- readonly layerFetchConfig: (config?: Config.Config<AnalyticsEngineQueryDefinition>) => Layer.Layer<Self, Config.ConfigError>;
312
- }
313
- declare const makeQueryClient: (definition: AnalyticsEngineQueryDefinition) => Effect.Effect<AnalyticsEngineQueryClient, never, HttpClient.HttpClient>;
314
- declare const isAnalyticsEngineDataset: <Candidate>(value: Candidate) => value is Candidate & AnalyticsEngineBinding;
315
- declare const makeClient$8: (definition: AnalyticsEngineDefinition, defaults?: AnalyticsEngineWritePolicy) => (dataset: AnalyticsEngineBinding) => AnalyticsEngineClient;
316
- declare const queryConfig: (options?: QueryConfigOptions) => Config.Config<{
317
- accountId: string;
318
- apiToken: Redacted.Redacted<string>;
319
- apiBaseUrl: string;
320
- }>;
321
- declare const queryLayer: <Self>(tag: Context.Service<Self, AnalyticsEngineQueryClient>, definition: AnalyticsEngineQueryDefinition) => Layer.Layer<Self, never, HttpClient.HttpClient>;
322
- declare const layerFetch: <Self>(tag: Context.Service<Self, AnalyticsEngineQueryClient>, definition: AnalyticsEngineQueryDefinition) => Layer.Layer<Self, never, never>;
323
- declare const queryLayerConfig: <Self>(tag: Context.Service<Self, AnalyticsEngineQueryClient>, config?: Config.Config<AnalyticsEngineQueryDefinition>) => Layer.Layer<Self, Config.ConfigError, HttpClient.HttpClient>;
324
- declare const layerFetchConfig: <Self>(tag: Context.Service<Self, AnalyticsEngineQueryClient>, config?: Config.Config<AnalyticsEngineQueryDefinition>) => Layer.Layer<Self, Config.ConfigError, never>;
325
- declare const layer$12: <Self>(tag: Context.Service<Self, AnalyticsEngineClient>, definition: LayerOptions$11) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
326
- declare const make$10: <Id extends string>(id: Id) => TagClass$9<AnalyticsEngineService<Id>, Id>;
327
- declare const makeQuery: <Id extends string>(id: Id) => QueryTagClass<AnalyticsEngineQueryService<Id>, Id>;
328
- declare const Tag$10: <Self>() => <Id extends string>(id: Id) => TagClass$9<Self, Id>;
329
- declare const QueryTag: <Self>() => <Id extends string>(id: Id) => QueryTagClass<Self, Id>;
330
- declare namespace BrowserRendering_d_exports {
331
- export { BrowserRenderingBinding, BrowserRenderingBrowserClient, BrowserRenderingBrowserLike, BrowserRenderingClient, BrowserRenderingConnect, BrowserRenderingDefinition, BrowserRenderingExternalResult, BrowserRenderingLaunch, BrowserRenderingMethodOptions, BrowserRenderingOperationError, BrowserRenderingPageClient, BrowserRenderingPageFunction, BrowserRenderingPageLike, BrowserRenderingService, LayerOptions$10 as LayerOptions, Tag$9 as Tag, TagClass$8 as TagClass, isBrowserRenderingBinding, layer$11 as layer, make$9 as make, makeClient$7 as makeClient };
332
- }
333
- declare const BrowserRenderingOperationError_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 & {
334
- readonly _tag: "BrowserRenderingOperationError";
335
- } & Readonly<A>;
336
- declare class BrowserRenderingOperationError extends BrowserRenderingOperationError_base<{
337
- readonly binding: string;
338
- readonly operation: string;
339
- readonly cause: unknown;
340
- }> {
341
- get message(): string;
342
- }
343
- interface BrowserRenderingDefinition {
344
- readonly binding: string;
345
- }
346
- type BrowserRenderingBinding = object;
347
- interface BrowserRenderingMethodOptions {}
348
- type BrowserRenderingExternalResult = Awaited<ReturnType<Response["json"]>>;
349
- type BrowserRenderingPageFunction = string | Function;
350
- type BrowserRenderingLaunch<RawBinding, Browser, LaunchOptions = unknown> = (binding: RawBinding, options?: LaunchOptions) => Promise<Browser>;
351
- type BrowserRenderingConnect<RawBinding, Browser, ConnectOptions = unknown> = (binding: RawBinding, options?: ConnectOptions) => Promise<Browser>;
352
- interface BrowserRenderingBrowserLike<Page = BrowserRenderingPageLike> {
353
- readonly newPage: () => Promise<Page>;
354
- readonly close?: () => Promise<void>;
355
- readonly disconnect?: () => void;
356
- readonly version?: () => Promise<string>;
357
- }
358
- interface BrowserRenderingPageLike {
359
- readonly goto?: (url: string, options?: BrowserRenderingMethodOptions) => Promise<BrowserRenderingExternalResult>;
360
- readonly setContent?: (html: string, options?: BrowserRenderingMethodOptions) => Promise<void>;
361
- readonly content?: () => Promise<string>;
362
- readonly screenshot?: (options?: BrowserRenderingMethodOptions) => Promise<Uint8Array | string>;
363
- readonly pdf?: (options?: BrowserRenderingMethodOptions) => Promise<Uint8Array>;
364
- readonly evaluate?: (pageFunction: BrowserRenderingPageFunction, ...args: ReadonlyArray<unknown>) => Promise<BrowserRenderingExternalResult>;
365
- readonly close?: (options?: BrowserRenderingMethodOptions) => Promise<void>;
366
- }
367
- interface BrowserRenderingPageClient<Page extends BrowserRenderingPageLike> {
368
- readonly raw: Page;
369
- readonly goto: (url: string, options?: Parameters<NonNullable<Page["goto"]>>[1]) => Effect.Effect<Awaited<ReturnType<NonNullable<Page["goto"]>>>, BrowserRenderingOperationError>;
370
- readonly setContent: (html: string, options?: Parameters<NonNullable<Page["setContent"]>>[1]) => Effect.Effect<void, BrowserRenderingOperationError>;
371
- readonly content: Effect.Effect<string, BrowserRenderingOperationError>;
372
- readonly screenshot: (options?: Parameters<NonNullable<Page["screenshot"]>>[0]) => Effect.Effect<Awaited<ReturnType<NonNullable<Page["screenshot"]>>>, BrowserRenderingOperationError>;
373
- readonly pdf: (options?: Parameters<NonNullable<Page["pdf"]>>[0]) => Effect.Effect<Awaited<ReturnType<NonNullable<Page["pdf"]>>>, BrowserRenderingOperationError>;
374
- readonly evaluate: (pageFunction: Parameters<NonNullable<Page["evaluate"]>>[0], ...args: ReadonlyArray<unknown>) => Effect.Effect<Awaited<ReturnType<NonNullable<Page["evaluate"]>>>, BrowserRenderingOperationError>;
375
- readonly close: (options?: Parameters<NonNullable<Page["close"]>>[0]) => Effect.Effect<void, BrowserRenderingOperationError>;
376
- }
377
- interface BrowserRenderingBrowserClient<Browser extends BrowserRenderingBrowserLike<Page>, Page extends BrowserRenderingPageLike> {
378
- readonly raw: Browser;
379
- readonly newPage: Effect.Effect<BrowserRenderingPageClient<Page>, BrowserRenderingOperationError>;
380
- readonly version: Effect.Effect<string, BrowserRenderingOperationError>;
381
- readonly close: Effect.Effect<void, BrowserRenderingOperationError>;
382
- readonly disconnect: Effect.Effect<void, BrowserRenderingOperationError>;
383
- }
384
- interface BrowserRenderingClient<RawBinding extends BrowserRenderingBinding = BrowserRenderingBinding> {
385
- readonly launchWith: <Browser extends BrowserRenderingBrowserLike<Page>, Page extends BrowserRenderingPageLike = BrowserRenderingPageLike, LaunchOptions = unknown>(launch: BrowserRenderingLaunch<RawBinding, Browser, LaunchOptions>, options?: LaunchOptions) => Effect.Effect<BrowserRenderingBrowserClient<Browser, Page>, BrowserRenderingOperationError>;
386
- readonly connectWith: <Browser extends BrowserRenderingBrowserLike<Page>, Page extends BrowserRenderingPageLike = BrowserRenderingPageLike, ConnectOptions = unknown>(connect: BrowserRenderingConnect<RawBinding, Browser, ConnectOptions>, options?: ConnectOptions) => Effect.Effect<BrowserRenderingBrowserClient<Browser, Page>, BrowserRenderingOperationError>;
387
- readonly rawUnsafe: Effect.Effect<RawBinding>;
388
- readonly definition: BrowserRenderingDefinition;
389
- }
390
- declare const BrowserRenderingServiceTypeId: unique symbol;
391
- interface BrowserRenderingService<Id extends string> {
392
- readonly [BrowserRenderingServiceTypeId]: {
393
- readonly id: Id;
394
- };
395
- }
396
- type LayerOptions$10 = {
397
- readonly binding: string;
398
- };
399
- interface TagClass$8<Self, Id extends string> extends Context.ServiceClass<Self, Id, BrowserRenderingClient> {
400
- readonly id: Id;
401
- readonly layer: (options: LayerOptions$10) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
402
- }
403
- declare const isBrowserRenderingBinding: <Candidate>(value: Candidate) => value is Candidate & BrowserRenderingBinding;
404
- declare const makeClient$7: <RawBinding extends BrowserRenderingBinding = BrowserRenderingBinding>(definition: BrowserRenderingDefinition) => (binding: RawBinding) => BrowserRenderingClient<RawBinding>;
405
- declare const layer$11: <Self>(tag: Context.Service<Self, BrowserRenderingClient>, definition: BrowserRenderingDefinition) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
406
- declare const make$9: <Id extends string>(id: Id) => TagClass$8<BrowserRenderingService<Id>, Id>;
407
- declare const Tag$9: <Self>() => <Id extends string>(id: Id) => TagClass$8<Self, Id>;
408
- declare namespace Cache_d_exports {
409
- export { CacheClient, CacheOperation, CacheOperationError, CacheQueryOptions, CacheRequest, CacheStorage, CacheStorageClient, layer$10 as layer, layerFrom, makeCacheClient, makeClient$6 as makeClient };
410
- }
411
- type CacheRequest = CloudflareRequestInfo | URL;
412
- type CacheQueryOptions = CloudflareCacheQueryOptions;
413
- type CacheOperation = "open" | "match" | "put" | "delete";
414
- declare const CacheOperationError_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 & {
415
- readonly _tag: "CacheOperationError";
416
- } & Readonly<A>;
417
- declare class CacheOperationError extends CacheOperationError_base<{
418
- readonly cache: string;
419
- readonly operation: CacheOperation;
420
- readonly cause: unknown;
421
- }> {
422
- get message(): string;
423
- }
424
- interface CacheClient {
425
- readonly name: string;
426
- readonly match: (request: CacheRequest, options?: CacheQueryOptions) => Effect.Effect<Option.Option<Response>, CacheOperationError>;
427
- readonly put: (request: CacheRequest, response: Response) => Effect.Effect<void, CacheOperationError>;
428
- readonly delete: (request: CacheRequest, options?: CacheQueryOptions) => Effect.Effect<boolean, CacheOperationError>;
429
- readonly rawUnsafe: Effect.Effect<CloudflareCache>;
430
- }
431
- interface CacheStorageClient {
432
- readonly default: CacheClient;
433
- readonly open: (name: string) => Effect.Effect<CacheClient, CacheOperationError>;
434
- readonly rawUnsafe: Effect.Effect<CloudflareCacheStorage>;
435
- }
436
- declare const CacheStorage_base: Context.ServiceClass<CacheStorage, "effect-cf/CacheStorage", CacheStorageClient>;
437
- declare class CacheStorage extends CacheStorage_base {}
438
- declare const makeCacheClient: (cache: CloudflareCache, name?: string) => CacheClient;
439
- declare const makeClient$6: (storage: CloudflareCacheStorage) => CacheStorageClient;
440
- declare const layerFrom: (storage: CloudflareCacheStorage) => Layer.Layer<CacheStorage>;
441
- declare const layer$10: Layer.Layer<CacheStorage>;
442
- declare namespace CloudflareOtlp_d_exports {
443
- export { DurableObjectLayerOptions, LayerOptions$9 as LayerOptions, ResourceOptions, Serialization, Signal, WorkerLayerOptions, layer$9 as layer, layerDurableObject, layerJson, layerProtobuf, layerWorker };
444
- }
445
- type ResourceAttributes = NonNullable<Parameters<typeof OtlpResource.make>[0]["attributes"]>;
446
- /** Telemetry signal groups supported by the Cloudflare OTLP layers. */
447
- type Signal = "logs" | "traces" | "metrics";
448
- /** OTLP payload serialization used by the Effect OTLP exporters. */
449
- type Serialization = "json" | "protobuf";
450
- /**
451
- * Resource metadata shared by Worker and Durable Object OTLP layers.
452
- *
453
- * Precedence follows Effect's `OtlpResource.fromConfig`: explicit
454
- * `serviceName`/`serviceVersion` win over matching explicit `attributes`, and
455
- * explicit attributes win over `OTEL_SERVICE_NAME`, `OTEL_SERVICE_VERSION`, and
456
- * `OTEL_RESOURCE_ATTRIBUTES`. Omit an option to let operators set it from the
457
- * environment.
458
- */
459
- interface ResourceOptions {
460
- /** Explicit service name. Takes precedence over OTEL environment variables. */
461
- readonly serviceName?: string;
462
- /** Explicit service version. Takes precedence over OTEL environment variables. */
463
- readonly serviceVersion?: string;
464
- /** Additional resource attributes attached to exported telemetry. */
465
- readonly attributes?: ResourceAttributes;
466
- }
467
- /** Options shared by all Cloudflare OTLP telemetry layers. */
468
- interface LayerOptions$9 {
469
- /**
470
- * Telemetry signals to export. Defaults to logs, traces, and metrics.
471
- *
472
- * Each selected signal is still controlled by standard OTEL exporter config,
473
- * such as `OTEL_TRACES_EXPORTER=otlp`.
474
- */
475
- readonly signals?: ReadonlyArray<Signal>;
476
- /** OTLP payload serialization. Defaults to protobuf. */
477
- readonly serialization?: Serialization;
478
- readonly resource?: ResourceOptions;
479
- readonly headers?: Headers$1.Input;
480
- readonly loggerExcludeLogSpans?: boolean;
481
- readonly loggerMergeWithExisting?: boolean;
482
- readonly tracerContext?: <X>(primitive: Tracer$1.EffectPrimitive<X>, span: Tracer$1.AnySpan) => X;
483
- }
484
- interface WorkerLayerOptions extends LayerOptions$9 {
485
- readonly workerName?: string;
486
- }
487
- interface DurableObjectLayerOptions extends LayerOptions$9 {
488
- readonly className?: string;
489
- /**
490
- * Include the Durable Object id as `cloudflare.durable_object.id`.
491
- *
492
- * This is disabled by default because object ids can be high-cardinality.
493
- */
494
- readonly includeObjectId?: boolean;
495
- }
496
- /**
497
- * Base OTLP telemetry layer for Cloudflare-compatible runtimes.
498
- *
499
- * Standard OpenTelemetry environment variables are resolved by Effect's OTLP
500
- * layers. In Cloudflare Workers and Durable Objects, the current `env` object is
501
- * installed as the primary `ConfigProvider`; outside Cloudflare, the ambient
502
- * Effect `ConfigProvider` remains the fallback.
503
- *
504
- * The layer provides {@link OtlpExporter.Flusher} for draining buffered
505
- * telemetry before the isolate freezes.
506
- */
507
- declare const layer$9: (options?: LayerOptions$9) => Layer.Layer<OtlpExporter.Flusher>;
508
- /** Base OTLP telemetry layer forced to JSON serialization. */
509
- declare const layerJson: (options?: Omit<LayerOptions$9, "serialization">) => Layer.Layer<OtlpExporter.Flusher>;
510
- /** Base OTLP telemetry layer forced to protobuf serialization. */
511
- declare const layerProtobuf: (options?: Omit<LayerOptions$9, "serialization">) => Layer.Layer<OtlpExporter.Flusher>;
512
- /**
513
- * OTLP layer with Cloudflare Worker resource attributes.
514
- *
515
- * Provide this layer at runtime scope for long-lived metrics aggregation, or at
516
- * handler scope when traces/logs should flush as the Cloudflare event finishes.
517
- * A handler-scoped exporter can delay scope closure while its own finalizer
518
- * flushes; the two-second background flush limit does not bound layer shutdown.
519
- */
520
- declare const layerWorker: (options?: WorkerLayerOptions) => Layer.Layer<OtlpExporter.Flusher>;
521
- /**
522
- * OTLP layer with Cloudflare Durable Object resource attributes.
523
- *
524
- * The layer reads {@link DurableObjectState} so it can optionally include the
525
- * Durable Object id. Prefer leaving `includeObjectId` disabled unless the
526
- * backend can tolerate high-cardinality resource attributes.
527
- */
528
- declare const layerDurableObject: (options?: DurableObjectLayerOptions) => Layer.Layer<OtlpExporter.Flusher, never, DurableObjectState>;
529
- declare namespace CloudflareTracer_d_exports {
530
- export { layer$8 as layer };
531
- }
532
- /**
533
- * Sends Effect spans to Cloudflare Workers Observability using the runtime's
534
- * custom span API. Build this layer inside each invocation, for example with
535
- * `Worker.make(Services, { eventLayer: CloudflareTracer.layer, fetch })`.
536
- * It captures the invocation's async context and must not be cached across requests.
537
- *
538
- * Enable `observability.traces.enabled` in Wrangler. Cloudflare owns sampling
539
- * and export; no OTLP exporter or flush is required. Scalar attributes are
540
- * forwarded; other attributes, events, and links remain Effect-local. Completion
541
- * is recorded as `effect.exit`, since Cloudflare has no outcome-setting API.
542
- * Effect trace/span IDs remain independent of Cloudflare's opaque IDs. External
543
- * parents and `root: true` cannot override the invocation's Cloudflare trace.
544
- */
545
- declare const layer$8: Layer.Layer<never>;
546
- declare namespace D1_d_exports {
547
- export { D1Definition, D1Service, D1SqlLayerOptions, Service, TypeId$1 as TypeId, make$8 as make };
548
- }
549
- declare const TypeId$1: "~effect-cf/D1";
550
- type TypeId$1 = typeof TypeId$1;
551
- interface D1Definition {
552
- readonly binding: string;
553
- }
554
- type D1SqlLayerOptions = Omit<D1Client.D1ClientConfig, "db">;
555
- declare const D1ServiceTypeId: unique symbol;
556
- interface D1Service<Id extends string> {
557
- readonly [D1ServiceTypeId]: {
558
- readonly id: Id;
559
- };
560
- }
561
- declare const make$8: <Id extends string>(id: Id, definition: D1Definition) => BindingService<D1Service<Id>, Id, D1Database> & {
562
- "~effect-cf/D1": "~effect-cf/D1";
563
- definition: D1Definition;
564
- sqlLayer: (options?: D1SqlLayerOptions) => Layer.Layer<D1Client.D1Client | SqlClient.SqlClient, Config.ConfigError | BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
565
- };
566
- declare const Service: <Self>() => <Id extends string>(id: Id, definition: D1Definition) => BindingService<Self, Id, D1Database> & {
567
- "~effect-cf/D1": "~effect-cf/D1";
568
- definition: D1Definition;
569
- sqlLayer: (options?: D1SqlLayerOptions) => Layer.Layer<D1Client.D1Client | SqlClient.SqlClient, Config.ConfigError | BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
570
- };
571
- declare namespace DurableObjectAlarm_d_exports {
572
- export { AlarmDefinitionConfig, AlarmDefinitionEntry, AlarmDefinitionPayload, AlarmDefinitions, AlarmFailurePolicy, AlarmPayload, AlarmPayloadSchema, AlarmRef, AlarmRegistration, AlarmRetryPolicy, AlarmScheduler, AlarmService, AlarmTagClass, AlarmTransaction, DefinedAlarmEvent, DefinedAlarmHandlers, DefinedAlarmScheduler, DefinedAlarmTransaction, DefinedScheduleAlarmInput, DurableObjectAlarm, DurableObjectAlarmError, DurableObjectAlarmEvent, InvalidAlarmPayloadError, InvalidAlarmRefError, InvalidProcessDueAlarmsOptionsError, InvalidRepeatEveryError, ProcessDueAlarmsFailure, ProcessDueAlarmsFailureAction, ProcessDueAlarmsHandler, ProcessDueAlarmsMode, ProcessDueAlarmsOptions, ProcessDueAlarmsResult, ScheduleAlarmInput, StoredAlarmDecodeError, Tag$8 as Tag, define, processDue };
573
- }
574
- type AlarmPayload = Schema.Json;
575
- declare const InvalidAlarmRefError_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 & {
576
- readonly _tag: "InvalidAlarmRefError";
577
- } & Readonly<A>;
578
- declare class InvalidAlarmRefError extends InvalidAlarmRefError_base<{
579
- readonly cause: unknown;
580
- }> {
581
- get message(): string;
582
- }
583
- declare const InvalidAlarmPayloadError_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 & {
584
- readonly _tag: "InvalidAlarmPayloadError";
585
- } & Readonly<A>;
586
- declare class InvalidAlarmPayloadError extends InvalidAlarmPayloadError_base<{
587
- readonly cause: unknown;
588
- }> {
589
- get message(): string;
590
- }
591
- declare const InvalidRepeatEveryError_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 & {
592
- readonly _tag: "InvalidRepeatEveryError";
593
- } & Readonly<A>;
594
- declare class InvalidRepeatEveryError extends InvalidRepeatEveryError_base<{
595
- readonly cause: unknown;
596
- }> {
597
- get message(): string;
598
- }
599
- declare const InvalidProcessDueAlarmsOptionsError_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 & {
600
- readonly _tag: "InvalidProcessDueAlarmsOptionsError";
601
- } & Readonly<A>;
602
- declare class InvalidProcessDueAlarmsOptionsError extends InvalidProcessDueAlarmsOptionsError_base<{
603
- readonly cause: unknown;
604
- }> {
605
- get message(): string;
606
- }
607
- declare const StoredAlarmDecodeError_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 & {
608
- readonly _tag: "StoredAlarmDecodeError";
609
- } & Readonly<A>;
610
- declare class StoredAlarmDecodeError extends StoredAlarmDecodeError_base<{
611
- readonly cause: unknown;
612
- readonly storageId: string;
613
- }> {
614
- get message(): string;
615
- }
616
- type DurableObjectAlarmError = InvalidAlarmPayloadError | InvalidAlarmRefError | InvalidProcessDueAlarmsOptionsError | InvalidRepeatEveryError | StorageOperationError | StoredAlarmDecodeError;
617
- declare const DurableObjectAlarmEvent: Schema.TaggedUnion<{
618
- readonly AlarmDue: Schema.TaggedStruct<"AlarmDue", {
619
- readonly id: Schema.NonEmptyString;
620
- readonly payload: Schema.Codec<Schema.Json, Schema.Json, never, never>;
621
- /** Persisted due time, which can differ from the invocation time during retries. */
622
- readonly scheduledAt: Schema.DateTimeUtc;
623
- readonly tag: Schema.NonEmptyString;
624
- }>;
625
- }>;
626
- type DurableObjectAlarmEvent = typeof DurableObjectAlarmEvent.Type;
627
- type AlarmRef<Tag extends string = string> = {
628
- readonly id: string;
629
- readonly tag: Tag;
630
- };
631
- /** Reusing `{tag, id}` replaces an alarm. Repeats run after success, never as fixed-cadence catch-up. */
632
- type ScheduleAlarmInput<Tag extends string = string> = AlarmRef<Tag> & {
633
- readonly payload: AlarmPayload;
634
- readonly repeatEvery?: Duration.Input;
635
- readonly runAt: DateTime.Utc;
636
- };
637
- type ProcessDueAlarmsMode = "isolated" | "ordered";
638
- interface ProcessDueAlarmsFailure {
639
- readonly cause: unknown;
640
- readonly event?: DurableObjectAlarmEvent;
641
- readonly id: string;
642
- readonly storageId: string;
643
- readonly tag: string;
644
- }
645
- interface ProcessDueAlarmsResult {
646
- readonly failed: readonly ProcessDueAlarmsFailure[];
647
- readonly handled: readonly DurableObjectAlarmEvent[];
648
- }
649
- type ProcessDueAlarmsFailureAction = "ordered" | "retry" | "skip-and-advance-repeat" | {
650
- readonly mode: "ordered";
651
- } | {
652
- readonly mode: "retry";
653
- readonly retryFailedAfter?: Duration.Input;
654
- } | {
655
- readonly mode: "skip-and-advance-repeat";
656
- };
657
- interface ProcessDueAlarmsOptions<OnFailureR = never, OnFailureE = never> {
658
- readonly limit?: number;
659
- /** `isolated` retries only the failed row; `ordered` stops before later rows. */
660
- readonly mode?: ProcessDueAlarmsMode;
661
- readonly onFailure?: (failure: ProcessDueAlarmsFailure) => Effect.Effect<ProcessDueAlarmsFailureAction | void, OnFailureE, OnFailureR>;
662
- readonly retryFailedAfter?: Duration.Input;
663
- }
664
- type ProcessDueAlarmsHandler<R = never, E = never> = (event: DurableObjectAlarmEvent) => Effect.Effect<void, E, R>;
665
- /**
666
- * Alarm mutations owned by one transaction callback. Run them in the callback's
667
- * fiber; forked work and use after the callback ends fail with StorageOperationError.
668
- */
669
- type AlarmTransaction = Pick<AlarmScheduler, "scheduleAlarm" | "cancelAlarm">;
670
- /** Own `storage.setAlarm()` exclusively: a Durable Object has one platform alarm timestamp. */
671
- type AlarmScheduler = {
672
- /**
673
- * Commits local application storage and logical alarms in one native SQLite
674
- * Durable Object transaction, reconciling the native alarm before commit.
675
- * Use the supplied mutations, not standalone alarm methods or nested transactions.
676
- * SqlClient queries must use this same Durable Object's storage.
677
- *
678
- * Failure, defects and interruption before commit roll back. A lost reply or
679
- * interruption after commit does not undo committed state. Keep RPC and other
680
- * external effects outside; atomically pre-arm a later wake before fallible work.
681
- * Cloudflare's native retries are bounded; composition does not remove the
682
- * pre-arm requirement or promise infinite retry liveness.
683
- */
684
- readonly transaction: <A, E, R>(closure: (alarms: AlarmTransaction) => Effect.Effect<A, E, R>) => Effect.Effect<A, E | StorageOperationError, R>;
685
- readonly cancelAlarm: (input: AlarmRef) => Effect.Effect<void, InvalidAlarmRefError | StorageOperationError>;
686
- /** Acknowledge after handling. Conditional writes preserve handler replacements; alarms are at-least-once. */
687
- readonly processDueAlarms: <R = never, E = never, OnFailureR = never, OnFailureE = never>(handle: ProcessDueAlarmsHandler<R, E>, options?: ProcessDueAlarmsOptions<OnFailureR, OnFailureE>) => Effect.Effect<ProcessDueAlarmsResult, E | OnFailureE | DurableObjectAlarmError, R | OnFailureR>;
688
- /** A failed platform setAlarm rolls back the logical schedule in the same transaction. */
689
- readonly scheduleAlarm: (input: ScheduleAlarmInput) => Effect.Effect<void, InvalidAlarmPayloadError | InvalidAlarmRefError | InvalidRepeatEveryError | StorageOperationError>;
690
- };
691
- declare const processDue: <R = never, E = never, OnFailureR = never, OnFailureE = never>(handle: ProcessDueAlarmsHandler<R, E>, options?: ProcessDueAlarmsOptions<OnFailureR, OnFailureE>) => Effect.Effect<ProcessDueAlarmsResult, E | OnFailureE | DurableObjectAlarmError, OnFailureR | R | DurableObjectAlarm>;
692
- type AlarmPayloadSchema = Schema.Codec<any, any, never, never>;
693
- type AlarmFailurePolicy = "ordered" | "retry" | "skip-and-advance-repeat";
694
- interface AlarmRetryPolicy {
695
- readonly initialDelay?: Duration.Input;
696
- }
697
- interface AlarmDefinitionConfig<Payload extends AlarmPayloadSchema = AlarmPayloadSchema> {
698
- readonly failure?: AlarmFailurePolicy;
699
- readonly payload: Payload;
700
- readonly retry?: AlarmRetryPolicy;
701
- }
702
- type AlarmDefinitionEntry = AlarmDefinitionConfig | AlarmPayloadSchema;
703
- type AlarmDefinitions = Readonly<Record<string, AlarmDefinitionEntry>>;
704
- type AlarmDefinitionSchema<Definition> = Definition extends AlarmDefinitionConfig<infer Payload> ? Payload : Definition;
705
- type AlarmDefinitionPayload<Definition> = AlarmDefinitionSchema<Definition> extends Schema.Codec<infer A, any, never, never> ? A : never;
706
- type DefinedAlarmEvent<Tag extends string, Payload> = Omit<DurableObjectAlarmEvent, "payload" | "tag"> & {
707
- readonly payload: Payload;
708
- readonly tag: Tag;
709
- };
710
- type DefinedAlarmHandlers<Definitions extends AlarmDefinitions, R = never, E = never> = { readonly [Tag in keyof Definitions & string]: (event: DefinedAlarmEvent<Tag$8, AlarmDefinitionPayload<Definitions[Tag$8]>>) => Effect.Effect<void, E, R>; };
711
- /** A discriminated union keeps each tag paired with its decoded payload type. */
712
- type DefinedScheduleAlarmInput<Definitions extends AlarmDefinitions> = { readonly [Tag in keyof Definitions & string]: Omit<ScheduleAlarmInput<Tag$8>, "payload"> & {
713
- readonly payload: AlarmDefinitionPayload<Definitions[Tag$8]>;
714
- }; }[keyof Definitions & string];
715
- interface DefinedAlarmTransaction<Definitions extends AlarmDefinitions> {
716
- readonly scheduleAlarm: (input: DefinedScheduleAlarmInput<Definitions>) => ReturnType<AlarmScheduler["scheduleAlarm"]>;
717
- readonly cancelAlarm: (input: AlarmRef<keyof Definitions & string>) => ReturnType<AlarmScheduler["cancelAlarm"]>;
718
- }
719
- declare const TypedAlarmSchedulerTypeId: unique symbol;
720
- /** Identifies service requirements whose scheduler needs a registered dispatcher. */
721
- interface AlarmService {
722
- readonly Service: {
723
- readonly [TypedAlarmSchedulerTypeId]: typeof TypedAlarmSchedulerTypeId;
724
- };
725
- }
726
- interface DefinedAlarmScheduler<Definitions extends AlarmDefinitions> extends DefinedAlarmTransaction<Definitions> {
727
- readonly [TypedAlarmSchedulerTypeId]: typeof TypedAlarmSchedulerTypeId;
728
- readonly transaction: <A, E, R>(closure: (alarms: DefinedAlarmTransaction<Definitions>) => Effect.Effect<A, E, R>) => Effect.Effect<A, E | StorageOperationError, R>;
729
- }
730
- /** Registers a dispatcher and the service authorized to schedule its alarms. */
731
- interface AlarmRegistration<Self, R = never, E = never> {
732
- readonly layer: Layer.Layer<Self, never, DurableObjectAlarm>;
733
- readonly run: Effect.Effect<ProcessDueAlarmsResult, E | DurableObjectAlarmError, R | DurableObjectAlarm>;
734
- }
735
- interface AlarmTagClass<Self, Id extends string, Definitions extends AlarmDefinitions> extends Context.ServiceClass<Self, Id, DefinedAlarmScheduler<Definitions>> {
736
- readonly handlers: <R = never, E = never>(handlers: DefinedAlarmHandlers<Definitions, R, E>, options?: ProcessDueAlarmsOptions<R, E>) => AlarmRegistration<Self, R, E>;
737
- }
738
- /** Handler-only definitions for applications using the raw scheduler. Prefer Tag for typed scheduling. */
739
- declare const define: <const Definitions extends AlarmDefinitions>(definitions: Definitions) => {
740
- handlers: <R = never, E = never>(handlers: DefinedAlarmHandlers<Definitions, R, E>, options?: ProcessDueAlarmsOptions<R, E> | undefined) => Effect.Effect<ProcessDueAlarmsResult, E | DurableObjectAlarmError, R | DurableObjectAlarm>;
741
- };
742
- /** The typed scheduler becomes available when its handlers are registered on a Durable Object. */
743
- declare const Tag$8: <Self>() => <const Id extends string, const Definitions extends AlarmDefinitions>(id: Id, definitions: Definitions) => AlarmTagClass<Self, Id, Definitions>;
744
- declare const DurableObjectAlarm_base: Context.ServiceClass<DurableObjectAlarm, "effect-cf/DurableObjectAlarm", AlarmScheduler>;
745
- declare class DurableObjectAlarm extends DurableObjectAlarm_base {
746
- static readonly layer: Layer.Layer<DurableObjectAlarm, never, DurableObjectState>;
747
- }
748
- declare namespace DurableObjectNamespace_d_exports {
749
- export { DurableObjectFetchError, DurableObjectNamespaceBindingDefinition, DurableObjectNamespaceClient, DurableObjectNamespaceDefinition, DurableObjectNamespaceEffectClient, DurableObjectNamespaceStaticClient, DurableObjectRpcError, DurableObjectStubClient, isDurableObjectNamespaceClient, layer$7 as layer, makeClient$5 as makeClient, makeDirectMethods };
750
- }
751
- interface DurableObjectFetcher {
752
- fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
753
- }
754
- type RpcClient<Api> = { readonly [Key in keyof Api as Key extends string ? Api[Key] extends ((...args: Array<any>) => any) ? Key : never : never]: Api[Key]; };
755
- type ReservedMethodName$1 = ReservedMethodName | "fetch";
756
- type NamespaceCandidate = Parameters<typeof Predicate.isUnknown>[0];
757
- /**
758
- * Cloudflare Durable Object stub, optionally enriched with RPC methods.
759
- */
760
- type DurableObjectStubClient<Api extends object> = DurableObjectFetcher & RpcClient<Provider<Api, ReservedMethodName$1>> & {
761
- readonly id: globalThis.DurableObjectId;
762
- readonly name?: string;
763
- };
764
- interface DurableObjectNamespaceClient<Api extends object> {
765
- newUniqueId(options?: globalThis.DurableObjectNamespaceNewUniqueIdOptions): globalThis.DurableObjectId;
766
- idFromName(name: string): globalThis.DurableObjectId;
767
- idFromString(id: string): globalThis.DurableObjectId;
768
- get(id: globalThis.DurableObjectId, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStubClient<Api>;
769
- getByName(name: string, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStubClient<Api>;
770
- jurisdiction(jurisdiction: globalThis.DurableObjectJurisdiction): DurableObjectNamespaceClient<Api>;
771
- }
772
- /**
773
- * Minimal namespace binding metadata.
774
- */
775
- interface DurableObjectNamespaceDefinition {
776
- readonly binding: string;
777
- }
778
- /**
779
- * Namespace binding metadata with optional RPC schema.
780
- */
781
- interface DurableObjectNamespaceBindingDefinition<Definition extends Definition$3.Any | undefined = undefined> {
782
- readonly binding: string;
783
- readonly definition?: Definition;
784
- /** Append live trace context only when the receiver also enables rpcTracing. */
785
- readonly rpcTracing?: boolean;
786
- }
787
- declare const DurableObjectRpcError_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 & {
788
- readonly _tag: "DurableObjectRpcError";
789
- } & Readonly<A>;
790
- /**
791
- * Failure raised when invoking an RPC method on a Durable Object stub.
792
- */
793
- declare class DurableObjectRpcError extends DurableObjectRpcError_base<{
794
- readonly binding: string;
795
- readonly method: string;
796
- readonly cause: unknown;
797
- }> {
798
- get message(): string;
799
- }
800
- declare const DurableObjectFetchError_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 & {
801
- readonly _tag: "DurableObjectFetchError";
802
- } & Readonly<A>;
803
- /**
804
- * Failure raised when forwarding a request to a Durable Object stub.
805
- */
806
- declare class DurableObjectFetchError extends DurableObjectFetchError_base<{
807
- readonly binding: string;
808
- readonly cause: unknown;
809
- }> {
810
- get message(): string;
811
- }
812
- type StubMethodKey<Api> = AsyncMethodKey<Api>;
813
- type StubMethodArgs<Api, Method extends keyof Api> = AsyncMethodArgs<Api, Method>;
814
- type StubMethodSuccess<Api, Method extends keyof Api> = AsyncMethodSuccess<Api, Method>;
815
- type StubMethodCloudflareReturn<Api, Method extends keyof Api> = AsyncMethodCloudflareReturn<Api, Method>;
816
- type StubCall<R, Api extends object> = <Method extends StubMethodKey<Api>>(stub: DurableObjectStubClient<Api>, method: Method, ...args: StubMethodArgs<Api, Method>) => Effect.Effect<StubMethodSuccess<Api, Method>, DurableObjectRpcError, R>;
817
- type DefinitionNamespaceDirectMethods<R, Api extends object, Definition extends Definition$3.Any> = { readonly [Method in Definition$4.MethodNames<Definition>]: (stub: DurableObjectStubClient<Api>, ...args: Method$2.Args<Definition["methods"][Method]>) => Effect.Effect<Method$2.Success<Definition["methods"][Method]>, DurableObjectRpcError, R>; };
818
- type DefinitionDurableObjectDirectClient<R, Definition extends Definition$3.Any> = {
819
- readonly fetch: (input: RequestInfo | URL, init?: RequestInit) => Effect.Effect<globalThis.Response, DurableObjectFetchError, R>;
820
- } & { readonly [Method in Definition$4.MethodNames<Definition>]: (...args: Method$2.Args<Definition["methods"][Method]>) => Effect.Effect<Method$2.Success<Definition["methods"][Method]>, DurableObjectRpcError, R>; };
821
- type DefinitionNamespaceDirectClientMethods<R, Definition extends Definition$3.Any> = {
822
- readonly byName: (name: string, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions) => DefinitionDurableObjectDirectClient<R, Definition>;
823
- readonly byId: (id: globalThis.DurableObjectId, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions) => DefinitionDurableObjectDirectClient<R, Definition>;
824
- };
825
- type DirectMethods<R, Api extends object, Definition> = Definition extends Definition$3.Any ? DefinitionNamespaceDirectMethods<R, Api, Definition> & DefinitionNamespaceDirectClientMethods<R, Definition> : {};
826
- type DurableObjectNamespaceEffectClient<Api extends object, Definition extends Definition$3.Any | undefined = undefined> = DirectMethods<never, Api, Definition> & {
827
- readonly newUniqueId: (options?: globalThis.DurableObjectNamespaceNewUniqueIdOptions) => Effect.Effect<globalThis.DurableObjectId>;
828
- readonly idFromName: (name: string) => Effect.Effect<globalThis.DurableObjectId>;
829
- readonly idFromString: (id: string) => Effect.Effect<globalThis.DurableObjectId>;
830
- readonly get: (id: globalThis.DurableObjectId, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions) => Effect.Effect<DurableObjectStubClient<Api>>;
831
- readonly getByName: (name: string, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions) => Effect.Effect<DurableObjectStubClient<Api>>;
832
- readonly jurisdiction: (jurisdiction: globalThis.DurableObjectJurisdiction) => Effect.Effect<DurableObjectNamespaceClient<Api>>;
833
- readonly fetch: (stub: DurableObjectStubClient<Api>, input: RequestInfo | URL, init?: RequestInit) => Effect.Effect<globalThis.Response, DurableObjectFetchError>;
834
- /**
835
- * Invokes a Durable Object RPC method and returns Cloudflare's raw RPC result.
836
- *
837
- * This preserves Cloudflare RPC behavior such as promise-like pipelining and
838
- * transferable / disposable result objects. It does not resolve the returned
839
- * promise-like value and it does not decode definition-backed success schemas.
840
- *
841
- * Most application code should use {@link call} instead.
842
- */
843
- readonly rpc: <Method extends StubMethodKey<Api>>(stub: DurableObjectStubClient<Api>, method: Method, ...args: StubMethodArgs<Api, Method>) => Effect.Effect<StubMethodCloudflareReturn<Api, Method>, DurableObjectRpcError>;
844
- /**
845
- * Invokes a Durable Object RPC method, resolves Cloudflare's RPC result, and
846
- * decodes the success value when the namespace was created from a definition.
847
- *
848
- * This is the normal choice when application code wants the final typed value.
849
- */
850
- readonly call: <Method extends StubMethodKey<Api>>(stub: DurableObjectStubClient<Api>, method: Method, ...args: StubMethodArgs<Api, Method>) => Effect.Effect<StubMethodSuccess<Api, Method>, DurableObjectRpcError>;
851
- /**
852
- * Invokes a Durable Object RPC method in the current `Scope`, resolves
853
- * Cloudflare's RPC result, decodes definition-backed success values, and
854
- * disposes the resolved result when the scope closes if it implements
855
- * `Symbol.dispose`.
856
- *
857
- * Use this for RPC methods that return Cloudflare RPC resources or other
858
- * disposable objects whose lifetime should be tied to an Effect scope.
859
- */
860
- readonly scopedCall: <Method extends StubMethodKey<Api>>(stub: DurableObjectStubClient<Api>, method: Method, ...args: StubMethodArgs<Api, Method>) => Effect.Effect<Awaited<StubMethodSuccess<Api, Method>>, DurableObjectRpcError, Scope.Scope>;
861
- /**
862
- * Exposes the underlying native Durable Object namespace binding.
863
- *
864
- * Prefer the typed helpers above unless Cloudflare exposes a platform feature
865
- * that is not wrapped by effect-cf yet.
866
- */
867
- readonly rawUnsafe: Effect.Effect<DurableObjectNamespaceClient<Api>>;
868
- };
869
- type DurableObjectNamespaceStaticClient<R, Api extends object, Definition extends Definition$3.Any | undefined = undefined> = DirectMethods<R, Api, Definition> & {
870
- readonly newUniqueId: (options?: globalThis.DurableObjectNamespaceNewUniqueIdOptions) => Effect.Effect<globalThis.DurableObjectId, never, R>;
871
- readonly idFromName: (name: string) => Effect.Effect<globalThis.DurableObjectId, never, R>;
872
- readonly idFromString: (id: string) => Effect.Effect<globalThis.DurableObjectId, never, R>;
873
- readonly get: (id: globalThis.DurableObjectId, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions) => Effect.Effect<DurableObjectStubClient<Api>, never, R>;
874
- readonly getByName: (name: string, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions) => Effect.Effect<DurableObjectStubClient<Api>, never, R>;
875
- readonly jurisdiction: (jurisdiction: globalThis.DurableObjectJurisdiction) => Effect.Effect<DurableObjectNamespaceClient<Api>, never, R>;
876
- readonly fetch: (stub: DurableObjectStubClient<Api>, input: RequestInfo | URL, init?: RequestInit) => Effect.Effect<globalThis.Response, DurableObjectFetchError, R>;
877
- readonly rpc: <Method extends StubMethodKey<Api>>(stub: DurableObjectStubClient<Api>, method: Method, ...args: StubMethodArgs<Api, Method>) => Effect.Effect<StubMethodCloudflareReturn<Api, Method>, DurableObjectRpcError, R>;
878
- readonly call: <Method extends StubMethodKey<Api>>(stub: DurableObjectStubClient<Api>, method: Method, ...args: StubMethodArgs<Api, Method>) => Effect.Effect<StubMethodSuccess<Api, Method>, DurableObjectRpcError, R>;
879
- readonly scopedCall: <Method extends StubMethodKey<Api>>(stub: DurableObjectStubClient<Api>, method: Method, ...args: StubMethodArgs<Api, Method>) => Effect.Effect<Awaited<StubMethodSuccess<Api, Method>>, DurableObjectRpcError, Scope.Scope | R>;
880
- readonly rawUnsafe: () => Effect.Effect<DurableObjectNamespaceClient<Api>, never, R>;
881
- };
882
- declare const isDurableObjectNamespaceClient: <Api extends object>(value: NamespaceCandidate) => value is DurableObjectNamespaceClient<Api>;
883
- declare const makeClient$5: <Api extends object, const Definition extends Definition$3.Any | undefined = undefined>(definition: DurableObjectNamespaceBindingDefinition<Definition>) => ((namespace: DurableObjectNamespaceClient<Api>) => DurableObjectNamespaceEffectClient<Api, Definition>);
884
- declare const layer$7: <Self, Api extends object, const Definition extends Definition$3.Any | undefined = undefined>(tag: Context.Service<Self, DurableObjectNamespaceEffectClient<Api, Definition>>, definition: DurableObjectNamespaceBindingDefinition<Definition>) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
885
- declare const makeDirectMethods: <R, Api extends object, Definition extends Definition$3.Any | undefined>(rpcDefinition: Definition | undefined, helpers: {
886
- readonly call: StubCall<R, Api>;
887
- readonly fetch: (stub: DurableObjectStubClient<Api>, input: RequestInfo | URL, init?: RequestInit) => Effect.Effect<globalThis.Response, DurableObjectFetchError, R>;
888
- readonly get: (id: globalThis.DurableObjectId, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions) => Effect.Effect<DurableObjectStubClient<Api>, never, R>;
889
- readonly getByName: (name: string, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions) => Effect.Effect<DurableObjectStubClient<Api>, never, R>;
890
- }) => DirectMethods<R, Api, Definition>;
891
- declare namespace DurableObjectDefinition_d_exports {
892
- export { Api, Definition$3 as Definition, DurableObject$1 as DurableObject, HandlerEffect, Handlers, LayerOptions$8 as LayerOptions, Method$1 as Method, Methods, NoReservedMethods, Options$2 as Options, ReservedMethodName, ServerApi, ServiceFreeSchema, Tag$7 as Tag, TagClass$7 as TagClass, implement$2 as implement, make$7 as make, method };
893
- }
894
- type ServiceFreeSchema = Schema.Codec<any, any, never, never>;
895
- interface Method$1<Args extends ReadonlyArray<ServiceFreeSchema> = ReadonlyArray<ServiceFreeSchema>, Success extends ServiceFreeSchema = ServiceFreeSchema> {
896
- readonly args: Args;
897
- readonly success: Success;
898
- }
899
- declare namespace Method$1 {
900
- export type Any = Method$1<ReadonlyArray<ServiceFreeSchema>, ServiceFreeSchema>;
901
- type ArgsFromSchemas<Args extends ReadonlyArray<ServiceFreeSchema>> = Args extends readonly [] ? [] : Args extends readonly [infer Head extends ServiceFreeSchema, ...infer Tail extends ReadonlyArray<ServiceFreeSchema>] ? [Schema.Schema.Type<Head>, ...ArgsFromSchemas<Tail>] : Array<Schema.Schema.Type<Args[number]>>;
902
- type EncodedArgsFromSchemas<Args extends ReadonlyArray<ServiceFreeSchema>> = { [Index in keyof Args]: Schema.Json; };
903
- export type Args<Self extends Any> = ArgsFromSchemas<Self["args"]>;
904
- export type EncodedArgs<Self extends Any> = EncodedArgsFromSchemas<Self["args"]>;
905
- export type Success<Self extends Any> = Schema.Schema.Type<Self["success"]>;
906
- export type EncodedSuccess<_Self extends Any> = Schema.Json;
907
- export {};
908
- }
909
- type Methods = Record<string, Method$1.Any>;
910
- /**
911
- * RPC contract for a Durable Object class.
912
- */
913
- interface Definition$3<Id extends string = string, MethodDefinitions extends Methods = Methods> {
914
- readonly id: Id;
915
- readonly methods: MethodDefinitions;
916
- }
917
- declare namespace Definition$3 {
918
- type Any = Definition$3<string, Methods>;
919
- }
920
- type ReservedMethodName = ReservedMethodName$2 | "fetch" | "alarm" | "webSocketMessage" | "webSocketClose" | "webSocketError";
921
- type NoReservedMethods<MethodDefinitions extends Methods> = Extract<keyof MethodDefinitions, ReservedMethodName> extends never ? MethodDefinitions : never;
922
- /**
923
- * Promise-based client API derived from a Durable Object definition.
924
- */
925
- type ServerApi<Self extends Definition$3.Any> = { readonly [Key in keyof Self["methods"]]: (...args: Method$1.Args<Self["methods"][Key]>) => Promise<Method$1.Success<Self["methods"][Key]>>; };
926
- type Api<Self extends Definition$3.Any> = Provider<ServerApi<Self>, ReservedMethodName>;
927
- /**
928
- * Effect handlers for each RPC method in a Durable Object definition.
929
- */
930
- type Handlers<ROut, Self extends Definition$3.Any> = { readonly [Key in keyof Self["methods"]]: (...args: Method$1.Args<Self["methods"][Key]>) => DurableObjectHandler<ROut, Method$1.Success<Self["methods"][Key]>>; };
931
- /**
932
- * Durable Object constructor options for a specific RPC definition.
933
- */
934
- type Options$2<ROut, Self extends Definition$3.Any, REvent = never, EventLayerError = never, RAlarm = never> = DurableObjectOptions<ROut, REvent, EventLayerError, Handlers<NoInfer<ROut> | REvent | NoInfer<RAlarm>, Self>, RAlarm> & {
935
- readonly rpc: Handlers<NoInfer<ROut> | REvent | NoInfer<RAlarm>, Self>;
936
- };
937
- type LayerOptions$8 = {
938
- readonly binding: string;
939
- readonly rpcTracing?: boolean;
940
- };
941
- type TagClass$7<Self, Id extends string, MethodDefinitions extends Methods> = Context.ServiceClass<Self, `effect-cf/DurableObject/${Id}`, DurableObjectNamespaceEffectClient<Api<Definition$3<Id, MethodDefinitions>>, Definition$3<Id, MethodDefinitions>>> & DurableObjectNamespaceStaticClient<Self, Api<Definition$3<Id, MethodDefinitions>>, Definition$3<Id, MethodDefinitions>> & {
942
- readonly id: Id;
943
- readonly methods: MethodDefinitions;
944
- readonly make: <ROut, LayerError, REvent = never, EventLayerError = never, RAlarm = never>(layer: Layer.Layer<ROut, LayerError, RuntimeContext$1<NoInfer<RAlarm>>>, options: Options$2<ROut, Definition$3<Id, MethodDefinitions>, REvent, EventLayerError, RAlarm>) => DurableObjectClass<Handlers<ROut | REvent | RAlarm, Definition$3<Id, MethodDefinitions>>, ROut | REvent | RAlarm>;
945
- readonly layer: (options: LayerOptions$8) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
946
- };
947
- /**
948
- * Defines a single RPC method schema in a Durable Object definition.
949
- */
950
- declare function method<Success extends ServiceFreeSchema>(definition: {
951
- readonly success: Success;
952
- }): Method$1<readonly [], Success>;
953
- declare function method<const Args extends ReadonlyArray<ServiceFreeSchema>, Success extends ServiceFreeSchema>(definition: {
954
- readonly args: Args;
955
- readonly success: Success;
956
- }): Method$1<Args, Success>;
957
- declare const make$7: <Id extends string, const MethodDefinitions extends Methods>(id: Id, methods: MethodDefinitions & NoReservedMethods<MethodDefinitions>) => TagClass$7<Definition$3<Id, MethodDefinitions>, Id, MethodDefinitions>;
958
- declare const Tag$7: <Self>() => <Id extends string, const MethodDefinitions extends Methods>(id: Id, methods: MethodDefinitions & NoReservedMethods<MethodDefinitions>) => TagClass$7<Self, Id, MethodDefinitions>;
959
- declare const DurableObject$1: typeof Tag$7;
960
- /**
961
- * Helper for implementing handlers with the exact method shape of a definition.
962
- */
963
- declare const implement$2: <ROut, const Self extends Definition$3.Any>(_definition: Self, handlers: Handlers<ROut, Self>) => Handlers<ROut, Self>;
964
- /**
965
- * Convenience alias for a single Durable Object RPC handler Effect.
966
- */
967
- type HandlerEffect<ROut, Self extends Definition$3.Any, Key extends keyof Self["methods"]> = DurableObjectHandler<ROut, Method$1.Success<Self["methods"][Key]>>;
968
- declare namespace DurableObject_d_exports {
969
- export { Api, Definition$3 as Definition, DurableObjectClass, DurableObjectHandler, DurableObjectOptions, DurableObjectRpc, DurableObjectRpcApi, DurableObjectRpcApi as DurableObjectRpcShape, HandlerEffect, Handlers, LayerOptions$8 as LayerOptions, Method$1 as Method, Methods, NoReservedMethods, Options$2 as Options, ReservedMethodName, RpcHandlers, RunOptions, RunSymbol, RuntimeContext$1 as RuntimeContext, ServerApi, ServiceFreeSchema, Tag$7 as Tag, TagClass$7 as TagClass, implement$2 as implement, make$6 as make, method };
970
- }
971
- type RuntimeContext$1<ROut> = DurableObjectState | DurableObjectAlarm | WorkerEnvironment | ROut;
972
- type HandlerContext<ROut> = RuntimeContext$1<ROut> | Scope.Scope;
973
- type FetchContext<ROut> = HandlerContext<ROut> | NativeRequest;
974
- /** Metadata available before an event effect or its event layer starts. */
975
- interface RunOptions {
976
- readonly eventLayer?: boolean;
977
- readonly event?: "fetch" | "rpc" | "alarm" | "webSocketMessage" | "webSocketClose" | "webSocketError";
978
- readonly rpc?: RpcInvocationInfo;
979
- }
980
- /** Override to instrument the whole event, then call super[RunSymbol]. */
981
- declare const RunSymbol: unique symbol;
982
- /**
983
- * Effect type for Durable Object lifecycle and RPC handlers.
984
- */
985
- type DurableObjectHandler<ROut, A = unknown> = Effect.Effect<A, unknown, HandlerContext<ROut>>;
986
- /**
987
- * Shape of Durable Object RPC handlers passed to {@link make}.
988
- */
989
- type DurableObjectRpc<ROut> = Record<string, (...args: Array<any>) => DurableObjectHandler<ROut>>;
990
- type DurableObjectRpcApi<Rpc extends DurableObjectRpc<ROut>, ROut> = { readonly [Key in keyof Rpc]: Rpc[Key] extends ((...args: infer Args) => Effect.Effect<infer A, unknown, HandlerContext<ROut>>) ? (...args: Args) => Promise<A> : never; };
991
- type RpcHandlers<ROut, Api> = { readonly [Key in keyof Api as Key extends keyof DurableObject<WorkerEnv> ? never : Key extends string ? [Api[Key]] extends [never] ? never : Api[Key] extends ((...args: Array<any>) => Promise<any>) ? Key : never : never]: Api[Key] extends ((...args: infer Args) => Promise<infer A>) ? (...args: Args) => DurableObjectHandler<ROut, A> : never; };
992
- interface DurableObjectOptionsBase<RRuntime, REvent = never, EventLayerError = never, Rpc extends DurableObjectRpc<RRuntime | REvent | RAlarm> = Record<never, never>, RAlarm = never> {
993
- /**
994
- * Layer provided around each Cloudflare event handled by this Durable Object.
995
- *
996
- * The layer is built inside the event's Effect scope and finalized when the
997
- * event effect completes. It is not applied to `initialize`, which is an
998
- * instance-load lifecycle hook rather than a platform event.
999
- */
1000
- readonly eventLayer?: Layer.Layer<REvent, EventLayerError, RuntimeContext$1<NoInfer<RRuntime | RAlarm>>>;
1001
- /**
1002
- * Effect run when Cloudflare loads this Durable Object instance into memory.
1003
- *
1004
- * Use `DurableObjectState.blockConcurrencyWhile` inside this hook when
1005
- * incoming events should wait for setup to finish. Cloudflare may construct
1006
- * the same Durable Object id again after eviction or restart; use Durable
1007
- * Object storage if work must happen only once per id.
1008
- */
1009
- readonly initialize?: Effect.Effect<void, unknown, HandlerContext<NoInfer<RRuntime | RAlarm>>>;
1010
- /**
1011
- * Optional RPC methods exposed as Durable Object instance methods.
1012
- *
1013
- * After every invocation, the configured OTLP flusher is scheduled through
1014
- * `DurableObjectState.waitUntil`, including when the handler fails. The
1015
- * scheduled flush silently settles within two seconds even if the exporter
1016
- * does not.
1017
- */
1018
- readonly rpc?: Rpc;
1019
- /** Accept live native trace metadata. The client must also enable rpcTracing. */
1020
- readonly rpcTracing?: ReceiverOptions;
1021
- readonly fetch?: Effect.Effect<Response, unknown, FetchContext<NoInfer<RRuntime | REvent | RAlarm>>>;
1022
- /** Register handlers to provide their typed scheduler to application layers and all DO events. */
1023
- readonly alarms?: Effect.Effect<unknown, unknown, HandlerContext<NoInfer<RRuntime> | REvent | NoInfer<RAlarm>>> | AlarmRegistration<RAlarm, HandlerContext<NoInfer<RRuntime> | REvent | NoInfer<RAlarm>>, unknown>;
1024
- /**
1025
- * Optional raw alarm handler.
1026
- *
1027
- * After every invocation, the configured OTLP flusher is scheduled through
1028
- * `DurableObjectState.waitUntil`, including when the handler fails. The
1029
- * scheduled flush silently settles within two seconds even if the exporter
1030
- * does not.
1031
- */
1032
- readonly alarm?: (alarmInfo?: globalThis.AlarmInvocationInfo) => Effect.Effect<void, unknown, HandlerContext<NoInfer<RRuntime> | REvent | NoInfer<RAlarm>>>;
1033
- readonly webSocketMessage?: (socket: DurableWebSocket, message: string | ArrayBuffer) => Effect.Effect<void, unknown, HandlerContext<NoInfer<RRuntime> | REvent | NoInfer<RAlarm>>>;
1034
- readonly webSocketClose?: (socket: DurableWebSocket, code: number, reason: string, wasClean: boolean) => Effect.Effect<void, unknown, HandlerContext<NoInfer<RRuntime> | REvent | NoInfer<RAlarm>>>;
1035
- readonly webSocketError?: (socket: DurableWebSocket, cause: unknown) => Effect.Effect<void, unknown, HandlerContext<NoInfer<RRuntime> | REvent | NoInfer<RAlarm>>>;
1036
- }
1037
- type CheckAlarmRegistration<RProvided, RAlarm> = [Exclude<Extract<NoInfer<RProvided>, AlarmService>, NoInfer<RAlarm>>] extends [never] ? unknown : never;
1038
- /** A declared event or alarm service must have its corresponding provider. */
1039
- type DurableObjectOptions<RRuntime, REvent = never, EventLayerError = never, Rpc extends DurableObjectRpc<RRuntime | REvent | RAlarm> = Record<never, never>, RAlarm = never> = DurableObjectOptionsBase<RRuntime, REvent, EventLayerError, Rpc, RAlarm> & CheckAlarmRegistration<RRuntime | REvent, RAlarm> & ([Exclude<REvent, RuntimeContext$1<RRuntime | RAlarm> | Scope.Scope>] extends [never] ? unknown : {
1040
- readonly eventLayer: Layer.Layer<REvent, EventLayerError, RuntimeContext$1<NoInfer<RRuntime | RAlarm>>>;
1041
- }) & ([RAlarm] extends [never] ? unknown : {
1042
- readonly alarms: AlarmRegistration<RAlarm, HandlerContext<NoInfer<RRuntime> | REvent | NoInfer<RAlarm>>, unknown>;
1043
- });
1044
- /**
1045
- * Cloudflare `DurableObject` constructor produced by {@link make}.
1046
- */
1047
- type DurableObjectClass<Rpc extends DurableObjectRpc<ROut>, ROut> = new (state: globalThis.DurableObjectState, env: WorkerEnv) => DurableObject<WorkerEnv> & DurableObjectRpcApi<Rpc, ROut> & {
1048
- [RunSymbol]<A, E>(effect: Effect.Effect<A, E, HandlerContext<ROut>>, options?: RunOptions): Promise<A>;
1049
- };
1050
- /**
1051
- * Builds a Durable Object whose base `layer` lives for the in-memory instance.
1052
- * Cloudflare does not expose an eviction or shutdown hook, so finalizers in
1053
- * that layer are not guaranteed to run. Put resources that require timely
1054
- * release in `eventLayer`, whose scope closes after each handled event.
1055
- */
1056
- declare function make$6<ROut, LayerError>(layer: Layer.Layer<ROut, LayerError, RuntimeContext$1<never>> & CheckAlarmRegistration<ROut, never>): DurableObjectClass<Record<never, never>, ROut>;
1057
- declare function make$6<ROut, LayerError, REvent = never, EventLayerError = never, const Rpc extends DurableObjectRpc<NoInfer<ROut> | REvent | NoInfer<RAlarm>> = Record<never, never>, RAlarm = never>(layer: Layer.Layer<ROut, LayerError, RuntimeContext$1<NoInfer<RAlarm>>>, options: DurableObjectOptions<ROut, REvent, EventLayerError, Rpc, RAlarm>): DurableObjectClass<Rpc, ROut | REvent | RAlarm>;
1058
- declare namespace DurableObjectRpcWebSocket_d_exports {
1059
- export { DurableObjectRpcWebSocket, DurableObjectRpcWebSocketService, HeartbeatPolicy, LayerOptions$7 as LayerOptions, NativeWebSocketMessage, ResumableStreamDeclaration, RpcWebSocketAttachment, layer$6 as layer, resumableStream };
1060
- }
1061
- /** Heartbeat handling for Effect's application-level RPC Ping messages. */
1062
- type HeartbeatPolicy = "auto-response" | "passthrough";
1063
- type RpcWebSocketAttachment = object;
1064
- /** A resumable RPC stream declaration understood by the websocket transport. */
1065
- interface ResumableStreamDeclaration<ResumeDescriptor = unknown, Checkpoint = unknown> {
1066
- /** Stable declaration identifier. Change it when the persisted representation changes. */
1067
- readonly id: string;
1068
- readonly rpcTag: string;
1069
- /** Validates a resume descriptor restored from a websocket attachment. */
1070
- readonly resumeDescriptorSchema: Schema.Decoder<ResumeDescriptor>;
1071
- /** Validates an acknowledged checkpoint restored from a websocket attachment. */
1072
- readonly checkpointSchema: Schema.Decoder<Checkpoint>;
1073
- /**
1074
- * Extracts compact persisted state from an initial encoded request. Do not
1075
- * recycle a subscription key for an unrelated logical subscription while a
1076
- * delayed checkpoint for the previous subscription can still arrive.
1077
- */
1078
- readonly identify: (request: RpcMessage.RequestEncoded) => Option.Option<{
1079
- readonly subscriptionKey: string;
1080
- readonly resumeDescriptor: ResumeDescriptor;
1081
- readonly acknowledgedCheckpoint: Checkpoint;
1082
- }>;
1083
- readonly rebuild: (options: {
1084
- readonly subscriptionKey: string;
1085
- readonly resumeDescriptor: ResumeDescriptor;
1086
- readonly acknowledgedCheckpoint: Checkpoint;
1087
- }) => {
1088
- readonly payload: unknown;
1089
- readonly headers?: ReadonlyArray<readonly [string, string]> | undefined;
1090
- readonly traceId?: string | undefined;
1091
- readonly spanId?: string | undefined;
1092
- readonly sampled?: boolean | undefined;
1093
- };
1094
- /** Extracts the durable checkpoint represented by one encoded stream value. */
1095
- readonly checkpointFromValue: (value: RpcMessage.ResponseChunkEncoded["values"][number]) => Option.Option<Checkpoint>;
1096
- /**
1097
- * Produces the checkpoint wire token. A logical event must keep the same
1098
- * token when replayed, and unrelated events must never reuse it during the
1099
- * lifetime of a subscription key.
1100
- */
1101
- readonly checkpointToken: (checkpoint: Checkpoint) => string;
1102
- }
1103
- type AnyResumableStreamDeclaration = ResumableStreamDeclaration<any, any>;
1104
- /** Declares an explicitly resumable RPC stream. */
1105
- declare const resumableStream: <ResumeDescriptor, Checkpoint>(declaration: ResumableStreamDeclaration<ResumeDescriptor, Checkpoint>) => ResumableStreamDeclaration<ResumeDescriptor, Checkpoint>;
1106
- /**
1107
- * Configuration for {@link layer}.
1108
- */
1109
- interface LayerOptions$7 {
1110
- readonly tag?: string | undefined;
1111
- readonly attachmentKey?: string | undefined;
1112
- /**
1113
- * Heartbeat behavior. `"auto-response"` (the default) installs Cloudflare's
1114
- * hibernation-safe text Ping/Pong response while an RPC socket exists and no
1115
- * non-resumable RPC operation is active, then removes it while one is pending.
1116
- * `"passthrough"` leaves the Durable Object's existing auto-response
1117
- * configuration unchanged and makes the application responsible for waking a
1118
- * lost pending operation.
1119
- * Cloudflare's pair is global to the Durable Object, so use `"passthrough"`
1120
- * when RPC and unrelated websocket protocols share one object.
1121
- */
1122
- readonly heartbeat?: HeartbeatPolicy | undefined;
1123
- readonly resumableStreams?: ReadonlyArray<AnyResumableStreamDeclaration> | undefined;
1124
- }
1125
- type NativeWebSocketMessage = string | ArrayBuffer;
1126
- interface DurableObjectRpcWebSocketService {
1127
- /** Accept a server socket that has not already been accepted. */
1128
- readonly accept: (socket: DurableWebSocket, tags?: ReadonlyArray<string>) => Effect.Effect<void>;
1129
- /** Shallow-merges application attachment fields with the adapter's metadata namespace. */
1130
- readonly acceptUpgrade: <Attachment extends RpcWebSocketAttachment = RpcWebSocketAttachment>(options?: AcceptUpgradeOptions<Attachment>) => Effect.Effect<AcceptedUpgrade<Attachment>, DurableWebSocketAttachmentError>;
1131
- readonly message: (socket: DurableWebSocket, message: NativeWebSocketMessage) => Effect.Effect<void>;
1132
- readonly close: (socket: DurableWebSocket) => Effect.Effect<void>;
1133
- readonly error: (socket: DurableWebSocket, cause: unknown) => Effect.Effect<void>;
1134
- /**
1135
- * Persists forward checkpoint progress for a resumable stream. Returns `true`
1136
- * only when the checkpoint advances the current pending chunk batch. A failed
1137
- * websocket attachment write resets the connection and fails with
1138
- * `DurableWebSocketAttachmentError`.
1139
- */
1140
- readonly checkpoint: <ResumeDescriptor, Checkpoint>(declaration: ResumableStreamDeclaration<ResumeDescriptor, Checkpoint>, options: {
1141
- readonly clientId: number;
1142
- readonly subscriptionKey: string;
1143
- readonly checkpoint: Checkpoint;
1144
- }) => Effect.Effect<boolean, DurableWebSocketAttachmentError>;
1145
- }
1146
- declare const DurableObjectRpcWebSocket_base: Context.ServiceClass<DurableObjectRpcWebSocket, "effect-cf/DurableObjectRpcWebSocket", DurableObjectRpcWebSocketService>;
1147
- declare class DurableObjectRpcWebSocket extends DurableObjectRpcWebSocket_base {}
1148
- /**
1149
- * Builds a hibernation-aware transport that bridges Durable Object websocket
1150
- * events to `RpcServer.Protocol`.
1151
- *
1152
- * The layer restores idle tagged sockets and explicitly declared resumable
1153
- * streams after constructor recreation. A socket that lost any other in-flight
1154
- * request is closed with code 1012, which the stock Effect socket protocol
1155
- * reports as an `RpcClientError` containing `SocketCloseError`.
1156
- */
1157
- declare const layer$6: (options?: LayerOptions$7) => Layer.Layer<RpcServer.Protocol | DurableObjectRpcWebSocket, never, DurableObjectState | RpcSerialization.RpcSerialization>;
1158
- declare namespace DurableObjectSqlite_d_exports {
1159
- export { SqliteLayerOptions, layer$5 as layer };
1160
- }
1161
- type SqliteLayerOptions = Omit<SqliteClient.SqliteClientConfig, "db" | "storage">;
1162
- declare const layer$5: (options?: SqliteLayerOptions) => Layer.Layer<SqliteClient.SqliteClient | SqlClient.SqlClient, never, DurableObjectState>;
1163
- declare namespace Email_d_exports {
1164
- export { EmailAddress, EmailAttachment, EmailBinding, EmailClient, EmailDefinition, EmailErrorCode, EmailMessageBuilder, EmailOperationError, EmailRecipients, EmailSendError, EmailSendOptions, EmailSendResult, EmailService, EmailValidationError, EmailViolation, LayerOptions$6 as LayerOptions, Tag$6 as Tag, TagClass$6 as TagClass, emailErrorCodes, isEmailBinding, layer$4 as layer, make$5 as make, makeClient$4 as makeClient, sendLimits, validateMessage };
1165
- }
1166
- declare const sendLimits: {
1167
- readonly maxRecipients: 50;
1168
- readonly maxAttachments: 32;
1169
- readonly maxMessageBytes: number;
1170
- readonly maxHeaderNameBytes: 100;
1171
- readonly maxHeaderValueBytes: 2048;
1172
- readonly maxHeadersBytes: number;
1173
- readonly maxAllowlistHeaders: 20;
1174
- };
1175
- /**
1176
- * Error codes reported by Cloudflare Email Sending.
1177
- *
1178
- * Surfaced on {@link EmailOperationError} `code` on a best-effort basis: the
1179
- * runtime attaches them as a non-standard `code` property on thrown errors,
1180
- * which may be missing depending on the runtime or dev-time proxying
1181
- * (miniflare remote bindings serialize errors and can strip it).
1182
- */
1183
- declare const emailErrorCodes: readonly ["E_VALIDATION_ERROR", "E_FIELD_MISSING", "E_TOO_MANY_RECIPIENTS", "E_TOO_MANY_ATTACHMENTS", "E_SENDER_NOT_VERIFIED", "E_RECIPIENT_NOT_ALLOWED", "E_RECIPIENT_SUPPRESSED", "E_SENDER_DOMAIN_NOT_AVAILABLE", "E_CONTENT_TOO_LARGE", "E_DELIVERY_FAILED", "E_RATE_LIMIT_EXCEEDED", "E_DAILY_LIMIT_EXCEEDED", "E_INTERNAL_SERVER_ERROR", "E_HEADER_NOT_ALLOWED", "E_HEADER_USE_API_FIELD", "E_HEADER_VALUE_INVALID", "E_HEADER_VALUE_TOO_LONG", "E_HEADER_NAME_INVALID", "E_HEADERS_TOO_LARGE", "E_HEADERS_TOO_MANY"];
1184
- type EmailErrorCode = (typeof emailErrorCodes)[number];
1185
- declare const EmailOperationError_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 & {
1186
- readonly _tag: "EmailOperationError";
1187
- } & Readonly<A>;
1188
- declare class EmailOperationError extends EmailOperationError_base<{
1189
- readonly binding: string;
1190
- readonly operation: string;
1191
- readonly cause: unknown;
1192
- /**
1193
- * Cloudflare error code taken from the thrown error, when present.
1194
- *
1195
- * Best-effort: may be `undefined` depending on the runtime or dev-time
1196
- * proxying — miniflare remote bindings (`"remote": true`) serialize thrown
1197
- * errors and can strip the non-standard `code` property.
1198
- */
1199
- readonly code?: EmailErrorCode | (string & {});
1200
- }> {
1201
- get message(): string;
1202
- }
1203
- interface EmailViolation {
1204
- readonly path: string;
1205
- readonly message: string;
1206
- readonly limit?: number;
1207
- readonly actual?: number;
1208
- }
1209
- declare const EmailValidationError_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 & {
1210
- readonly _tag: "EmailValidationError";
1211
- } & Readonly<A>;
1212
- declare class EmailValidationError extends EmailValidationError_base<{
1213
- readonly binding: string;
1214
- readonly operation: string;
1215
- readonly violations: ReadonlyArray<EmailViolation>;
1216
- }> {
1217
- get message(): string;
1218
- }
1219
- interface EmailDefinition {
1220
- readonly binding: string;
1221
- }
1222
- type EmailAddress = CloudflareEmailAddress;
1223
- type EmailAttachment = CloudflareEmailAttachment;
1224
- type EmailMessageBuilder = Parameters<CloudflareSendEmail["send"]>[0];
1225
- type EmailSendResult = CloudflareEmailSendResult;
1226
- type EmailBinding = CloudflareSendEmail;
1227
- type EmailRecipients = string | EmailAddress | ReadonlyArray<string | EmailAddress>;
1228
- type EmailSendError = EmailOperationError | EmailValidationError;
1229
- interface EmailSendOptions {
1230
- readonly validate?: boolean;
1231
- }
1232
- interface EmailClient {
1233
- readonly send: (message: EmailMessageBuilder) => Effect.Effect<EmailSendResult, EmailSendError>;
1234
- readonly rawUnsafe: Effect.Effect<EmailBinding>;
1235
- readonly definition: EmailDefinition;
1236
- }
1237
- declare const EmailServiceTypeId: unique symbol;
1238
- interface EmailService<Id extends string> {
1239
- readonly [EmailServiceTypeId]: {
1240
- readonly id: Id;
1241
- };
1242
- }
1243
- type LayerOptions$6 = {
1244
- readonly binding: string;
1245
- readonly send?: EmailSendOptions;
1246
- };
1247
- interface TagClass$6<Self, Id extends string> extends Context.ServiceClass<Self, Id, EmailClient> {
1248
- readonly id: Id;
1249
- readonly layer: (options: LayerOptions$6) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
1250
- }
1251
- /**
1252
- * Validates a structured message against documented Cloudflare Email Sending
1253
- * limits and returns every violation found. Total message size is not checked
1254
- * because the encoded MIME size is only known once Cloudflare composes it.
1255
- */
1256
- declare const validateMessage: (message: EmailMessageBuilder) => ReadonlyArray<EmailViolation>;
1257
- declare const isEmailBinding: <Candidate>(value: Candidate) => value is Candidate & EmailBinding;
1258
- declare const makeClient$4: (definition: EmailDefinition, options?: EmailSendOptions) => (email: EmailBinding) => EmailClient;
1259
- declare const layer$4: <Self>(tag: Context.Service<Self, EmailClient>, definition: LayerOptions$6) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
1260
- declare const make$5: <Id extends string>(id: Id) => TagClass$6<EmailService<Id>, Id>;
1261
- declare const Tag$6: <Self>() => <Id extends string>(id: Id) => TagClass$6<Self, Id>;
1262
- declare namespace Images_d_exports {
1263
- export { DrawStepOptions, HostedImagesClient, ImageDirectUploadOptions, ImageDirectUploadResult, ImageDrawOptions, ImageHandleClient, ImageInfoResponse, ImageInputOptions, ImageInputValue, ImageList, ImageListOptions, ImageMetadata, ImageOutputOptions, ImageSignedUrlOptions, ImageTransform, ImageTransformationOutputOptions, ImageTransformationResponseOptions, ImageTransformationResult, ImageUpdateOptions, ImageUploadOptions, ImageUploadValue, ImagesClient, ImagesDefinition, ImagesOperationError, ImagesRuntimeBinding, ImagesService, ImagesTransformationResultClient, LayerOptions$5 as LayerOptions, ProcessOptions, Step, Steps, Tag$5 as Tag, TagClass$5 as TagClass, TextOptions, TypeId, draw, empty, isImagesBinding, layer$3 as layer, make$4 as make, makeClient$3 as makeClient, transform };
1264
- }
1265
- declare const TypeId: "~effect-cf/Images/Steps";
1266
- type TypeId = typeof TypeId;
1267
- declare const ImagesOperationError_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 & {
1268
- readonly _tag: "ImagesOperationError";
1269
- } & Readonly<A>;
1270
- declare class ImagesOperationError extends ImagesOperationError_base<{
1271
- readonly binding: string;
1272
- readonly operation: string;
1273
- readonly cause: unknown;
1274
- }> {
1275
- get message(): string;
1276
- }
1277
- interface ImagesDefinition {
1278
- readonly binding: string;
1279
- }
1280
- type ImageInfoResponse = CloudflareImageInfoResponse;
1281
- type ImageTransform = CloudflareImageTransform;
1282
- type ImageDrawOptions = CloudflareImageDrawOptions;
1283
- type ImageInputOptions = CloudflareImageInputOptions;
1284
- type ImageOutputOptions = CloudflareImageOutputOptions;
1285
- type ImageTransformationOutputOptions = CloudflareImageTransformationOutputOptions;
1286
- type ImageTransformationResponseOptions = CloudflareImageTransformationResponseOptions;
1287
- type ImageTransformationResult = CloudflareImageTransformationResult;
1288
- type ImageUploadOptions = CloudflareImageUploadOptions;
1289
- type ImageUpdateOptions = CloudflareImageUpdateOptions;
1290
- type ImageListOptions = CloudflareImageListOptions;
1291
- type ImageList = CloudflareImageList;
1292
- type ImageMetadata = CloudflareImageMetadata;
1293
- type ImageSignedUrlOptions = CloudflareImageSignedUrlOptions;
1294
- type ImageDirectUploadOptions = CloudflareImageDirectUploadOptions;
1295
- type ImageDirectUploadResult = CloudflareImageDirectUploadResult;
1296
- type TextOptions = CloudflareTextOptions;
1297
- type ImageInputValue = ReadableStream<Uint8Array> | ArrayBuffer;
1298
- type ImageUploadValue = ReadableStream<Uint8Array> | ArrayBuffer;
1299
- interface DrawStepOptions {
1300
- readonly image: ReadableStream<Uint8Array> | CloudflareImageTransformer;
1301
- readonly options?: ImageDrawOptions;
1302
- }
1303
- type Step = Data.TaggedEnum<{
1304
- readonly Transform: {
1305
- readonly transform: ImageTransform;
1306
- };
1307
- readonly Draw: DrawStepOptions;
1308
- }>;
1309
- declare const Step: {
1310
- readonly $is: <Tag extends "Draw" | "Transform">(tag: Tag) => (u: unknown) => u is Extract<{
1311
- readonly _tag: "Draw";
1312
- readonly image: ReadableStream<Uint8Array> | CloudflareImageTransformer;
1313
- readonly options?: ImageDrawOptions;
1314
- }, {
1315
- readonly _tag: Tag;
1316
- }> | Extract<{
1317
- readonly _tag: "Transform";
1318
- readonly transform: ImageTransform;
1319
- }, {
1320
- readonly _tag: Tag;
1321
- }>;
1322
- readonly $match: {
1323
- <Cases extends { readonly [Tag in "Draw" | "Transform"]: (args: Extract<{
1324
- readonly _tag: "Draw";
1325
- readonly image: ReadableStream<Uint8Array> | CloudflareImageTransformer;
1326
- readonly options?: ImageDrawOptions;
1327
- } | {
1328
- readonly _tag: "Transform";
1329
- readonly transform: ImageTransform;
1330
- }, {
1331
- readonly _tag: Tag;
1332
- }>) => any; }>(cases: Cases): (value: {
1333
- readonly _tag: "Draw";
1334
- readonly image: ReadableStream<Uint8Array> | CloudflareImageTransformer;
1335
- readonly options?: ImageDrawOptions;
1336
- } | {
1337
- readonly _tag: "Transform";
1338
- readonly transform: ImageTransform;
1339
- }) => import("effect/Unify").Unify<ReturnType<Cases["Draw" | "Transform"]>>;
1340
- <Cases extends { readonly [Tag in "Draw" | "Transform"]: (args: Extract<{
1341
- readonly _tag: "Draw";
1342
- readonly image: ReadableStream<Uint8Array> | CloudflareImageTransformer;
1343
- readonly options?: ImageDrawOptions;
1344
- } | {
1345
- readonly _tag: "Transform";
1346
- readonly transform: ImageTransform;
1347
- }, {
1348
- readonly _tag: Tag;
1349
- }>) => any; }>(value: {
1350
- readonly _tag: "Draw";
1351
- readonly image: ReadableStream<Uint8Array> | CloudflareImageTransformer;
1352
- readonly options?: ImageDrawOptions;
1353
- } | {
1354
- readonly _tag: "Transform";
1355
- readonly transform: ImageTransform;
1356
- }, cases: Cases): import("effect/Unify").Unify<ReturnType<Cases["Draw" | "Transform"]>>;
1357
- };
1358
- readonly Draw: Data.TaggedEnum.ConstructorFrom<{
1359
- readonly _tag: "Draw";
1360
- readonly image: ReadableStream<Uint8Array> | CloudflareImageTransformer;
1361
- readonly options?: ImageDrawOptions;
1362
- }, "_tag">;
1363
- readonly Transform: Data.TaggedEnum.ConstructorFrom<{
1364
- readonly _tag: "Transform";
1365
- readonly transform: ImageTransform;
1366
- }, "_tag">;
1367
- };
1368
- interface Steps {
1369
- readonly [TypeId]: typeof TypeId;
1370
- readonly steps: ReadonlyArray<Step>;
1371
- }
1372
- type ProcessOptions = {
1373
- readonly stream: ImageInputValue;
1374
- readonly inputOptions?: ImageInputOptions;
1375
- readonly outputOptions: ImageOutputOptions;
1376
- } | {
1377
- readonly text: string;
1378
- readonly textOptions: TextOptions;
1379
- readonly outputOptions: ImageOutputOptions;
1380
- };
1381
- interface ImagesTransformationResultClient {
1382
- readonly raw: CloudflareImageTransformationResult;
1383
- readonly response: (options?: ImageTransformationResponseOptions) => Effect.Effect<CloudflareResponse, ImagesOperationError>;
1384
- readonly contentType: Effect.Effect<string, ImagesOperationError>;
1385
- readonly image: (options?: ImageTransformationOutputOptions) => Effect.Effect<ReadableStream<Uint8Array>, ImagesOperationError>;
1386
- }
1387
- interface ImageHandleClient {
1388
- readonly raw: CloudflareImageHandle;
1389
- readonly details: Effect.Effect<Option.Option<ImageMetadata>, ImagesOperationError>;
1390
- readonly bytes: Effect.Effect<Option.Option<ReadableStream<Uint8Array>>, ImagesOperationError>;
1391
- readonly signedUrl: (options: ImageSignedUrlOptions) => Effect.Effect<string, ImagesOperationError>;
1392
- readonly update: (options: ImageUpdateOptions) => Effect.Effect<ImageMetadata, ImagesOperationError>;
1393
- readonly delete: Effect.Effect<boolean, ImagesOperationError>;
1394
- }
1395
- interface HostedImagesClient {
1396
- readonly image: (imageId: string) => ImageHandleClient;
1397
- readonly upload: (image: ImageUploadValue, options?: ImageUploadOptions) => Effect.Effect<ImageMetadata, ImagesOperationError>;
1398
- readonly list: (options?: ImageListOptions) => Effect.Effect<ImageList, ImagesOperationError>;
1399
- readonly createDirectUpload: (options?: ImageDirectUploadOptions) => Effect.Effect<ImageDirectUploadResult, ImagesOperationError>;
1400
- readonly rawUnsafe: Effect.Effect<CloudflareHostedImagesBinding>;
1401
- }
1402
- interface ImagesRuntimeBinding {
1403
- readonly info: (image: ImageInputValue, options?: ImageInputOptions) => Promise<ImageInfoResponse>;
1404
- readonly input: (image: ImageInputValue, options?: ImageInputOptions) => CloudflareImageTransformer;
1405
- readonly text?: (content: string, options: TextOptions) => CloudflareImageTransformer;
1406
- readonly hosted?: CloudflareHostedImagesBinding;
1407
- }
1408
- interface ImagesClient {
1409
- readonly info: (image: ImageInputValue, options?: ImageInputOptions) => Effect.Effect<ImageInfoResponse, ImagesOperationError>;
1410
- readonly input: (image: ImageInputValue, options?: ImageInputOptions) => Effect.Effect<CloudflareImageTransformer, ImagesOperationError>;
1411
- readonly text: (content: string, options: TextOptions) => Effect.Effect<CloudflareImageTransformer, ImagesOperationError>;
1412
- readonly process: (steps: Steps, options: ProcessOptions) => Effect.Effect<ImagesTransformationResultClient, ImagesOperationError>;
1413
- readonly hosted: Option.Option<HostedImagesClient>;
1414
- readonly rawUnsafe: Effect.Effect<ImagesRuntimeBinding>;
1415
- readonly definition: ImagesDefinition;
1416
- }
1417
- declare const ImagesServiceTypeId: unique symbol;
1418
- interface ImagesService<Id extends string> {
1419
- readonly [ImagesServiceTypeId]: {
1420
- readonly id: Id;
1421
- };
1422
- }
1423
- type LayerOptions$5 = {
1424
- readonly binding: string;
1425
- };
1426
- interface TagClass$5<Self, Id extends string> extends Context.ServiceClass<Self, Id, ImagesClient> {
1427
- readonly id: Id;
1428
- readonly layer: (options: LayerOptions$5) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
1429
- }
1430
- declare const empty: Steps;
1431
- declare const transform: {
1432
- (transform: ImageTransform): (steps: Steps) => Steps;
1433
- (steps: Steps, transform: ImageTransform): Steps;
1434
- };
1435
- declare const draw: {
1436
- (draw: DrawStepOptions): (steps: Steps) => Steps;
1437
- (steps: Steps, draw: DrawStepOptions): Steps;
1438
- };
1439
- declare const isImagesBinding: <Candidate>(value: Candidate) => value is Candidate & ImagesRuntimeBinding;
1440
- declare const makeClient$3: (definition: ImagesDefinition) => (images: ImagesRuntimeBinding) => ImagesClient;
1441
- declare const layer$3: <Self>(tag: Context.Service<Self, ImagesClient>, definition: ImagesDefinition) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
1442
- declare const make$4: <Id extends string>(id: Id) => TagClass$5<ImagesService<Id>, Id>;
1443
- declare const Tag$5: <Self>() => <Id extends string>(id: Id) => TagClass$5<Self, Id>;
1444
- declare namespace Kv_d_exports {
1445
- export { Definition$2 as Definition, KvClient, KvDefinition, KvListKey, KvListOptions, KvListResult, KvOperation, KvOperationError, KvPutOptions, KvWithMetadata, LayerOptions$4 as LayerOptions, Tag$4 as Tag, TagClass$4 as TagClass, isKvNamespace, layer$2 as layer, makeClient$2 as makeClient };
1446
- }
1447
- type KvOperation = "put" | "get" | "getWithMetadata" | "list" | "delete";
1448
- declare const KvOperationError_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 & {
1449
- readonly _tag: "KvOperationError";
1450
- } & Readonly<A>;
1451
- declare class KvOperationError extends KvOperationError_base<{
1452
- readonly binding: string;
1453
- readonly operation: KvOperation;
1454
- readonly cause: unknown;
1455
- }> {
1456
- get message(): string;
1457
- }
1458
- type KvPutOptions = CloudflareKVNamespacePutOptions;
1459
- type KvListOptions<Metadata = unknown> = CloudflareKVNamespaceListOptions & {
1460
- readonly metadataSchema?: Schema.Codec<Metadata, unknown>;
1461
- };
1462
- interface KvWithMetadata<Value, Metadata> {
1463
- readonly value: Value;
1464
- readonly metadata: Option.Option<Metadata>;
1465
- readonly cacheStatus: Option.Option<string>;
1466
- }
1467
- interface KvListKey<Key, Metadata = unknown> {
1468
- readonly name: Key;
1469
- readonly expiration: Option.Option<number>;
1470
- readonly metadata: Option.Option<Metadata>;
1471
- }
1472
- interface KvListResult<Key, Metadata = unknown> {
1473
- readonly keys: ReadonlyArray<KvListKey<Key, Metadata>>;
1474
- readonly listComplete: boolean;
1475
- readonly cursor: Option.Option<string>;
1476
- readonly cacheStatus: Option.Option<string>;
1477
- }
1478
- interface KvDefinition<Key, Value, EncodedValue> {
1479
- readonly binding: string;
1480
- readonly key: Schema.Codec<Key, string>;
1481
- readonly value: Schema.Codec<Value, EncodedValue>;
1482
- }
1483
- /**
1484
- * Reusable typed KV resource definition without a concrete Cloudflare binding name.
1485
- */
1486
- interface Definition$2<Id extends string = string, Key = unknown, Value = unknown, EncodedValue = unknown> {
1487
- readonly id: Id;
1488
- readonly key: Schema.Codec<Key, string>;
1489
- readonly value: Schema.Codec<Value, EncodedValue>;
1490
- }
1491
- declare namespace Definition$2 {
1492
- type Any = Definition$2<string, any, any, any>;
1493
- }
1494
- interface KvClient<Key, Value, EncodedValue> {
1495
- readonly put: (key: Key, value: Value, options?: KvPutOptions) => Effect.Effect<void, KvOperationError | Schema.SchemaError>;
1496
- readonly get: (key: Key) => Effect.Effect<Option.Option<Value>, KvOperationError | Schema.SchemaError>;
1497
- readonly getWithMetadata: <Metadata>(key: Key, metadataSchema: Schema.Codec<Metadata, unknown>) => Effect.Effect<Option.Option<KvWithMetadata<Value, Metadata>>, KvOperationError | Schema.SchemaError>;
1498
- readonly list: <Metadata = unknown>(options?: KvListOptions<Metadata>) => Effect.Effect<KvListResult<Key, Metadata>, KvOperationError | Schema.SchemaError>;
1499
- readonly delete: (key: Key) => Effect.Effect<void, KvOperationError | Schema.SchemaError>;
1500
- readonly rawUnsafe: Effect.Effect<KVNamespace>;
1501
- readonly definition: KvDefinition<Key, Value, EncodedValue>;
1502
- }
1503
- type LayerOptions$4 = {
1504
- readonly binding: string;
1505
- };
1506
- interface TagClass$4<Self, Id extends string, Key, Value, EncodedValue> extends Context.ServiceClass<Self, Id, KvClient<Key, Value, EncodedValue>> {
1507
- readonly id: Id;
1508
- readonly keySchema: Schema.Codec<Key, string>;
1509
- readonly valueSchema: Schema.Codec<Value, EncodedValue>;
1510
- readonly layer: (options: LayerOptions$4) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
1511
- }
1512
- declare const isKvNamespace: <Candidate>(value: Candidate) => value is Candidate & KVNamespace;
1513
- declare const makeClient$2: <Key, Value, EncodedValue>(definition: KvDefinition<Key, Value, EncodedValue>) => ((kv: KVNamespace) => KvClient<Key, Value, EncodedValue>);
1514
- declare const layer$2: <Self, Key, Value, EncodedValue>(tag: Context.Service<Self, KvClient<Key, Value, EncodedValue>>, definition: KvDefinition<Key, Value, EncodedValue>) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
1515
- declare const Tag$4: <Self>() => <Id extends string, Key, Value, EncodedValue>(id: Id, definition: {
1516
- readonly key: Schema.Codec<Key, string>;
1517
- readonly value: Schema.Codec<Value, EncodedValue>;
1518
- }) => TagClass$4<Self, Id, Key, Value, EncodedValue>;
1519
- declare namespace R2_d_exports {
1520
- export { LayerOptions$3 as LayerOptions, R2Client, R2Definition, R2GetOptions, R2ListOptions, R2MultipartOptions, R2MultipartUploadClient, R2ObjectBodyClient, R2Operation, R2OperationError, R2PutOptions, R2PutValue, R2Service, R2UploadPartOptions, R2UploadPartValue, Tag$3 as Tag, TagClass$3 as TagClass, isR2Bucket, layer$1 as layer, make$3 as make, makeClient$1 as makeClient };
1521
- }
1522
- type R2Operation = "head" | "get" | "put" | "delete" | "list" | "createMultipartUpload" | "resumeMultipartUpload" | "uploadPart" | "abortMultipartUpload" | "completeMultipartUpload" | "arrayBuffer" | "bytes" | "text" | "json" | "blob";
1523
- declare const R2OperationError_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 & {
1524
- readonly _tag: "R2OperationError";
1525
- } & Readonly<A>;
1526
- declare class R2OperationError extends R2OperationError_base<{
1527
- readonly binding: string;
1528
- readonly operation: R2Operation;
1529
- readonly cause: unknown;
1530
- }> {
1531
- get message(): string;
1532
- }
1533
- interface R2Definition {
1534
- readonly binding: string;
1535
- }
1536
- type R2GetOptions = CloudflareR2GetOptions;
1537
- type R2PutOptions = CloudflareR2PutOptions;
1538
- type R2ListOptions = CloudflareR2ListOptions;
1539
- type R2MultipartOptions = CloudflareR2MultipartOptions;
1540
- type R2UploadPartOptions = CloudflareR2UploadPartOptions;
1541
- type R2PutValue = ReadableStream | ArrayBuffer | ArrayBufferView | string | null | Blob;
1542
- type R2UploadPartValue = ReadableStream | ArrayBuffer | ArrayBufferView | string | Blob;
1543
- interface R2ObjectBodyClient extends Omit<CloudflareR2ObjectBody, "arrayBuffer" | "blob" | "bytes" | "json" | "text"> {
1544
- readonly raw: CloudflareR2ObjectBody;
1545
- readonly arrayBuffer: Effect.Effect<ArrayBuffer, R2OperationError>;
1546
- readonly bytes: Effect.Effect<Uint8Array, R2OperationError>;
1547
- readonly text: Effect.Effect<string, R2OperationError>;
1548
- readonly json: <T = unknown>() => Effect.Effect<T, R2OperationError>;
1549
- readonly blob: Effect.Effect<Blob, R2OperationError>;
1550
- }
1551
- interface R2MultipartUploadClient {
1552
- readonly raw: CloudflareR2MultipartUpload;
1553
- readonly key: string;
1554
- readonly uploadId: string;
1555
- readonly uploadPart: (partNumber: number, value: R2UploadPartValue, options?: R2UploadPartOptions) => Effect.Effect<CloudflareR2UploadedPart, R2OperationError>;
1556
- readonly abort: Effect.Effect<void, R2OperationError>;
1557
- readonly complete: (uploadedParts: ReadonlyArray<CloudflareR2UploadedPart>) => Effect.Effect<CloudflareR2Object, R2OperationError>;
1558
- }
1559
- interface R2Client {
1560
- readonly head: (key: string) => Effect.Effect<Option.Option<CloudflareR2Object>, R2OperationError>;
1561
- readonly get: {
1562
- (key: string, options: R2GetOptions & {
1563
- readonly onlyIf: CloudflareR2Conditional | Headers;
1564
- }): Effect.Effect<Option.Option<R2ObjectBodyClient | CloudflareR2Object>, R2OperationError>;
1565
- (key: string, options?: R2GetOptions): Effect.Effect<Option.Option<R2ObjectBodyClient>, R2OperationError>;
1566
- };
1567
- readonly put: {
1568
- (key: string, value: R2PutValue, options: R2PutOptions & {
1569
- readonly onlyIf: CloudflareR2Conditional | Headers;
1570
- }): Effect.Effect<Option.Option<CloudflareR2Object>, R2OperationError>;
1571
- (key: string, value: R2PutValue, options?: R2PutOptions): Effect.Effect<CloudflareR2Object, R2OperationError>;
1572
- };
1573
- readonly createMultipartUpload: (key: string, options?: R2MultipartOptions) => Effect.Effect<R2MultipartUploadClient, R2OperationError>;
1574
- readonly resumeMultipartUpload: (key: string, uploadId: string) => Effect.Effect<R2MultipartUploadClient, R2OperationError>;
1575
- readonly delete: (keys: string | ReadonlyArray<string>) => Effect.Effect<void, R2OperationError>;
1576
- readonly list: (options?: R2ListOptions) => Effect.Effect<CloudflareR2Objects, R2OperationError>;
1577
- readonly rawUnsafe: Effect.Effect<CloudflareR2Bucket>;
1578
- readonly definition: R2Definition;
1579
- }
1580
- declare const R2ServiceTypeId: unique symbol;
1581
- interface R2Service<Id extends string> {
1582
- readonly [R2ServiceTypeId]: {
1583
- readonly id: Id;
1584
- };
1585
- }
1586
- type LayerOptions$3 = {
1587
- readonly binding: string;
1588
- };
1589
- interface TagClass$3<Self, Id extends string> extends Context.ServiceClass<Self, Id, R2Client> {
1590
- readonly id: Id;
1591
- readonly layer: (options: LayerOptions$3) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
1592
- }
1593
- type R2BindingValue = Schema.Schema.Type<typeof Schema.Unknown>;
1594
- declare const isR2Bucket: (value: R2BindingValue) => value is CloudflareR2Bucket;
1595
- declare const makeClient$1: (definition: R2Definition) => ((bucket: CloudflareR2Bucket) => R2Client);
1596
- declare const layer$1: <Self>(tag: Context.Service<Self, R2Client>, definition: R2Definition) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
1597
- declare const make$3: <Id extends string>(id: Id) => TagClass$3<R2Service<Id>, Id>;
1598
- declare const Tag$3: <Self>() => <Id extends string>(id: Id) => TagClass$3<Self, Id>;
1599
- declare namespace Vectorize_d_exports {
1600
- export { LayerOptions$2 as LayerOptions, Tag$2 as Tag, TagClass$2 as TagClass, VectorizeBinding, VectorizeClient, VectorizeDefinition, VectorizeIndexDetails, VectorizeIndexInfo, VectorizeMatch, VectorizeMatches, VectorizeMutation, VectorizeOperation, VectorizeOperationError, VectorizeQueryOptions, VectorizeService, VectorizeValues, VectorizeVector, VectorizeVectorMetadata, VectorizeVectorMetadataFilter, VectorizeVectorMetadataValue, isVectorizeBinding, layer, make$2 as make, makeClient };
1601
- }
1602
- type VectorizeOperation = "describe" | "query" | "queryById" | "insert" | "upsert" | "deleteByIds" | "getByIds";
1603
- declare const VectorizeOperationError_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 & {
1604
- readonly _tag: "VectorizeOperationError";
1605
- } & Readonly<A>;
1606
- declare class VectorizeOperationError extends VectorizeOperationError_base<{
1607
- readonly binding: string;
1608
- readonly operation: VectorizeOperation;
1609
- readonly cause: unknown;
1610
- }> {
1611
- get message(): string;
1612
- }
1613
- interface VectorizeDefinition {
1614
- readonly binding: string;
1615
- }
1616
- type VectorizeBinding = CloudflareVectorize | CloudflareVectorizeIndex;
1617
- type VectorizeVector = CloudflareVectorizeVector;
1618
- type VectorizeVectorMetadata = CloudflareVectorizeVectorMetadata;
1619
- type VectorizeVectorMetadataValue = CloudflareVectorizeVectorMetadataValue;
1620
- type VectorizeVectorMetadataFilter = CloudflareVectorizeVectorMetadataFilter;
1621
- type VectorizeQueryOptions = CloudflareVectorizeQueryOptions;
1622
- type VectorizeMatches = CloudflareVectorizeMatches;
1623
- type VectorizeMatch = CloudflareVectorizeMatch;
1624
- type VectorizeIndexInfo = CloudflareVectorizeIndexInfo;
1625
- type VectorizeIndexDetails = CloudflareVectorizeIndexDetails;
1626
- type VectorizeMutation = CloudflareVectorizeAsyncMutation | CloudflareVectorizeVectorMutation;
1627
- type VectorizeValues = Float32Array | Float64Array | ReadonlyArray<number>;
1628
- interface VectorizeClient {
1629
- readonly describe: Effect.Effect<VectorizeIndexInfo | VectorizeIndexDetails, VectorizeOperationError>;
1630
- readonly query: (vector: VectorizeValues, options?: VectorizeQueryOptions) => Effect.Effect<VectorizeMatches, VectorizeOperationError>;
1631
- readonly queryById: (vectorId: string, options?: VectorizeQueryOptions) => Effect.Effect<VectorizeMatches, VectorizeOperationError>;
1632
- readonly insert: (vectors: ReadonlyArray<VectorizeVector>) => Effect.Effect<VectorizeMutation, VectorizeOperationError>;
1633
- readonly upsert: (vectors: ReadonlyArray<VectorizeVector>) => Effect.Effect<VectorizeMutation, VectorizeOperationError>;
1634
- readonly deleteByIds: (ids: ReadonlyArray<string>) => Effect.Effect<VectorizeMutation, VectorizeOperationError>;
1635
- readonly delete: (ids: ReadonlyArray<string>) => Effect.Effect<VectorizeMutation, VectorizeOperationError>;
1636
- readonly getByIds: (ids: ReadonlyArray<string>) => Effect.Effect<ReadonlyArray<VectorizeVector>, VectorizeOperationError>;
1637
- readonly rawUnsafe: Effect.Effect<VectorizeBinding>;
1638
- readonly definition: VectorizeDefinition;
1639
- }
1640
- declare const VectorizeServiceTypeId: unique symbol;
1641
- interface VectorizeService<Id extends string> {
1642
- readonly [VectorizeServiceTypeId]: {
1643
- readonly id: Id;
1644
- };
1645
- }
1646
- type LayerOptions$2 = {
1647
- readonly binding: string;
1648
- };
1649
- interface TagClass$2<Self, Id extends string> extends Context.ServiceClass<Self, Id, VectorizeClient> {
1650
- readonly id: Id;
1651
- readonly layer: (options: LayerOptions$2) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
1652
- }
1653
- type VectorizeBindingValue = Schema.Schema.Type<typeof Schema.Unknown>;
1654
- declare const isVectorizeBinding: (value: VectorizeBindingValue) => value is VectorizeBinding;
1655
- declare const makeClient: (definition: VectorizeDefinition) => (index: VectorizeBinding) => VectorizeClient;
1656
- declare const layer: <Self>(tag: Context.Service<Self, VectorizeClient>, definition: VectorizeDefinition) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
1657
- declare const make$2: <Id extends string>(id: Id) => TagClass$2<VectorizeService<Id>, Id>;
1658
- declare const Tag$2: <Self>() => <Id extends string>(id: Id) => TagClass$2<Self, Id>;
1659
- declare namespace WebTransport_d_exports {
1660
- export { Capabilities, InboundTransport, WebTransportCapability, WebTransportUnsupportedError, capabilities, inboundSessionsUnsupported, inboundTransport, isHttp3 };
1661
- }
1662
- declare const InboundTransport_base: Schema.Class<InboundTransport, Schema.Struct<{
1663
- readonly httpProtocol: Schema.String;
1664
- readonly clientQuicRtt: Schema.optional<Schema.Number>;
1665
- readonly clientTcpRtt: Schema.optional<Schema.Number>;
1666
- }>, {}>;
1667
- /**
1668
- * Metadata Cloudflare's edge reports about the inbound client connection.
1669
- *
1670
- * `httpProtocol` and `clientTcpRtt` are declared in
1671
- * `@cloudflare/workers-types`; `clientQuicRtt` is documented by Cloudflare
1672
- * ("only present when the client connected over QUIC (HTTP/3)") but not yet
1673
- * present in the published types, so it is decoded from the open
1674
- * `Record<string, unknown>` side of `request.cf`.
1675
- */
1676
- declare class InboundTransport extends InboundTransport_base {}
1677
- /**
1678
- * Decodes the inbound transport metadata from `request.cf`.
1679
- *
1680
- * Returns `None` when the metadata is absent (for example in local `wrangler
1681
- * dev` or when a Worker invokes another Worker directly) or does not match
1682
- * the expected shape.
1683
- */
1684
- declare const inboundTransport: (request: Pick<CloudflareRequest, "cf">) => Option.Option<InboundTransport>;
1685
- declare const isHttp3: (transport: InboundTransport) => boolean;
1686
- interface Capabilities {
1687
- /**
1688
- * Whether Worker code can accept inbound WebTransport sessions. Typed as
1689
- * literally `false`: no such runtime API exists (cloudflare/workerd#6451),
1690
- * so this can only change through a breaking, deliberate update when
1691
- * Cloudflare ships one.
1692
- */
1693
- readonly inboundSessions: false;
1694
- /**
1695
- * Whether the runtime exposes a client `WebTransport` constructor global.
1696
- * Feature-detected at runtime; `false` in workerd today, which has no
1697
- * QUIC stack.
1698
- */
1699
- readonly outboundSessions: boolean;
1700
- }
1701
- declare const capabilities: Effect.Effect<Capabilities>;
1702
- type WebTransportCapability = "inbound-sessions" | "outbound-sessions";
1703
- declare const WebTransportUnsupportedError_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 & {
1704
- readonly _tag: "WebTransportUnsupportedError";
1705
- } & Readonly<A>;
1706
- declare class WebTransportUnsupportedError extends WebTransportUnsupportedError_base<{
1707
- readonly capability: WebTransportCapability;
1708
- }> {
1709
- get message(): string;
1710
- }
1711
- /**
1712
- * The explicit typed boundary for inbound WebTransport sessions.
1713
- *
1714
- * Always fails with {@link WebTransportUnsupportedError} today. Route the
1715
- * code path that would accept a session through this effect so the
1716
- * limitation is visible in the type system and greppable when Cloudflare
1717
- * ships a real API.
1718
- */
1719
- declare const inboundSessionsUnsupported: Effect.Effect<never, WebTransportUnsupportedError>;
1720
- declare namespace WorkflowDefinition_d_exports {
1721
- export { Definition$1 as Definition, Handler$1 as Handler, LayerOptions$1 as LayerOptions, Options$1 as Options, Tag$1 as Tag, TagClass$1 as TagClass, Workflow, implement$1 as implement, make$1 as make };
1722
- }
1723
- interface Definition$1<Id extends string = string, Payload extends ServiceFreeSchema$1 = ServiceFreeSchema$1, Result extends ServiceFreeSchema$1 = ServiceFreeSchema$1> {
1724
- readonly id: Id;
1725
- readonly payload: Payload;
1726
- readonly result: Result;
1727
- }
1728
- declare namespace Definition$1 {
1729
- type Any = Definition$1<string, ServiceFreeSchema$1, ServiceFreeSchema$1>;
1730
- }
1731
- type Handler$1<ROut, Self extends Definition$1.Any> = (payload: Schema.Schema.Type<Self["payload"]>) => Effect.Effect<Schema.Schema.Type<Self["result"]>, unknown, WorkflowRunContext<ROut>>;
1732
- interface Options$1<ROut, Self extends Definition$1.Any> {
1733
- readonly run: Handler$1<ROut, Self>;
1734
- }
1735
- type LayerOptions$1 = {
1736
- readonly binding: string;
1737
- };
1738
- interface TagClass$1<Self, Id extends string, Payload extends ServiceFreeSchema$1, Result extends ServiceFreeSchema$1> extends Context.ServiceClass<Self, `effect-cf/Workflow/${Id}`, WorkflowBindingClient<Payload, Result>> {
1739
- readonly id: Id;
1740
- readonly payload: Payload;
1741
- readonly result: Result;
1742
- readonly make: <ROut, LayerError>(layer: Layer.Layer<ROut, LayerError, ExecutionContext | WorkerContext | WorkerEnvironment>, options: Options$1<ROut, Definition$1<Id, Payload, Result>>) => WorkflowClass<Schema.Codec.Encoded<Payload>, Schema.Codec.Encoded<Result>, ROut>;
1743
- readonly layer: (options: LayerOptions$1) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
1744
- readonly create: (payload: Schema.Schema.Type<Payload>, options?: WorkflowInstanceCreateOptions<Schema.Codec.Encoded<Payload>>) => Effect.Effect<WorkflowInstance<Schema.Schema.Type<Result>>, WorkflowOperationError | Schema.SchemaError, Self>;
1745
- readonly createBatch: (batch: WorkflowInstanceCreateBatchOptions<Schema.Schema.Type<Payload>, Schema.Codec.Encoded<Payload>>) => Effect.Effect<ReadonlyArray<WorkflowInstance<Schema.Schema.Type<Result>>>, WorkflowOperationError | Schema.SchemaError, Self>;
1746
- readonly get: (instanceId: string) => Effect.Effect<WorkflowInstance<Schema.Schema.Type<Result>>, WorkflowOperationError, Self>;
1747
- readonly rawUnsafe: Effect.Effect<globalThis.Workflow<Schema.Codec.Encoded<Payload>>, never, Self>;
1748
- }
1749
- declare const make$1: <Id extends string, Payload extends ServiceFreeSchema$1, Result extends ServiceFreeSchema$1>(id: Id, definition: {
1750
- readonly payload: Payload;
1751
- readonly result: Result;
1752
- }) => TagClass$1<Definition$1<Id, Payload, Result>, Id, Payload, Result>;
1753
- declare const Tag$1: <Self>() => <Id extends string, Payload extends ServiceFreeSchema$1, Result extends ServiceFreeSchema$1>(id: Id, definition: {
1754
- readonly payload: Payload;
1755
- readonly result: Result;
1756
- }) => TagClass$1<Self, Id, Payload, Result>;
1757
- declare const Workflow: typeof Tag$1;
1758
- declare const implement$1: <ROut, const Self extends Definition$1.Any>(_definition: Self, handler: Handler$1<ROut, Self>) => Handler$1<ROut, Self>;
1759
- declare namespace Workflow_d_exports {
1760
- export { Definition, Handler, LayerOptions, Options, Tag, TagClass, WorkflowClass, WorkflowEvent$1 as WorkflowEvent, WorkflowEventService, WorkflowHandler, WorkflowOptions, WorkflowRunContext, WorkflowStep$1 as WorkflowStep, WorkflowStepContext$1 as WorkflowStepContext, WorkflowStepError, WorkflowStepNonRetryableError, WorkflowStepService, implement, make, sleep, sleepUntil, step, waitForEvent };
1761
- }
1762
- interface WorkflowEventService<Payload = unknown> {
1763
- readonly raw: WorkflowEvent<unknown>;
1764
- readonly payload: Payload;
1765
- readonly timestamp: Date;
1766
- readonly instanceId: string;
1767
- readonly workflowName: string;
1768
- }
1769
- declare const WorkflowEvent_base: Context.ServiceClass<WorkflowEvent$1, "effect-cf/WorkflowEvent", WorkflowEventService<unknown>>;
1770
- declare class WorkflowEvent$1 extends WorkflowEvent_base {}
1771
- declare const WorkflowStepError_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]; }>) => Cause.YieldableError & {
1772
- readonly _tag: "WorkflowStepError";
1773
- } & Readonly<A>;
1774
- declare class WorkflowStepError extends WorkflowStepError_base<{
1775
- readonly step?: string;
1776
- readonly operation: string;
1777
- readonly cause: unknown;
1778
- }> {
1779
- get message(): string;
1780
- }
1781
- declare const WorkflowStepNonRetryableError_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]; }>) => Cause.YieldableError & {
1782
- readonly _tag: "WorkflowStepNonRetryableError";
1783
- } & Readonly<A>;
1784
- /**
1785
- * Typed step failure that Cloudflare must treat as terminal instead of retrying.
1786
- *
1787
- * The workflow boundary converts this value into Cloudflare's native
1788
- * `NonRetryableError` while preserving the original cause and its message.
1789
- */
1790
- declare class WorkflowStepNonRetryableError extends WorkflowStepNonRetryableError_base<{
1791
- readonly cause: unknown;
1792
- }> {
1793
- get message(): string;
1794
- }
1795
- interface WorkflowStepService {
1796
- readonly raw: WorkflowStep;
1797
- do<A, E, R>(name: string, effect: Effect.Effect<A, E, R>, config?: WorkflowStepConfig): Effect.Effect<A, WorkflowStepError, Exclude<R, WorkflowStepContext$1>>;
1798
- readonly sleep: (name: string, duration: WorkflowSleepDuration) => Effect.Effect<void, WorkflowStepError>;
1799
- readonly sleepUntil: (name: string, timestamp: Date | number) => Effect.Effect<void, WorkflowStepError>;
1800
- readonly waitForEvent: <Payload>(name: string, options: {
1801
- readonly type: string;
1802
- readonly timeout?: WorkflowTimeoutDuration | number;
1803
- }) => Effect.Effect<WorkflowStepEvent<Payload>, WorkflowStepError>;
1804
- }
1805
- declare const WorkflowStep_base: Context.ServiceClass<WorkflowStep$1, "effect-cf/WorkflowStep", WorkflowStepService>;
1806
- declare class WorkflowStep$1 extends WorkflowStep_base {}
1807
- declare const WorkflowStepContext_base: Context.ServiceClass<WorkflowStepContext$1, "effect-cf/WorkflowStepContext", WorkflowStepContext>;
1808
- declare class WorkflowStepContext$1 extends WorkflowStepContext_base {}
1809
- type RuntimeContext<ROut> = ExecutionContext | WorkerContext | WorkerEnvironment | ROut;
1810
- type WorkflowRunContext<ROut> = RuntimeContext<ROut> | WorkflowEvent$1 | WorkflowStep$1 | Scope.Scope;
1811
- type WorkflowHandler<ROut, Payload = unknown, Result = unknown> = (payload: Payload) => Effect.Effect<Result, unknown, WorkflowRunContext<ROut>>;
1812
- interface WorkflowOptions<ROut, Payload = unknown, Result = unknown> {
1813
- readonly run: WorkflowHandler<ROut, Payload, Result>;
1814
- }
1815
- type WorkflowClass<Payload, Result, _ROut> = new (ctx: globalThis.ExecutionContext, env: WorkerEnv) => WorkflowEntrypoint<WorkerEnv, Payload> & {
1816
- run(event: Readonly<WorkflowEvent<Payload>>, step: WorkflowStep): Promise<Result>;
1817
- };
1818
- declare const make: <ROut, LayerError, Payload = unknown, Result = unknown>(layer: Layer.Layer<ROut, LayerError, ExecutionContext | WorkerContext | WorkerEnvironment>, options: WorkflowOptions<ROut, Payload, Result>) => WorkflowClass<Payload, Result, ROut>;
1819
- declare const step: <A, E, R>(name: string, effect: Effect.Effect<A, E, R>, config?: WorkflowStepConfig) => Effect.Effect<A, WorkflowStepError, WorkflowStep$1 | Exclude<R, WorkflowStepContext$1>>;
1820
- declare const sleep: (name: string, duration: WorkflowSleepDuration) => Effect.Effect<void, WorkflowStepError, WorkflowStep$1>;
1821
- declare const sleepUntil: (name: string, timestamp: Date | number) => Effect.Effect<void, WorkflowStepError, WorkflowStep$1>;
1822
- declare const waitForEvent: <Payload>(name: string, options: {
1823
- readonly type: string;
1824
- readonly timeout?: WorkflowTimeoutDuration | number;
1825
- }) => Effect.Effect<WorkflowStepEvent<Payload>, WorkflowStepError, WorkflowStep$1>;
1826
- type Definition<Id extends string = string, Payload extends Definition$1.Any["payload"] = Definition$1.Any["payload"], Result extends Definition$1.Any["result"] = Definition$1.Any["result"]> = Definition$1<Id, Payload, Result>;
1827
- declare namespace Definition {
1828
- type Any = Definition$1.Any;
1829
- }
1830
- type LayerOptions = LayerOptions$1;
1831
- type TagClass<Self, Id extends string, Payload extends Definition$1.Any["payload"], Result extends Definition$1.Any["result"]> = TagClass$1<Self, Id, Payload, Result>;
1832
- declare const Tag: <Self>() => <Id extends string, Payload extends Definition$1.Any["payload"], Result extends Definition$1.Any["result"]>(id: Id, definition: {
1833
- readonly payload: Payload;
1834
- readonly result: Result;
1835
- }) => TagClass<Self, Id, Payload, Result>;
1836
- declare const implement: typeof implement$1;
1837
- type Handler<ROut, Self extends Definition$1.Any> = Handler$1<ROut, Self>;
1838
- type Options<ROut, Self extends Definition$1.Any> = Options$1<ROut, Self>;
1839
- //#endregion
1
+ import { Environment_d_exports, WorkerConfig, WorkerEnv, WorkerEnvironment } from "./Environment.mjs";
2
+ import { Binding_d_exports } from "./Binding.mjs";
3
+ import { Artifacts_d_exports } from "./Artifacts.mjs";
4
+ import { DurableObjectStorage_d_exports } from "./DurableObjectStorage.mjs";
5
+ import { DurableObjectWebSocket_d_exports } from "./DurableObjectWebSocket.mjs";
6
+ import { Rpc_d_exports } from "./Rpc.mjs";
7
+ import { RpcDefinition_d_exports } from "./RpcDefinition.mjs";
8
+ import { QueueBinding_d_exports } from "./QueueBinding.mjs";
9
+ import { QueueDefinition_d_exports } from "./QueueDefinition.mjs";
10
+ import { Queue_d_exports } from "./Queue.mjs";
11
+ import { RpcTracing_d_exports } from "./RpcTracing.mjs";
12
+ import { ServiceBinding_d_exports } from "./ServiceBinding.mjs";
13
+ import { WorkerDefinition_d_exports } from "./WorkerDefinition.mjs";
14
+ import { Worker_d_exports } from "./Worker.mjs";
15
+ import { DurableObjectState_d_exports } from "./DurableObjectState.mjs";
16
+ import { Hyperdrive_d_exports } from "./Hyperdrive.mjs";
17
+ import { ContainerNamespace_d_exports } from "./ContainerNamespace.mjs";
18
+ import { WorkflowBinding_d_exports } from "./WorkflowBinding.mjs";
19
+ import { WorkersAi_d_exports } from "./WorkersAi.mjs";
20
+ import { AiGateway_d_exports } from "./AiGateway.mjs";
21
+ import { AnalyticsEngine_d_exports } from "./AnalyticsEngine.mjs";
22
+ import { BrowserRendering_d_exports } from "./BrowserRendering.mjs";
23
+ import { Cache_d_exports } from "./Cache.mjs";
24
+ import { CloudflareOtlp_d_exports } from "./CloudflareOtlp.mjs";
25
+ import { CloudflareTracer_d_exports } from "./CloudflareTracer.mjs";
26
+ import { D1_d_exports } from "./D1.mjs";
27
+ import { DurableObjectAlarm_d_exports } from "./DurableObjectAlarm.mjs";
28
+ import { DurableObjectNamespace_d_exports } from "./DurableObjectNamespace.mjs";
29
+ import { DurableObjectDefinition_d_exports } from "./DurableObjectDefinition.mjs";
30
+ import { DurableObject_d_exports } from "./DurableObject.mjs";
31
+ import { DurableObjectRpcWebSocket_d_exports } from "./DurableObjectRpcWebSocket.mjs";
32
+ import { DurableObjectSqlite_d_exports } from "./DurableObjectSqlite.mjs";
33
+ import { Email_d_exports } from "./Email.mjs";
34
+ import { Images_d_exports } from "./Images.mjs";
35
+ import { Kv_d_exports } from "./Kv.mjs";
36
+ import { R2_d_exports } from "./R2.mjs";
37
+ import { Vectorize_d_exports } from "./Vectorize.mjs";
38
+ import { WebTransport_d_exports } from "./WebTransport.mjs";
39
+ import { WorkflowDefinition_d_exports } from "./WorkflowDefinition.mjs";
40
+ import { Workflow_d_exports } from "./Workflow.mjs";
1840
41
  export { AiGateway_d_exports as AiGateway, AnalyticsEngine_d_exports as AnalyticsEngine, Artifacts_d_exports as Artifacts, Binding_d_exports as Binding, BrowserRendering_d_exports as BrowserRendering, Cache_d_exports as Cache, CloudflareOtlp_d_exports as CloudflareOtlp, CloudflareTracer_d_exports as CloudflareTracer, ContainerNamespace_d_exports as ContainerNamespace, D1_d_exports as D1, DurableObject_d_exports as DurableObject, DurableObjectAlarm_d_exports as DurableObjectAlarm, DurableObjectDefinition_d_exports as DurableObjectDefinition, DurableObjectNamespace_d_exports as DurableObjectNamespace, DurableObjectRpcWebSocket_d_exports as DurableObjectRpcWebSocket, DurableObjectSqlite_d_exports as DurableObjectSqlite, DurableObjectState_d_exports as DurableObjectState, DurableObjectStorage_d_exports as DurableObjectStorage, DurableObjectWebSocket_d_exports as DurableObjectWebSocket, Email_d_exports as Email, Environment_d_exports as Environment, Hyperdrive_d_exports as Hyperdrive, Images_d_exports as Images, Kv_d_exports as Kv, Queue_d_exports as Queue, QueueBinding_d_exports as QueueBinding, QueueDefinition_d_exports as QueueDefinition, R2_d_exports as R2, Rpc_d_exports as Rpc, RpcDefinition_d_exports as RpcDefinition, RpcTracing_d_exports as RpcTracing, ServiceBinding_d_exports as ServiceBinding, Vectorize_d_exports as Vectorize, WebTransport_d_exports as WebTransport, Worker_d_exports as Worker, WorkerConfig, WorkerDefinition_d_exports as WorkerDefinition, type WorkerEnv, WorkerEnvironment, WorkersAi_d_exports as WorkersAi, Workflow_d_exports as Workflow, WorkflowBinding_d_exports as WorkflowBinding, WorkflowDefinition_d_exports as WorkflowDefinition };