effect-cf 0.33.0 → 0.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +31 -1079
  3. package/dist/{Artifacts-DnHQA-Ax.d.mts → Artifacts-B3r3RuTB.d.mts} +1 -48
  4. package/dist/{Artifacts-CSIk1Oml.mjs → Artifacts-CBxWGeZB.mjs} +2 -7
  5. package/dist/{Binding-pfilNJmP.mjs → Binding-C82jRhdr.mjs} +1 -2
  6. package/dist/{Binding-xJJJPmiD.d.mts → Binding-DKcLrQCM.d.mts} +0 -45
  7. package/dist/ComputerArtifacts.d.mts +1 -3
  8. package/dist/ComputerArtifacts.mjs +1 -2
  9. package/dist/ComputerWorkspace.d.mts +11 -12
  10. package/dist/ComputerWorkspace.mjs +31 -10
  11. package/dist/ComputerWorkspaceHost.d.mts +1 -9
  12. package/dist/{ContainerNamespace-CFjiLw8b.d.mts → ContainerNamespace-DbLaeFhN.d.mts} +1 -14
  13. package/dist/{DurableObjectState-CVLLse69.mjs → DurableObjectState-DcqElJ4e.mjs} +82 -89
  14. package/dist/{DurableObjectState-BpRjz6-q.d.mts → DurableObjectState-DpYdNZgT.d.mts} +102 -266
  15. package/dist/{ErrorMessage-BM0K-Nik.mjs → ErrorMessage-Byx2OgNd.mjs} +0 -1
  16. package/dist/{Hyperdrive-z-9fFz15.d.mts → Hyperdrive-HrwFlZ6x.d.mts} +1 -4
  17. package/dist/HyperdrivePg.d.mts +2 -11
  18. package/dist/HyperdrivePg.mjs +0 -8
  19. package/dist/Sandbox.d.mts +2 -32
  20. package/dist/Sandbox.mjs +2 -11
  21. package/dist/Vitest.d.mts +3 -31
  22. package/dist/Vitest.mjs +8 -26
  23. package/dist/{WorkflowBinding-lBR4_-op.d.mts → WorkflowBinding-Cn3AuUyP.d.mts} +2 -5
  24. package/dist/index.d.mts +42 -480
  25. package/dist/index.mjs +267 -380
  26. package/package.json +1 -1
  27. package/src/AiGateway.ts +0 -6
  28. package/src/AnalyticsEngine.ts +8 -10
  29. package/src/Artifacts.ts +0 -47
  30. package/src/Binding.ts +0 -8
  31. package/src/BrowserRendering.ts +0 -4
  32. package/src/Cache.ts +0 -19
  33. package/src/CloudflareOtlp.ts +6 -39
  34. package/src/ComputerArtifacts.ts +0 -2
  35. package/src/ComputerWorkspace.ts +53 -35
  36. package/src/ComputerWorkspaceHost.ts +0 -8
  37. package/src/ContainerNamespace.ts +0 -13
  38. package/src/D1.ts +0 -22
  39. package/src/DurableObject.ts +51 -32
  40. package/src/DurableObjectAlarm.ts +6 -210
  41. package/src/DurableObjectDefinition.ts +8 -20
  42. package/src/DurableObjectNamespace.ts +88 -115
  43. package/src/DurableObjectRpcWebSocket.ts +5 -46
  44. package/src/DurableObjectSqlite.ts +0 -12
  45. package/src/DurableObjectState.ts +18 -38
  46. package/src/DurableObjectStorage.ts +55 -70
  47. package/src/DurableObjectWebSocket.ts +23 -72
  48. package/src/Email.ts +0 -12
  49. package/src/Environment.ts +0 -37
  50. package/src/Hyperdrive.ts +0 -3
  51. package/src/HyperdrivePg.ts +0 -9
  52. package/src/Images.ts +0 -5
  53. package/src/Kv.ts +0 -15
  54. package/src/QueueBinding.ts +0 -2
  55. package/src/R2.ts +0 -5
  56. package/src/RpcDefinition.ts +5 -17
  57. package/src/RpcTracing.ts +133 -0
  58. package/src/Sandbox.ts +0 -30
  59. package/src/ServiceBinding.ts +83 -128
  60. package/src/Vectorize.ts +0 -5
  61. package/src/Vitest.ts +18 -43
  62. package/src/WebTransport.ts +0 -15
  63. package/src/Worker.ts +140 -108
  64. package/src/WorkerDefinition.ts +5 -14
  65. package/src/WorkersAi.ts +21 -18
  66. package/src/Workflow.ts +45 -54
  67. package/src/WorkflowBinding.ts +0 -3
  68. package/src/index.ts +1 -0
  69. package/src/internal/Entrypoint.ts +23 -4
  70. package/src/internal/ErrorMessage.ts +0 -1
  71. package/src/internal/NativeCallback.ts +55 -0
  72. package/src/internal/RpcInvocation.ts +18 -1
  73. package/src/internal/Runtime.ts +12 -7
  74. package/src/internal/WorkerContext.ts +5 -14
package/dist/index.d.mts CHANGED
@@ -1,9 +1,9 @@
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-xJJJPmiD.mjs";
2
- import { l as Artifacts_d_exports } from "./Artifacts-DnHQA-Ax.mjs";
3
- import { A as StorageOperationError, C as Rpc_d_exports, D as DurableWebSocket, E as DurableObjectWebSocket_d_exports, O as DurableWebSocketAttachmentError, S as Provider, T as AcceptedUpgrade, _ as Definition$4, a as NativeRequest, b as RpcDefinition_d_exports, c as WorkerDefinition_d_exports, d as AsyncMethodCloudflareReturn, f as AsyncMethodKey, g as QueueBinding_d_exports, h as QueueDefinition_d_exports, i as ExecutionContext, k as DurableObjectStorage_d_exports, l as ServiceBinding_d_exports, m as Queue_d_exports, o as WorkerContext, p as AsyncMethodSuccess, r as DurableObjectState_d_exports, s as Worker_d_exports, t as DurableObjectState, u as AsyncMethodArgs, v as Method$2, w as AcceptUpgradeOptions, x as ServiceFreeSchema$1, y as ReservedMethodName$2 } from "./DurableObjectState-BpRjz6-q.mjs";
4
- import { t as Hyperdrive_d_exports } from "./Hyperdrive-z-9fFz15.mjs";
5
- import { t as ContainerNamespace_d_exports } from "./ContainerNamespace-CFjiLw8b.mjs";
6
- import { a as WorkflowInstanceCreateOptions, i as WorkflowInstanceCreateBatchOptions, n as WorkflowBinding_d_exports, r as WorkflowInstance, s as WorkflowOperationError, t as WorkflowBindingClient } from "./WorkflowBinding-lBR4_-op.mjs";
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 DurableWebSocket, C as RpcDefinition_d_exports, D as AcceptUpgradeOptions, E as Rpc_d_exports, M as DurableObjectStorage_d_exports, N as StorageOperationError, O as AcceptedUpgrade, S as ReservedMethodName$2, T as Provider, _ as Queue_d_exports, a as NativeRequest, b as Definition$4, c as WorkerDefinition_d_exports, d as AsyncMethodCloudflareReturn, f as AsyncMethodKey, g as RpcTracing_d_exports, h as RpcInvocationInfo, i as ExecutionContext, j as DurableWebSocketAttachmentError, k as DurableObjectWebSocket_d_exports, l as ServiceBinding_d_exports, m as ReceiverOptions, o as WorkerContext, p as AsyncMethodSuccess, r as DurableObjectState_d_exports, s as Worker_d_exports, t as DurableObjectState, u as AsyncMethodArgs, v as QueueDefinition_d_exports, w as ServiceFreeSchema$1, x as Method$2, y as QueueBinding_d_exports } from "./DurableObjectState-DpYdNZgT.mjs";
4
+ import { t as Hyperdrive_d_exports } from "./Hyperdrive-HrwFlZ6x.mjs";
5
+ import { t as ContainerNamespace_d_exports } from "./ContainerNamespace-DbLaeFhN.mjs";
6
+ import { a as WorkflowInstanceCreateOptions, i as WorkflowInstanceCreateBatchOptions, n as WorkflowBinding_d_exports, r as WorkflowInstance, s as WorkflowOperationError, t as WorkflowBindingClient } from "./WorkflowBinding-Cn3AuUyP.mjs";
7
7
  import { Cause, Config, Context, Data, DateTime, Duration, Effect, Layer, Option, Predicate, Redacted, Schema, Scope } from "effect";
8
8
  import { Headers as Headers$1, HttpClient, HttpClientResponse } from "effect/unstable/http";
9
9
  import { OtlpExporter, OtlpResource } from "effect/unstable/observability";
@@ -14,14 +14,13 @@ import * as RpcSerialization from "effect/unstable/rpc/RpcSerialization";
14
14
  import * as RpcServer from "effect/unstable/rpc/RpcServer";
15
15
  import { SqliteClient } from "@effect/sql-sqlite-do";
16
16
  import { SqlClient } from "effect/unstable/sql";
17
- import * as Tracer from "effect/Tracer";
17
+ import * as Tracer$1 from "effect/Tracer";
18
18
  declare namespace WorkersAi_d_exports {
19
19
  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$13 as layer, make$12 as make, makeClient$10 as makeClient };
20
20
  }
21
21
  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 & {
22
22
  readonly _tag: "WorkersAiOperationError";
23
23
  } & Readonly<A>;
