effect-cf 0.32.1 → 0.34.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 (73) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +31 -1072
  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 +1 -10
  10. package/dist/ComputerWorkspace.mjs +1 -2
  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-B0A0Y1ef.d.mts → DurableObjectState-CrEunfQ-.d.mts} +86 -254
  14. package/dist/{DurableObjectState-D1Ibr6k0.mjs → DurableObjectState-De4ZojhY.mjs} +2 -40
  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 +2 -17
  23. package/dist/{WorkflowBinding-B9_S8tX2.d.mts → WorkflowBinding-BumVQTuW.d.mts} +2 -5
  24. package/dist/index.d.mts +34 -480
  25. package/dist/index.mjs +174 -312
  26. package/package.json +2 -2
  27. package/src/AiGateway.ts +0 -6
  28. package/src/AnalyticsEngine.ts +0 -9
  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 +3 -39
  34. package/src/ComputerArtifacts.ts +0 -2
  35. package/src/ComputerWorkspace.ts +0 -9
  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 +45 -25
  40. package/src/DurableObjectAlarm.ts +6 -210
  41. package/src/DurableObjectDefinition.ts +8 -20
  42. package/src/DurableObjectNamespace.ts +57 -112
  43. package/src/DurableObjectRpcWebSocket.ts +3 -19
  44. package/src/DurableObjectSqlite.ts +0 -12
  45. package/src/DurableObjectState.ts +6 -21
  46. package/src/DurableObjectStorage.ts +2 -35
  47. package/src/DurableObjectWebSocket.ts +0 -31
  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 +0 -2
  57. package/src/RpcTracing.ts +133 -0
  58. package/src/Sandbox.ts +0 -30
  59. package/src/ServiceBinding.ts +48 -125
  60. package/src/Vectorize.ts +0 -5
  61. package/src/Vitest.ts +0 -28
  62. package/src/WebTransport.ts +0 -15
  63. package/src/Worker.ts +36 -57
  64. package/src/WorkerDefinition.ts +5 -14
  65. package/src/WorkersAi.ts +0 -4
  66. package/src/Workflow.ts +0 -5
  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/RpcInvocation.ts +18 -1
  72. package/src/internal/Runtime.ts +12 -7
  73. package/src/internal/WorkerContext.ts +0 -11
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-B0A0Y1ef.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-B9_S8tX2.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-CrEunfQ-.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-BumVQTuW.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`.
@@ -584,43 +528,21 @@ declare namespace D1_d_exports {
584
528
  }
585
529
  declare const TypeId$1: "~effect-cf/D1";
586
530
  type TypeId$1 = typeof TypeId$1;
587
- /** Typed D1 binding definition. */
588
531
  interface D1Definition {
589
- /** Binding name as configured in `wrangler.jsonc`. */
590
532
  readonly binding: string;
591
533
  }
592
- /** Options forwarded to `@effect/sql-d1` when building a SQL client layer. */
593
534
  type D1SqlLayerOptions = Omit<D1Client.D1ClientConfig, "db">;
594
535
  declare const D1ServiceTypeId: unique symbol;
595
- /** Nominal service marker for D1 services created with {@link make}. */
596
536
  interface D1Service<Id extends string> {
597
537
  readonly [D1ServiceTypeId]: {
598
538
  readonly id: Id;
599
539
  };
600
540
  }
601
- /**
602
- * Creates a typed D1 service tag plus Effect helpers.
603
- */
604
541
  declare const make$8: <Id extends string>(id: Id, definition: D1Definition) => BindingService<D1Service<Id>, Id, D1Database> & {
605
542
  "~effect-cf/D1": "~effect-cf/D1";
606
543
  definition: D1Definition;
607
544
  sqlLayer: (options?: D1SqlLayerOptions) => Layer.Layer<D1Client.D1Client | SqlClient.SqlClient, Config.ConfigError | BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
608
545
  };
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
546
  declare const Service: <Self>() => <Id extends string>(id: Id, definition: D1Definition) => BindingService<Self, Id, D1Database> & {
625
547
  "~effect-cf/D1": "~effect-cf/D1";
626
548
  definition: D1Definition;
@@ -642,21 +564,12 @@ type DurableObjectStubClient<Api extends object> = DurableObjectFetcher & RpcCli
642
564
  readonly id: globalThis.DurableObjectId;
643
565
  readonly name?: string;
644
566
  };
645
- /**
646
- * Native Durable Object namespace binding shape.
647
- */
648
567
  interface DurableObjectNamespaceClient<Api extends object> {
649
- /** Creates a globally unique Durable Object id. */
650
568
  newUniqueId(options?: globalThis.DurableObjectNamespaceNewUniqueIdOptions): globalThis.DurableObjectId;
651
- /** Deterministically maps a name to a Durable Object id. */
652
569
  idFromName(name: string): globalThis.DurableObjectId;
653
- /** Rehydrates a Durable Object id from its string form. */
654
570
  idFromString(id: string): globalThis.DurableObjectId;
655
- /** Returns a stub for an existing Durable Object id. */
656
571
  get(id: globalThis.DurableObjectId, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStubClient<Api>;
657
- /** Returns a stub by deterministic name. */
658
572
  getByName(name: string, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStubClient<Api>;
659
- /** Selects a namespace pinned to a specific jurisdiction. */
660
573
  jurisdiction(jurisdiction: globalThis.DurableObjectJurisdiction): DurableObjectNamespaceClient<Api>;
661
574
  }
662
575
  /**
@@ -669,10 +582,10 @@ interface DurableObjectNamespaceDefinition {
669
582
  * Namespace binding metadata with optional RPC schema.
670
583
  */
671
584
  interface DurableObjectNamespaceBindingDefinition<Definition extends Definition$3.Any | undefined = undefined> {
672
- /** Binding name as configured in `wrangler.jsonc`. */
673
585
  readonly binding: string;
674
- /** Optional RPC schema used for argument/result encoding. */
675
586
  readonly definition?: Definition;
587
+ /** Append live trace context only when the receiver also enables rpcTracing. */
588
+ readonly rpcTracing?: boolean;
676
589
  }
677
590
  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
591
  readonly _tag: "DurableObjectRpcError";
@@ -714,36 +627,12 @@ type DefinitionNamespaceDirectClientMethods<R, Definition extends Definition$3.A
714
627
  };
715
628
  type DirectMethods<R, Api extends object, Definition> = Definition extends Definition$3.Any ? DefinitionNamespaceDirectMethods<R, Api, Definition> & DefinitionNamespaceDirectClientMethods<R, Definition> : {};
716
629
  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
630
  readonly newUniqueId: (options?: globalThis.DurableObjectNamespaceNewUniqueIdOptions) => Effect.Effect<globalThis.DurableObjectId>;
719
- /** Deterministically maps a name to a Durable Object id. */
720
631
  readonly idFromName: (name: string) => Effect.Effect<globalThis.DurableObjectId>;
721
- /** Rehydrates a Durable Object id from its string form. */
722
632
  readonly idFromString: (id: string) => Effect.Effect<globalThis.DurableObjectId>;
723
- /** Returns a stub for an existing Durable Object id. */
724
633
  readonly get: (id: globalThis.DurableObjectId, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions) => Effect.Effect<DurableObjectStubClient<Api>>;
725
- /** Returns a stub by deterministic name. */
726
634
  readonly getByName: (name: string, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions) => Effect.Effect<DurableObjectStubClient<Api>>;
727
- /** Selects a namespace pinned to a specific jurisdiction. */
728
635
  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
636
  readonly fetch: (stub: DurableObjectStubClient<Api>, input: RequestInfo | URL, init?: RequestInit) => Effect.Effect<globalThis.Response, DurableObjectFetchError>;
748
637
  /**
749
638
  * Invokes a Durable Object RPC method and returns Cloudflare's raw RPC result.
@@ -753,21 +642,6 @@ type DurableObjectNamespaceEffectClient<Api extends object, Definition extends D
753
642
  * promise-like value and it does not decode definition-backed success schemas.
754
643
  *
755
644
  * 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
645
  */
772
646
  readonly rpc: <Method extends StubMethodKey<Api>>(stub: DurableObjectStubClient<Api>, method: Method, ...args: StubMethodArgs<Api, Method>) => Effect.Effect<StubMethodCloudflareReturn<Api, Method>, DurableObjectRpcError>;
773
647
  /**
@@ -775,18 +649,6 @@ type DurableObjectNamespaceEffectClient<Api extends object, Definition extends D
775
649
  * decodes the success value when the namespace was created from a definition.
776
650
  *
777
651
  * 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
652
  */
791
653
  readonly call: <Method extends StubMethodKey<Api>>(stub: DurableObjectStubClient<Api>, method: Method, ...args: StubMethodArgs<Api, Method>) => Effect.Effect<StubMethodSuccess<Api, Method>, DurableObjectRpcError>;
792
654
  /**
@@ -797,21 +659,6 @@ type DurableObjectNamespaceEffectClient<Api extends object, Definition extends D
797
659
  *
798
660
  * Use this for RPC methods that return Cloudflare RPC resources or other
799
661
  * 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
662
  */
816
663
  readonly scopedCall: <Method extends StubMethodKey<Api>>(stub: DurableObjectStubClient<Api>, method: Method, ...args: StubMethodArgs<Api, Method>) => Effect.Effect<Awaited<StubMethodSuccess<Api, Method>>, unknown, Scope.Scope>;
817
664
  /**
@@ -855,7 +702,6 @@ interface Method$1<Args extends ReadonlyArray<ServiceFreeSchema> = ReadonlyArray
855
702
  declare namespace Method$1 {
856
703
  export type Any = Method$1<ReadonlyArray<ServiceFreeSchema>, ServiceFreeSchema>;
857
704
  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
705
  type EncodedArgsFromSchemas<Args extends ReadonlyArray<ServiceFreeSchema>> = { [Index in keyof Args]: Schema.Json; };
860
706
  export type Args<Self extends Any> = ArgsFromSchemas<Self["args"]>;
861
707
  export type EncodedArgs<Self extends Any> = EncodedArgsFromSchemas<Self["args"]>;
@@ -893,6 +739,7 @@ interface Options$2<ROut, Self extends Definition$3.Any, REvent = never, EventLa
893
739
  }
894
740
  type LayerOptions$8 = {
895
741
  readonly binding: string;
742
+ readonly rpcTracing?: boolean;
896
743
  };
897
744
  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
745
  readonly id: Id;
@@ -922,11 +769,19 @@ declare const implement$2: <ROut, const Self extends Definition$3.Any>(_definiti
922
769
  */
923
770
  type HandlerEffect<ROut, Self extends Definition$3.Any, Key extends keyof Self["methods"]> = DurableObjectHandler<ROut, Method$1.Success<Self["methods"][Key]>>;
924
771
  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 };
772
+ 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
773
  }
927
774
  type RuntimeContext$1<ROut> = DurableObjectState | WorkerEnvironment | ROut;
928
775
  type HandlerContext<ROut> = RuntimeContext$1<ROut> | Scope.Scope;
929
776
  type FetchContext<ROut> = HandlerContext<ROut> | NativeRequest;
777
+ /** Metadata available before an event effect or its event layer starts. */
778
+ interface RunOptions {
779
+ readonly eventLayer?: boolean;
780
+ readonly event?: "fetch" | "rpc" | "alarm" | "webSocketMessage" | "webSocketClose" | "webSocketError";
781
+ readonly rpc?: RpcInvocationInfo;
782
+ }
783
+ /** Override to instrument the whole event, then call super[RunSymbol]. */
784
+ declare const RunSymbol: unique symbol;
930
785
  /**
931
786
  * Effect type for Durable Object lifecycle and RPC handlers.
932
787
  */
@@ -937,9 +792,6 @@ type DurableObjectHandler<ROut, A = unknown> = Effect.Effect<A, unknown, Handler
937
792
  type DurableObjectRpc<ROut> = Record<string, (...args: Array<any>) => DurableObjectHandler<ROut>>;
938
793
  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
794
  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
795
  interface DurableObjectOptions<RRuntime, REvent = never, EventLayerError = never, Rpc extends DurableObjectRpc<RRuntime | REvent> = Record<never, never>> {
944
796
  /**
945
797
  * Layer provided around each Cloudflare event handled by this Durable Object.
@@ -967,15 +819,9 @@ interface DurableObjectOptions<RRuntime, REvent = never, EventLayerError = never
967
819
  * does not.
968
820
  */
969
821
  readonly rpc?: Rpc;
970
- /** Optional fetch handler for HTTP/WebSocket requests. */
822
+ /** Accept live native trace metadata. The client must also enable rpcTracing. */
823
+ readonly rpcTracing?: ReceiverOptions;
971
824
  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
825
  readonly alarms?: Effect.Effect<unknown, unknown, HandlerContext<RRuntime | REvent>>;
980
826
  /**
981
827
  * Optional raw alarm handler.
@@ -993,21 +839,13 @@ interface DurableObjectOptions<RRuntime, REvent = never, EventLayerError = never
993
839
  /**
994
840
  * Cloudflare `DurableObject` constructor produced by {@link make}.
995
841
  */
996
- type DurableObjectClass<Rpc extends DurableObjectRpc<ROut>, ROut> = new (state: globalThis.DurableObjectState, env: WorkerEnv) => DurableObject<WorkerEnv> & DurableObjectRpcApi<Rpc, ROut>;
997
- /**
998
- * Creates a Durable Object class backed by a single managed Effect runtime.
999
- */
842
+ type DurableObjectClass<Rpc extends DurableObjectRpc<ROut>, ROut> = new (state: globalThis.DurableObjectState, env: WorkerEnv) => DurableObject<WorkerEnv> & DurableObjectRpcApi<Rpc, ROut> & {
843
+ [RunSymbol]<A, E>(effect: Effect.Effect<A, E, HandlerContext<ROut>>, options?: RunOptions): Promise<A>;
844
+ };
1000
845
  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
846
  declare namespace DurableObjectAlarm_d_exports {
1002
847
  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
848
  }
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
849
  type AlarmPayload = Schema.Json;
1012
850
  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
851
  readonly _tag: "InvalidAlarmRefError";
@@ -1051,87 +889,21 @@ declare class StoredAlarmDecodeError extends StoredAlarmDecodeError_base<{
1051
889
  get message(): string;
1052
890
  }
1053
891
  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
892
  declare const DurableObjectAlarmEvent: Schema.TaggedUnion<{
1076
893
  readonly AlarmDue: Schema.TaggedStruct<"AlarmDue", {
1077
894
  readonly id: Schema.NonEmptyString;
1078
895
  readonly payload: Schema.Codec<Schema.Json, Schema.Json, never, never>;
896
+ /** Persisted due time, which can differ from the invocation time during retries. */
1079
897
  readonly scheduledAt: Schema.DateTimeUtc;
1080
898
  readonly tag: Schema.NonEmptyString;
1081
899
  }>;
1082
900
  }>;
1083
901
  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
902
  type AlarmRef<Tag extends string = string> = {
1100
903
  readonly id: string;
1101
904
  readonly tag: Tag;
1102
905
  };
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
- */
906
+ /** Reusing `{tag, id}` replaces an alarm. Repeats run after success, never as fixed-cadence catch-up. */
1135
907
  type ScheduleAlarmInput<Tag extends string = string> = AlarmRef<Tag> & {
1136
908
  readonly payload: AlarmPayload;
1137
909
  readonly repeatEvery?: Duration.Input;
@@ -1158,106 +930,19 @@ type ProcessDueAlarmsFailureAction = "ordered" | "retry" | "skip-and-advance-rep
1158
930
  readonly mode: "skip-and-advance-repeat";
1159
931
  };
1160
932
  interface ProcessDueAlarmsOptions<OnFailureR = never, OnFailureE = never> {
1161
- /** Maximum due rows to load and process in one invocation. Defaults to 100. */
1162
933
  readonly limit?: number;
1163
- /**
1164
- * Failure isolation mode. Defaults to `isolated` so one poison logical alarm
1165
- * does not block unrelated maintenance work.
1166
- */
934
+ /** `isolated` retries only the failed row; `ordered` stops before later rows. */
1167
935
  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
936
  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
937
  readonly retryFailedAfter?: Duration.Input;
1181
938
  }
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
939
  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
- */
940
+ /** Own `storage.setAlarm()` exclusively: a Durable Object has one platform alarm timestamp. */
1224
941
  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
942
  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
- */
943
+ /** Acknowledge after handling. Conditional writes preserve handler replacements; alarms are at-least-once. */
1253
944
  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
- */
945
+ /** A failed platform setAlarm rolls back the logical schedule in the same transaction. */
1261
946
  readonly scheduleAlarm: (input: ScheduleAlarmInput) => Effect.Effect<void, InvalidAlarmPayloadError | InvalidAlarmRefError | InvalidRepeatEveryError | StorageOperationError>;
1262
947
  };
1263
948
  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 +969,6 @@ declare const define: <const Definitions extends AlarmDefinitions>(definitions:
1284
969
  handlers: <R = never, E = never>(handlers: DefinedAlarmHandlers<Definitions, R, E>, options?: ProcessDueAlarmsOptions<R, E>) => Effect.Effect<ProcessDueAlarmsResult, E | DurableObjectAlarmError, R | DurableObjectAlarm>;
1285
970
  };
1286
971
  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
972
  declare class DurableObjectAlarm extends DurableObjectAlarm_base {
1332
973
  static readonly layer: Layer.Layer<DurableObjectAlarm, never, DurableObjectState>;
1333
974
  }
@@ -1336,13 +977,11 @@ declare namespace DurableObjectRpcWebSocket_d_exports {
1336
977
  }
1337
978
  /** Heartbeat handling for Effect's application-level RPC Ping messages. */
1338
979
  type HeartbeatPolicy = "auto-response" | "passthrough";
1339
- /** Object-shaped application attachment fields that can coexist with adapter metadata. */
1340
980
  type RpcWebSocketAttachment = object;
1341
981
  /** A resumable RPC stream declaration understood by the websocket transport. */
1342
982
  interface ResumableStreamDeclaration<ResumeDescriptor = unknown, Checkpoint = unknown> {
1343
983
  /** Stable declaration identifier. Change it when the persisted representation changes. */
1344
984
  readonly id: string;
1345
- /** RPC tag matched against encoded client requests. */
1346
985
  readonly rpcTag: string;
1347
986
  /** Validates a resume descriptor restored from a websocket attachment. */
1348
987
  readonly resumeDescriptorSchema: Schema.Decoder<ResumeDescriptor>;
@@ -1358,7 +997,6 @@ interface ResumableStreamDeclaration<ResumeDescriptor = unknown, Checkpoint = un
1358
997
  readonly resumeDescriptor: ResumeDescriptor;
1359
998
  readonly acknowledgedCheckpoint: Checkpoint;
1360
999
  }>;
1361
- /** Rebuilds the encoded request fields used to restart a handler. */
1362
1000
  readonly rebuild: (options: {
1363
1001
  readonly subscriptionKey: string;
1364
1002
  readonly resumeDescriptor: ResumeDescriptor;
@@ -1386,9 +1024,7 @@ declare const resumableStream: <ResumeDescriptor, Checkpoint>(declaration: Resum
1386
1024
  * Configuration for {@link layer}.
1387
1025
  */
1388
1026
  interface LayerOptions$7 {
1389
- /** Tag used to select hibernated sockets. */
1390
1027
  readonly tag?: string | undefined;
1391
- /** Socket attachment namespace used to persist adapter metadata across hibernation. */
1392
1028
  readonly attachmentKey?: string | undefined;
1393
1029
  /**
1394
1030
  * Heartbeat behavior. `"auto-response"` (the default) installs Cloudflare's
@@ -1401,22 +1037,13 @@ interface LayerOptions$7 {
1401
1037
  * when RPC and unrelated websocket protocols share one object.
1402
1038
  */
1403
1039
  readonly heartbeat?: HeartbeatPolicy | undefined;
1404
- /** Explicit stream declarations that may be reconstructed after activation loss. */
1405
1040
  readonly resumableStreams?: ReadonlyArray<AnyResumableStreamDeclaration> | undefined;
1406
1041
  }
1407
- /** Native websocket event payload accepted by Cloudflare Durable Objects. */
1408
1042
  type NativeWebSocketMessage = string | ArrayBuffer;
1409
- /**
1410
- * Service API used to wire websocket lifecycle events to Effect RPC server protocol.
1411
- */
1412
1043
  interface DurableObjectRpcWebSocketService {
1413
- /** Accepts a new, not-yet-accepted socket with the RPC tag and any application tags. */
1044
+ /** Accept a server socket that has not already been accepted. */
1414
1045
  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
- */
1046
+ /** Shallow-merges application attachment fields with the adapter's metadata namespace. */
1420
1047
  readonly acceptUpgrade: <Attachment extends RpcWebSocketAttachment = RpcWebSocketAttachment>(options?: AcceptUpgradeOptions<Attachment>) => Effect.Effect<AcceptedUpgrade<Attachment>, DurableWebSocketAttachmentError>;
1421
1048
  readonly message: (socket: DurableWebSocket, message: NativeWebSocketMessage) => Effect.Effect<void>;
1422
1049
  readonly close: (socket: DurableWebSocket) => Effect.Effect<void>;
@@ -1434,9 +1061,6 @@ interface DurableObjectRpcWebSocketService {
1434
1061
  }) => Effect.Effect<boolean, DurableWebSocketAttachmentError>;
1435
1062
  }
1436
1063
  declare const DurableObjectRpcWebSocket_base: Context.ServiceClass<DurableObjectRpcWebSocket, "effect-cf/DurableObjectRpcWebSocket", DurableObjectRpcWebSocketService>;
1437
- /**
1438
- * Context tag for the Durable Object RPC websocket service.
1439
- */
1440
1064
  declare class DurableObjectRpcWebSocket extends DurableObjectRpcWebSocket_base {}
1441
1065
  /**
1442
1066
  * Builds a hibernation-aware transport that bridges Durable Object websocket
@@ -1451,34 +1075,18 @@ declare const layer$6: (options?: LayerOptions$7) => Layer.Layer<RpcServer.Proto
1451
1075
  declare namespace DurableObjectSqlite_d_exports {
1452
1076
  export { SqliteLayerOptions, layer$5 as layer };
1453
1077
  }
1454
- /** Options forwarded to `@effect/sql-sqlite-do` when building a SQL client layer. */
1455
1078
  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
1079
  declare const layer$5: (options?: SqliteLayerOptions) => Layer.Layer<SqliteClient.SqliteClient | SqlClient.SqlClient, never, DurableObjectState>;
1468
1080
  declare namespace Email_d_exports {
1469
1081
  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
1082
  }
1471
- /** Documented Cloudflare Email Sending limits. */
1472
1083
  declare const sendLimits: {
1473
- /** Combined `to`, `cc`, and `bcc` addresses per message. */
1474
1084
  readonly maxRecipients: 50;
1475
1085
  readonly maxAttachments: 32;
1476
- /** Total message size, including attachments. Not enforced client side. */
1477
1086
  readonly maxMessageBytes: number;
1478
1087
  readonly maxHeaderNameBytes: 100;
1479
1088
  readonly maxHeaderValueBytes: 2048;
1480
1089
  readonly maxHeadersBytes: number;
1481
- /** Allowlisted custom headers, excluding `X-` prefixed headers. */
1482
1090
  readonly maxAllowlistHeaders: 20;
1483
1091
  };
1484
1092
  /**
@@ -1490,12 +1098,10 @@ declare const sendLimits: {
1490
1098
  * (miniflare remote bindings serialize errors and can strip it).
1491
1099
  */
1492
1100
  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
1101
  type EmailErrorCode = (typeof emailErrorCodes)[number];
1495
1102
  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
1103
  readonly _tag: "EmailOperationError";
1497
1104
  } & Readonly<A>;
1498
- /** Error raised when a Cloudflare Send Email operation fails. */
1499
1105
  declare class EmailOperationError extends EmailOperationError_base<{
1500
1106
  readonly binding: string;
1501
1107
  readonly operation: string;
@@ -1511,7 +1117,6 @@ declare class EmailOperationError extends EmailOperationError_base<{
1511
1117
  }> {
1512
1118
  get message(): string;
1513
1119
  }
1514
- /** A single message field that violates a documented Email Sending limit. */
1515
1120
  interface EmailViolation {
1516
1121
  readonly path: string;
1517
1122
  readonly message: string;
@@ -1521,7 +1126,6 @@ interface EmailViolation {
1521
1126
  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
1127
  readonly _tag: "EmailValidationError";
1523
1128
  } & Readonly<A>;
1524
- /** Error raised when a message violates documented Cloudflare Email Sending limits. */
1525
1129
  declare class EmailValidationError extends EmailValidationError_base<{
1526
1130
  readonly binding: string;
1527
1131
  readonly operation: string;
@@ -1529,9 +1133,7 @@ declare class EmailValidationError extends EmailValidationError_base<{
1529
1133
  }> {
1530
1134
  get message(): string;
1531
1135
  }
1532
- /** Typed Cloudflare Send Email binding definition. */
1533
1136
  interface EmailDefinition {
1534
- /** Binding name as configured in `wrangler.jsonc`. */
1535
1137
  readonly binding: string;
1536
1138
  }
1537
1139
  type EmailAddress = CloudflareEmailAddress;
@@ -1542,7 +1144,6 @@ type EmailBinding = CloudflareSendEmail;
1542
1144
  type EmailRecipients = string | EmailAddress | ReadonlyArray<string | EmailAddress>;
1543
1145
  type EmailSendError = EmailOperationError | EmailValidationError;
1544
1146
  interface EmailSendOptions {
1545
- /** Validates builder messages against documented limits. Defaults to `true`. */
1546
1147
  readonly validate?: boolean;
1547
1148
  }
1548
1149
  interface EmailClient {
@@ -1551,7 +1152,6 @@ interface EmailClient {
1551
1152
  readonly definition: EmailDefinition;
1552
1153
  }
1553
1154
  declare const EmailServiceTypeId: unique symbol;
1554
- /** Nominal service marker for Send Email services created with {@link make}. */
1555
1155
  interface EmailService<Id extends string> {
1556
1156
  readonly [EmailServiceTypeId]: {
1557
1157
  readonly id: Id;
@@ -1584,7 +1184,6 @@ type TypeId = typeof TypeId;
1584
1184
  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
1185
  readonly _tag: "ImagesOperationError";
1586
1186
  } & Readonly<A>;
1587
- /** Error raised when a Cloudflare Images operation fails. */
1588
1187
  declare class ImagesOperationError extends ImagesOperationError_base<{
1589
1188
  readonly binding: string;
1590
1189
  readonly operation: string;
@@ -1592,9 +1191,7 @@ declare class ImagesOperationError extends ImagesOperationError_base<{
1592
1191
  }> {
1593
1192
  get message(): string;
1594
1193
  }
1595
- /** Typed Cloudflare Images binding definition. */
1596
1194
  interface ImagesDefinition {
1597
- /** Binding name as configured in `wrangler.jsonc`. */
1598
1195
  readonly binding: string;
1599
1196
  }
1600
1197
  type ImageInfoResponse = CloudflareImageInfoResponse;
@@ -1735,7 +1332,6 @@ interface ImagesClient {
1735
1332
  readonly definition: ImagesDefinition;
1736
1333
  }
1737
1334
  declare const ImagesServiceTypeId: unique symbol;
1738
- /** Nominal service marker for Images services created with {@link make}. */
1739
1335
  interface ImagesService<Id extends string> {
1740
1336
  readonly [ImagesServiceTypeId]: {
1741
1337
  readonly id: Id;
@@ -1748,7 +1344,6 @@ interface TagClass$5<Self, Id extends string> extends Context.ServiceClass<Self,
1748
1344
  readonly id: Id;
1749
1345
  readonly layer: (options: LayerOptions$5) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
1750
1346
  }
1751
- /** Empty Images transformation pipeline. */
1752
1347
  declare const empty: Steps;
1753
1348
  declare const transform: {
1754
1349
  (transform: ImageTransform): (steps: Steps) => Steps;
@@ -1766,12 +1361,10 @@ declare const Tag$6: <Self>() => <Id extends string>(id: Id) => TagClass$5<Self,
1766
1361
  declare namespace Kv_d_exports {
1767
1362
  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
1363
  }
1769
- /** KV operation represented by {@link KvOperationError}. */
1770
1364
  type KvOperation = "put" | "get" | "getWithMetadata" | "list" | "delete";
1771
1365
  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
1366
  readonly _tag: "KvOperationError";
1773
1367
  } & Readonly<A>;
1774
- /** Error raised when a KV operation fails. */
1775
1368
  declare class KvOperationError extends KvOperationError_base<{
1776
1369
  readonly binding: string;
1777
1370
  readonly operation: KvOperation;
@@ -1779,40 +1372,29 @@ declare class KvOperationError extends KvOperationError_base<{
1779
1372
  }> {
1780
1373
  get message(): string;
1781
1374
  }
1782
- /** `KVNamespace.put` options. */
1783
1375
  type KvPutOptions = CloudflareKVNamespacePutOptions;
1784
- /** `KVNamespace.list` options with optional metadata decoding schema. */
1785
1376
  type KvListOptions<Metadata = unknown> = CloudflareKVNamespaceListOptions & {
1786
1377
  readonly metadataSchema?: Schema.Codec<Metadata, unknown>;
1787
1378
  };
1788
- /** Successful value returned by `getWithMetadata`. */
1789
1379
  interface KvWithMetadata<Value, Metadata> {
1790
1380
  readonly value: Value;
1791
1381
  readonly metadata: Option.Option<Metadata>;
1792
1382
  readonly cacheStatus: Option.Option<string>;
1793
1383
  }
1794
- /** Decoded key entry returned by `list`. */
1795
1384
  interface KvListKey<Key, Metadata = unknown> {
1796
1385
  readonly name: Key;
1797
1386
  readonly expiration: Option.Option<number>;
1798
1387
  readonly metadata: Option.Option<Metadata>;
1799
1388
  }
1800
- /** Decoded result returned by `list`. */
1801
1389
  interface KvListResult<Key, Metadata = unknown> {
1802
1390
  readonly keys: ReadonlyArray<KvListKey<Key, Metadata>>;
1803
1391
  readonly listComplete: boolean;
1804
1392
  readonly cursor: Option.Option<string>;
1805
1393
  readonly cacheStatus: Option.Option<string>;
1806
1394
  }
1807
- /**
1808
- * Typed KV binding definition.
1809
- */
1810
1395
  interface KvDefinition<Key, Value, EncodedValue> {
1811
- /** Binding name as configured in `wrangler.jsonc`. */
1812
1396
  readonly binding: string;
1813
- /** Codec used to encode/decode keys. */
1814
1397
  readonly key: Schema.Codec<Key, string>;
1815
- /** Codec used to encode/decode values. */
1816
1398
  readonly value: Schema.Codec<Value, EncodedValue>;
1817
1399
  }
1818
1400
  /**
@@ -1820,9 +1402,7 @@ interface KvDefinition<Key, Value, EncodedValue> {
1820
1402
  */
1821
1403
  interface Definition$2<Id extends string = string, Key = unknown, Value = unknown, EncodedValue = unknown> {
1822
1404
  readonly id: Id;
1823
- /** Codec used to encode/decode keys. */
1824
1405
  readonly key: Schema.Codec<Key, string>;
1825
- /** Codec used to encode/decode values. */
1826
1406
  readonly value: Schema.Codec<Value, EncodedValue>;
1827
1407
  }
1828
1408
  declare namespace Definition$2 {
@@ -1856,12 +1436,10 @@ declare const Tag$5: <Self>() => <Id extends string, Key, Value, EncodedValue>(i
1856
1436
  declare namespace R2_d_exports {
1857
1437
  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
1438
  }
1859
- /** R2 operation represented by {@link R2OperationError}. */
1860
1439
  type R2Operation = "head" | "get" | "put" | "delete" | "list" | "createMultipartUpload" | "resumeMultipartUpload" | "uploadPart" | "abortMultipartUpload" | "completeMultipartUpload" | "arrayBuffer" | "bytes" | "text" | "json" | "blob";
1861
1440
  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
1441
  readonly _tag: "R2OperationError";
1863
1442
  } & Readonly<A>;
1864
- /** Error raised when an R2 operation fails. */
1865
1443
  declare class R2OperationError extends R2OperationError_base<{
1866
1444
  readonly binding: string;
1867
1445
  readonly operation: R2Operation;
@@ -1869,9 +1447,7 @@ declare class R2OperationError extends R2OperationError_base<{
1869
1447
  }> {
1870
1448
  get message(): string;
1871
1449
  }
1872
- /** Typed R2 bucket binding definition. */
1873
1450
  interface R2Definition {
1874
- /** Binding name as configured in `wrangler.jsonc`. */
1875
1451
  readonly binding: string;
1876
1452
  }
1877
1453
  type R2GetOptions = CloudflareR2GetOptions;
@@ -1919,7 +1495,6 @@ interface R2Client {
1919
1495
  readonly definition: R2Definition;
1920
1496
  }
1921
1497
  declare const R2ServiceTypeId: unique symbol;
1922
- /** Nominal service marker for R2 services created with {@link make}. */
1923
1498
  interface R2Service<Id extends string> {
1924
1499
  readonly [R2ServiceTypeId]: {
1925
1500
  readonly id: Id;
@@ -1941,12 +1516,10 @@ declare const Tag$4: <Self>() => <Id extends string>(id: Id) => TagClass$3<Self,
1941
1516
  declare namespace Vectorize_d_exports {
1942
1517
  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
1518
  }
1944
- /** Vectorize operation represented by {@link VectorizeOperationError}. */
1945
1519
  type VectorizeOperation = "describe" | "query" | "queryById" | "insert" | "upsert" | "deleteByIds" | "getByIds";
1946
1520
  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
1521
  readonly _tag: "VectorizeOperationError";
1948
1522
  } & Readonly<A>;
1949
- /** Error raised when a Vectorize operation fails. */
1950
1523
  declare class VectorizeOperationError extends VectorizeOperationError_base<{
1951
1524
  readonly binding: string;
1952
1525
  readonly operation: VectorizeOperation;
@@ -1954,9 +1527,7 @@ declare class VectorizeOperationError extends VectorizeOperationError_base<{
1954
1527
  }> {
1955
1528
  get message(): string;
1956
1529
  }
1957
- /** Typed Vectorize binding definition. */
1958
1530
  interface VectorizeDefinition {
1959
- /** Binding name as configured in `wrangler.jsonc`. */
1960
1531
  readonly binding: string;
1961
1532
  }
1962
1533
  type VectorizeBinding = CloudflareVectorize | CloudflareVectorizeIndex;
@@ -1984,7 +1555,6 @@ interface VectorizeClient {
1984
1555
  readonly definition: VectorizeDefinition;
1985
1556
  }
1986
1557
  declare const VectorizeServiceTypeId: unique symbol;
1987
- /** Nominal service marker for Vectorize services created with {@link make}. */
1988
1558
  interface VectorizeService<Id extends string> {
1989
1559
  readonly [VectorizeServiceTypeId]: {
1990
1560
  readonly id: Id;
@@ -2007,11 +1577,8 @@ declare namespace WebTransport_d_exports {
2007
1577
  export { Capabilities, InboundTransport, WebTransportCapability, WebTransportUnsupportedError, capabilities, inboundSessionsUnsupported, inboundTransport, isHttp3 };
2008
1578
  }
2009
1579
  declare const InboundTransport_base: Schema.Class<InboundTransport, Schema.Struct<{
2010
- /** The HTTP protocol the client used, e.g. `"HTTP/2"` or `"HTTP/3"`. */
2011
1580
  readonly httpProtocol: Schema.String;
2012
- /** Client round-trip time; only present for QUIC (HTTP/3) connections. */
2013
1581
  readonly clientQuicRtt: Schema.optional<Schema.Number>;
2014
- /** Client round-trip time; only present for TCP (HTTP/1.x, HTTP/2) connections. */
2015
1582
  readonly clientTcpRtt: Schema.optional<Schema.Number>;
2016
1583
  }>, {}>;
2017
1584
  /**
@@ -2032,16 +1599,7 @@ declare class InboundTransport extends InboundTransport_base {}
2032
1599
  * the expected shape.
2033
1600
  */
2034
1601
  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
1602
  declare const isHttp3: (transport: InboundTransport) => boolean;
2044
- /** WebTransport-related capabilities of the current Workers runtime. */
2045
1603
  interface Capabilities {
2046
1604
  /**
2047
1605
  * Whether Worker code can accept inbound WebTransport sessions. Typed as
@@ -2057,14 +1615,11 @@ interface Capabilities {
2057
1615
  */
2058
1616
  readonly outboundSessions: boolean;
2059
1617
  }
2060
- /** Feature-detects the WebTransport capabilities of the current runtime. */
2061
1618
  declare const capabilities: Effect.Effect<Capabilities>;
2062
- /** WebTransport capability missing from the current Workers runtime. */
2063
1619
  type WebTransportCapability = "inbound-sessions" | "outbound-sessions";
2064
1620
  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
1621
  readonly _tag: "WebTransportUnsupportedError";
2066
1622
  } & Readonly<A>;
2067
- /** Raised when a WebTransport capability is unavailable in this runtime. */
2068
1623
  declare class WebTransportUnsupportedError extends WebTransportUnsupportedError_base<{
2069
1624
  readonly capability: WebTransportCapability;
2070
1625
  }> {
@@ -2133,7 +1688,6 @@ declare class WorkflowEvent$1 extends WorkflowEvent_base {}
2133
1688
  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
1689
  readonly _tag: "WorkflowStepError";
2135
1690
  } & Readonly<A>;
2136
- /** Failure raised when a Cloudflare Workflow step operation rejects. */
2137
1691
  declare class WorkflowStepError extends WorkflowStepError_base<{
2138
1692
  readonly step?: string;
2139
1693
  readonly operation: string;
@@ -2200,4 +1754,4 @@ declare const implement: typeof implement$1;
2200
1754
  type Handler<ROut, Self extends Definition$1.Any> = Handler$1<ROut, Self>;
2201
1755
  type Options<ROut, Self extends Definition$1.Any> = Options$1<ROut, Self>;
2202
1756
  //#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 };
1757
+ 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 };