effect-cf 0.11.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 +6 -0
- package/dist/index.d.mts +292 -82
- package/dist/index.mjs +415 -89
- package/package.json +2 -1
- package/src/CloudflareOtlp.ts +628 -0
- package/src/index.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# effect-cf
|
|
2
2
|
|
|
3
|
+
## 0.12.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#37](https://github.com/danieljvdm/effect-cf/pull/37) [`4936579`](https://github.com/danieljvdm/effect-cf/commit/4936579eed9b2ad690f3fece468cc435e5bbf8e8) Thanks [@danieljvdm](https://github.com/danieljvdm)! - Add Cloudflare OTLP layers for Effect logs, traces, and metrics in Workers and Durable Objects.
|
|
8
|
+
|
|
3
9
|
## 0.11.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
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";
|
|
8
9
|
import { SqliteClient } from "@effect/sql-sqlite-do";
|
|
@@ -11,54 +12,11 @@ import * as _$effect_Types0 from "effect/Types";
|
|
|
11
12
|
import * as _$effect_Cause0 from "effect/Cause";
|
|
12
13
|
import * as _$effect_Layer0 from "effect/Layer";
|
|
13
14
|
import * as _$effect_Scope0 from "effect/Scope";
|
|
15
|
+
import * as Duration$1 from "effect/Duration";
|
|
16
|
+
import * as Tracer from "effect/Tracer";
|
|
14
17
|
import * as _$effect_Config0 from "effect/Config";
|
|
15
18
|
|
|
16
|
-
//#region src/
|
|
17
|
-
declare namespace D1_d_exports {
|
|
18
|
-
export { D1Definition, D1Service, D1SqlLayerOptions, Service$1 as Service, make$10 as make };
|
|
19
|
-
}
|
|
20
|
-
/** Typed D1 binding definition. */
|
|
21
|
-
interface D1Definition {
|
|
22
|
-
/** Binding name as configured in `wrangler.jsonc`. */
|
|
23
|
-
readonly binding: string;
|
|
24
|
-
}
|
|
25
|
-
/** Options forwarded to `@effect/sql-d1` when building a SQL client layer. */
|
|
26
|
-
type D1SqlLayerOptions = Omit<D1Client.D1ClientConfig, "db">;
|
|
27
|
-
declare const D1ServiceTypeId: unique symbol;
|
|
28
|
-
/** Nominal service marker for D1 services created with {@link make}. */
|
|
29
|
-
interface D1Service<Id extends string> {
|
|
30
|
-
readonly [D1ServiceTypeId]: {
|
|
31
|
-
readonly id: Id;
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Creates a typed D1 service tag plus Effect helpers.
|
|
36
|
-
*/
|
|
37
|
-
declare const make$10: <Id extends string>(id: Id, definition: D1Definition) => BindingService<D1Service<Id>, Id, D1Database> & {
|
|
38
|
-
"effect-cf/D1": "effect-cf/D1";
|
|
39
|
-
definition: D1Definition;
|
|
40
|
-
sqlLayer: (options?: D1SqlLayerOptions) => Layer.Layer<D1Client.D1Client | _$effect_unstable_sql_SqlClient0.SqlClient, BindingNotFoundError | BindingValidationError | _$effect_Config0.ConfigError, WorkerEnvironment>;
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* Builds a D1 service around a Cloudflare D1 database binding.
|
|
44
|
-
*
|
|
45
|
-
* The returned service exposes the raw `D1Database` binding and `sqlLayer(...)`
|
|
46
|
-
* for providing `effect/unstable/sql` via `@effect/sql-d1`.
|
|
47
|
-
*
|
|
48
|
-
* @example
|
|
49
|
-
* ```ts
|
|
50
|
-
* class TodoDatabase extends D1.Service<TodoDatabase>()("TodoDatabase", {
|
|
51
|
-
* binding: "TODO_DB",
|
|
52
|
-
* }) {}
|
|
53
|
-
*
|
|
54
|
-
* const SqlLive = TodoDatabase.sqlLayer();
|
|
55
|
-
* ```
|
|
56
|
-
*/
|
|
57
|
-
declare const Service$1: <Self>() => <Id extends string>(id: Id, definition: D1Definition) => BindingService<Self, Id, D1Database> & {
|
|
58
|
-
"effect-cf/D1": "effect-cf/D1";
|
|
59
|
-
definition: D1Definition;
|
|
60
|
-
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>>;
|
|
61
|
-
};
|
|
19
|
+
//#region src/Rpc.d.ts
|
|
62
20
|
declare namespace Rpc_d_exports {
|
|
63
21
|
export { DisposableValue, MethodArgs, MethodKey, MethodReturn, Provider, Result, RpcStub, RpcTarget, Serializable, Stub, Stubable, Stubify, dispose, isDisposable, resolve, scoped };
|
|
64
22
|
}
|
|
@@ -84,7 +42,7 @@ declare const dispose: (value: unknown) => Effect.Effect<void>;
|
|
|
84
42
|
declare const resolve: <A>(value: A) => Effect.Effect<Awaited<A>, unknown>;
|
|
85
43
|
declare const scoped: <A>(value: A) => Effect.Effect<Awaited<A>, unknown, Scope.Scope>;
|
|
86
44
|
declare namespace RpcDefinition_d_exports {
|
|
87
|
-
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 };
|
|
88
46
|
}
|
|
89
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 & {
|
|
90
48
|
readonly _tag: "RpcReservedMethodNameError";
|
|
@@ -183,9 +141,9 @@ declare const decodeArgs: <const Self extends Definition$9.Any, MethodName exten
|
|
|
183
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>;
|
|
184
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>;
|
|
185
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>;
|
|
186
|
-
declare const make$
|
|
144
|
+
declare const make$10: <Id extends string, const MethodsShape extends Methods$4>(id: Id, methods: MethodsShape) => Definition$9<Id, MethodsShape>;
|
|
187
145
|
declare namespace QueueBinding_d_exports {
|
|
188
|
-
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 };
|
|
189
147
|
}
|
|
190
148
|
type QueueSendOptions = globalThis.QueueSendOptions;
|
|
191
149
|
type QueueSendResponse = globalThis.QueueSendResponse;
|
|
@@ -217,9 +175,9 @@ declare class QueueOperationError extends QueueOperationError_base<{
|
|
|
217
175
|
}> {}
|
|
218
176
|
declare const isQueue: <Body>(value: unknown) => value is QueueProducer<Body>;
|
|
219
177
|
declare const makeClient$6: <Message extends ServiceFreeSchema$4>(definition: QueueBindingDefinition<Message>) => ((queue: QueueProducer<Schema.Codec.Encoded<Message>>) => QueueBindingClient<Message>);
|
|
220
|
-
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>;
|
|
221
179
|
declare namespace QueueDefinition_d_exports {
|
|
222
|
-
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 };
|
|
223
181
|
}
|
|
224
182
|
interface Definition$8<Id extends string = string, Message extends ServiceFreeSchema$4 = ServiceFreeSchema$4> {
|
|
225
183
|
readonly id: Id;
|
|
@@ -233,20 +191,20 @@ interface Options$7<ROut, Self extends Definition$8.Any> extends Omit<WorkerOpti
|
|
|
233
191
|
readonly queue: Handler$3<ROut, Self>;
|
|
234
192
|
readonly rpc?: never;
|
|
235
193
|
}
|
|
236
|
-
type LayerOptions$
|
|
194
|
+
type LayerOptions$12 = {
|
|
237
195
|
readonly binding: string;
|
|
238
196
|
};
|
|
239
197
|
interface TagClass$10<Self, Id extends string, Message extends ServiceFreeSchema$4> extends Context.ServiceClass<Self, Id, QueueBindingClient<Message>> {
|
|
240
198
|
readonly id: Id;
|
|
241
199
|
readonly message: Message;
|
|
242
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>;
|
|
243
|
-
readonly layer: (options: LayerOptions$
|
|
201
|
+
readonly layer: (options: LayerOptions$12) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
244
202
|
readonly send: (message: Schema.Schema.Type<Message>, options?: QueueSendOptions) => Effect.Effect<void, QueueOperationError | Schema.SchemaError, Self>;
|
|
245
203
|
readonly sendBatch: (messages: Iterable<MessageSendRequest<Schema.Schema.Type<Message>>>, options?: QueueSendBatchOptions) => Effect.Effect<void, QueueOperationError | Schema.SchemaError, Self>;
|
|
246
204
|
readonly metrics: () => Effect.Effect<QueueMetrics, QueueOperationError, Self>;
|
|
247
205
|
readonly unsafeRaw: () => Effect.Effect<globalThis.Queue<Schema.Codec.Encoded<Message>>, never, Self>;
|
|
248
206
|
}
|
|
249
|
-
declare const make$
|
|
207
|
+
declare const make$9: <Id extends string, Message extends ServiceFreeSchema$4>(id: Id, definition: {
|
|
250
208
|
readonly message: Message;
|
|
251
209
|
}) => TagClass$10<Definition$8<Id, Message>, Id, Message>;
|
|
252
210
|
declare const Tag$11: <Self>() => <Id extends string, Message extends ServiceFreeSchema$4>(id: Id, definition: {
|
|
@@ -257,7 +215,7 @@ declare const Queue$1: <Self>() => <Id extends string, Message extends ServiceFr
|
|
|
257
215
|
}) => TagClass$10<Self, Id, Message>;
|
|
258
216
|
declare const implement$7: <ROut, const Self extends Definition$8.Any>(_definition: Self, handler: Handler$3<ROut, Self>) => Handler$3<ROut, Self>;
|
|
259
217
|
declare namespace Queue_d_exports {
|
|
260
|
-
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 };
|
|
261
219
|
}
|
|
262
220
|
interface QueueMessage<Body> {
|
|
263
221
|
readonly raw: globalThis.Message<unknown>;
|
|
@@ -306,7 +264,7 @@ type Definition$7<Id extends string = string, Message extends Definition$8.Any["
|
|
|
306
264
|
declare namespace Definition$7 {
|
|
307
265
|
type Any = Definition$8.Any;
|
|
308
266
|
}
|
|
309
|
-
type LayerOptions$
|
|
267
|
+
type LayerOptions$11 = LayerOptions$12;
|
|
310
268
|
type TagClass$9<Self, Id extends string, Message extends Definition$8.Any["message"]> = TagClass$10<Self, Id, Message>;
|
|
311
269
|
declare const Tag$10: <Self>() => <Id extends string, Message extends Definition$8.Any["message"]>(id: Id, definition: {
|
|
312
270
|
readonly message: Message;
|
|
@@ -315,7 +273,7 @@ declare const implement$6: <ROut, const Self extends Definition$8.Any>(_definiti
|
|
|
315
273
|
type Handler$2<ROut, Self extends Definition$8.Any> = Handler$3<ROut, Self>;
|
|
316
274
|
type Options$6<ROut, Self extends Definition$8.Any> = Options$7<ROut, Self>;
|
|
317
275
|
declare namespace WorkerDefinition_d_exports {
|
|
318
|
-
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 };
|
|
319
277
|
}
|
|
320
278
|
type ServiceFreeSchema$3 = Schema.Codec<any, any, never, never>;
|
|
321
279
|
interface Method$4<Args extends ReadonlyArray<ServiceFreeSchema$3> = ReadonlyArray<ServiceFreeSchema$3>, Success extends ServiceFreeSchema$3 = ServiceFreeSchema$3> {
|
|
@@ -363,14 +321,14 @@ type Handlers$3<ROut, Self extends Definition$6.Any> = { readonly [Key in keyof
|
|
|
363
321
|
interface Options$5<ROut, Self extends Definition$6.Any> extends Omit<WorkerOptions<ROut, Handlers$3<ROut, Self>>, "rpc"> {
|
|
364
322
|
readonly rpc: Handlers$3<ROut, Self>;
|
|
365
323
|
}
|
|
366
|
-
type LayerOptions$
|
|
324
|
+
type LayerOptions$10 = {
|
|
367
325
|
readonly binding: string;
|
|
368
326
|
};
|
|
369
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>> & {
|
|
370
328
|
readonly id: Id;
|
|
371
329
|
readonly methods: MethodsShape;
|
|
372
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>;
|
|
373
|
-
readonly layer: (options: LayerOptions$
|
|
331
|
+
readonly layer: (options: LayerOptions$10) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
374
332
|
};
|
|
375
333
|
/**
|
|
376
334
|
* Defines a single RPC method schema in a worker definition.
|
|
@@ -384,7 +342,7 @@ declare const method$3: {
|
|
|
384
342
|
readonly success: Success;
|
|
385
343
|
}): Method$4<Args, Success>;
|
|
386
344
|
};
|
|
387
|
-
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>;
|
|
388
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>;
|
|
389
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>;
|
|
390
348
|
/**
|
|
@@ -403,7 +361,7 @@ type AsyncMethodArgs<Api, Method extends keyof Api> = Api[Method] extends ((...a
|
|
|
403
361
|
type AsyncMethodSuccess<Api, Method extends keyof Api> = Api[Method] extends ((...args: AnyArgs) => Promise<infer A>) ? A : never;
|
|
404
362
|
type AsyncMethodCloudflareReturn<Api, Method extends keyof Api> = Result<AsyncMethodSuccess<Api, Method>>;
|
|
405
363
|
declare namespace ServiceBinding_d_exports {
|
|
406
|
-
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 };
|
|
407
365
|
}
|
|
408
366
|
declare const TypeId$1: "effect-cf/ServiceBinding";
|
|
409
367
|
/**
|
|
@@ -550,7 +508,7 @@ type ServiceBindingStaticClient<R, Api extends object, Definition extends Defini
|
|
|
550
508
|
};
|
|
551
509
|
declare const isServiceBindingClient: <Api extends object>(value: unknown) => value is ServiceBindingClient<Api>;
|
|
552
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>);
|
|
553
|
-
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>;
|
|
554
512
|
/**
|
|
555
513
|
* Creates a typed Effect service for a Worker service binding.
|
|
556
514
|
*
|
|
@@ -580,7 +538,7 @@ declare const layer$7: <Self, Api extends object, const Definition extends Defin
|
|
|
580
538
|
* });
|
|
581
539
|
* ```
|
|
582
540
|
*/
|
|
583
|
-
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> & {
|
|
584
542
|
readonly [TypeId$1]: typeof TypeId$1;
|
|
585
543
|
readonly definition: ServiceBindingDefinition<Definition>;
|
|
586
544
|
readonly fetch: (input: RequestInfo | URL, init?: RequestInit) => Effect.Effect<Response, ServiceBindingFetchError, Self>;
|
|
@@ -590,7 +548,7 @@ declare const Service: <Self, Api extends object = never>() => <Id extends strin
|
|
|
590
548
|
};
|
|
591
549
|
declare const makeDirectMethods$1: <R, Api, Definition extends Definition$6.Any | undefined>(rpcDefinition: Definition | undefined, call: ServiceCall<R, Api>) => DirectMethods$1<R, Definition>;
|
|
592
550
|
declare namespace Worker_d_exports {
|
|
593
|
-
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 };
|
|
594
552
|
}
|
|
595
553
|
declare const ExecutionContext_base: Context.ServiceClass<ExecutionContext, "effect-cf/ExecutionContext", globalThis.ExecutionContext<unknown>>;
|
|
596
554
|
declare class ExecutionContext extends ExecutionContext_base {}
|
|
@@ -635,8 +593,8 @@ interface FetchHandler<Env extends WorkerEnv = WorkerEnv> {
|
|
|
635
593
|
readonly fetch: (request: Request, env: Env, ctx: globalThis.ExecutionContext) => Promise<Response>;
|
|
636
594
|
}
|
|
637
595
|
declare const renderHttpResponse: <A extends HttpServerResponse.HttpServerResponse, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<Response, E, R>;
|
|
638
|
-
declare function make$
|
|
639
|
-
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>;
|
|
640
598
|
declare const makeFetchHandler: <ROut, LayerError, Env extends WorkerEnv = WorkerEnv>(layer: Layer.Layer<ROut, LayerError, ExecutionContext | WorkerContext | WorkerEnvironment>, options: FetchWorkerOptions<ROut>) => FetchHandler<Env>;
|
|
641
599
|
type ServiceFreeSchema$2 = Schema.Codec<any, any, never, never>;
|
|
642
600
|
interface Method$3<Args extends ReadonlyArray<ServiceFreeSchema$2> = ReadonlyArray<ServiceFreeSchema$2>, Success extends ServiceFreeSchema$2 = ServiceFreeSchema$2> {
|
|
@@ -665,12 +623,12 @@ type Handlers$2<ROut, Self extends Definition$5.Any> = { readonly [Key in keyof
|
|
|
665
623
|
interface Options$4<ROut, Self extends Definition$5.Any> extends Omit<WorkerOptions<ROut, Handlers$2<ROut, Self>>, "rpc"> {
|
|
666
624
|
readonly rpc: Handlers$2<ROut, Self>;
|
|
667
625
|
}
|
|
668
|
-
type LayerOptions$
|
|
626
|
+
type LayerOptions$9 = LayerOptions$10;
|
|
669
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>> & {
|
|
670
628
|
readonly id: Id;
|
|
671
629
|
readonly methods: MethodsShape;
|
|
672
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>;
|
|
673
|
-
readonly layer: (options: LayerOptions$
|
|
631
|
+
readonly layer: (options: LayerOptions$9) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
674
632
|
};
|
|
675
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>;
|
|
676
634
|
declare const Tag$8: TagFactory$1;
|
|
@@ -987,7 +945,7 @@ declare class DurableObjectState extends DurableObjectState_base {}
|
|
|
987
945
|
*/
|
|
988
946
|
declare const fromDurableObjectState: (state: globalThis.DurableObjectState) => DurableObjectStateService;
|
|
989
947
|
declare namespace DurableObjectNamespace_d_exports {
|
|
990
|
-
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 };
|
|
991
949
|
}
|
|
992
950
|
interface DurableObjectFetcher {
|
|
993
951
|
fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
|
|
@@ -1186,7 +1144,7 @@ type DurableObjectNamespaceStaticClient<R, Api extends object, Definition extend
|
|
|
1186
1144
|
};
|
|
1187
1145
|
declare const isDurableObjectNamespaceClient: <Api extends object>(value: unknown) => value is DurableObjectNamespaceClient<Api>;
|
|
1188
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>);
|
|
1189
|
-
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>;
|
|
1190
1148
|
declare const makeDirectMethods: <R, Api extends object, Definition extends Definition$4.Any | undefined>(rpcDefinition: Definition | undefined, helpers: {
|
|
1191
1149
|
readonly call: StubCall<R, Api>;
|
|
1192
1150
|
readonly fetch: (stub: DurableObjectStubClient<Api>, input: RequestInfo | URL, init?: RequestInit) => Effect.Effect<globalThis.Response, DurableObjectFetchError, R>;
|
|
@@ -1194,7 +1152,7 @@ declare const makeDirectMethods: <R, Api extends object, Definition extends Defi
|
|
|
1194
1152
|
readonly getByName: (name: string, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions) => Effect.Effect<DurableObjectStubClient<Api>, never, R>;
|
|
1195
1153
|
}) => DirectMethods<R, Api, Definition>;
|
|
1196
1154
|
declare namespace DurableObjectDefinition_d_exports {
|
|
1197
|
-
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 };
|
|
1198
1156
|
}
|
|
1199
1157
|
type ServiceFreeSchema$1 = Schema.Codec<any, any, never, never>;
|
|
1200
1158
|
interface Method$2<Args extends ReadonlyArray<ServiceFreeSchema$1> = ReadonlyArray<ServiceFreeSchema$1>, Success extends ServiceFreeSchema$1 = ServiceFreeSchema$1> {
|
|
@@ -1239,14 +1197,14 @@ type Handlers$1<ROut, Self extends Definition$4.Any> = { readonly [Key in keyof
|
|
|
1239
1197
|
interface Options$3<ROut, Self extends Definition$4.Any> extends Omit<DurableObjectOptions<ROut, Handlers$1<ROut, Self>>, "rpc"> {
|
|
1240
1198
|
readonly rpc: Handlers$1<ROut, Self>;
|
|
1241
1199
|
}
|
|
1242
|
-
type LayerOptions$
|
|
1200
|
+
type LayerOptions$8 = {
|
|
1243
1201
|
readonly binding: string;
|
|
1244
1202
|
};
|
|
1245
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>> & {
|
|
1246
1204
|
readonly id: Id;
|
|
1247
1205
|
readonly methods: MethodsShape;
|
|
1248
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>;
|
|
1249
|
-
readonly layer: (options: LayerOptions$
|
|
1207
|
+
readonly layer: (options: LayerOptions$8) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
1250
1208
|
};
|
|
1251
1209
|
/**
|
|
1252
1210
|
* Defines a single RPC method schema in a Durable Object definition.
|
|
@@ -1260,7 +1218,7 @@ declare const method$1: {
|
|
|
1260
1218
|
readonly success: Success;
|
|
1261
1219
|
}): Method$2<Args, Success>;
|
|
1262
1220
|
};
|
|
1263
|
-
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>;
|
|
1264
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>;
|
|
1265
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>;
|
|
1266
1224
|
/**
|
|
@@ -1272,7 +1230,7 @@ declare const implement$3: <ROut, const Self extends Definition$4.Any>(_definiti
|
|
|
1272
1230
|
*/
|
|
1273
1231
|
type HandlerEffect$1<ROut, Self extends Definition$4.Any, Key extends keyof Self["methods"]> = DurableObjectHandler<ROut, Method$2.Success<Self["methods"][Key]>>;
|
|
1274
1232
|
declare namespace DurableObject_d_exports {
|
|
1275
|
-
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 };
|
|
1276
1234
|
}
|
|
1277
1235
|
type RuntimeContext$1<ROut> = DurableObjectState | WorkerEnvironment | ROut;
|
|
1278
1236
|
type HandlerContext<ROut> = RuntimeContext$1<ROut> | Scope.Scope;
|
|
@@ -1324,7 +1282,7 @@ type DurableObjectClass<Rpc extends DurableObjectRpc<ROut>, ROut> = new (state:
|
|
|
1324
1282
|
/**
|
|
1325
1283
|
* Creates a Durable Object class backed by a single managed Effect runtime.
|
|
1326
1284
|
*/
|
|
1327
|
-
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>;
|
|
1328
1286
|
type ServiceFreeSchema = Schema.Codec<any, any, never, never>;
|
|
1329
1287
|
interface Method$1<Args extends ReadonlyArray<ServiceFreeSchema> = ReadonlyArray<ServiceFreeSchema>, Success extends ServiceFreeSchema = ServiceFreeSchema> {
|
|
1330
1288
|
readonly args: Args;
|
|
@@ -1347,7 +1305,7 @@ interface Definition$3<Id extends string = string, MethodsShape extends Methods
|
|
|
1347
1305
|
declare namespace Definition$3 {
|
|
1348
1306
|
type Any = Definition$3<string, Methods>;
|
|
1349
1307
|
}
|
|
1350
|
-
type LayerOptions$
|
|
1308
|
+
type LayerOptions$7 = LayerOptions$8;
|
|
1351
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]>> };
|
|
1352
1310
|
type Api<Self extends Definition$3.Any> = Provider<ServerApi$1<Self>, ReservedMethodName>;
|
|
1353
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]>> };
|
|
@@ -1358,7 +1316,7 @@ type TagClass$5<Self, Id extends string, MethodsShape extends Methods> = Context
|
|
|
1358
1316
|
readonly id: Id;
|
|
1359
1317
|
readonly methods: MethodsShape;
|
|
1360
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>;
|
|
1361
|
-
readonly layer: (options: LayerOptions$
|
|
1319
|
+
readonly layer: (options: LayerOptions$7) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
1362
1320
|
};
|
|
1363
1321
|
type TagFactory = <Self>() => <Id extends string, const MethodsShape extends Methods>(id: Id, methods: MethodsShape & NoReservedMethods<MethodsShape>) => TagClass$5<Self, Id, MethodsShape>;
|
|
1364
1322
|
declare const Tag$6: TagFactory;
|
|
@@ -1373,6 +1331,258 @@ declare const method: {
|
|
|
1373
1331
|
};
|
|
1374
1332
|
declare const implement$2: <ROut, const Self extends Definition$3.Any>(_definition: Self, handlers: Handlers<ROut, Self>) => Handlers<ROut, Self>;
|
|
1375
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
|
+
};
|
|
1376
1586
|
declare namespace DurableObjectAlarm_d_exports {
|
|
1377
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 };
|
|
1378
1588
|
}
|
|
@@ -2188,4 +2398,4 @@ declare const implement: <ROut, const Self extends Definition$1.Any>(_definition
|
|
|
2188
2398
|
type Handler<ROut, Self extends Definition$1.Any> = Handler$1<ROut, Self>;
|
|
2189
2399
|
type Options<ROut, Self extends Definition$1.Any> = Options$1<ROut, Self>;
|
|
2190
2400
|
//#endregion
|
|
2191
|
-
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, 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 };
|
|
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 };
|