24
- /** Error raised when a Workers AI operation fails. */
25
24
  declare class WorkersAiOperationError extends WorkersAiOperationError_base<{
26
25
  readonly binding: string;
27
26
  readonly operation: string;
@@ -29,9 +28,7 @@ declare class WorkersAiOperationError extends WorkersAiOperationError_base<{
29
28
  }> {
30
29
  get message(): string;
31
30
  }
32
- /** Typed Workers AI binding definition. */
33
31
  interface WorkersAiDefinition {
34
- /** Binding name as configured in `wrangler.jsonc`. */
35
32
  readonly binding: string;
36
33
  }
37
34
  type WorkersAiBinding<ModelList extends AiModelListType = AiModels> = CloudflareAi<ModelList>;
@@ -72,7 +69,6 @@ interface WorkersAiClient<ModelList extends AiModelListType = AiModels> {
72
69
  readonly definition: WorkersAiDefinition;
73
70
  }
74
71
  declare const WorkersAiServiceTypeId: unique symbol;
75
- /** Nominal service marker for Workers AI services created with {@link make}. */
76
72
  interface WorkersAiService<Id extends string> {
77
73
  readonly [WorkersAiServiceTypeId]: {
78
74
  readonly id: Id;
@@ -101,7 +97,6 @@ declare namespace AiGateway_d_exports {
101
97
  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 & {
102
98
  readonly _tag: "AiGatewayOperationError";
103
99
  } & Readonly<A>;
104
- /** Error raised when an AI Gateway operation fails. */
105
100
  declare class AiGatewayOperationError extends AiGatewayOperationError_base<{
106
101
  readonly binding: string;
107
102
  readonly operation: string;
@@ -109,13 +104,9 @@ declare class AiGatewayOperationError extends AiGatewayOperationError_base<{
109
104
  }> {
110
105
  get message(): string;
111
106
  }
112
- /** Typed AI Gateway client definition. */
113
107
  interface AiGatewayDefinition {
114
- /** Binding name as configured in `wrangler.jsonc`. */
115
108
  readonly binding: string;
116
- /** Gateway id/name passed to `env.AI.gateway(id)`. */
117
109
  readonly gatewayId: string;
118
- /** Optional account id used by the HTTP-only helper. */
119
110
  readonly accountId?: string;
120
111
  }
121
112
  type AiGatewayBinding = CloudflareAiGateway;
@@ -142,7 +133,6 @@ interface AiGatewayClient {
142
133
  readonly definition: AiGatewayDefinition;
143
134
  }
144
135
  declare const AiGatewayServiceTypeId: unique symbol;
145
- /** Nominal service marker for AI Gateway services created with {@link make}. */
146
136
  interface AiGatewayService<Id extends string> {
147
137
  readonly [AiGatewayServiceTypeId]: {
148
138
  readonly id: Id;
@@ -204,7 +194,6 @@ declare const AnalyticsEngineDataPointSchema: Schema.Struct<{
204
194
  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 & {
205
195
  readonly _tag: "AnalyticsEngineOperationError";
206
196
  } & Readonly<A>;
207
- /** Error raised when an Analytics Engine operation fails. */
208
197
  declare class AnalyticsEngineOperationError extends AnalyticsEngineOperationError_base<{
209
198
  readonly binding: string;
210
199
  readonly operation: string;
@@ -221,7 +210,6 @@ interface AnalyticsEngineWriteViolation {
221
210
  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 & {
222
211
  readonly _tag: "AnalyticsEngineWriteValidationError";
223
212
  } & Readonly<A>;
224
- /** Error raised when an Analytics Engine write input violates Cloudflare limits. */
225
213
  declare class AnalyticsEngineWriteValidationError extends AnalyticsEngineWriteValidationError_base<{
226
214
  readonly binding: string;
227
215
  readonly operation: string;
@@ -233,7 +221,6 @@ declare class AnalyticsEngineWriteValidationError extends AnalyticsEngineWriteVa
233
221
  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 & {
234
222
  readonly _tag: "AnalyticsEngineQueryError";
235
223
  } & Readonly<A>;
236
- /** Error raised when an Analytics Engine SQL API query fails. */
237
224
  declare class AnalyticsEngineQueryError extends AnalyticsEngineQueryError_base<{
238
225
  readonly operation: string;
239
226
  readonly accountId: string;
@@ -242,9 +229,7 @@ declare class AnalyticsEngineQueryError extends AnalyticsEngineQueryError_base<{
242
229
  readonly body?: string;
243
230
  readonly cause?: unknown;
244
231
  }> {}
245
- /** Typed Analytics Engine dataset binding definition. */
246
232
  interface AnalyticsEngineDefinition {
247
- /** Binding name as configured in `wrangler.jsonc`. */
248
233
  readonly binding: string;
249
234
  }
250
235
  type AnalyticsEngineBinding = CloudflareAnalyticsEngineDataset;
@@ -268,11 +253,9 @@ interface AnalyticsEngineQueryResult<Row = AnalyticsEngineQueryRow> {
268
253
  readonly rows: number;
269
254
  }
270
255
  interface AnalyticsEngineQueryDefinition {
271
- /** Cloudflare account id that owns the Analytics Engine datasets. */
272
256
  readonly accountId: string;
273
257
  /** API token with Account Analytics Read permission. */
274
258
  readonly apiToken: Redacted.Redacted<string>;
275
- /** Base Cloudflare API URL. Defaults to `https://api.cloudflare.com/client/v4`. */
276
259
  readonly apiBaseUrl?: string | URL;
277
260
  }
278
261
  interface AnalyticsEngineQueryOptions {
@@ -296,13 +279,11 @@ interface AnalyticsEngineQueryClient {
296
279
  }
297
280
  declare const AnalyticsEngineServiceTypeId: unique symbol;
298
281
  declare const AnalyticsEngineQueryServiceTypeId: unique symbol;
299
- /** Nominal service marker for Analytics Engine services created with {@link make}. */
300
282
  interface AnalyticsEngineService<Id extends string> {
301
283
  readonly [AnalyticsEngineServiceTypeId]: {
302
284
  readonly id: Id;
303
285
  };
304
286
  }
305
- /** Nominal service marker for Analytics Engine query services created with {@link makeQuery}. */
306
287
  interface AnalyticsEngineQueryService<Id extends string> {
307
288
  readonly [AnalyticsEngineQueryServiceTypeId]: {
308
289
  readonly id: Id;
@@ -351,7 +332,6 @@ declare namespace BrowserRendering_d_exports {
351
332
  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 & {
352
333
  readonly _tag: "BrowserRenderingOperationError";
353
334
  } & Readonly<A>;
354
- /** Error raised when a Browser Rendering operation fails. */
355
335
  declare class BrowserRenderingOperationError extends BrowserRenderingOperationError_base<{
356
336
  readonly binding: string;
357
337
  readonly operation: string;
@@ -359,9 +339,7 @@ declare class BrowserRenderingOperationError extends BrowserRenderingOperationEr
359
339
  }> {
360
340
  get message(): string;
361
341
  }
362
- /** Typed Browser Rendering binding definition. */
363
342
  interface BrowserRenderingDefinition {
364
- /** Binding name as configured in `wrangler.jsonc`. */
365
343
  readonly binding: string;
366
344
  }
367
345
  type BrowserRenderingBinding = object;
@@ -409,7 +387,6 @@ interface BrowserRenderingClient<RawBinding extends BrowserRenderingBinding = Br
409
387
  readonly definition: BrowserRenderingDefinition;
410
388
  }
411
389
  declare const BrowserRenderingServiceTypeId: unique symbol;
412
- /** Nominal service marker for Browser Rendering services created with {@link make}. */
413
390
  interface BrowserRenderingService<Id extends string> {
414
391
  readonly [BrowserRenderingServiceTypeId]: {
415
392
  readonly id: Id;
@@ -430,16 +407,12 @@ declare const Tag$9: <Self>() => <Id extends string>(id: Id) => TagClass$8<Self,
430
407
  declare namespace Cache_d_exports {
431
408
  export { CacheClient, CacheOperation, CacheOperationError, CacheQueryOptions, CacheRequest, CacheStorage, CacheStorageClient, layer$9 as layer, layerFrom, makeCacheClient, makeClient$6 as makeClient };
432
409
  }
433
- /** Request key accepted by Cloudflare's Cache API. */
434
410
  type CacheRequest = CloudflareRequestInfo | URL;
435
- /** Query options supported by Cloudflare's Cache API. */
436
411
  type CacheQueryOptions = CloudflareCacheQueryOptions;
437
- /** Cache operation represented by {@link CacheOperationError}. */
438
412
  type CacheOperation = "open" | "match" | "put" | "delete";
439
413
  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 & {
440
414
  readonly _tag: "CacheOperationError";
441
415
  } & Readonly<A>;
442
- /** Error raised when a Cloudflare Cache API operation fails. */
443
416
  declare class CacheOperationError extends CacheOperationError_base<{
444
417
  readonly cache: string;
445
418
  readonly operation: CacheOperation;
@@ -447,38 +420,23 @@ declare class CacheOperationError extends CacheOperationError_base<{
447
420
  }> {
448
421
  get message(): string;
449
422
  }
450
- /** Effect wrapper around one Cloudflare `Cache` instance. */
451
423
  interface CacheClient {
452
- /** Cache name (`default` for `caches.default`). */
453
424
  readonly name: string;
454
- /** Finds a cached response, mapping cache misses to `Option.none()`. */
455
425
  readonly match: (request: CacheRequest, options?: CacheQueryOptions) => Effect.Effect<Option.Option<Response>, CacheOperationError>;
456
- /** Stores a response under the request key. */
457
426
  readonly put: (request: CacheRequest, response: Response) => Effect.Effect<void, CacheOperationError>;
458
- /** Deletes a cached response and reports whether it existed. */
459
427
  readonly delete: (request: CacheRequest, options?: CacheQueryOptions) => Effect.Effect<boolean, CacheOperationError>;
460
- /** Access to the native Cloudflare `Cache` instance. */
461
428
  readonly rawUnsafe: Effect.Effect<CloudflareCache>;
462
429
  }
463
- /** Effect wrapper around Cloudflare's global `caches` object. */
464
430
  interface CacheStorageClient {
465
- /** Cloudflare's shared default cache. */
466
431
  readonly default: CacheClient;
467
- /** Opens a named cache. */
468
432
  readonly open: (name: string) => Effect.Effect<CacheClient, CacheOperationError>;
469
- /** Access to the native Cloudflare `CacheStorage` instance. */
470
433
  readonly rawUnsafe: Effect.Effect<CloudflareCacheStorage>;
471
434
  }
472
435
  declare const CacheStorage_base: Context.ServiceClass<CacheStorage, "effect-cf/CacheStorage", CacheStorageClient>;
473
- /** Service for Cloudflare's global Cache API. */
474
436
  declare class CacheStorage extends CacheStorage_base {}
475
- /** Wraps a native Cloudflare `Cache` instance. */
476
437
  declare const makeCacheClient: (cache: CloudflareCache, name?: string) => CacheClient;
477
- /** Wraps a native Cloudflare `CacheStorage` instance. */
478
438
  declare const makeClient$6: (storage: CloudflareCacheStorage) => CacheStorageClient;
479
- /** Provides Cache API services from an explicit native `CacheStorage` instance. */
480
439
  declare const layerFrom: (storage: CloudflareCacheStorage) => Layer.Layer<CacheStorage>;
481
- /** Provides Cache API services from Cloudflare's global `caches` object. */
482
440
  declare const layer$9: Layer.Layer<CacheStorage>;
483
441
  declare namespace CloudflareOtlp_d_exports {
484
442
  export { DurableObjectLayerOptions, LayerOptions$9 as LayerOptions, ResourceOptions, Serialization, Signal, WorkerLayerOptions, layer$8 as layer, layerDurableObject, layerJson, layerProtobuf, layerWorker };
@@ -516,30 +474,16 @@ interface LayerOptions$9 {
516
474
  readonly signals?: ReadonlyArray<Signal>;
517
475
  /** OTLP payload serialization. Defaults to protobuf. */
518
476
  readonly serialization?: Serialization;
519
- /** Resource metadata forwarded to Effect's OTLP resource resolver. */
520
477
  readonly resource?: ResourceOptions;
521
- /**
522
- * Explicit headers for every selected signal.
523
- *
524
- * When omitted, Effect reads `OTEL_EXPORTER_OTLP_HEADERS` and the
525
- * signal-specific `OTEL_EXPORTER_OTLP_*_HEADERS` variables.
526
- */
527
478
  readonly headers?: Headers$1.Input;
528
- /** Exclude log records emitted for spans when exporting logs. */
529
479
  readonly loggerExcludeLogSpans?: boolean;
530
- /** Merge the OTLP logger with existing loggers instead of replacing them. */
531
480
  readonly loggerMergeWithExisting?: boolean;
532
- /** Custom trace context lookup used by the Effect OTLP tracer. */
533
- readonly tracerContext?: <X>(primitive: Tracer.EffectPrimitive<X>, span: Tracer.AnySpan) => X;
481
+ readonly tracerContext?: <X>(primitive: Tracer$1.EffectPrimitive<X>, span: Tracer$1.AnySpan) => X;
534
482
  }
535
- /** Resource metadata specific to Cloudflare Workers. */
536
483
  interface WorkerLayerOptions extends LayerOptions$9 {
537
- /** Cloudflare Worker name to attach as `cloudflare.worker.name`. */
538
484
  readonly workerName?: string;
539
485
  }
540
- /** Resource metadata specific to Cloudflare Durable Objects. */
541
486
  interface DurableObjectLayerOptions extends LayerOptions$9 {
542
- /** Durable Object class name to attach as `cloudflare.durable_object.class`. */
543
487
  readonly className?: string;
544
488
  /**
545
489
  * Include the Durable Object id as `cloudflare.durable_object.id`.
@@ -569,6 +513,8 @@ declare const layerProtobuf: (options?: Omit<LayerOptions$9, "serialization">) =
569
513
  *
570
514
  * Provide this layer at runtime scope for long-lived metrics aggregation, or at
571
515
  * handler scope when traces/logs should flush as the Cloudflare event finishes.
516
+ * A handler-scoped exporter can delay scope closure while its own finalizer
517
+ * flushes; the two-second background flush limit does not bound layer shutdown.
572
518
  */
573
519
  declare const layerWorker: (options?: WorkerLayerOptions) => Layer.Layer<OtlpExporter.Flusher>;
574
520
  /**
@@ -584,43 +530,21 @@ declare namespace D1_d_exports {
584
530
  }
585
531
  declare const TypeId$1: "~effect-cf/D1";
586
532
  type TypeId$1 = typeof TypeId$1;
587
- /** Typed D1 binding definition. */
588
533
  interface D1Definition {
589
- /** Binding name as configured in `wrangler.jsonc`. */
590
534
  readonly binding: string;
591
535
  }
592
- /** Options forwarded to `@effect/sql-d1` when building a SQL client layer. */
593
536
  type D1SqlLayerOptions = Omit<D1Client.D1ClientConfig, "db">;
594
537
  declare const D1ServiceTypeId: unique symbol;
595
- /** Nominal service marker for D1 services created with {@link make}. */
596
538
  interface D1Service<Id extends string> {
597
539
  readonly [D1ServiceTypeId]: {
598
540
  readonly id: Id;
599
541
  };
600
542
  }
601
- /**
602
- * Creates a typed D1 service tag plus Effect helpers.
603
- */
604
543
  declare const make$8: <Id extends string>(id: Id, definition: D1Definition) => BindingService<D1Service<Id>, Id, D1Database> & {
605
544
  "~effect-cf/D1": "~effect-cf/D1";
606
545
  definition: D1Definition;
607
546
  sqlLayer: (options?: D1SqlLayerOptions) => Layer.Layer<D1Client.D1Client | SqlClient.SqlClient, Config.ConfigError | BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
608
547
  };
609
- /**
610
- * Builds a D1 service around a Cloudflare D1 database binding.
611
- *
612
- * The returned service exposes the raw `D1Database` binding and `sqlLayer(...)`
613
- * for providing `effect/unstable/sql` via `@effect/sql-d1`.
614
- *
615
- * @example
616
- * ```ts
617
- * class TodoDatabase extends D1.Service<TodoDatabase>()("TodoDatabase", {
618
- * binding: "TODO_DB",
619
- * }) {}
620
- *
621
- * const SqlLive = TodoDatabase.sqlLayer();
622
- * ```
623
- */
624
548
  declare const Service: <Self>() => <Id extends string>(id: Id, definition: D1Definition) => BindingService<Self, Id, D1Database> & {
625
549
  "~effect-cf/D1": "~effect-cf/D1";
626
550
  definition: D1Definition;
@@ -642,21 +566,12 @@ type DurableObjectStubClient<Api extends object> = DurableObjectFetcher & RpcCli
642
566
  readonly id: globalThis.DurableObjectId;
643
567
  readonly name?: string;
644
568
  };
645
- /**
646
- * Native Durable Object namespace binding shape.
647
- */
648
569
  interface DurableObjectNamespaceClient<Api extends object> {
649
- /** Creates a globally unique Durable Object id. */
650
570
  newUniqueId(options?: globalThis.DurableObjectNamespaceNewUniqueIdOptions): globalThis.DurableObjectId;
651
- /** Deterministically maps a name to a Durable Object id. */
652
571
  idFromName(name: string): globalThis.DurableObjectId;
653
- /** Rehydrates a Durable Object id from its string form. */
654
572
  idFromString(id: string): globalThis.DurableObjectId;
655
- /** Returns a stub for an existing Durable Object id. */
656
573
  get(id: globalThis.DurableObjectId, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStubClient<Api>;
657
- /** Returns a stub by deterministic name. */
658
574
  getByName(name: string, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStubClient<Api>;
659
- /** Selects a namespace pinned to a specific jurisdiction. */
660
575
  jurisdiction(jurisdiction: globalThis.DurableObjectJurisdiction): DurableObjectNamespaceClient<Api>;
661
576
  }
662
577
  /**
@@ -669,10 +584,10 @@ interface DurableObjectNamespaceDefinition {
669
584
  * Namespace binding metadata with optional RPC schema.
670
585
  */
671
586
  interface DurableObjectNamespaceBindingDefinition<Definition extends Definition$3.Any | undefined = undefined> {
672
- /** Binding name as configured in `wrangler.jsonc`. */
673
587
  readonly binding: string;
674
- /** Optional RPC schema used for argument/result encoding. */
675
588
  readonly definition?: Definition;
589
+ /** Append live trace context only when the receiver also enables rpcTracing. */
590
+ readonly rpcTracing?: boolean;
676
591
  }
677
592
  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 & {
678
593
  readonly _tag: "DurableObjectRpcError";
@@ -714,36 +629,12 @@ type DefinitionNamespaceDirectClientMethods<R, Definition extends Definition$3.A
714
629
  };
715
630
  type DirectMethods<R, Api extends object, Definition> = Definition extends Definition$3.Any ? DefinitionNamespaceDirectMethods<R, Api, Definition> & DefinitionNamespaceDirectClientMethods<R, Definition> : {};
716
631
  type DurableObjectNamespaceEffectClient<Api extends object, Definition extends Definition$3.Any | undefined = undefined> = DirectMethods<never, Api, Definition> & {
717
- /** Creates a globally unique Durable Object id. */
718
632
  readonly newUniqueId: (options?: globalThis.DurableObjectNamespaceNewUniqueIdOptions) => Effect.Effect<globalThis.DurableObjectId>;
719
- /** Deterministically maps a name to a Durable Object id. */
720
633
  readonly idFromName: (name: string) => Effect.Effect<globalThis.DurableObjectId>;
721
- /** Rehydrates a Durable Object id from its string form. */
722
634
  readonly idFromString: (id: string) => Effect.Effect<globalThis.DurableObjectId>;
723
- /** Returns a stub for an existing Durable Object id. */
724
635
  readonly get: (id: globalThis.DurableObjectId, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions) => Effect.Effect<DurableObjectStubClient<Api>>;
725
- /** Returns a stub by deterministic name. */
726
636
  readonly getByName: (name: string, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions) => Effect.Effect<DurableObjectStubClient<Api>>;
727
- /** Selects a namespace pinned to a specific jurisdiction. */
728
637
  readonly jurisdiction: (jurisdiction: globalThis.DurableObjectJurisdiction) => Effect.Effect<DurableObjectNamespaceClient<Api>>;
729
- /**
730
- * Forwards an HTTP request to a Durable Object stub.
731
- *
732
- * Use this for fetch-based Durable Object APIs, including WebSocket upgrade
733
- * forwarding where the native response must be preserved.
734
- *
735
- * @example
736
- * ```ts
737
- * import { Effect } from "effect";
738
- *
739
- * const program = Effect.gen(function* () {
740
- * const rooms = yield* ChatRooms;
741
- * const room = yield* rooms.getByName("general");
742
- *
743
- * return yield* rooms.fetch(room, new Request("https://worker.example/room"));
744
- * });
745
- * ```
746
- */
747
638
  readonly fetch: (stub: DurableObjectStubClient<Api>, input: RequestInfo | URL, init?: RequestInit) => Effect.Effect<globalThis.Response, DurableObjectFetchError>;
748
639
  /**
749
640
  * Invokes a Durable Object RPC method and returns Cloudflare's raw RPC result.
@@ -753,21 +644,6 @@ type DurableObjectNamespaceEffectClient<Api extends object, Definition extends D
753
644
  * promise-like value and it does not decode definition-backed success schemas.
754
645
  *
755
646
  * Most application code should use {@link call} instead.
756
- *
757
- * @example
758
- * ```ts
759
- * import { Effect } from "effect";
760
- *
761
- * const program = Effect.gen(function* () {
762
- * const counters = yield* Counters;
763
- * const counter = yield* counters.getByName("main");
764
- *
765
- * const result = yield* counters.rpc(counter, "get");
766
- * const value = yield* Effect.promise(() => result);
767
- *
768
- * return value;
769
- * });
770
- * ```
771
647
  */
772
648
  readonly rpc: <Method extends StubMethodKey<Api>>(stub: DurableObjectStubClient<Api>, method: Method, ...args: StubMethodArgs<Api, Method>) => Effect.Effect<StubMethodCloudflareReturn<Api, Method>, DurableObjectRpcError>;
773
649
  /**
@@ -775,18 +651,6 @@ type DurableObjectNamespaceEffectClient<Api extends object, Definition extends D
775
651
  * decodes the success value when the namespace was created from a definition.
776
652
  *
777
653
  * This is the normal choice when application code wants the final typed value.
778
- *
779
- * @example
780
- * ```ts
781
- * import { Effect } from "effect";
782
- *
783
- * const program = Effect.gen(function* () {
784
- * const counters = yield* Counters;
785
- * const counter = yield* counters.getByName("main");
786
- *
787
- * return yield* counters.call(counter, "increment", 1);
788
- * });
789
- * ```
790
654
  */
791
655
  readonly call: <Method extends StubMethodKey<Api>>(stub: DurableObjectStubClient<Api>, method: Method, ...args: StubMethodArgs<Api, Method>) => Effect.Effect<StubMethodSuccess<Api, Method>, DurableObjectRpcError>;
792
656
  /**
@@ -797,23 +661,8 @@ type DurableObjectNamespaceEffectClient<Api extends object, Definition extends D
797
661
  *
798
662
  * Use this for RPC methods that return Cloudflare RPC resources or other
799
663
  * disposable objects whose lifetime should be tied to an Effect scope.
800
- *
801
- * @example
802
- * ```ts
803
- * import { Effect } from "effect";
804
- *
805
- * const program = Effect.scoped(
806
- * Effect.gen(function* () {
807
- * const rooms = yield* ChatRooms;
808
- * const room = yield* rooms.getByName("general");
809
- * const handle = yield* rooms.scopedCall(room, "openStream");
810
- *
811
- * return yield* handle.read();
812
- * }),
813
- * );
814
- * ```
815
664
  */
816
- readonly scopedCall: <Method extends StubMethodKey<Api>>(stub: DurableObjectStubClient<Api>, method: Method, ...args: StubMethodArgs<Api, Method>) => Effect.Effect<Awaited<StubMethodSuccess<Api, Method>>, unknown, Scope.Scope>;
665
+ readonly scopedCall: <Method extends StubMethodKey<Api>>(stub: DurableObjectStubClient<Api>, method: Method, ...args: StubMethodArgs<Api, Method>) => Effect.Effect<Awaited<StubMethodSuccess<Api, Method>>, DurableObjectRpcError, Scope.Scope>;
817
666
  /**
818
667
  * Exposes the underlying native Durable Object namespace binding.
819
668
  *
@@ -832,7 +681,7 @@ type DurableObjectNamespaceStaticClient<R, Api extends object, Definition extend
832
681
  readonly fetch: (stub: DurableObjectStubClient<Api>, input: RequestInfo | URL, init?: RequestInit) => Effect.Effect<globalThis.Response, DurableObjectFetchError, R>;
833
682
  readonly rpc: <Method extends StubMethodKey<Api>>(stub: DurableObjectStubClient<Api>, method: Method, ...args: StubMethodArgs<Api, Method>) => Effect.Effect<StubMethodCloudflareReturn<Api, Method>, DurableObjectRpcError, R>;
834
683
  readonly call: <Method extends StubMethodKey<Api>>(stub: DurableObjectStubClient<Api>, method: Method, ...args: StubMethodArgs<Api, Method>) => Effect.Effect<StubMethodSuccess<Api, Method>, DurableObjectRpcError, R>;
835
- readonly scopedCall: <Method extends StubMethodKey<Api>>(stub: DurableObjectStubClient<Api>, method: Method, ...args: StubMethodArgs<Api, Method>) => Effect.Effect<Awaited<StubMethodSuccess<Api, Method>>, unknown, Scope.Scope | R>;
684
+ 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>;
836
685
  readonly rawUnsafe: () => Effect.Effect<DurableObjectNamespaceClient<Api>, never, R>;
837
686
  };
838
687
  declare const isDurableObjectNamespaceClient: <Api extends object>(value: NamespaceCandidate) => value is DurableObjectNamespaceClient<Api>;
@@ -855,7 +704,6 @@ interface Method$1<Args extends ReadonlyArray<ServiceFreeSchema> = ReadonlyArray
855
704
  declare namespace Method$1 {
856
705
  export type Any = Method$1<ReadonlyArray<ServiceFreeSchema>, ServiceFreeSchema>;
857
706
  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]>>;
858
- /** Method schemas cross the wire through their canonical JSON codec. */
859
707
  type EncodedArgsFromSchemas<Args extends ReadonlyArray<ServiceFreeSchema>> = { [Index in keyof Args]: Schema.Json; };
860
708
  export type Args<Self extends Any> = ArgsFromSchemas<Self["args"]>;
861
709
  export type EncodedArgs<Self extends Any> = EncodedArgsFromSchemas<Self["args"]>;
@@ -893,6 +741,7 @@ interface Options$2<ROut, Self extends Definition$3.Any, REvent = never, EventLa
893
741
  }
894
742
  type LayerOptions$8 = {
895
743
  readonly binding: string;
744
+ readonly rpcTracing?: boolean;
896
745
  };
897
746
  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>> & {
898
747
  readonly id: Id;
@@ -922,11 +771,19 @@ declare const implement$2: <ROut, const Self extends Definition$3.Any>(_definiti
922
771
  */
923
772
  type HandlerEffect<ROut, Self extends Definition$3.Any, Key extends keyof Self["methods"]> = DurableObjectHandler<ROut, Method$1.Success<Self["methods"][Key]>>;
924
773
  declare namespace DurableObject_d_exports {
925
- 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, ServerApi, ServiceFreeSchema, Tag$8 as Tag, TagClass$7 as TagClass, implement$2 as implement, make$6 as make, method };
774
+ 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, ServerApi, ServiceFreeSchema, Tag$8 as Tag, TagClass$7 as TagClass, implement$2 as implement, make$6 as make, method };
926
775
  }
927
776
  type RuntimeContext$1<ROut> = DurableObjectState | WorkerEnvironment | ROut;
928
777
  type HandlerContext<ROut> = RuntimeContext$1<ROut> | Scope.Scope;
929
778
  type FetchContext<ROut> = HandlerContext<ROut> | NativeRequest;
779
+ /** Metadata available before an event effect or its event layer starts. */
780
+ interface RunOptions {
781
+ readonly eventLayer?: boolean;
782
+ readonly event?: "fetch" | "rpc" | "alarm" | "webSocketMessage" | "webSocketClose" | "webSocketError";
783
+ readonly rpc?: RpcInvocationInfo;
784
+ }
785
+ /** Override to instrument the whole event, then call super[RunSymbol]. */
786
+ declare const RunSymbol: unique symbol;
930
787
  /**
931
788
  * Effect type for Durable Object lifecycle and RPC handlers.
932
789
  */
@@ -937,9 +794,6 @@ type DurableObjectHandler<ROut, A = unknown> = Effect.Effect<A, unknown, Handler
937
794
  type DurableObjectRpc<ROut> = Record<string, (...args: Array<any>) => DurableObjectHandler<ROut>>;
938
795
  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; };
939
796
  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; };
940
- /**
941
- * Options for creating a Durable Object class backed by Effect handlers.
942
- */
943
797
  interface DurableObjectOptions<RRuntime, REvent = never, EventLayerError = never, Rpc extends DurableObjectRpc<RRuntime | REvent> = Record<never, never>> {
944
798
  /**
945
799
  * Layer provided around each Cloudflare event handled by this Durable Object.
@@ -967,15 +821,9 @@ interface DurableObjectOptions<RRuntime, REvent = never, EventLayerError = never
967
821
  * does not.
968
822
  */
969
823
  readonly rpc?: Rpc;
970
- /** Optional fetch handler for HTTP/WebSocket requests. */
824
+ /** Accept live native trace metadata. The client must also enable rpcTracing. */
825
+ readonly rpcTracing?: ReceiverOptions;
971
826
  readonly fetch?: Effect.Effect<Response, unknown, FetchContext<RRuntime | REvent>>;
972
- /**
973
- * Optional logical alarm processing effect.
974
- *
975
- * This runs before `alarm` and should be built with helpers such as
976
- * `DurableObjectAlarm.processDue(...)` so the reusable scheduler stays inside
977
- * the Durable Object's single managed runtime boundary.
978
- */
979
827
  readonly alarms?: Effect.Effect<unknown, unknown, HandlerContext<RRuntime | REvent>>;
980
828
  /**
981
829
  * Optional raw alarm handler.
@@ -993,21 +841,19 @@ interface DurableObjectOptions<RRuntime, REvent = never, EventLayerError = never
993
841
  /**
994
842
  * Cloudflare `DurableObject` constructor produced by {@link make}.
995
843
  */
996
- type DurableObjectClass<Rpc extends DurableObjectRpc<ROut>, ROut> = new (state: globalThis.DurableObjectState, env: WorkerEnv) => DurableObject<WorkerEnv> & DurableObjectRpcApi<Rpc, ROut>;
844
+ type DurableObjectClass<Rpc extends DurableObjectRpc<ROut>, ROut> = new (state: globalThis.DurableObjectState, env: WorkerEnv) => DurableObject<WorkerEnv> & DurableObjectRpcApi<Rpc, ROut> & {
845
+ [RunSymbol]<A, E>(effect: Effect.Effect<A, E, HandlerContext<ROut>>, options?: RunOptions): Promise<A>;
846
+ };
997
847
  /**
998
- * Creates a Durable Object class backed by a single managed Effect runtime.
848
+ * Builds a Durable Object whose base `layer` lives for the in-memory instance.
849
+ * Cloudflare does not expose an eviction or shutdown hook, so finalizers in
850
+ * that layer are not guaranteed to run. Put resources that require timely
851
+ * release in `eventLayer`, whose scope closes after each handled event.
999
852
  */
1000
853
  declare const make$6: <ROut, LayerError, REvent = never, EventLayerError = never, const Rpc extends DurableObjectRpc<ROut | REvent> = Record<never, never>>(layer: Layer.Layer<ROut, LayerError, DurableObjectState | WorkerEnvironment>, options?: DurableObjectOptions<ROut, REvent, EventLayerError, Rpc>) => DurableObjectClass<Rpc, ROut | REvent>;
1001
854
  declare namespace DurableObjectAlarm_d_exports {
1002
855
  export { AlarmDefinitionConfig, AlarmDefinitionEntry, AlarmDefinitionPayload, AlarmDefinitions, AlarmFailurePolicy, AlarmPayload, AlarmPayloadSchema, AlarmRef, AlarmRetryPolicy, AlarmScheduler, DefinedAlarmEvent, DefinedAlarmHandlers, DurableObjectAlarm, DurableObjectAlarmError, DurableObjectAlarmEvent, InvalidAlarmPayloadError, InvalidAlarmRefError, InvalidProcessDueAlarmsOptionsError, InvalidRepeatEveryError, ProcessDueAlarmsFailure, ProcessDueAlarmsFailureAction, ProcessDueAlarmsHandler, ProcessDueAlarmsMode, ProcessDueAlarmsOptions, ProcessDueAlarmsResult, ScheduleAlarmInput, StoredAlarmDecodeError, define, processDue };
1003
856
  }
1004
- /**
1005
- * JSON-serializable alarm payload stored with each scheduled alarm.
1006
- *
1007
- * Payloads are intentionally opaque to `DurableObjectAlarm`. Consumers should use
1008
- * stable `tag` values to route due alarms and then decode the payload for that
1009
- * tag in their own domain layer.
1010
- */
1011
857
  type AlarmPayload = Schema.Json;
1012
858
  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 & {
1013
859
  readonly _tag: "InvalidAlarmRefError";
@@ -1051,87 +897,21 @@ declare class StoredAlarmDecodeError extends StoredAlarmDecodeError_base<{
1051
897
  get message(): string;
1052
898
  }
1053
899
  type DurableObjectAlarmError = InvalidAlarmPayloadError | InvalidAlarmRefError | InvalidProcessDueAlarmsOptionsError | InvalidRepeatEveryError | StorageOperationError | StoredAlarmDecodeError;
1054
- /**
1055
- * Events handled by `processDueAlarms`.
1056
- *
1057
- * `AlarmDue` represents one durable alarm whose scheduled time is now due. The
1058
- * `tag` is the consumer-owned routing key, while `id` is the stable alarm id
1059
- * within that tag.
1060
- *
1061
- * `scheduledAt` is the logical due-after timestamp from durable storage. It is
1062
- * not expected to match the current Durable Object alarm invocation time,
1063
- * especially during retries. Retries re-scan durable rows with `run_at <= now`
1064
- * and identify logical events by `{ tag, id }`.
1065
- *
1066
- * @example Handling events by tag
1067
- * ```ts
1068
- * yield* durableObjectAlarm.processDueAlarms((event) =>
1069
- * event.tag === "heartbeat"
1070
- * ? heartbeatManager.handleAlarmEvent(event).pipe(Effect.asVoid)
1071
- * : Effect.void
1072
- * );
1073
- * ```
1074
- */
1075
900
  declare const DurableObjectAlarmEvent: Schema.TaggedUnion<{
1076
901
  readonly AlarmDue: Schema.TaggedStruct<"AlarmDue", {
1077
902
  readonly id: Schema.NonEmptyString;
1078
903
  readonly payload: Schema.Codec<Schema.Json, Schema.Json, never, never>;
904
+ /** Persisted due time, which can differ from the invocation time during retries. */
1079
905
  readonly scheduledAt: Schema.DateTimeUtc;
1080
906
  readonly tag: Schema.NonEmptyString;
1081
907
  }>;
1082
908
  }>;
1083
909
  type DurableObjectAlarmEvent = typeof DurableObjectAlarmEvent.Type;
1084
- /**
1085
- * Stable reference for a scheduled alarm.
1086
- *
1087
- * The pair of `tag` and `id` is the durable identity. Scheduling another alarm
1088
- * with the same pair replaces the previous alarm, and cancellation uses the
1089
- * same pair.
1090
- *
1091
- * @example Cancel an alarm
1092
- * ```ts
1093
- * yield* durableObjectAlarm.cancelAlarm({
1094
- * tag: "connection-reconnect-grace",
1095
- * id: "reconnect-grace-check",
1096
- * });
1097
- * ```
1098
- */
1099
910
  type AlarmRef<Tag extends string = string> = {
1100
911
  readonly id: string;
1101
912
  readonly tag: Tag;
1102
913
  };
1103
- /**
1104
- * Input for scheduling or replacing an alarm.
1105
- *
1106
- * `runAt` is the absolute first fire time. `repeatEvery` can be any Effect
1107
- * `Duration.Input`, including strings like `"5 seconds"`, numbers interpreted
1108
- * as milliseconds, or `Duration` values.
1109
- *
1110
- * @example One-shot alarm
1111
- * ```ts
1112
- * const now = yield* DateTime.now;
1113
- *
1114
- * yield* durableObjectAlarm.scheduleAlarm({
1115
- * tag: "connection-reconnect-grace",
1116
- * id: "reconnect-grace-check",
1117
- * runAt: DateTime.add(now, { seconds: 15 }),
1118
- * payload: { reason: "socket-closed" },
1119
- * });
1120
- * ```
1121
- *
1122
- * @example Repeating alarm
1123
- * ```ts
1124
- * const now = yield* DateTime.now;
1125
- *
1126
- * yield* durableObjectAlarm.scheduleAlarm({
1127
- * tag: "heartbeat",
1128
- * id: "heartbeat-check",
1129
- * runAt: DateTime.add(now, { seconds: 5 }),
1130
- * repeatEvery: "5 seconds",
1131
- * payload: null,
1132
- * });
1133
- * ```
1134
- */
914
+ /** Reusing `{tag, id}` replaces an alarm. Repeats run after success, never as fixed-cadence catch-up. */
1135
915
  type ScheduleAlarmInput<Tag extends string = string> = AlarmRef<Tag> & {
1136
916
  readonly payload: AlarmPayload;
1137
917
  readonly repeatEvery?: Duration.Input;
@@ -1158,106 +938,19 @@ type ProcessDueAlarmsFailureAction = "ordered" | "retry" | "skip-and-advance-rep
1158
938
  readonly mode: "skip-and-advance-repeat";
1159
939
  };
1160
940
  interface ProcessDueAlarmsOptions<OnFailureR = never, OnFailureE = never> {
1161
- /** Maximum due rows to load and process in one invocation. Defaults to 100. */
1162
941
  readonly limit?: number;
1163
- /**
1164
- * Failure isolation mode. Defaults to `isolated` so one poison logical alarm
1165
- * does not block unrelated maintenance work.
1166
- */
942
+ /** `isolated` retries only the failed row; `ordered` stops before later rows. */
1167
943
  readonly mode?: ProcessDueAlarmsMode;
1168
- /**
1169
- * Callback for logical handler/decode failures. Return a failure action to
1170
- * override the global failure behavior for this row.
1171
- */
1172
944
  readonly onFailure?: (failure: ProcessDueAlarmsFailure) => Effect.Effect<ProcessDueAlarmsFailureAction | void, OnFailureE, OnFailureR>;
1173
- /**
1174
- * Delay before retrying a failed logical row in isolated mode. Defaults to 30
1175
- * seconds. Ignored by ordered mode unless supplied explicitly.
1176
- *
1177
- * Retrying updates only the selected occurrence, so replacements scheduled by
1178
- * a long-running handler are not clobbered by failure handling.
1179
- */
1180
945
  readonly retryFailedAfter?: Duration.Input;
1181
946
  }
1182
- /**
1183
- * Handler invoked for each due alarm before that alarm is acknowledged.
1184
- *
1185
- * If the handler fails, `DurableObjectAlarm` leaves the row due and fails the alarm
1186
- * processing effect. Cloudflare can then retry the Durable Object alarm handler,
1187
- * and the scheduler will find the same logical row again because `run_at` is
1188
- * still less than or equal to the retry time.
1189
- */
1190
947
  type ProcessDueAlarmsHandler<R = never, E = never> = (event: DurableObjectAlarmEvent) => Effect.Effect<void, E, R>;
1191
- /**
1192
- * Durable alarm scheduler API.
1193
- *
1194
- * This service only owns scheduling semantics. It does not publish, subscribe,
1195
- * or dispatch events to consumers. Durable Object alarm handlers should pass a
1196
- * domain handler to `processDueAlarms`; rows are acknowledged only after that
1197
- * handler succeeds.
1198
- *
1199
- * This service must be the only code path that owns `storage.setAlarm()` inside
1200
- * a Durable Object instance. Cloudflare exposes one platform alarm timestamp per
1201
- * object, so another scheduler in the same object can clobber this service's
1202
- * reconciled alarm timestamp.
1203
- *
1204
- * @example Durable Object alarm handler
1205
- * ```ts
1206
- * const onAlarm = Effect.gen(function* () {
1207
- * const durableObjectAlarm = yield* DurableObjectAlarm;
1208
- *
1209
- * yield* durableObjectAlarm.processDueAlarms((event) =>
1210
- * Effect.gen(function* () {
1211
- * if (event.tag === "heartbeat") {
1212
- * yield* heartbeatManager.handleAlarmEvent(event);
1213
- * return;
1214
- * }
1215
- *
1216
- * if (event.tag === "connection-reconnect-grace") {
1217
- * yield* connectionManager.expireReconnectGracePeriods();
1218
- * }
1219
- * })
1220
- * );
1221
- * });
1222
- * ```
1223
- */
948
+ /** Own `storage.setAlarm()` exclusively: a Durable Object has one platform alarm timestamp. */
1224
949
  type AlarmScheduler = {
1225
- /**
1226
- * Cancel a scheduled alarm by `{ tag, id }`.
1227
- *
1228
- * This is idempotent. Cancelling a missing alarm is a no-op. The underlying
1229
- * Durable Object alarm is reconciled afterward.
1230
- */
1231
950
  readonly cancelAlarm: (input: AlarmRef) => Effect.Effect<void, InvalidAlarmRefError | StorageOperationError>;
1232
- /**
1233
- * Process due alarms according to `Clock.currentTimeMillis`.
1234
- *
1235
- * Each row is acknowledged only after `handle` succeeds. One-shot alarms are
1236
- * then deleted. Repeating alarms are rescheduled to `acknowledgedAt +
1237
- * repeatEvery`, which intentionally behaves as delay-after-success rather
1238
- * than fixed-cadence catch-up. Acknowledgements are conditional on the stored
1239
- * row still matching the selected occurrence, so a handler that reschedules
1240
- * the same `{ tag, id }` will not have its replacement clobbered by the old
1241
- * acknowledgement.
1242
- *
1243
- * Processing is ordered by `runAt` and stable alarm id. By default, logical
1244
- * handler/decode failures are isolated to the failing row: the row is retried
1245
- * after `retryFailedAfter`, later due rows still run, and the result reports
1246
- * both handled and failed rows. Use `mode: "ordered"` when a workflow
1247
- * intentionally requires strict head-of-line blocking.
1248
- *
1249
- * Handlers must still be idempotent: Cloudflare alarms are at-least-once, and
1250
- * if a handler succeeds but the acknowledgement write fails, the logical event
1251
- * can be delivered again.
1252
- */
951
+ /** Acknowledge after handling. Conditional writes preserve handler replacements; alarms are at-least-once. */
1253
952
  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>;
1254
- /**
1255
- * Schedule or replace an alarm by `{ tag, id }`.
1256
- *
1257
- * The durable row write and underlying platform alarm reconciliation are run
1258
- * in one Durable Object storage transaction, so a failed `setAlarm` rolls back
1259
- * the logical schedule instead of leaving a stored-but-unarmed alarm.
1260
- */
953
+ /** A failed platform setAlarm rolls back the logical schedule in the same transaction. */
1261
954
  readonly scheduleAlarm: (input: ScheduleAlarmInput) => Effect.Effect<void, InvalidAlarmPayloadError | InvalidAlarmRefError | InvalidRepeatEveryError | StorageOperationError>;
1262
955
  };
1263
956
  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>;
@@ -1284,50 +977,6 @@ declare const define: <const Definitions extends AlarmDefinitions>(definitions:
1284
977
  handlers: <R = never, E = never>(handlers: DefinedAlarmHandlers<Definitions, R, E>, options?: ProcessDueAlarmsOptions<R, E>) => Effect.Effect<ProcessDueAlarmsResult, E | DurableObjectAlarmError, R | DurableObjectAlarm>;
1285
978
  };
1286
979
  declare const DurableObjectAlarm_base: Context.ServiceClass<DurableObjectAlarm, "effect-cf/DurableObjectAlarm", AlarmScheduler>;
1287
- /**
1288
- * SQLite-backed Durable Object alarm scheduler.
1289
- *
1290
- * `DurableObjectAlarm` stores alarms in the current Durable Object's SQLite storage
1291
- * and keeps the platform alarm set to the earliest pending scheduled alarm. The
1292
- * platform alarm timestamp is only a wake-up hint; logical event identity comes
1293
- * from persisted `{ tag, id }` rows.
1294
- *
1295
- * Retry safety depends on acknowledgement ordering. `processDueAlarms` runs the
1296
- * caller's handler first and only then conditionally deletes or advances the
1297
- * same selected row. By default, handler failures are isolated: the failed row
1298
- * is retried after a delay, later due rows continue, and the platform alarm is
1299
- * reconciled once at the end. Use `mode: "ordered"` for strict workflows where
1300
- * one failed logical alarm should block later due alarms.
1301
- *
1302
- * Provide `DurableObjectAlarm.layer` anywhere `DurableObjectState` is available.
1303
- *
1304
- * @example Providing the service
1305
- * ```ts
1306
- * const program = Effect.gen(function* () {
1307
- * const durableObjectAlarm = yield* DurableObjectAlarm;
1308
- * const now = yield* DateTime.now;
1309
- *
1310
- * yield* durableObjectAlarm.scheduleAlarm({
1311
- * tag: "heartbeat",
1312
- * id: "heartbeat-check",
1313
- * runAt: DateTime.add(now, { seconds: 5 }),
1314
- * repeatEvery: Duration.seconds(5),
1315
- * payload: null,
1316
- * });
1317
- * }).pipe(Effect.provide(DurableObjectAlarm.layer));
1318
- * ```
1319
- *
1320
- * @example Processing due alarms
1321
- * ```ts
1322
- * const handledEvents = yield* durableObjectAlarm.processDueAlarms((event) =>
1323
- * Effect.gen(function* () {
1324
- * if (event.tag === "heartbeat") {
1325
- * yield* heartbeatManager.handleAlarmEvent(event);
1326
- * }
1327
- * })
1328
- * );
1329
- * ```
1330
- */
1331
980
  declare class DurableObjectAlarm extends DurableObjectAlarm_base {
1332
981
  static readonly layer: Layer.Layer<DurableObjectAlarm, never, DurableObjectState>;
1333
982
  }
@@ -1336,13 +985,11 @@ declare namespace DurableObjectRpcWebSocket_d_exports {
1336
985
  }
1337
986
  /** Heartbeat handling for Effect's application-level RPC Ping messages. */
1338
987
  type HeartbeatPolicy = "auto-response" | "passthrough";
1339
- /** Object-shaped application attachment fields that can coexist with adapter metadata. */
1340
988
  type RpcWebSocketAttachment = object;
1341
989
  /** A resumable RPC stream declaration understood by the websocket transport. */
1342
990
  interface ResumableStreamDeclaration<ResumeDescriptor = unknown, Checkpoint = unknown> {
1343
991
  /** Stable declaration identifier. Change it when the persisted representation changes. */
1344
992
  readonly id: string;
1345
- /** RPC tag matched against encoded client requests. */
1346
993
  readonly rpcTag: string;
1347
994
  /** Validates a resume descriptor restored from a websocket attachment. */
1348
995
  readonly resumeDescriptorSchema: Schema.Decoder<ResumeDescriptor>;
@@ -1358,7 +1005,6 @@ interface ResumableStreamDeclaration<ResumeDescriptor = unknown, Checkpoint = un
1358
1005
  readonly resumeDescriptor: ResumeDescriptor;
1359
1006
  readonly acknowledgedCheckpoint: Checkpoint;
1360
1007
  }>;
1361
- /** Rebuilds the encoded request fields used to restart a handler. */
1362
1008
  readonly rebuild: (options: {
1363
1009
  readonly subscriptionKey: string;
1364
1010
  readonly resumeDescriptor: ResumeDescriptor;
@@ -1386,9 +1032,7 @@ declare const resumableStream: <ResumeDescriptor, Checkpoint>(declaration: Resum
1386
1032
  * Configuration for {@link layer}.
1387
1033
  */
1388
1034
  interface LayerOptions$7 {
1389
- /** Tag used to select hibernated sockets. */
1390
1035
  readonly tag?: string | undefined;
1391
- /** Socket attachment namespace used to persist adapter metadata across hibernation. */
1392
1036
  readonly attachmentKey?: string | undefined;
1393
1037
  /**
1394
1038
  * Heartbeat behavior. `"auto-response"` (the default) installs Cloudflare's
@@ -1401,22 +1045,13 @@ interface LayerOptions$7 {
1401
1045
  * when RPC and unrelated websocket protocols share one object.
1402
1046
  */
1403
1047
  readonly heartbeat?: HeartbeatPolicy | undefined;
1404
- /** Explicit stream declarations that may be reconstructed after activation loss. */
1405
1048
  readonly resumableStreams?: ReadonlyArray<AnyResumableStreamDeclaration> | undefined;
1406
1049
  }
1407
- /** Native websocket event payload accepted by Cloudflare Durable Objects. */
1408
1050
  type NativeWebSocketMessage = string | ArrayBuffer;
1409
- /**
1410
- * Service API used to wire websocket lifecycle events to Effect RPC server protocol.
1411
- */
1412
1051
  interface DurableObjectRpcWebSocketService {
1413
- /** Accepts a new, not-yet-accepted socket with the RPC tag and any application tags. */
1052
+ /** Accept a server socket that has not already been accepted. */
1414
1053
  readonly accept: (socket: DurableWebSocket, tags?: ReadonlyArray<string>) => Effect.Effect<void>;
1415
- /**
1416
- * Creates and accepts a websocket upgrade without double-accepting the server
1417
- * socket. Application attachment fields are shallow-merged with the adapter's
1418
- * metadata namespace.
1419
- */
1054
+ /** Shallow-merges application attachment fields with the adapter's metadata namespace. */
1420
1055
  readonly acceptUpgrade: <Attachment extends RpcWebSocketAttachment = RpcWebSocketAttachment>(options?: AcceptUpgradeOptions<Attachment>) => Effect.Effect<AcceptedUpgrade<Attachment>, DurableWebSocketAttachmentError>;
1421
1056
  readonly message: (socket: DurableWebSocket, message: NativeWebSocketMessage) => Effect.Effect<void>;
1422
1057
  readonly close: (socket: DurableWebSocket) => Effect.Effect<void>;
@@ -1434,9 +1069,6 @@ interface DurableObjectRpcWebSocketService {
1434
1069
  }) => Effect.Effect<boolean, DurableWebSocketAttachmentError>;
1435
1070
  }
1436
1071
  declare const DurableObjectRpcWebSocket_base: Context.ServiceClass<DurableObjectRpcWebSocket, "effect-cf/DurableObjectRpcWebSocket", DurableObjectRpcWebSocketService>;
1437
- /**
1438
- * Context tag for the Durable Object RPC websocket service.
1439
- */
1440
1072
  declare class DurableObjectRpcWebSocket extends DurableObjectRpcWebSocket_base {}
1441
1073
  /**
1442
1074
  * Builds a hibernation-aware transport that bridges Durable Object websocket
@@ -1451,34 +1083,18 @@ declare const layer$6: (options?: LayerOptions$7) => Layer.Layer<RpcServer.Proto
1451
1083
  declare namespace DurableObjectSqlite_d_exports {
1452
1084
  export { SqliteLayerOptions, layer$5 as layer };
1453
1085
  }
1454
- /** Options forwarded to `@effect/sql-sqlite-do` when building a SQL client layer. */
1455
1086
  type SqliteLayerOptions = Omit<SqliteClient.SqliteClientConfig, "db" | "storage">;
1456
- /**
1457
- * Provides `effect/unstable/sql` from the current Durable Object SQLite storage.
1458
- *
1459
- * @example
1460
- * ```ts
1461
- * const RoomLayer = Layer.mergeAll(
1462
- * DurableObjectSqlite.layer(),
1463
- * OtherRoomServices,
1464
- * );
1465
- * ```
1466
- */
1467
1087
  declare const layer$5: (options?: SqliteLayerOptions) => Layer.Layer<SqliteClient.SqliteClient | SqlClient.SqlClient, never, DurableObjectState>;
1468
1088
  declare namespace Email_d_exports {
1469
1089
  export { EmailAddress, EmailAttachment, EmailBinding, EmailClient, EmailDefinition, EmailErrorCode, EmailMessageBuilder, EmailOperationError, EmailRecipients, EmailSendError, EmailSendOptions, EmailSendResult, EmailService, EmailValidationError, EmailViolation, LayerOptions$6 as LayerOptions, Tag$7 as Tag, TagClass$6 as TagClass, emailErrorCodes, isEmailBinding, layer$4 as layer, make$5 as make, makeClient$4 as makeClient, sendLimits, validateMessage };
1470
1090
  }
1471
- /** Documented Cloudflare Email Sending limits. */
1472
1091
  declare const sendLimits: {
1473
- /** Combined `to`, `cc`, and `bcc` addresses per message. */
1474
1092
  readonly maxRecipients: 50;
1475
1093
  readonly maxAttachments: 32;
1476
- /** Total message size, including attachments. Not enforced client side. */
1477
1094
  readonly maxMessageBytes: number;
1478
1095
  readonly maxHeaderNameBytes: 100;
1479
1096
  readonly maxHeaderValueBytes: 2048;
1480
1097
  readonly maxHeadersBytes: number;
1481
- /** Allowlisted custom headers, excluding `X-` prefixed headers. */
1482
1098
  readonly maxAllowlistHeaders: 20;
1483
1099
  };
1484
1100
  /**
@@ -1490,12 +1106,10 @@ declare const sendLimits: {
1490
1106
  * (miniflare remote bindings serialize errors and can strip it).
1491
1107
  */
1492
1108
  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"];
1493
- /** A documented Cloudflare Email Sending error code. */
1494
1109
  type EmailErrorCode = (typeof emailErrorCodes)[number];
1495
1110
  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 & {
1496
1111
  readonly _tag: "EmailOperationError";
1497
1112
  } & Readonly<A>;
1498
- /** Error raised when a Cloudflare Send Email operation fails. */
1499
1113
  declare class EmailOperationError extends EmailOperationError_base<{
1500
1114
  readonly binding: string;
1501
1115
  readonly operation: string;
@@ -1511,7 +1125,6 @@ declare class EmailOperationError extends EmailOperationError_base<{
1511
1125
  }> {
1512
1126
  get message(): string;
1513
1127
  }
1514
- /** A single message field that violates a documented Email Sending limit. */
1515
1128
  interface EmailViolation {
1516
1129
  readonly path: string;
1517
1130
  readonly message: string;
@@ -1521,7 +1134,6 @@ interface EmailViolation {
1521
1134
  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 & {
1522
1135
  readonly _tag: "EmailValidationError";
1523
1136
  } & Readonly<A>;
1524
- /** Error raised when a message violates documented Cloudflare Email Sending limits. */
1525
1137
  declare class EmailValidationError extends EmailValidationError_base<{
1526
1138
  readonly binding: string;
1527
1139
  readonly operation: string;
@@ -1529,9 +1141,7 @@ declare class EmailValidationError extends EmailValidationError_base<{
1529
1141
  }> {
1530
1142
  get message(): string;
1531
1143
  }
1532
- /** Typed Cloudflare Send Email binding definition. */
1533
1144
  interface EmailDefinition {
1534
- /** Binding name as configured in `wrangler.jsonc`. */
1535
1145
  readonly binding: string;
1536
1146
  }
1537
1147
  type EmailAddress = CloudflareEmailAddress;
@@ -1542,7 +1152,6 @@ type EmailBinding = CloudflareSendEmail;
1542
1152
  type EmailRecipients = string | EmailAddress | ReadonlyArray<string | EmailAddress>;
1543
1153
  type EmailSendError = EmailOperationError | EmailValidationError;
1544
1154
  interface EmailSendOptions {
1545
- /** Validates builder messages against documented limits. Defaults to `true`. */
1546
1155
  readonly validate?: boolean;
1547
1156
  }
1548
1157
  interface EmailClient {
@@ -1551,7 +1160,6 @@ interface EmailClient {
1551
1160
  readonly definition: EmailDefinition;
1552
1161
  }
1553
1162
  declare const EmailServiceTypeId: unique symbol;
1554
- /** Nominal service marker for Send Email services created with {@link make}. */
1555
1163
  interface EmailService<Id extends string> {
1556
1164
  readonly [EmailServiceTypeId]: {
1557
1165
  readonly id: Id;
@@ -1584,7 +1192,6 @@ type TypeId = typeof TypeId;
1584
1192
  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 & {
1585
1193
  readonly _tag: "ImagesOperationError";
1586
1194
  } & Readonly<A>;
1587
- /** Error raised when a Cloudflare Images operation fails. */
1588
1195
  declare class ImagesOperationError extends ImagesOperationError_base<{
1589
1196
  readonly binding: string;
1590
1197
  readonly operation: string;
@@ -1592,9 +1199,7 @@ declare class ImagesOperationError extends ImagesOperationError_base<{
1592
1199
  }> {
1593
1200
  get message(): string;
1594
1201
  }
1595
- /** Typed Cloudflare Images binding definition. */
1596
1202
  interface ImagesDefinition {
1597
- /** Binding name as configured in `wrangler.jsonc`. */
1598
1203
  readonly binding: string;
1599
1204
  }
1600
1205
  type ImageInfoResponse = CloudflareImageInfoResponse;
@@ -1735,7 +1340,6 @@ interface ImagesClient {
1735
1340
  readonly definition: ImagesDefinition;
1736
1341
  }
1737
1342
  declare const ImagesServiceTypeId: unique symbol;
1738
- /** Nominal service marker for Images services created with {@link make}. */
1739
1343
  interface ImagesService<Id extends string> {
1740
1344
  readonly [ImagesServiceTypeId]: {
1741
1345
  readonly id: Id;
@@ -1748,7 +1352,6 @@ interface TagClass$5<Self, Id extends string> extends Context.ServiceClass<Self,
1748
1352
  readonly id: Id;
1749
1353
  readonly layer: (options: LayerOptions$5) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
1750
1354
  }
1751
- /** Empty Images transformation pipeline. */
1752
1355
  declare const empty: Steps;
1753
1356
  declare const transform: {
1754
1357
  (transform: ImageTransform): (steps: Steps) => Steps;
@@ -1766,12 +1369,10 @@ declare const Tag$6: <Self>() => <Id extends string>(id: Id) => TagClass$5<Self,
1766
1369
  declare namespace Kv_d_exports {
1767
1370
  export { Definition$2 as Definition, KvClient, KvDefinition, KvListKey, KvListOptions, KvListResult, KvOperation, KvOperationError, KvPutOptions, KvWithMetadata, LayerOptions$4 as LayerOptions, Tag$5 as Tag, TagClass$4 as TagClass, isKvNamespace, layer$2 as layer, makeClient$2 as makeClient };
1768
1371
  }
1769
- /** KV operation represented by {@link KvOperationError}. */
1770
1372
  type KvOperation = "put" | "get" | "getWithMetadata" | "list" | "delete";
1771
1373
  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 & {
1772
1374
  readonly _tag: "KvOperationError";
1773
1375
  } & Readonly<A>;
1774
- /** Error raised when a KV operation fails. */
1775
1376
  declare class KvOperationError extends KvOperationError_base<{
1776
1377
  readonly binding: string;
1777
1378
  readonly operation: KvOperation;
@@ -1779,40 +1380,29 @@ declare class KvOperationError extends KvOperationError_base<{
1779
1380
  }> {
1780
1381
  get message(): string;
1781
1382
  }
1782
- /** `KVNamespace.put` options. */
1783
1383
  type KvPutOptions = CloudflareKVNamespacePutOptions;
1784
- /** `KVNamespace.list` options with optional metadata decoding schema. */
1785
1384
  type KvListOptions<Metadata = unknown> = CloudflareKVNamespaceListOptions & {
1786
1385
  readonly metadataSchema?: Schema.Codec<Metadata, unknown>;
1787
1386
  };
1788
- /** Successful value returned by `getWithMetadata`. */
1789
1387
  interface KvWithMetadata<Value, Metadata> {
1790
1388
  readonly value: Value;
1791
1389
  readonly metadata: Option.Option<Metadata>;
1792
1390
  readonly cacheStatus: Option.Option<string>;
1793
1391
  }
1794
- /** Decoded key entry returned by `list`. */
1795
1392
  interface KvListKey<Key, Metadata = unknown> {
1796
1393
  readonly name: Key;
1797
1394
  readonly expiration: Option.Option<number>;
1798
1395
  readonly metadata: Option.Option<Metadata>;
1799
1396
  }
1800
- /** Decoded result returned by `list`. */
1801
1397
  interface KvListResult<Key, Metadata = unknown> {
1802
1398
  readonly keys: ReadonlyArray<KvListKey<Key, Metadata>>;
1803
1399
  readonly listComplete: boolean;
1804
1400
  readonly cursor: Option.Option<string>;
1805
1401
  readonly cacheStatus: Option.Option<string>;
1806
1402
  }
1807
- /**
1808
- * Typed KV binding definition.
1809
- */
1810
1403
  interface KvDefinition<Key, Value, EncodedValue> {
1811
- /** Binding name as configured in `wrangler.jsonc`. */
1812
1404
  readonly binding: string;
1813
- /** Codec used to encode/decode keys. */
1814
1405
  readonly key: Schema.Codec<Key, string>;
1815
- /** Codec used to encode/decode values. */
1816
1406
  readonly value: Schema.Codec<Value, EncodedValue>;
1817
1407
  }
1818
1408
  /**
@@ -1820,9 +1410,7 @@ interface KvDefinition<Key, Value, EncodedValue> {
1820
1410
  */
1821
1411
  interface Definition$2<Id extends string = string, Key = unknown, Value = unknown, EncodedValue = unknown> {
1822
1412
  readonly id: Id;
1823
- /** Codec used to encode/decode keys. */
1824
1413
  readonly key: Schema.Codec<Key, string>;
1825
- /** Codec used to encode/decode values. */
1826
1414
  readonly value: Schema.Codec<Value, EncodedValue>;
1827
1415
  }
1828
1416
  declare namespace Definition$2 {
@@ -1856,12 +1444,10 @@ declare const Tag$5: <Self>() => <Id extends string, Key, Value, EncodedValue>(i
1856
1444
  declare namespace R2_d_exports {
1857
1445
  export { LayerOptions$3 as LayerOptions, R2Client, R2Definition, R2GetOptions, R2ListOptions, R2MultipartOptions, R2MultipartUploadClient, R2ObjectBodyClient, R2Operation, R2OperationError, R2PutOptions, R2PutValue, R2Service, R2UploadPartOptions, R2UploadPartValue, Tag$4 as Tag, TagClass$3 as TagClass, isR2Bucket, layer$1 as layer, make$3 as make, makeClient$1 as makeClient };
1858
1446
  }
1859
- /** R2 operation represented by {@link R2OperationError}. */
1860
1447
  type R2Operation = "head" | "get" | "put" | "delete" | "list" | "createMultipartUpload" | "resumeMultipartUpload" | "uploadPart" | "abortMultipartUpload" | "completeMultipartUpload" | "arrayBuffer" | "bytes" | "text" | "json" | "blob";
1861
1448
  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 & {
1862
1449
  readonly _tag: "R2OperationError";
1863
1450
  } & Readonly<A>;
1864
- /** Error raised when an R2 operation fails. */
1865
1451
  declare class R2OperationError extends R2OperationError_base<{
1866
1452
  readonly binding: string;
1867
1453
  readonly operation: R2Operation;
@@ -1869,9 +1455,7 @@ declare class R2OperationError extends R2OperationError_base<{
1869
1455
  }> {
1870
1456
  get message(): string;
1871
1457
  }
1872
- /** Typed R2 bucket binding definition. */
1873
1458
  interface R2Definition {
1874
- /** Binding name as configured in `wrangler.jsonc`. */
1875
1459
  readonly binding: string;
1876
1460
  }
1877
1461
  type R2GetOptions = CloudflareR2GetOptions;
@@ -1919,7 +1503,6 @@ interface R2Client {
1919
1503
  readonly definition: R2Definition;
1920
1504
  }
1921
1505
  declare const R2ServiceTypeId: unique symbol;
1922
- /** Nominal service marker for R2 services created with {@link make}. */
1923
1506
  interface R2Service<Id extends string> {
1924
1507
  readonly [R2ServiceTypeId]: {
1925
1508
  readonly id: Id;
@@ -1941,12 +1524,10 @@ declare const Tag$4: <Self>() => <Id extends string>(id: Id) => TagClass$3<Self,
1941
1524
  declare namespace Vectorize_d_exports {
1942
1525
  export { LayerOptions$2 as LayerOptions, Tag$3 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 };
1943
1526
  }
1944
- /** Vectorize operation represented by {@link VectorizeOperationError}. */
1945
1527
  type VectorizeOperation = "describe" | "query" | "queryById" | "insert" | "upsert" | "deleteByIds" | "getByIds";
1946
1528
  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 & {
1947
1529
  readonly _tag: "VectorizeOperationError";
1948
1530
  } & Readonly<A>;
1949
- /** Error raised when a Vectorize operation fails. */
1950
1531
  declare class VectorizeOperationError extends VectorizeOperationError_base<{
1951
1532
  readonly binding: string;
1952
1533
  readonly operation: VectorizeOperation;
@@ -1954,9 +1535,7 @@ declare class VectorizeOperationError extends VectorizeOperationError_base<{
1954
1535
  }> {
1955
1536
  get message(): string;
1956
1537
  }
1957
- /** Typed Vectorize binding definition. */
1958
1538
  interface VectorizeDefinition {
1959
- /** Binding name as configured in `wrangler.jsonc`. */
1960
1539
  readonly binding: string;
1961
1540
  }
1962
1541
  type VectorizeBinding = CloudflareVectorize | CloudflareVectorizeIndex;
@@ -1984,7 +1563,6 @@ interface VectorizeClient {
1984
1563
  readonly definition: VectorizeDefinition;
1985
1564
  }
1986
1565
  declare const VectorizeServiceTypeId: unique symbol;
1987
- /** Nominal service marker for Vectorize services created with {@link make}. */
1988
1566
  interface VectorizeService<Id extends string> {
1989
1567
  readonly [VectorizeServiceTypeId]: {
1990
1568
  readonly id: Id;
@@ -2007,11 +1585,8 @@ declare namespace WebTransport_d_exports {
2007
1585
  export { Capabilities, InboundTransport, WebTransportCapability, WebTransportUnsupportedError, capabilities, inboundSessionsUnsupported, inboundTransport, isHttp3 };
2008
1586
  }
2009
1587
  declare const InboundTransport_base: Schema.Class<InboundTransport, Schema.Struct<{
2010
- /** The HTTP protocol the client used, e.g. `"HTTP/2"` or `"HTTP/3"`. */
2011
1588
  readonly httpProtocol: Schema.String;
2012
- /** Client round-trip time; only present for QUIC (HTTP/3) connections. */
2013
1589
  readonly clientQuicRtt: Schema.optional<Schema.Number>;
2014
- /** Client round-trip time; only present for TCP (HTTP/1.x, HTTP/2) connections. */
2015
1590
  readonly clientTcpRtt: Schema.optional<Schema.Number>;
2016
1591
  }>, {}>;
2017
1592
  /**
@@ -2032,16 +1607,7 @@ declare class InboundTransport extends InboundTransport_base {}
2032
1607
  * the expected shape.
2033
1608
  */
2034
1609
  declare const inboundTransport: (request: Pick<CloudflareRequest, "cf">) => Option.Option<InboundTransport>;
2035
- /**
2036
- * Returns `true` when the client reached Cloudflare's edge over QUIC
2037
- * (HTTP/3). Prefers the documented QUIC signal (`clientQuicRtt` is only
2038
- * present for QUIC connections) and falls back to the `httpProtocol` string.
2039
- *
2040
- * Note this describes the browser→edge hop only: the edge always terminates
2041
- * QUIC, and the Worker still handles an ordinary `fetch` Request.
2042
- */
2043
1610
  declare const isHttp3: (transport: InboundTransport) => boolean;
2044
- /** WebTransport-related capabilities of the current Workers runtime. */
2045
1611
  interface Capabilities {
2046
1612
  /**
2047
1613
  * Whether Worker code can accept inbound WebTransport sessions. Typed as
@@ -2057,14 +1623,11 @@ interface Capabilities {
2057
1623
  */
2058
1624
  readonly outboundSessions: boolean;
2059
1625
  }
2060
- /** Feature-detects the WebTransport capabilities of the current runtime. */
2061
1626
  declare const capabilities: Effect.Effect<Capabilities>;
2062
- /** WebTransport capability missing from the current Workers runtime. */
2063
1627
  type WebTransportCapability = "inbound-sessions" | "outbound-sessions";
2064
1628
  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 & {
2065
1629
  readonly _tag: "WebTransportUnsupportedError";
2066
1630
  } & Readonly<A>;
2067
- /** Raised when a WebTransport capability is unavailable in this runtime. */
2068
1631
  declare class WebTransportUnsupportedError extends WebTransportUnsupportedError_base<{
2069
1632
  readonly capability: WebTransportCapability;
2070
1633
  }> {
@@ -2133,7 +1696,6 @@ declare class WorkflowEvent$1 extends WorkflowEvent_base {}
2133
1696
  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 & {
2134
1697
  readonly _tag: "WorkflowStepError";
2135
1698
  } & Readonly<A>;
2136
- /** Failure raised when a Cloudflare Workflow step operation rejects. */
2137
1699
  declare class WorkflowStepError extends WorkflowStepError_base<{
2138
1700
  readonly step?: string;
2139
1701
  readonly operation: string;
@@ -2200,4 +1762,4 @@ declare const implement: typeof implement$1;
2200
1762
  type Handler<ROut, Self extends Definition$1.Any> = Handler$1<ROut, Self>;
2201
1763
  type Options<ROut, Self extends Definition$1.Any> = Options$1<ROut, Self>;
2202
1764
  //#endregion
2203
- 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, 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, 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 };
1765
+ 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, 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 };