effect-cf 0.10.0 → 0.12.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.
- package/CHANGELOG.md +12 -0
- package/dist/index.d.mts +312 -84
- package/dist/index.mjs +439 -91
- package/package.json +4 -1
- package/src/CloudflareOtlp.ts +628 -0
- package/src/DurableObjectSqlite.ts +26 -0
- package/src/index.ts +2 -0
package/dist/index.d.mts
CHANGED
|
@@ -1,63 +1,22 @@
|
|
|
1
1
|
import { a as BindingService, c as WorkerConfig, i as BindingNotFoundError, l as WorkerEnv, o as BindingValidationError, s as Binding_d_exports, t as Hyperdrive_d_exports, u as WorkerEnvironment } from "./Hyperdrive-L6ldMlRF.mjs";
|
|
2
|
-
import { Cause, Context, Data, DateTime, Duration, Effect, Layer, Option, Schema, Scope } from "effect";
|
|
3
|
-
import { D1Client } from "@effect/sql-d1";
|
|
4
|
-
import { DurableObject, RpcStub, RpcTarget, WorkerEntrypoint, WorkflowEntrypoint, WorkflowEvent, WorkflowSleepDuration, WorkflowStep, WorkflowStepConfig, WorkflowStepContext, WorkflowStepEvent, WorkflowTimeoutDuration } from "cloudflare:workers";
|
|
2
|
+
import { Cause, Config, Context, Data, DateTime, Duration, Effect, Layer, Option, Schema, Scope } from "effect";
|
|
5
3
|
import { HttpServerRequest, HttpServerResponse } from "effect/unstable/http";
|
|
4
|
+
import { OtlpMetrics } from "effect/unstable/observability";
|
|
5
|
+
import { DurableObject, RpcStub, RpcTarget, WorkerEntrypoint, WorkflowEntrypoint, WorkflowEvent, WorkflowSleepDuration, WorkflowStep, WorkflowStepConfig, WorkflowStepContext, WorkflowStepEvent, WorkflowTimeoutDuration } from "cloudflare:workers";
|
|
6
|
+
import { D1Client } from "@effect/sql-d1";
|
|
6
7
|
import * as RpcSerialization from "effect/unstable/rpc/RpcSerialization";
|
|
7
8
|
import * as RpcServer from "effect/unstable/rpc/RpcServer";
|
|
9
|
+
import { SqliteClient } from "@effect/sql-sqlite-do";
|
|
8
10
|
import * as _$effect_unstable_sql_SqlClient0 from "effect/unstable/sql/SqlClient";
|
|
9
11
|
import * as _$effect_Types0 from "effect/Types";
|
|
10
12
|
import * as _$effect_Cause0 from "effect/Cause";
|
|
11
13
|
import * as _$effect_Layer0 from "effect/Layer";
|
|
12
14
|
import * as _$effect_Scope0 from "effect/Scope";
|
|
15
|
+
import * as Duration$1 from "effect/Duration";
|
|
16
|
+
import * as Tracer from "effect/Tracer";
|
|
13
17
|
import * as _$effect_Config0 from "effect/Config";
|
|
14
18
|
|
|
15
|
-
//#region src/
|
|
16
|
-
declare namespace D1_d_exports {
|
|
17
|
-
export { D1Definition, D1Service, D1SqlLayerOptions, Service$1 as Service, make$10 as make };
|
|
18
|
-
}
|
|
19
|
-
/** Typed D1 binding definition. */
|
|
20
|
-
interface D1Definition {
|
|
21
|
-
/** Binding name as configured in `wrangler.jsonc`. */
|
|
22
|
-
readonly binding: string;
|
|
23
|
-
}
|
|
24
|
-
/** Options forwarded to `@effect/sql-d1` when building a SQL client layer. */
|
|
25
|
-
type D1SqlLayerOptions = Omit<D1Client.D1ClientConfig, "db">;
|
|
26
|
-
declare const D1ServiceTypeId: unique symbol;
|
|
27
|
-
/** Nominal service marker for D1 services created with {@link make}. */
|
|
28
|
-
interface D1Service<Id extends string> {
|
|
29
|
-
readonly [D1ServiceTypeId]: {
|
|
30
|
-
readonly id: Id;
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Creates a typed D1 service tag plus Effect helpers.
|
|
35
|
-
*/
|
|
36
|
-
declare const make$10: <Id extends string>(id: Id, definition: D1Definition) => BindingService<D1Service<Id>, Id, D1Database> & {
|
|
37
|
-
"effect-cf/D1": "effect-cf/D1";
|
|
38
|
-
definition: D1Definition;
|
|
39
|
-
sqlLayer: (options?: D1SqlLayerOptions) => Layer.Layer<D1Client.D1Client | _$effect_unstable_sql_SqlClient0.SqlClient, BindingNotFoundError | BindingValidationError | _$effect_Config0.ConfigError, WorkerEnvironment>;
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* Builds a D1 service around a Cloudflare D1 database binding.
|
|
43
|
-
*
|
|
44
|
-
* The returned service exposes the raw `D1Database` binding and `sqlLayer(...)`
|
|
45
|
-
* for providing `effect/unstable/sql` via `@effect/sql-d1`.
|
|
46
|
-
*
|
|
47
|
-
* @example
|
|
48
|
-
* ```ts
|
|
49
|
-
* class TodoDatabase extends D1.Service<TodoDatabase>()("TodoDatabase", {
|
|
50
|
-
* binding: "TODO_DB",
|
|
51
|
-
* }) {}
|
|
52
|
-
*
|
|
53
|
-
* const SqlLive = TodoDatabase.sqlLayer();
|
|
54
|
-
* ```
|
|
55
|
-
*/
|
|
56
|
-
declare const Service$1: <Self>() => <Id extends string>(id: Id, definition: D1Definition) => BindingService<Self, Id, D1Database> & {
|
|
57
|
-
"effect-cf/D1": "effect-cf/D1";
|
|
58
|
-
definition: D1Definition;
|
|
59
|
-
sqlLayer: (options?: D1SqlLayerOptions) => Layer.Layer<D1Client.D1Client | _$effect_unstable_sql_SqlClient0.SqlClient, BindingNotFoundError | BindingValidationError | _$effect_Config0.ConfigError, WorkerEnvironment | Exclude<Exclude<Self, _$effect_Scope0.Scope>, Self>>;
|
|
60
|
-
};
|
|
19
|
+
//#region src/Rpc.d.ts
|
|
61
20
|
declare namespace Rpc_d_exports {
|
|
62
21
|
export { DisposableValue, MethodArgs, MethodKey, MethodReturn, Provider, Result, RpcStub, RpcTarget, Serializable, Stub, Stubable, Stubify, dispose, isDisposable, resolve, scoped };
|
|
63
22
|
}
|
|
@@ -83,7 +42,7 @@ declare const dispose: (value: unknown) => Effect.Effect<void>;
|
|
|
83
42
|
declare const resolve: <A>(value: A) => Effect.Effect<Awaited<A>, unknown>;
|
|
84
43
|
declare const scoped: <A>(value: A) => Effect.Effect<Awaited<A>, unknown, Scope.Scope>;
|
|
85
44
|
declare namespace RpcDefinition_d_exports {
|
|
86
|
-
export { Definition$9 as Definition, Method$5 as Method, Methods$4 as Methods, NoReservedMethods$4 as NoReservedMethods, ReservedMethodName$6 as ReservedMethodName, ReservedMethodNameError, RpcArgumentCountError, RpcArgumentDecodeError, RpcArgumentEncodeError, RpcReservedMethodNameError, RpcSuccessDecodeError, RpcSuccessEncodeError, ServiceFreeSchema$4 as ServiceFreeSchema, assertNoReservedMethodNames, assertNoReservedMethods, decodeArgs, decodeSuccess, encodeArgs, encodeSuccess, make$
|
|
45
|
+
export { Definition$9 as Definition, Method$5 as Method, Methods$4 as Methods, NoReservedMethods$4 as NoReservedMethods, ReservedMethodName$6 as ReservedMethodName, ReservedMethodNameError, RpcArgumentCountError, RpcArgumentDecodeError, RpcArgumentEncodeError, RpcReservedMethodNameError, RpcSuccessDecodeError, RpcSuccessEncodeError, ServiceFreeSchema$4 as ServiceFreeSchema, assertNoReservedMethodNames, assertNoReservedMethods, decodeArgs, decodeSuccess, encodeArgs, encodeSuccess, make$10 as make, method$4 as method, reservedMethodNames };
|
|
87
46
|
}
|
|
88
47
|
declare const RpcReservedMethodNameError_base: new <A extends Record<string, any> = {}>(args: _$effect_Types0.VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => _$effect_Cause0.YieldableError & {
|
|
89
48
|
readonly _tag: "RpcReservedMethodNameError";
|
|
@@ -182,9 +141,9 @@ declare const decodeArgs: <const Self extends Definition$9.Any, MethodName exten
|
|
|
182
141
|
declare const encodeArgs: <const Self extends Definition$9.Any, MethodName extends Definition$9.MethodNames<Self>>(definition: Self, methodName: MethodName, args: Method$5.Args<Self["methods"][MethodName]>) => Effect.Effect<Method$5.EncodedArgs<Self["methods"][MethodName]>, RpcArgumentCountError | RpcArgumentEncodeError>;
|
|
183
142
|
declare const encodeSuccess: <const Self extends Definition$9.Any, MethodName extends Definition$9.MethodNames<Self>>(definition: Self, methodName: MethodName, value: Method$5.Success<Self["methods"][MethodName]>) => Effect.Effect<Method$5.EncodedSuccess<Self["methods"][MethodName]>, RpcSuccessEncodeError>;
|
|
184
143
|
declare const decodeSuccess: <const Self extends Definition$9.Any, MethodName extends Definition$9.MethodNames<Self>>(definition: Self, methodName: MethodName, value: unknown) => Effect.Effect<Method$5.Success<Self["methods"][MethodName]>, RpcSuccessDecodeError>;
|
|
185
|
-
declare const make$
|
|
144
|
+
declare const make$10: <Id extends string, const MethodsShape extends Methods$4>(id: Id, methods: MethodsShape) => Definition$9<Id, MethodsShape>;
|
|
186
145
|
declare namespace QueueBinding_d_exports {
|
|
187
|
-
export { MessageSendRequest, QueueBindingClient, QueueBindingDefinition, QueueMetrics, QueueOperationError, QueueProducer, QueueSendBatchOptions, QueueSendBatchResponse, QueueSendOptions, QueueSendResponse, isQueue, layer$
|
|
146
|
+
export { MessageSendRequest, QueueBindingClient, QueueBindingDefinition, QueueMetrics, QueueOperationError, QueueProducer, QueueSendBatchOptions, QueueSendBatchResponse, QueueSendOptions, QueueSendResponse, isQueue, layer$9 as layer, makeClient$6 as makeClient };
|
|
188
147
|
}
|
|
189
148
|
type QueueSendOptions = globalThis.QueueSendOptions;
|
|
190
149
|
type QueueSendResponse = globalThis.QueueSendResponse;
|
|
@@ -216,9 +175,9 @@ declare class QueueOperationError extends QueueOperationError_base<{
|
|
|
216
175
|
}> {}
|
|
217
176
|
declare const isQueue: <Body>(value: unknown) => value is QueueProducer<Body>;
|
|
218
177
|
declare const makeClient$6: <Message extends ServiceFreeSchema$4>(definition: QueueBindingDefinition<Message>) => ((queue: QueueProducer<Schema.Codec.Encoded<Message>>) => QueueBindingClient<Message>);
|
|
219
|
-
declare const layer$
|
|
178
|
+
declare const layer$9: <Self, Message extends ServiceFreeSchema$4>(tag: Context.Service<Self, QueueBindingClient<Message>>, definition: QueueBindingDefinition<Message>) => _$effect_Layer0.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
220
179
|
declare namespace QueueDefinition_d_exports {
|
|
221
|
-
export { Definition$8 as Definition, Handler$3 as Handler, LayerOptions$
|
|
180
|
+
export { Definition$8 as Definition, Handler$3 as Handler, LayerOptions$12 as LayerOptions, Options$7 as Options, Queue$1 as Queue, Tag$11 as Tag, TagClass$10 as TagClass, implement$7 as implement, make$9 as make };
|
|
222
181
|
}
|
|
223
182
|
interface Definition$8<Id extends string = string, Message extends ServiceFreeSchema$4 = ServiceFreeSchema$4> {
|
|
224
183
|
readonly id: Id;
|
|
@@ -232,20 +191,20 @@ interface Options$7<ROut, Self extends Definition$8.Any> extends Omit<WorkerOpti
|
|
|
232
191
|
readonly queue: Handler$3<ROut, Self>;
|
|
233
192
|
readonly rpc?: never;
|
|
234
193
|
}
|
|
235
|
-
type LayerOptions$
|
|
194
|
+
type LayerOptions$12 = {
|
|
236
195
|
readonly binding: string;
|
|
237
196
|
};
|
|
238
197
|
interface TagClass$10<Self, Id extends string, Message extends ServiceFreeSchema$4> extends Context.ServiceClass<Self, Id, QueueBindingClient<Message>> {
|
|
239
198
|
readonly id: Id;
|
|
240
199
|
readonly message: Message;
|
|
241
200
|
readonly make: <ROut, LayerError>(layer: Layer.Layer<ROut, LayerError, ExecutionContext | WorkerContext | WorkerEnvironment>, options: Options$7<ROut, Definition$8<Id, Message>>) => WorkerClass<Record<never, never>, ROut>;
|
|
242
|
-
readonly layer: (options: LayerOptions$
|
|
201
|
+
readonly layer: (options: LayerOptions$12) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
243
202
|
readonly send: (message: Schema.Schema.Type<Message>, options?: QueueSendOptions) => Effect.Effect<void, QueueOperationError | Schema.SchemaError, Self>;
|
|
244
203
|
readonly sendBatch: (messages: Iterable<MessageSendRequest<Schema.Schema.Type<Message>>>, options?: QueueSendBatchOptions) => Effect.Effect<void, QueueOperationError | Schema.SchemaError, Self>;
|
|
245
204
|
readonly metrics: () => Effect.Effect<QueueMetrics, QueueOperationError, Self>;
|
|
246
205
|
readonly unsafeRaw: () => Effect.Effect<globalThis.Queue<Schema.Codec.Encoded<Message>>, never, Self>;
|
|
247
206
|
}
|
|
248
|
-
declare const make$
|
|
207
|
+
declare const make$9: <Id extends string, Message extends ServiceFreeSchema$4>(id: Id, definition: {
|
|
249
208
|
readonly message: Message;
|
|
250
209
|
}) => TagClass$10<Definition$8<Id, Message>, Id, Message>;
|
|
251
210
|
declare const Tag$11: <Self>() => <Id extends string, Message extends ServiceFreeSchema$4>(id: Id, definition: {
|
|
@@ -256,7 +215,7 @@ declare const Queue$1: <Self>() => <Id extends string, Message extends ServiceFr
|
|
|
256
215
|
}) => TagClass$10<Self, Id, Message>;
|
|
257
216
|
declare const implement$7: <ROut, const Self extends Definition$8.Any>(_definition: Self, handler: Handler$3<ROut, Self>) => Handler$3<ROut, Self>;
|
|
258
217
|
declare namespace Queue_d_exports {
|
|
259
|
-
export { Definition$7 as Definition, Handler$2 as Handler, LayerOptions$
|
|
218
|
+
export { Definition$7 as Definition, Handler$2 as Handler, LayerOptions$11 as LayerOptions, Options$6 as Options, QueueBatch, QueueHandler, QueueMessage, QueueMessageDecodeError, QueueOptions, Tag$10 as Tag, TagClass$9 as TagClass, decodeBatch, fromMessage, fromMessageBatch, implement$6 as implement };
|
|
260
219
|
}
|
|
261
220
|
interface QueueMessage<Body> {
|
|
262
221
|
readonly raw: globalThis.Message<unknown>;
|
|
@@ -305,7 +264,7 @@ type Definition$7<Id extends string = string, Message extends Definition$8.Any["
|
|
|
305
264
|
declare namespace Definition$7 {
|
|
306
265
|
type Any = Definition$8.Any;
|
|
307
266
|
}
|
|
308
|
-
type LayerOptions$
|
|
267
|
+
type LayerOptions$11 = LayerOptions$12;
|
|
309
268
|
type TagClass$9<Self, Id extends string, Message extends Definition$8.Any["message"]> = TagClass$10<Self, Id, Message>;
|
|
310
269
|
declare const Tag$10: <Self>() => <Id extends string, Message extends Definition$8.Any["message"]>(id: Id, definition: {
|
|
311
270
|
readonly message: Message;
|
|
@@ -314,7 +273,7 @@ declare const implement$6: <ROut, const Self extends Definition$8.Any>(_definiti
|
|
|
314
273
|
type Handler$2<ROut, Self extends Definition$8.Any> = Handler$3<ROut, Self>;
|
|
315
274
|
type Options$6<ROut, Self extends Definition$8.Any> = Options$7<ROut, Self>;
|
|
316
275
|
declare namespace WorkerDefinition_d_exports {
|
|
317
|
-
export { Api$3 as Api, Definition$6 as Definition, HandlerEffect$3 as HandlerEffect, Handlers$3 as Handlers, LayerOptions$
|
|
276
|
+
export { Api$3 as Api, Definition$6 as Definition, HandlerEffect$3 as HandlerEffect, Handlers$3 as Handlers, LayerOptions$10 as LayerOptions, Method$4 as Method, Methods$3 as Methods, NoReservedMethods$3 as NoReservedMethods, Options$5 as Options, ReservedMethodName$5 as ReservedMethodName, ServerApi$4 as ServerApi, ServiceFreeSchema$3 as ServiceFreeSchema, Tag$9 as Tag, TagClass$8 as TagClass, Worker, implement$5 as implement, make$8 as make, method$3 as method };
|
|
318
277
|
}
|
|
319
278
|
type ServiceFreeSchema$3 = Schema.Codec<any, any, never, never>;
|
|
320
279
|
interface Method$4<Args extends ReadonlyArray<ServiceFreeSchema$3> = ReadonlyArray<ServiceFreeSchema$3>, Success extends ServiceFreeSchema$3 = ServiceFreeSchema$3> {
|
|
@@ -362,14 +321,14 @@ type Handlers$3<ROut, Self extends Definition$6.Any> = { readonly [Key in keyof
|
|
|
362
321
|
interface Options$5<ROut, Self extends Definition$6.Any> extends Omit<WorkerOptions<ROut, Handlers$3<ROut, Self>>, "rpc"> {
|
|
363
322
|
readonly rpc: Handlers$3<ROut, Self>;
|
|
364
323
|
}
|
|
365
|
-
type LayerOptions$
|
|
324
|
+
type LayerOptions$10 = {
|
|
366
325
|
readonly binding: string;
|
|
367
326
|
};
|
|
368
327
|
type TagClass$8<Self, Id extends string, MethodsShape extends Methods$3> = Context.ServiceClass<Self, Id, ServiceBindingEffectClient<Api$3<Definition$6<Id, MethodsShape>>, Definition$6<Id, MethodsShape>>> & ServiceBindingStaticClient<Self, Api$3<Definition$6<Id, MethodsShape>>, Definition$6<Id, MethodsShape>> & {
|
|
369
328
|
readonly id: Id;
|
|
370
329
|
readonly methods: MethodsShape;
|
|
371
330
|
readonly make: <ROut, LayerError>(layer: Layer.Layer<ROut, LayerError, ExecutionContext | WorkerContext | WorkerEnvironment>, options: Options$5<ROut, Definition$6<Id, MethodsShape>>) => WorkerClass<Handlers$3<ROut, Definition$6<Id, MethodsShape>>, ROut>;
|
|
372
|
-
readonly layer: (options: LayerOptions$
|
|
331
|
+
readonly layer: (options: LayerOptions$10) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
373
332
|
};
|
|
374
333
|
/**
|
|
375
334
|
* Defines a single RPC method schema in a worker definition.
|
|
@@ -383,7 +342,7 @@ declare const method$3: {
|
|
|
383
342
|
readonly success: Success;
|
|
384
343
|
}): Method$4<Args, Success>;
|
|
385
344
|
};
|
|
386
|
-
declare const make$
|
|
345
|
+
declare const make$8: <Id extends string, const MethodsShape extends Methods$3>(id: Id, methods: MethodsShape & NoReservedMethods$3<MethodsShape>) => TagClass$8<Definition$6<Id, MethodsShape>, Id, MethodsShape>;
|
|
387
346
|
declare const Tag$9: <Self>() => <Id extends string, const MethodsShape extends Methods$3>(id: Id, methods: MethodsShape & NoReservedMethods$3<MethodsShape>) => TagClass$8<Self, Id, MethodsShape>;
|
|
388
347
|
declare const Worker: <Self>() => <Id extends string, const MethodsShape extends Methods$3>(id: Id, methods: MethodsShape & NoReservedMethods$3<MethodsShape>) => TagClass$8<Self, Id, MethodsShape>;
|
|
389
348
|
/**
|
|
@@ -402,7 +361,7 @@ type AsyncMethodArgs<Api, Method extends keyof Api> = Api[Method] extends ((...a
|
|
|
402
361
|
type AsyncMethodSuccess<Api, Method extends keyof Api> = Api[Method] extends ((...args: AnyArgs) => Promise<infer A>) ? A : never;
|
|
403
362
|
type AsyncMethodCloudflareReturn<Api, Method extends keyof Api> = Result<AsyncMethodSuccess<Api, Method>>;
|
|
404
363
|
declare namespace ServiceBinding_d_exports {
|
|
405
|
-
export { Service, ServiceBindingClient, ServiceBindingDefinition, ServiceBindingEffectClient, ServiceBindingFetchError, ServiceBindingRpcError, ServiceBindingStaticClient, ServiceFetcher, isServiceBindingClient, layer$
|
|
364
|
+
export { Service$1 as Service, ServiceBindingClient, ServiceBindingDefinition, ServiceBindingEffectClient, ServiceBindingFetchError, ServiceBindingRpcError, ServiceBindingStaticClient, ServiceFetcher, isServiceBindingClient, layer$8 as layer, makeClient$5 as makeClient, makeDirectMethods$1 as makeDirectMethods };
|
|
406
365
|
}
|
|
407
366
|
declare const TypeId$1: "effect-cf/ServiceBinding";
|
|
408
367
|
/**
|
|
@@ -549,7 +508,7 @@ type ServiceBindingStaticClient<R, Api extends object, Definition extends Defini
|
|
|
549
508
|
};
|
|
550
509
|
declare const isServiceBindingClient: <Api extends object>(value: unknown) => value is ServiceBindingClient<Api>;
|
|
551
510
|
declare const makeClient$5: <Api extends object, const Definition extends Definition$6.Any | undefined = undefined>(definition: ServiceBindingDefinition<Definition>) => ((service: ServiceBindingClient<Api>) => ServiceBindingEffectClient<Api, Definition>);
|
|
552
|
-
declare const layer$
|
|
511
|
+
declare const layer$8: <Self, Api extends object, const Definition extends Definition$6.Any | undefined = undefined>(tag: Context.Service<Self, ServiceBindingEffectClient<Api, Definition>>, definition: ServiceBindingDefinition<Definition>) => _$effect_Layer0.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
553
512
|
/**
|
|
554
513
|
* Creates a typed Effect service for a Worker service binding.
|
|
555
514
|
*
|
|
@@ -579,7 +538,7 @@ declare const layer$6: <Self, Api extends object, const Definition extends Defin
|
|
|
579
538
|
* });
|
|
580
539
|
* ```
|
|
581
540
|
*/
|
|
582
|
-
declare const Service: <Self, Api extends object = never>() => <Id extends string, const Definition extends Definition$6.Any | undefined = undefined>(id: Id, definition: ServiceBindingDefinition<Definition>) => BindingService<Self, Id, ServiceBindingEffectClient<ApiOrDefinition<Api, Definition>, Definition>> & DirectMethods$1<Self, Definition> & {
|
|
541
|
+
declare const Service$1: <Self, Api extends object = never>() => <Id extends string, const Definition extends Definition$6.Any | undefined = undefined>(id: Id, definition: ServiceBindingDefinition<Definition>) => BindingService<Self, Id, ServiceBindingEffectClient<ApiOrDefinition<Api, Definition>, Definition>> & DirectMethods$1<Self, Definition> & {
|
|
583
542
|
readonly [TypeId$1]: typeof TypeId$1;
|
|
584
543
|
readonly definition: ServiceBindingDefinition<Definition>;
|
|
585
544
|
readonly fetch: (input: RequestInfo | URL, init?: RequestInit) => Effect.Effect<Response, ServiceBindingFetchError, Self>;
|
|
@@ -589,7 +548,7 @@ declare const Service: <Self, Api extends object = never>() => <Id extends strin
|
|
|
589
548
|
};
|
|
590
549
|
declare const makeDirectMethods$1: <R, Api, Definition extends Definition$6.Any | undefined>(rpcDefinition: Definition | undefined, call: ServiceCall<R, Api>) => DirectMethods$1<R, Definition>;
|
|
591
550
|
declare namespace Worker_d_exports {
|
|
592
|
-
export { Api$2 as Api, Definition$5 as Definition, ExecutionContext, FetchHandler, FetchWorkerOptions, HandlerEffect$2 as HandlerEffect, Handlers$2 as Handlers, LayerOptions$
|
|
551
|
+
export { Api$2 as Api, Definition$5 as Definition, ExecutionContext, FetchHandler, FetchWorkerOptions, HandlerEffect$2 as HandlerEffect, Handlers$2 as Handlers, LayerOptions$9 as LayerOptions, Method$3 as Method, Methods$2 as Methods, NativeRequest, NoReservedMethods$2 as NoReservedMethods, Options$4 as Options, ReservedMethodName$3 as ReservedMethodName, RpcHandlers$1 as RpcHandlers, ServerApi$3 as ServerApi, ServiceFreeSchema$2 as ServiceFreeSchema, Tag$8 as Tag, TagClass$7 as TagClass, TagFactory$1 as TagFactory, WorkerClass, WorkerContext, WorkerContextService, WorkerContextWaitUntilOptions, WorkerFetchSuccess, WorkerHandler, WorkerOptions, WorkerRpc, WorkerRpcHandler, WorkerRpcShape, implement$4 as implement, isWebSocketUpgrade, make$7 as make, makeFetchHandler, method$2 as method, renderHttpResponse };
|
|
593
552
|
}
|
|
594
553
|
declare const ExecutionContext_base: Context.ServiceClass<ExecutionContext, "effect-cf/ExecutionContext", globalThis.ExecutionContext<unknown>>;
|
|
595
554
|
declare class ExecutionContext extends ExecutionContext_base {}
|
|
@@ -634,8 +593,8 @@ interface FetchHandler<Env extends WorkerEnv = WorkerEnv> {
|
|
|
634
593
|
readonly fetch: (request: Request, env: Env, ctx: globalThis.ExecutionContext) => Promise<Response>;
|
|
635
594
|
}
|
|
636
595
|
declare const renderHttpResponse: <A extends HttpServerResponse.HttpServerResponse, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<Response, E, R>;
|
|
637
|
-
declare function make$
|
|
638
|
-
declare function make$
|
|
596
|
+
declare function make$7<ROut, LayerError>(layer: Layer.Layer<ROut, LayerError, ExecutionContext | WorkerContext | WorkerEnvironment>, fetch: WorkerHandler<ROut>): WorkerClass<Record<never, never>, ROut>;
|
|
597
|
+
declare function make$7<ROut, LayerError, const Rpc extends WorkerRpc<ROut> = Record<never, never>>(layer: Layer.Layer<ROut, LayerError, ExecutionContext | WorkerContext | WorkerEnvironment>, options: WorkerOptions<ROut, Rpc>): WorkerClass<Rpc, ROut>;
|
|
639
598
|
declare const makeFetchHandler: <ROut, LayerError, Env extends WorkerEnv = WorkerEnv>(layer: Layer.Layer<ROut, LayerError, ExecutionContext | WorkerContext | WorkerEnvironment>, options: FetchWorkerOptions<ROut>) => FetchHandler<Env>;
|
|
640
599
|
type ServiceFreeSchema$2 = Schema.Codec<any, any, never, never>;
|
|
641
600
|
interface Method$3<Args extends ReadonlyArray<ServiceFreeSchema$2> = ReadonlyArray<ServiceFreeSchema$2>, Success extends ServiceFreeSchema$2 = ServiceFreeSchema$2> {
|
|
@@ -664,12 +623,12 @@ type Handlers$2<ROut, Self extends Definition$5.Any> = { readonly [Key in keyof
|
|
|
664
623
|
interface Options$4<ROut, Self extends Definition$5.Any> extends Omit<WorkerOptions<ROut, Handlers$2<ROut, Self>>, "rpc"> {
|
|
665
624
|
readonly rpc: Handlers$2<ROut, Self>;
|
|
666
625
|
}
|
|
667
|
-
type LayerOptions$
|
|
626
|
+
type LayerOptions$9 = LayerOptions$10;
|
|
668
627
|
type TagClass$7<Self, Id extends string, MethodsShape extends Methods$2> = Context.ServiceClass<Self, Id, ServiceBindingEffectClient<Api$2<Definition$5<Id, MethodsShape>>, Definition$5<Id, MethodsShape>>> & ServiceBindingStaticClient<Self, Api$2<Definition$5<Id, MethodsShape>>, Definition$5<Id, MethodsShape>> & {
|
|
669
628
|
readonly id: Id;
|
|
670
629
|
readonly methods: MethodsShape;
|
|
671
630
|
readonly make: <ROut, LayerError>(layer: Layer.Layer<ROut, LayerError, ExecutionContext | WorkerContext | WorkerEnvironment>, options: Options$4<ROut, Definition$5<Id, MethodsShape>>) => WorkerClass<Handlers$2<ROut, Definition$5<Id, MethodsShape>>, ROut>;
|
|
672
|
-
readonly layer: (options: LayerOptions$
|
|
631
|
+
readonly layer: (options: LayerOptions$9) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
673
632
|
};
|
|
674
633
|
type TagFactory$1 = <Self>() => <Id extends string, const MethodsShape extends Methods$2>(id: Id, methods: MethodsShape & NoReservedMethods$2<MethodsShape>) => TagClass$7<Self, Id, MethodsShape>;
|
|
675
634
|
declare const Tag$8: TagFactory$1;
|
|
@@ -986,7 +945,7 @@ declare class DurableObjectState extends DurableObjectState_base {}
|
|
|
986
945
|
*/
|
|
987
946
|
declare const fromDurableObjectState: (state: globalThis.DurableObjectState) => DurableObjectStateService;
|
|
988
947
|
declare namespace DurableObjectNamespace_d_exports {
|
|
989
|
-
export { DurableObjectFetchError, DurableObjectNamespaceBindingDefinition, DurableObjectNamespaceClient, DurableObjectNamespaceDefinition, DurableObjectNamespaceEffectClient, DurableObjectNamespaceStaticClient, DurableObjectRpcError, DurableObjectStubClient, isDurableObjectNamespaceClient, layer$
|
|
948
|
+
export { DurableObjectFetchError, DurableObjectNamespaceBindingDefinition, DurableObjectNamespaceClient, DurableObjectNamespaceDefinition, DurableObjectNamespaceEffectClient, DurableObjectNamespaceStaticClient, DurableObjectRpcError, DurableObjectStubClient, isDurableObjectNamespaceClient, layer$7 as layer, makeClient$4 as makeClient, makeDirectMethods };
|
|
990
949
|
}
|
|
991
950
|
interface DurableObjectFetcher {
|
|
992
951
|
fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
|
|
@@ -1185,7 +1144,7 @@ type DurableObjectNamespaceStaticClient<R, Api extends object, Definition extend
|
|
|
1185
1144
|
};
|
|
1186
1145
|
declare const isDurableObjectNamespaceClient: <Api extends object>(value: unknown) => value is DurableObjectNamespaceClient<Api>;
|
|
1187
1146
|
declare const makeClient$4: <Api extends object, const Definition extends Definition$4.Any | undefined = undefined>(definition: DurableObjectNamespaceBindingDefinition<Definition>) => ((namespace: DurableObjectNamespaceClient<Api>) => DurableObjectNamespaceEffectClient<Api, Definition>);
|
|
1188
|
-
declare const layer$
|
|
1147
|
+
declare const layer$7: <Self, Api extends object, const Definition extends Definition$4.Any | undefined = undefined>(tag: Context.Service<Self, DurableObjectNamespaceEffectClient<Api, Definition>>, definition: DurableObjectNamespaceBindingDefinition<Definition>) => _$effect_Layer0.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
1189
1148
|
declare const makeDirectMethods: <R, Api extends object, Definition extends Definition$4.Any | undefined>(rpcDefinition: Definition | undefined, helpers: {
|
|
1190
1149
|
readonly call: StubCall<R, Api>;
|
|
1191
1150
|
readonly fetch: (stub: DurableObjectStubClient<Api>, input: RequestInfo | URL, init?: RequestInit) => Effect.Effect<globalThis.Response, DurableObjectFetchError, R>;
|
|
@@ -1193,7 +1152,7 @@ declare const makeDirectMethods: <R, Api extends object, Definition extends Defi
|
|
|
1193
1152
|
readonly getByName: (name: string, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions) => Effect.Effect<DurableObjectStubClient<Api>, never, R>;
|
|
1194
1153
|
}) => DirectMethods<R, Api, Definition>;
|
|
1195
1154
|
declare namespace DurableObjectDefinition_d_exports {
|
|
1196
|
-
export { Api$1 as Api, Definition$4 as Definition, DurableObject$1 as DurableObject, HandlerEffect$1 as HandlerEffect, Handlers$1 as Handlers, LayerOptions$
|
|
1155
|
+
export { Api$1 as Api, Definition$4 as Definition, DurableObject$1 as DurableObject, HandlerEffect$1 as HandlerEffect, Handlers$1 as Handlers, LayerOptions$8 as LayerOptions, Method$2 as Method, Methods$1 as Methods, NoReservedMethods$1 as NoReservedMethods, Options$3 as Options, ReservedMethodName$1 as ReservedMethodName, ServerApi$2 as ServerApi, ServiceFreeSchema$1 as ServiceFreeSchema, Tag$7 as Tag, TagClass$6 as TagClass, implement$3 as implement, make$6 as make, method$1 as method };
|
|
1197
1156
|
}
|
|
1198
1157
|
type ServiceFreeSchema$1 = Schema.Codec<any, any, never, never>;
|
|
1199
1158
|
interface Method$2<Args extends ReadonlyArray<ServiceFreeSchema$1> = ReadonlyArray<ServiceFreeSchema$1>, Success extends ServiceFreeSchema$1 = ServiceFreeSchema$1> {
|
|
@@ -1238,14 +1197,14 @@ type Handlers$1<ROut, Self extends Definition$4.Any> = { readonly [Key in keyof
|
|
|
1238
1197
|
interface Options$3<ROut, Self extends Definition$4.Any> extends Omit<DurableObjectOptions<ROut, Handlers$1<ROut, Self>>, "rpc"> {
|
|
1239
1198
|
readonly rpc: Handlers$1<ROut, Self>;
|
|
1240
1199
|
}
|
|
1241
|
-
type LayerOptions$
|
|
1200
|
+
type LayerOptions$8 = {
|
|
1242
1201
|
readonly binding: string;
|
|
1243
1202
|
};
|
|
1244
1203
|
type TagClass$6<Self, Id extends string, MethodsShape extends Methods$1> = Context.ServiceClass<Self, Id, DurableObjectNamespaceEffectClient<Api$1<Definition$4<Id, MethodsShape>>, Definition$4<Id, MethodsShape>>> & DurableObjectNamespaceStaticClient<Self, Api$1<Definition$4<Id, MethodsShape>>, Definition$4<Id, MethodsShape>> & {
|
|
1245
1204
|
readonly id: Id;
|
|
1246
1205
|
readonly methods: MethodsShape;
|
|
1247
1206
|
readonly make: <ROut, LayerError>(layer: Layer.Layer<ROut, LayerError, DurableObjectState | WorkerEnvironment>, options: Options$3<ROut, Definition$4<Id, MethodsShape>>) => DurableObjectClass<Handlers$1<ROut, Definition$4<Id, MethodsShape>>, ROut>;
|
|
1248
|
-
readonly layer: (options: LayerOptions$
|
|
1207
|
+
readonly layer: (options: LayerOptions$8) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
1249
1208
|
};
|
|
1250
1209
|
/**
|
|
1251
1210
|
* Defines a single RPC method schema in a Durable Object definition.
|
|
@@ -1259,7 +1218,7 @@ declare const method$1: {
|
|
|
1259
1218
|
readonly success: Success;
|
|
1260
1219
|
}): Method$2<Args, Success>;
|
|
1261
1220
|
};
|
|
1262
|
-
declare const make$
|
|
1221
|
+
declare const make$6: <Id extends string, const MethodsShape extends Methods$1>(id: Id, methods: MethodsShape & NoReservedMethods$1<MethodsShape>) => TagClass$6<Definition$4<Id, MethodsShape>, Id, MethodsShape>;
|
|
1263
1222
|
declare const Tag$7: <Self>() => <Id extends string, const MethodsShape extends Methods$1>(id: Id, methods: MethodsShape & NoReservedMethods$1<MethodsShape>) => TagClass$6<Self, Id, MethodsShape>;
|
|
1264
1223
|
declare const DurableObject$1: <Self>() => <Id extends string, const MethodsShape extends Methods$1>(id: Id, methods: MethodsShape & NoReservedMethods$1<MethodsShape>) => TagClass$6<Self, Id, MethodsShape>;
|
|
1265
1224
|
/**
|
|
@@ -1271,7 +1230,7 @@ declare const implement$3: <ROut, const Self extends Definition$4.Any>(_definiti
|
|
|
1271
1230
|
*/
|
|
1272
1231
|
type HandlerEffect$1<ROut, Self extends Definition$4.Any, Key extends keyof Self["methods"]> = DurableObjectHandler<ROut, Method$2.Success<Self["methods"][Key]>>;
|
|
1273
1232
|
declare namespace DurableObject_d_exports {
|
|
1274
|
-
export { Api, Definition$3 as Definition, DurableObjectClass, DurableObjectHandler, DurableObjectOptions, DurableObjectRpc, DurableObjectRpcShape, HandlerEffect, Handlers, LayerOptions$
|
|
1233
|
+
export { Api, Definition$3 as Definition, DurableObjectClass, DurableObjectHandler, DurableObjectOptions, DurableObjectRpc, DurableObjectRpcShape, HandlerEffect, Handlers, LayerOptions$7 as LayerOptions, Method$1 as Method, Methods, NoReservedMethods, Options$2 as Options, ReservedMethodName, RpcHandlers, ServerApi$1 as ServerApi, ServiceFreeSchema, Tag$6 as Tag, TagClass$5 as TagClass, TagFactory, implement$2 as implement, make$5 as make, method };
|
|
1275
1234
|
}
|
|
1276
1235
|
type RuntimeContext$1<ROut> = DurableObjectState | WorkerEnvironment | ROut;
|
|
1277
1236
|
type HandlerContext<ROut> = RuntimeContext$1<ROut> | Scope.Scope;
|
|
@@ -1323,7 +1282,7 @@ type DurableObjectClass<Rpc extends DurableObjectRpc<ROut>, ROut> = new (state:
|
|
|
1323
1282
|
/**
|
|
1324
1283
|
* Creates a Durable Object class backed by a single managed Effect runtime.
|
|
1325
1284
|
*/
|
|
1326
|
-
declare const make$
|
|
1285
|
+
declare const make$5: <ROut, LayerError, const Rpc extends DurableObjectRpc<ROut> = Record<never, never>>(layer: Layer.Layer<ROut, LayerError, DurableObjectState | WorkerEnvironment>, options?: DurableObjectOptions<ROut, Rpc>) => DurableObjectClass<Rpc, ROut>;
|
|
1327
1286
|
type ServiceFreeSchema = Schema.Codec<any, any, never, never>;
|
|
1328
1287
|
interface Method$1<Args extends ReadonlyArray<ServiceFreeSchema> = ReadonlyArray<ServiceFreeSchema>, Success extends ServiceFreeSchema = ServiceFreeSchema> {
|
|
1329
1288
|
readonly args: Args;
|
|
@@ -1346,7 +1305,7 @@ interface Definition$3<Id extends string = string, MethodsShape extends Methods
|
|
|
1346
1305
|
declare namespace Definition$3 {
|
|
1347
1306
|
type Any = Definition$3<string, Methods>;
|
|
1348
1307
|
}
|
|
1349
|
-
type LayerOptions$
|
|
1308
|
+
type LayerOptions$7 = LayerOptions$8;
|
|
1350
1309
|
type ServerApi$1<Self extends Definition$3.Any> = { readonly [Key in keyof Self["methods"]]: (...args: Method$1.Args<Self["methods"][Key]>) => Promise<Method$1.Success<Self["methods"][Key]>> };
|
|
1351
1310
|
type Api<Self extends Definition$3.Any> = Provider<ServerApi$1<Self>, ReservedMethodName>;
|
|
1352
1311
|
type Handlers<ROut, Self extends Definition$3.Any> = { readonly [Key in keyof Self["methods"]]: (...args: Method$1.Args<Self["methods"][Key]>) => DurableObjectHandler<ROut, Method$1.Success<Self["methods"][Key]>> };
|
|
@@ -1357,7 +1316,7 @@ type TagClass$5<Self, Id extends string, MethodsShape extends Methods> = Context
|
|
|
1357
1316
|
readonly id: Id;
|
|
1358
1317
|
readonly methods: MethodsShape;
|
|
1359
1318
|
readonly make: <ROut, LayerError>(layer: Layer.Layer<ROut, LayerError, DurableObjectState | WorkerEnvironment>, options: Options$2<ROut, Definition$3<Id, MethodsShape>>) => DurableObjectClass<Handlers<ROut, Definition$3<Id, MethodsShape>>, ROut>;
|
|
1360
|
-
readonly layer: (options: LayerOptions$
|
|
1319
|
+
readonly layer: (options: LayerOptions$7) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
1361
1320
|
};
|
|
1362
1321
|
type TagFactory = <Self>() => <Id extends string, const MethodsShape extends Methods>(id: Id, methods: MethodsShape & NoReservedMethods<MethodsShape>) => TagClass$5<Self, Id, MethodsShape>;
|
|
1363
1322
|
declare const Tag$6: TagFactory;
|
|
@@ -1372,6 +1331,258 @@ declare const method: {
|
|
|
1372
1331
|
};
|
|
1373
1332
|
declare const implement$2: <ROut, const Self extends Definition$3.Any>(_definition: Self, handlers: Handlers<ROut, Self>) => Handlers<ROut, Self>;
|
|
1374
1333
|
type HandlerEffect<ROut, Self extends Definition$3.Any, Key extends keyof Self["methods"]> = DurableObjectHandler<ROut, Method$1.Success<Self["methods"][Key]>>;
|
|
1334
|
+
declare namespace CloudflareOtlp_d_exports {
|
|
1335
|
+
export { CloudflareOtlpSettings, DurableObjectResourceOptions, LayerOptions$6 as LayerOptions, ResourceOptions, Serialization, Settings, Signal, WorkerResourceOptions, durableObjectLayer, instrumentDurableObjectOptions, instrumentWorkerOptions, layer$6 as layer, layerJson, layerProtobuf, settingsConfig, settingsLayer, workerLayer };
|
|
1336
|
+
}
|
|
1337
|
+
/** Telemetry signal groups supported by the Cloudflare OTLP layers. */
|
|
1338
|
+
type Signal = "logs" | "traces" | "metrics";
|
|
1339
|
+
/** OTLP payload serialization used by the Effect OTLP exporters. */
|
|
1340
|
+
type Serialization = "json" | "protobuf";
|
|
1341
|
+
/**
|
|
1342
|
+
* Resolved OpenTelemetry settings used by the Cloudflare OTLP layers.
|
|
1343
|
+
*
|
|
1344
|
+
* The default {@link settingsLayer} reads the standard OpenTelemetry
|
|
1345
|
+
* environment variable names from `WorkerEnvironment`. Applications that use
|
|
1346
|
+
* different binding names can provide {@link CloudflareOtlpSettings} directly
|
|
1347
|
+
* with a custom layer.
|
|
1348
|
+
*/
|
|
1349
|
+
interface Settings {
|
|
1350
|
+
/** Generic OTLP base endpoint, read from `OTEL_EXPORTER_OTLP_ENDPOINT`. */
|
|
1351
|
+
readonly endpoint: Option.Option<string>;
|
|
1352
|
+
/** Logs-specific OTLP endpoint, read from `OTEL_EXPORTER_OTLP_LOGS_ENDPOINT`. */
|
|
1353
|
+
readonly logsEndpoint: Option.Option<string>;
|
|
1354
|
+
/** Traces-specific OTLP endpoint, read from `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT`. */
|
|
1355
|
+
readonly tracesEndpoint: Option.Option<string>;
|
|
1356
|
+
/** Metrics-specific OTLP endpoint, read from `OTEL_EXPORTER_OTLP_METRICS_ENDPOINT`. */
|
|
1357
|
+
readonly metricsEndpoint: Option.Option<string>;
|
|
1358
|
+
/** Comma-separated OTLP headers, read from `OTEL_EXPORTER_OTLP_HEADERS`. */
|
|
1359
|
+
readonly headers: Option.Option<string>;
|
|
1360
|
+
/** Logs-specific OTLP headers, read from `OTEL_EXPORTER_OTLP_LOGS_HEADERS`. */
|
|
1361
|
+
readonly logsHeaders: Option.Option<string>;
|
|
1362
|
+
/** Traces-specific OTLP headers, read from `OTEL_EXPORTER_OTLP_TRACES_HEADERS`. */
|
|
1363
|
+
readonly tracesHeaders: Option.Option<string>;
|
|
1364
|
+
/** Metrics-specific OTLP headers, read from `OTEL_EXPORTER_OTLP_METRICS_HEADERS`. */
|
|
1365
|
+
readonly metricsHeaders: Option.Option<string>;
|
|
1366
|
+
/** Service name, read from `OTEL_SERVICE_NAME`. */
|
|
1367
|
+
readonly serviceName: Option.Option<string>;
|
|
1368
|
+
/** Service version, read from the effect-cf convenience alias `OTEL_SERVICE_VERSION`. */
|
|
1369
|
+
readonly serviceVersion: Option.Option<string>;
|
|
1370
|
+
/** Resource attributes, read from `OTEL_RESOURCE_ATTRIBUTES`. */
|
|
1371
|
+
readonly resourceAttributes: Option.Option<Record<string, string>>;
|
|
1372
|
+
}
|
|
1373
|
+
/**
|
|
1374
|
+
* Supported OpenTelemetry environment configuration for Cloudflare OTLP export.
|
|
1375
|
+
*
|
|
1376
|
+
* This config intentionally uses the conventional `OTEL_*` variable names so
|
|
1377
|
+
* deployments can share the same settings used by other OpenTelemetry SDKs.
|
|
1378
|
+
* It covers the OTLP HTTP settings supported by the Effect OTLP layers:
|
|
1379
|
+
*
|
|
1380
|
+
* - `OTEL_EXPORTER_OTLP_ENDPOINT`
|
|
1381
|
+
* - `OTEL_EXPORTER_OTLP_LOGS_ENDPOINT`
|
|
1382
|
+
* - `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT`
|
|
1383
|
+
* - `OTEL_EXPORTER_OTLP_METRICS_ENDPOINT`
|
|
1384
|
+
* - `OTEL_EXPORTER_OTLP_HEADERS`
|
|
1385
|
+
* - `OTEL_EXPORTER_OTLP_LOGS_HEADERS`
|
|
1386
|
+
* - `OTEL_EXPORTER_OTLP_TRACES_HEADERS`
|
|
1387
|
+
* - `OTEL_EXPORTER_OTLP_METRICS_HEADERS`
|
|
1388
|
+
* - `OTEL_SERVICE_NAME`
|
|
1389
|
+
* - `OTEL_RESOURCE_ATTRIBUTES`
|
|
1390
|
+
*
|
|
1391
|
+
* `OTEL_SERVICE_VERSION` is also accepted as an effect-cf convenience alias.
|
|
1392
|
+
* The standard OpenTelemetry way to configure service version is
|
|
1393
|
+
* `OTEL_RESOURCE_ATTRIBUTES=service.version=...`.
|
|
1394
|
+
*
|
|
1395
|
+
* Consumers with non-standard binding names should map those names into
|
|
1396
|
+
* {@link CloudflareOtlpSettings} rather than changing this config globally.
|
|
1397
|
+
*/
|
|
1398
|
+
declare const settingsConfig: Config.Config<{
|
|
1399
|
+
endpoint: Option.Option<string>;
|
|
1400
|
+
logsEndpoint: Option.Option<string>;
|
|
1401
|
+
tracesEndpoint: Option.Option<string>;
|
|
1402
|
+
metricsEndpoint: Option.Option<string>;
|
|
1403
|
+
headers: Option.Option<string>;
|
|
1404
|
+
logsHeaders: Option.Option<string>;
|
|
1405
|
+
tracesHeaders: Option.Option<string>;
|
|
1406
|
+
metricsHeaders: Option.Option<string>;
|
|
1407
|
+
serviceName: Option.Option<string>;
|
|
1408
|
+
serviceVersion: Option.Option<string>;
|
|
1409
|
+
resourceAttributes: Option.Option<{
|
|
1410
|
+
readonly [x: string]: string;
|
|
1411
|
+
}>;
|
|
1412
|
+
}>;
|
|
1413
|
+
declare const CloudflareOtlpSettings_base: Context.ServiceClass<CloudflareOtlpSettings, "effect-cf/CloudflareOtlpSettings", Settings>;
|
|
1414
|
+
/**
|
|
1415
|
+
* Service carrying already-resolved Cloudflare OTLP settings.
|
|
1416
|
+
*
|
|
1417
|
+
* Provide this service directly when an application needs to map custom
|
|
1418
|
+
* Cloudflare binding names, compute settings dynamically, or override settings
|
|
1419
|
+
* in tests. When this service is present, the OTLP layers use it instead of
|
|
1420
|
+
* reading {@link settingsConfig}.
|
|
1421
|
+
*
|
|
1422
|
+
* @example
|
|
1423
|
+
* ```ts
|
|
1424
|
+
* const CustomOtlpSettings = Layer.effect(
|
|
1425
|
+
* CloudflareOtlp.CloudflareOtlpSettings,
|
|
1426
|
+
* Config.all({
|
|
1427
|
+
* ...CloudflareOtlp.settingsConfig,
|
|
1428
|
+
* endpoint: Config.string("MY_OTLP_ENDPOINT").pipe(Config.option),
|
|
1429
|
+
* }),
|
|
1430
|
+
* ).pipe(Layer.provide(WorkerConfig.layer));
|
|
1431
|
+
* ```
|
|
1432
|
+
*/
|
|
1433
|
+
declare class CloudflareOtlpSettings extends CloudflareOtlpSettings_base {}
|
|
1434
|
+
/** Resource metadata shared by Worker and Durable Object OTLP layers. */
|
|
1435
|
+
interface ResourceOptions {
|
|
1436
|
+
/** Explicit service name. Overrides `OTEL_SERVICE_NAME` when provided. */
|
|
1437
|
+
readonly serviceName?: string;
|
|
1438
|
+
/** Explicit service version. Overrides `OTEL_SERVICE_VERSION` when provided. */
|
|
1439
|
+
readonly serviceVersion?: string;
|
|
1440
|
+
/** Additional resource attributes attached to all exported telemetry. */
|
|
1441
|
+
readonly attributes?: Record<string, unknown>;
|
|
1442
|
+
}
|
|
1443
|
+
/** Resource metadata specific to Cloudflare Workers. */
|
|
1444
|
+
interface WorkerResourceOptions extends ResourceOptions {
|
|
1445
|
+
/** Cloudflare Worker name to attach as `cloudflare.worker.name`. */
|
|
1446
|
+
readonly workerName?: string;
|
|
1447
|
+
}
|
|
1448
|
+
/** Resource metadata specific to Cloudflare Durable Objects. */
|
|
1449
|
+
interface DurableObjectResourceOptions extends ResourceOptions {
|
|
1450
|
+
/** Durable Object class name to attach as `cloudflare.durable_object.class`. */
|
|
1451
|
+
readonly className?: string;
|
|
1452
|
+
/**
|
|
1453
|
+
* Include the Durable Object id as `cloudflare.durable_object.id`.
|
|
1454
|
+
*
|
|
1455
|
+
* This is disabled by default because object ids can be high-cardinality.
|
|
1456
|
+
*/
|
|
1457
|
+
readonly includeObjectId?: boolean;
|
|
1458
|
+
}
|
|
1459
|
+
/** Options shared by all Cloudflare OTLP telemetry layers. */
|
|
1460
|
+
interface LayerOptions$6 extends ResourceOptions {
|
|
1461
|
+
/** Telemetry signals to export. Defaults to logs, traces, and metrics. */
|
|
1462
|
+
readonly signals?: ReadonlyArray<Signal>;
|
|
1463
|
+
/** OTLP payload serialization. Defaults to protobuf. */
|
|
1464
|
+
readonly serialization?: Serialization;
|
|
1465
|
+
/** Maximum batch size for log and trace exporters. */
|
|
1466
|
+
readonly maxBatchSize?: number;
|
|
1467
|
+
/** Maximum time to wait for exporter shutdown/flush when a scope closes. */
|
|
1468
|
+
readonly shutdownTimeout?: Duration$1.Input;
|
|
1469
|
+
/** Export interval for the logs exporter. */
|
|
1470
|
+
readonly loggerExportInterval?: Duration$1.Input;
|
|
1471
|
+
/** Exclude log records emitted for spans when exporting logs. */
|
|
1472
|
+
readonly loggerExcludeLogSpans?: boolean;
|
|
1473
|
+
/** Merge the OTLP logger with existing loggers instead of replacing them. */
|
|
1474
|
+
readonly loggerMergeWithExisting?: boolean;
|
|
1475
|
+
/** Export interval for the traces exporter. */
|
|
1476
|
+
readonly tracerExportInterval?: Duration$1.Input;
|
|
1477
|
+
/** Custom trace context lookup used by the Effect OTLP tracer. */
|
|
1478
|
+
readonly tracerContext?: <X>(primitive: Tracer.EffectPrimitive<X>, span: Tracer.AnySpan) => X;
|
|
1479
|
+
/** Export interval for the metrics exporter. */
|
|
1480
|
+
readonly metricsExportInterval?: Duration$1.Input;
|
|
1481
|
+
/** Aggregation temporality for exported metrics. */
|
|
1482
|
+
readonly metricsTemporality?: OtlpMetrics.AggregationTemporality;
|
|
1483
|
+
}
|
|
1484
|
+
/**
|
|
1485
|
+
* Layer that reads standard OpenTelemetry settings from the current Cloudflare
|
|
1486
|
+
* `env` object.
|
|
1487
|
+
*
|
|
1488
|
+
* The layer depends on {@link WorkerEnvironment} and installs a
|
|
1489
|
+
* Cloudflare-backed Effect `ConfigProvider`, so `settingsConfig` reads from
|
|
1490
|
+
* Worker vars/secrets instead of Node process environment variables.
|
|
1491
|
+
*/
|
|
1492
|
+
declare const settingsLayer: Layer.Layer<CloudflareOtlpSettings, Config.ConfigError, WorkerEnvironment>;
|
|
1493
|
+
/**
|
|
1494
|
+
* Base OTLP telemetry layer for Cloudflare-compatible runtimes.
|
|
1495
|
+
*
|
|
1496
|
+
* The layer reads {@link CloudflareOtlpSettings} when provided. Otherwise it
|
|
1497
|
+
* reads standard OpenTelemetry config from `WorkerEnvironment` when available,
|
|
1498
|
+
* then falls back to the ambient Effect `ConfigProvider`.
|
|
1499
|
+
*
|
|
1500
|
+
* When only `OTEL_EXPORTER_OTLP_ENDPOINT` is configured, per-signal paths are
|
|
1501
|
+
* derived by appending `/v1/logs`, `/v1/traces`, and `/v1/metrics`. Signal
|
|
1502
|
+
* specific endpoints are used as-is, matching the OpenTelemetry OTLP exporter
|
|
1503
|
+
* convention.
|
|
1504
|
+
*/
|
|
1505
|
+
declare const layer$6: (options?: LayerOptions$6) => Layer.Layer<never, never, never>;
|
|
1506
|
+
/** Base OTLP telemetry layer forced to JSON serialization. */
|
|
1507
|
+
declare const layerJson: (options?: Omit<LayerOptions$6, "serialization">) => Layer.Layer<never, never, never>;
|
|
1508
|
+
/** Base OTLP telemetry layer forced to protobuf serialization. */
|
|
1509
|
+
declare const layerProtobuf: (options?: Omit<LayerOptions$6, "serialization">) => Layer.Layer<never, never, never>;
|
|
1510
|
+
/**
|
|
1511
|
+
* OTLP layer with Cloudflare Worker resource attributes.
|
|
1512
|
+
*
|
|
1513
|
+
* Provide this layer at runtime scope for long-lived metrics aggregation, or at
|
|
1514
|
+
* handler scope when traces/logs should flush as the Cloudflare event finishes.
|
|
1515
|
+
*/
|
|
1516
|
+
declare const workerLayer: (options?: LayerOptions$6 & WorkerResourceOptions) => Layer.Layer<never, never, never>;
|
|
1517
|
+
/**
|
|
1518
|
+
* OTLP layer with Cloudflare Durable Object resource attributes.
|
|
1519
|
+
*
|
|
1520
|
+
* The layer reads {@link DurableObjectState} so it can optionally include the
|
|
1521
|
+
* Durable Object id. Prefer leaving `includeObjectId` disabled unless the
|
|
1522
|
+
* backend can tolerate high-cardinality resource attributes.
|
|
1523
|
+
*/
|
|
1524
|
+
declare const durableObjectLayer: (options?: LayerOptions$6 & DurableObjectResourceOptions) => Layer.Layer<never, never, DurableObjectState>;
|
|
1525
|
+
/**
|
|
1526
|
+
* Instrument Worker lifecycle handlers with event-scoped OTLP telemetry.
|
|
1527
|
+
*
|
|
1528
|
+
* Each defined handler is provided with {@link workerLayer}. Because Worker
|
|
1529
|
+
* handlers run inside `Effect.scoped`, the exporter scope closes and flushes at
|
|
1530
|
+
* the end of each Cloudflare event.
|
|
1531
|
+
*/
|
|
1532
|
+
declare const instrumentWorkerOptions: (options?: LayerOptions$6 & WorkerResourceOptions) => <ROut, Rpc extends WorkerRpc<ROut>>(handlers: WorkerOptions<ROut, Rpc>) => WorkerOptions<ROut | WorkerEnvironment | CloudflareOtlpSettings, Rpc>;
|
|
1533
|
+
/**
|
|
1534
|
+
* Instrument Durable Object lifecycle handlers with event-scoped OTLP telemetry.
|
|
1535
|
+
*
|
|
1536
|
+
* Each defined handler is provided with {@link durableObjectLayer}. Because
|
|
1537
|
+
* Durable Object handlers run inside `Effect.scoped`, the exporter scope closes
|
|
1538
|
+
* and flushes at the end of each Cloudflare event.
|
|
1539
|
+
*/
|
|
1540
|
+
declare const instrumentDurableObjectOptions: (options?: LayerOptions$6 & DurableObjectResourceOptions) => <ROut, Rpc extends DurableObjectRpc<ROut>>(handlers: DurableObjectOptions<ROut, Rpc>) => DurableObjectOptions<ROut | WorkerEnvironment | DurableObjectState | CloudflareOtlpSettings, Rpc>;
|
|
1541
|
+
declare namespace D1_d_exports {
|
|
1542
|
+
export { D1Definition, D1Service, D1SqlLayerOptions, Service, make$4 as make };
|
|
1543
|
+
}
|
|
1544
|
+
/** Typed D1 binding definition. */
|
|
1545
|
+
interface D1Definition {
|
|
1546
|
+
/** Binding name as configured in `wrangler.jsonc`. */
|
|
1547
|
+
readonly binding: string;
|
|
1548
|
+
}
|
|
1549
|
+
/** Options forwarded to `@effect/sql-d1` when building a SQL client layer. */
|
|
1550
|
+
type D1SqlLayerOptions = Omit<D1Client.D1ClientConfig, "db">;
|
|
1551
|
+
declare const D1ServiceTypeId: unique symbol;
|
|
1552
|
+
/** Nominal service marker for D1 services created with {@link make}. */
|
|
1553
|
+
interface D1Service<Id extends string> {
|
|
1554
|
+
readonly [D1ServiceTypeId]: {
|
|
1555
|
+
readonly id: Id;
|
|
1556
|
+
};
|
|
1557
|
+
}
|
|
1558
|
+
/**
|
|
1559
|
+
* Creates a typed D1 service tag plus Effect helpers.
|
|
1560
|
+
*/
|
|
1561
|
+
declare const make$4: <Id extends string>(id: Id, definition: D1Definition) => BindingService<D1Service<Id>, Id, D1Database> & {
|
|
1562
|
+
"effect-cf/D1": "effect-cf/D1";
|
|
1563
|
+
definition: D1Definition;
|
|
1564
|
+
sqlLayer: (options?: D1SqlLayerOptions) => Layer.Layer<D1Client.D1Client | _$effect_unstable_sql_SqlClient0.SqlClient, BindingNotFoundError | BindingValidationError | _$effect_Config0.ConfigError, WorkerEnvironment>;
|
|
1565
|
+
};
|
|
1566
|
+
/**
|
|
1567
|
+
* Builds a D1 service around a Cloudflare D1 database binding.
|
|
1568
|
+
*
|
|
1569
|
+
* The returned service exposes the raw `D1Database` binding and `sqlLayer(...)`
|
|
1570
|
+
* for providing `effect/unstable/sql` via `@effect/sql-d1`.
|
|
1571
|
+
*
|
|
1572
|
+
* @example
|
|
1573
|
+
* ```ts
|
|
1574
|
+
* class TodoDatabase extends D1.Service<TodoDatabase>()("TodoDatabase", {
|
|
1575
|
+
* binding: "TODO_DB",
|
|
1576
|
+
* }) {}
|
|
1577
|
+
*
|
|
1578
|
+
* const SqlLive = TodoDatabase.sqlLayer();
|
|
1579
|
+
* ```
|
|
1580
|
+
*/
|
|
1581
|
+
declare const Service: <Self>() => <Id extends string>(id: Id, definition: D1Definition) => BindingService<Self, Id, D1Database> & {
|
|
1582
|
+
"effect-cf/D1": "effect-cf/D1";
|
|
1583
|
+
definition: D1Definition;
|
|
1584
|
+
sqlLayer: (options?: D1SqlLayerOptions) => Layer.Layer<D1Client.D1Client | _$effect_unstable_sql_SqlClient0.SqlClient, BindingNotFoundError | BindingValidationError | _$effect_Config0.ConfigError, WorkerEnvironment | Exclude<Exclude<Self, _$effect_Scope0.Scope>, Self>>;
|
|
1585
|
+
};
|
|
1375
1586
|
declare namespace DurableObjectAlarm_d_exports {
|
|
1376
1587
|
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, process, processDue };
|
|
1377
1588
|
}
|
|
@@ -1697,7 +1908,7 @@ declare class DurableObjectAlarm extends DurableObjectAlarm_base {
|
|
|
1697
1908
|
static readonly layer: Layer.Layer<DurableObjectAlarm, never, DurableObjectState>;
|
|
1698
1909
|
}
|
|
1699
1910
|
declare namespace DurableObjectRpcWebSocket_d_exports {
|
|
1700
|
-
export { DurableObjectRpcWebSocket, DurableObjectRpcWebSocketService, LayerOptions$5 as LayerOptions, NativeWebSocketMessage, layer$
|
|
1911
|
+
export { DurableObjectRpcWebSocket, DurableObjectRpcWebSocketService, LayerOptions$5 as LayerOptions, NativeWebSocketMessage, layer$5 as layer };
|
|
1701
1912
|
}
|
|
1702
1913
|
/**
|
|
1703
1914
|
* Configuration for {@link layer}.
|
|
@@ -1727,7 +1938,24 @@ declare class DurableObjectRpcWebSocket extends DurableObjectRpcWebSocket_base {
|
|
|
1727
1938
|
/**
|
|
1728
1939
|
* Builds a layer that bridges Durable Object websocket events to `RpcServer.Protocol`.
|
|
1729
1940
|
*/
|
|
1730
|
-
declare const layer$
|
|
1941
|
+
declare const layer$5: (options?: LayerOptions$5) => Layer.Layer<DurableObjectRpcWebSocket | RpcServer.Protocol, never, DurableObjectState | RpcSerialization.RpcSerialization>;
|
|
1942
|
+
declare namespace DurableObjectSqlite_d_exports {
|
|
1943
|
+
export { SqliteLayerOptions, layer$4 as layer };
|
|
1944
|
+
}
|
|
1945
|
+
/** Options forwarded to `@effect/sql-sqlite-do` when building a SQL client layer. */
|
|
1946
|
+
type SqliteLayerOptions = Omit<SqliteClient.SqliteClientConfig, "db">;
|
|
1947
|
+
/**
|
|
1948
|
+
* Provides `effect/unstable/sql` from the current Durable Object SQLite storage.
|
|
1949
|
+
*
|
|
1950
|
+
* @example
|
|
1951
|
+
* ```ts
|
|
1952
|
+
* const RoomLayer = Layer.mergeAll(
|
|
1953
|
+
* DurableObjectSqlite.layer(),
|
|
1954
|
+
* OtherRoomServices,
|
|
1955
|
+
* );
|
|
1956
|
+
* ```
|
|
1957
|
+
*/
|
|
1958
|
+
declare const layer$4: (options?: SqliteLayerOptions) => Layer.Layer<_$effect_unstable_sql_SqlClient0.SqlClient | SqliteClient.SqliteClient, never, DurableObjectState>;
|
|
1731
1959
|
declare namespace Images_d_exports {
|
|
1732
1960
|
export { DrawStepOptions, HostedImagesClient, ImageDrawOptions, ImageHandleClient, ImageInfoResponse, ImageInputOptions, ImageInputValue, ImageList, ImageListOptions, ImageMetadata, ImageOutputOptions, ImageTransform, ImageTransformationOutputOptions, ImageTransformationResult, ImageUpdateOptions, ImageUploadOptions, ImageUploadValue, ImagesClient, ImagesDefinition, ImagesOperationError, ImagesRuntimeBinding, ImagesService, ImagesTransformationResultClient, LayerOptions$4 as LayerOptions, ProcessOptions, Step, Steps, Tag$5 as Tag, TagClass$4 as TagClass, draw, empty, isImagesBinding, layer$3 as layer, make$3 as make, makeClient$3 as makeClient, transform };
|
|
1733
1961
|
}
|
|
@@ -2170,4 +2398,4 @@ declare const implement: <ROut, const Self extends Definition$1.Any>(_definition
|
|
|
2170
2398
|
type Handler<ROut, Self extends Definition$1.Any> = Handler$1<ROut, Self>;
|
|
2171
2399
|
type Options<ROut, Self extends Definition$1.Any> = Options$1<ROut, Self>;
|
|
2172
2400
|
//#endregion
|
|
2173
|
-
export { Binding_d_exports as Binding, 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, DurableObjectState_d_exports as DurableObjectState, DurableObjectStorage_d_exports as DurableObjectStorage, DurableObjectWebSocket_d_exports as DurableObjectWebSocket, 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, Worker_d_exports as Worker, WorkerConfig, WorkerDefinition_d_exports as WorkerDefinition, type WorkerEnv, WorkerEnvironment, Workflow_d_exports as Workflow, WorkflowBinding_d_exports as WorkflowBinding, WorkflowDefinition_d_exports as WorkflowDefinition };
|
|
2401
|
+
export { Binding_d_exports as Binding, CloudflareOtlp_d_exports as CloudflareOtlp, 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, 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, Worker_d_exports as Worker, WorkerConfig, WorkerDefinition_d_exports as WorkerDefinition, type WorkerEnv, WorkerEnvironment, Workflow_d_exports as Workflow, WorkflowBinding_d_exports as WorkflowBinding, WorkflowDefinition_d_exports as WorkflowDefinition };
|