effect-cf 0.20.1 → 0.23.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 +52 -0
- package/README.md +27 -3
- package/dist/{Hyperdrive-RTjgirMV.d.mts → Hyperdrive-COyg7R26.d.mts} +40 -13
- package/dist/HyperdrivePg.d.mts +13 -5
- package/dist/HyperdrivePg.mjs +12 -7
- package/dist/index.d.mts +1113 -922
- package/dist/index.mjs +980 -604
- package/package.json +10 -5
- package/src/AiGateway.ts +82 -47
- package/src/AnalyticsEngine.ts +74 -58
- package/src/Binding.ts +66 -13
- package/src/BrowserRendering.ts +30 -7
- package/src/Cache.ts +32 -8
- package/src/CloudflareOtlp.ts +32 -9
- package/src/ContainerNamespace.ts +251 -80
- package/src/D1.ts +13 -3
- package/src/DurableObject.ts +27 -164
- package/src/DurableObjectAlarm.ts +30 -9
- package/src/DurableObjectDefinition.ts +58 -54
- package/src/DurableObjectNamespace.ts +99 -96
- package/src/DurableObjectRpcWebSocket.ts +14 -6
- package/src/DurableObjectSqlite.ts +6 -3
- package/src/DurableObjectState.ts +63 -39
- package/src/DurableObjectStorage.ts +7 -1
- package/src/DurableObjectWebSocket.ts +51 -41
- package/src/Email.ts +40 -13
- package/src/Environment.ts +26 -6
- package/src/Hyperdrive.ts +2 -2
- package/src/HyperdrivePg.ts +25 -13
- package/src/Images.ts +77 -82
- package/src/Kv.ts +37 -27
- package/src/Queue.ts +6 -1
- package/src/QueueBinding.ts +18 -21
- package/src/QueueDefinition.ts +15 -14
- package/src/R2.ts +107 -29
- package/src/Rpc.ts +3 -1
- package/src/RpcDefinition.ts +177 -133
- package/src/ServiceBinding.ts +112 -108
- package/src/Vectorize.ts +59 -14
- package/src/Worker.ts +172 -192
- package/src/WorkerDefinition.ts +5 -10
- package/src/WorkersAi.ts +27 -17
- package/src/Workflow.ts +54 -49
- package/src/WorkflowBinding.ts +19 -11
- package/src/WorkflowDefinition.ts +24 -27
- package/src/index.ts +4 -3
- package/src/internal/Entrypoint.ts +3 -1
- package/src/internal/ErrorMessage.ts +24 -0
- package/src/internal/RpcInvocation.ts +11 -8
- package/src/internal/Runtime.ts +52 -0
- package/src/internal/WorkerContext.ts +39 -17
- package/src/Entry.ts +0 -259
- package/src/internal/Clock.ts +0 -37
package/dist/index.d.mts
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { a as BindingService, c as
|
|
1
|
+
import { a as BindingService, c as Environment_d_exports, d as WorkerEnvironment, i as BindingNotFoundError, l as WorkerConfig, o as BindingValidationError, s as Binding_d_exports, t as Hyperdrive_d_exports, u as WorkerEnv } from "./Hyperdrive-COyg7R26.mjs";
|
|
2
2
|
import { Cause, Config, Context, Data, DateTime, Duration, Effect, Layer, Option, Redacted, Schema, Scope } from "effect";
|
|
3
3
|
import { Headers as Headers$1, HttpClient, HttpClientResponse, HttpServerRequest, HttpServerResponse } from "effect/unstable/http";
|
|
4
|
+
import { OtlpExporter } from "effect/unstable/observability";
|
|
4
5
|
import { D1Client } from "@effect/sql-d1";
|
|
5
6
|
import { DurableObject, RpcStub, RpcTarget, WorkerEntrypoint, WorkflowEntrypoint, WorkflowEvent, WorkflowSleepDuration, WorkflowStep, WorkflowStepConfig, WorkflowStepContext, WorkflowStepEvent, WorkflowTimeoutDuration } from "cloudflare:workers";
|
|
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";
|
|
10
|
+
import { SqlClient } from "effect/unstable/sql";
|
|
9
11
|
import * as Tracer from "effect/Tracer";
|
|
10
12
|
declare namespace WorkersAi_d_exports {
|
|
11
|
-
export { LayerOptions$
|
|
13
|
+
export { LayerOptions$17 as LayerOptions, Tag$16 as Tag, TagClass$15 as TagClass, WorkersAiAsyncBatchResponse, WorkersAiBinding, WorkersAiClient, WorkersAiDefinition, WorkersAiEmbeddingInput, WorkersAiEmbeddingResponse, WorkersAiModelsSearchObject, WorkersAiModelsSearchParams, WorkersAiOperationError, WorkersAiOptions, WorkersAiService, embeddingResponse, isWorkersAiBinding, layer$17 as layer, make$17 as make, makeClient$14 as makeClient };
|
|
12
14
|
}
|
|
13
15
|
declare const WorkersAiOperationError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
14
16
|
readonly _tag: "WorkersAiOperationError";
|
|
@@ -18,7 +20,9 @@ declare class WorkersAiOperationError extends WorkersAiOperationError_base<{
|
|
|
18
20
|
readonly binding: string;
|
|
19
21
|
readonly operation: string;
|
|
20
22
|
readonly cause: unknown;
|
|
21
|
-
}> {
|
|
23
|
+
}> {
|
|
24
|
+
get message(): string;
|
|
25
|
+
}
|
|
22
26
|
/** Typed Workers AI binding definition. */
|
|
23
27
|
interface WorkersAiDefinition {
|
|
24
28
|
/** Binding name as configured in `wrangler.jsonc`. */
|
|
@@ -57,7 +61,7 @@ interface WorkersAiClient<ModelList extends AiModelListType = AiModels> {
|
|
|
57
61
|
readonly runEmbedding: <Input extends WorkersAiEmbeddingInput>(model: string, input: Input, options?: WorkersAiOptions) => Effect.Effect<WorkersAiEmbeddingResponse, WorkersAiOperationError>;
|
|
58
62
|
readonly models: (params?: WorkersAiModelsSearchParams) => Effect.Effect<ReadonlyArray<WorkersAiModelsSearchObject>, WorkersAiOperationError>;
|
|
59
63
|
readonly gateway: (gatewayId: string) => Effect.Effect<CloudflareAiGateway, WorkersAiOperationError>;
|
|
60
|
-
readonly
|
|
64
|
+
readonly rawUnsafe: Effect.Effect<WorkersAiBinding<ModelList>>;
|
|
61
65
|
readonly definition: WorkersAiDefinition;
|
|
62
66
|
}
|
|
63
67
|
declare const WorkersAiServiceTypeId: unique symbol;
|
|
@@ -67,12 +71,12 @@ interface WorkersAiService<Id extends string> {
|
|
|
67
71
|
readonly id: Id;
|
|
68
72
|
};
|
|
69
73
|
}
|
|
70
|
-
type LayerOptions$
|
|
74
|
+
type LayerOptions$17 = {
|
|
71
75
|
readonly binding: string;
|
|
72
76
|
};
|
|
73
|
-
interface TagClass$
|
|
77
|
+
interface TagClass$15<Self, Id extends string, ModelList extends AiModelListType = AiModels> extends Context.ServiceClass<Self, Id, WorkersAiClient<ModelList>> {
|
|
74
78
|
readonly id: Id;
|
|
75
|
-
readonly layer: (options: LayerOptions$
|
|
79
|
+
readonly layer: (options: LayerOptions$17) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
76
80
|
}
|
|
77
81
|
declare const isWorkersAiBinding: (value: unknown) => value is WorkersAiBinding;
|
|
78
82
|
declare const embeddingResponse: (value: {
|
|
@@ -81,10 +85,10 @@ declare const embeddingResponse: (value: {
|
|
|
81
85
|
}) => WorkersAiEmbeddingResponse;
|
|
82
86
|
declare const makeClient$14: <ModelList extends AiModelListType = AiModels>(definition: WorkersAiDefinition) => (ai: WorkersAiBinding<ModelList>) => WorkersAiClient<ModelList>;
|
|
83
87
|
declare const layer$17: <Self, ModelList extends AiModelListType = AiModels>(tag: Context.Service<Self, WorkersAiClient<ModelList>>, definition: WorkersAiDefinition) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
84
|
-
declare const make$17: <Id extends string>(id: Id) => TagClass$
|
|
85
|
-
declare const Tag$
|
|
88
|
+
declare const make$17: <Id extends string>(id: Id) => TagClass$15<WorkersAiService<Id>, Id, AiModels>;
|
|
89
|
+
declare const Tag$16: <Self>() => <Id extends string, ModelList extends AiModelListType = AiModels>(id: Id) => TagClass$15<Self, Id, ModelList>;
|
|
86
90
|
declare namespace AiGateway_d_exports {
|
|
87
|
-
export { AiGatewayBinding, AiGatewayClient, AiGatewayDefinition, AiGatewayFetchOptions, AiGatewayHeaders, AiGatewayLog, AiGatewayOperationError, AiGatewayPatchLog, AiGatewayProvider, AiGatewayRunOptions, AiGatewayService, AiGatewayUniversalRequest, LayerOptions$
|
|
91
|
+
export { AiGatewayBinding, AiGatewayClient, AiGatewayDefinition, AiGatewayFetchOptions, AiGatewayHeaders, AiGatewayLog, AiGatewayOperationError, AiGatewayPatchLog, AiGatewayProvider, AiGatewayRunOptions, AiGatewayService, AiGatewayUniversalRequest, LayerOptions$16 as LayerOptions, Tag$15 as Tag, TagClass$14 as TagClass, isAiGatewayBinding, layer$16 as layer, make$16 as make, makeClient$13 as makeClient, makeClientFromAi, makeHttpClient };
|
|
88
92
|
}
|
|
89
93
|
declare const AiGatewayOperationError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
90
94
|
readonly _tag: "AiGatewayOperationError";
|
|
@@ -94,7 +98,9 @@ declare class AiGatewayOperationError extends AiGatewayOperationError_base<{
|
|
|
94
98
|
readonly binding: string;
|
|
95
99
|
readonly operation: string;
|
|
96
100
|
readonly cause: unknown;
|
|
97
|
-
}> {
|
|
101
|
+
}> {
|
|
102
|
+
get message(): string;
|
|
103
|
+
}
|
|
98
104
|
/** Typed AI Gateway client definition. */
|
|
99
105
|
interface AiGatewayDefinition {
|
|
100
106
|
/** Binding name as configured in `wrangler.jsonc`. */
|
|
@@ -123,7 +129,7 @@ interface AiGatewayClient {
|
|
|
123
129
|
readonly fetch: (options: AiGatewayFetchOptions) => Effect.Effect<Response, AiGatewayOperationError>;
|
|
124
130
|
readonly patchLog: (logId: string, data: AiGatewayPatchLog) => Effect.Effect<void, AiGatewayOperationError>;
|
|
125
131
|
readonly getLog: (logId: string) => Effect.Effect<AiGatewayLog, AiGatewayOperationError>;
|
|
126
|
-
readonly
|
|
132
|
+
readonly rawUnsafe: Effect.Effect<AiGatewayBinding, AiGatewayOperationError>;
|
|
127
133
|
readonly definition: AiGatewayDefinition;
|
|
128
134
|
}
|
|
129
135
|
declare const AiGatewayServiceTypeId: unique symbol;
|
|
@@ -133,28 +139,28 @@ interface AiGatewayService<Id extends string> {
|
|
|
133
139
|
readonly id: Id;
|
|
134
140
|
};
|
|
135
141
|
}
|
|
136
|
-
type LayerOptions$
|
|
142
|
+
type LayerOptions$16 = {
|
|
137
143
|
readonly binding: string;
|
|
138
144
|
readonly gatewayId: string;
|
|
139
145
|
readonly accountId?: string;
|
|
140
146
|
};
|
|
141
|
-
interface TagClass$
|
|
147
|
+
interface TagClass$14<Self, Id extends string> extends Context.ServiceClass<Self, Id, AiGatewayClient> {
|
|
142
148
|
readonly id: Id;
|
|
143
|
-
readonly layer: (options: LayerOptions$
|
|
149
|
+
readonly layer: (options: LayerOptions$16) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError | AiGatewayOperationError, WorkerEnvironment>;
|
|
144
150
|
}
|
|
145
151
|
declare const isAiGatewayBinding: (value: unknown) => value is WorkersAiBinding;
|
|
146
152
|
declare const makeClient$13: (definition: AiGatewayDefinition, gateway: AiGatewayBinding) => {
|
|
147
153
|
definition: AiGatewayDefinition;
|
|
148
|
-
run: (data:
|
|
149
|
-
gateway?:
|
|
154
|
+
run: (data: import("@cloudflare/workers-types").AIGatewayUniversalRequest | readonly import("@cloudflare/workers-types").AIGatewayUniversalRequest[], options?: {
|
|
155
|
+
gateway?: import("@cloudflare/workers-types").UniversalGatewayOptions;
|
|
150
156
|
extraHeaders?: object;
|
|
151
|
-
signal?:
|
|
152
|
-
} | undefined) => Effect.Effect<
|
|
153
|
-
getUrl: (provider
|
|
157
|
+
signal?: import("@cloudflare/workers-types").AbortSignal;
|
|
158
|
+
} | undefined) => Effect.Effect<import("@cloudflare/workers-types").Response, AiGatewayOperationError, never>;
|
|
159
|
+
getUrl: (provider?: string | undefined) => Effect.Effect<string, AiGatewayOperationError, never>;
|
|
154
160
|
fetch: (options: AiGatewayFetchOptions) => Effect.Effect<Response, AiGatewayOperationError, never>;
|
|
155
|
-
patchLog: (logId: string, data:
|
|
156
|
-
getLog: (logId: string) => Effect.Effect<
|
|
157
|
-
|
|
161
|
+
patchLog: (logId: string, data: import("@cloudflare/workers-types").AiGatewayPatchLog) => Effect.Effect<void, AiGatewayOperationError, never>;
|
|
162
|
+
getLog: (logId: string) => Effect.Effect<import("@cloudflare/workers-types").AiGatewayLog, AiGatewayOperationError, never>;
|
|
163
|
+
rawUnsafe: Effect.Effect<CloudflareAiGateway, never, never>;
|
|
158
164
|
};
|
|
159
165
|
declare const makeClientFromAi: (definition: AiGatewayDefinition, ai: WorkersAiBinding) => AiGatewayClient;
|
|
160
166
|
declare const makeHttpClient: (definition: Omit<AiGatewayDefinition, "binding"> & {
|
|
@@ -162,10 +168,10 @@ declare const makeHttpClient: (definition: Omit<AiGatewayDefinition, "binding">
|
|
|
162
168
|
readonly binding?: string;
|
|
163
169
|
}, request?: typeof fetch) => AiGatewayClient;
|
|
164
170
|
declare const layer$16: <Self>(tag: Context.Service<Self, AiGatewayClient>, definition: AiGatewayDefinition) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
165
|
-
declare const make$16: <Id extends string>(id: Id) => TagClass$
|
|
166
|
-
declare const Tag$
|
|
171
|
+
declare const make$16: <Id extends string>(id: Id) => TagClass$14<AiGatewayService<Id>, Id>;
|
|
172
|
+
declare const Tag$15: <Self>() => <Id extends string>(id: Id) => TagClass$14<Self, Id>;
|
|
167
173
|
declare namespace AnalyticsEngine_d_exports {
|
|
168
|
-
export { AnalyticsEngineBinding, AnalyticsEngineClient, AnalyticsEngineDataPoint, AnalyticsEngineDataPointSchema, AnalyticsEngineDefinition, AnalyticsEngineFieldValue, AnalyticsEngineFieldValueSchema, AnalyticsEngineInvalidWritePolicy, AnalyticsEngineOperationError, AnalyticsEngineQueryClient, AnalyticsEngineQueryColumn, AnalyticsEngineQueryDefinition, AnalyticsEngineQueryError, AnalyticsEngineQueryOptions, AnalyticsEngineQueryResult, AnalyticsEngineQueryRow, AnalyticsEngineQueryService, AnalyticsEngineService, AnalyticsEngineWriteBatchOptions, AnalyticsEngineWriteError, AnalyticsEngineWriteOptions, AnalyticsEngineWritePolicy, AnalyticsEngineWriteValidationError, AnalyticsEngineWriteViolation, LayerOptions$
|
|
174
|
+
export { AnalyticsEngineBinding, AnalyticsEngineClient, AnalyticsEngineDataPoint, AnalyticsEngineDataPointSchema, AnalyticsEngineDefinition, AnalyticsEngineFieldValue, AnalyticsEngineFieldValueSchema, AnalyticsEngineInvalidWritePolicy, AnalyticsEngineOperationError, AnalyticsEngineQueryClient, AnalyticsEngineQueryColumn, AnalyticsEngineQueryDefinition, AnalyticsEngineQueryError, AnalyticsEngineQueryOptions, AnalyticsEngineQueryResult, AnalyticsEngineQueryRow, AnalyticsEngineQueryService, AnalyticsEngineService, AnalyticsEngineWriteBatchOptions, AnalyticsEngineWriteError, AnalyticsEngineWriteOptions, AnalyticsEngineWritePolicy, AnalyticsEngineWriteValidationError, AnalyticsEngineWriteViolation, LayerOptions$15 as LayerOptions, QueryConfigOptions, QueryTag, QueryTagClass, Tag$14 as Tag, TagClass$13 as TagClass, isAnalyticsEngineDataset, layer$15 as layer, layerFetch, layerFetchConfig, make$15 as make, makeClient$12 as makeClient, makeQuery, makeQueryClient, queryConfig, queryLayer, queryLayerConfig, writeLimits };
|
|
169
175
|
}
|
|
170
176
|
declare const writeLimits: {
|
|
171
177
|
readonly maxBlobs: 20;
|
|
@@ -194,7 +200,9 @@ declare class AnalyticsEngineOperationError extends AnalyticsEngineOperationErro
|
|
|
194
200
|
readonly binding: string;
|
|
195
201
|
readonly operation: string;
|
|
196
202
|
readonly cause: unknown;
|
|
197
|
-
}> {
|
|
203
|
+
}> {
|
|
204
|
+
get message(): string;
|
|
205
|
+
}
|
|
198
206
|
interface AnalyticsEngineWriteViolation {
|
|
199
207
|
readonly path: string;
|
|
200
208
|
readonly message: string;
|
|
@@ -210,7 +218,9 @@ declare class AnalyticsEngineWriteValidationError extends AnalyticsEngineWriteVa
|
|
|
210
218
|
readonly operation: string;
|
|
211
219
|
readonly violations: ReadonlyArray<AnalyticsEngineWriteViolation>;
|
|
212
220
|
readonly cause?: unknown;
|
|
213
|
-
}> {
|
|
221
|
+
}> {
|
|
222
|
+
get message(): string;
|
|
223
|
+
}
|
|
214
224
|
declare const AnalyticsEngineQueryError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
215
225
|
readonly _tag: "AnalyticsEngineQueryError";
|
|
216
226
|
} & Readonly<A>;
|
|
@@ -272,7 +282,7 @@ interface AnalyticsEngineClient {
|
|
|
272
282
|
readonly write: (dataPoint?: AnalyticsEngineDataPoint, options?: AnalyticsEngineWriteOptions) => Effect.Effect<void, AnalyticsEngineWriteError>;
|
|
273
283
|
readonly writeDataPoints: (dataPoints: ReadonlyArray<AnalyticsEngineDataPoint>, options?: AnalyticsEngineWriteBatchOptions) => Effect.Effect<void, AnalyticsEngineWriteError>;
|
|
274
284
|
readonly writeBatch: (dataPoints: ReadonlyArray<AnalyticsEngineDataPoint>, options?: AnalyticsEngineWriteBatchOptions) => Effect.Effect<void, AnalyticsEngineWriteError>;
|
|
275
|
-
readonly
|
|
285
|
+
readonly rawUnsafe: Effect.Effect<AnalyticsEngineBinding>;
|
|
276
286
|
readonly definition: AnalyticsEngineDefinition;
|
|
277
287
|
}
|
|
278
288
|
interface AnalyticsEngineQueryClient {
|
|
@@ -298,7 +308,7 @@ interface AnalyticsEngineQueryService<Id extends string> {
|
|
|
298
308
|
readonly id: Id;
|
|
299
309
|
};
|
|
300
310
|
}
|
|
301
|
-
type LayerOptions$
|
|
311
|
+
type LayerOptions$15 = {
|
|
302
312
|
readonly binding: string;
|
|
303
313
|
readonly write?: AnalyticsEngineWritePolicy;
|
|
304
314
|
};
|
|
@@ -307,16 +317,16 @@ type QueryConfigOptions = {
|
|
|
307
317
|
readonly apiToken?: Config.Config<Redacted.Redacted<string>>;
|
|
308
318
|
readonly apiBaseUrl?: Config.Config<string>;
|
|
309
319
|
};
|
|
310
|
-
interface TagClass$
|
|
320
|
+
interface TagClass$13<Self, Id extends string> extends Context.ServiceClass<Self, Id, AnalyticsEngineClient> {
|
|
311
321
|
readonly id: Id;
|
|
312
|
-
readonly layer: (options: LayerOptions$
|
|
322
|
+
readonly layer: (options: LayerOptions$15) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
313
323
|
}
|
|
314
324
|
interface QueryTagClass<Self, Id extends string> extends Context.ServiceClass<Self, Id, AnalyticsEngineQueryClient> {
|
|
315
325
|
readonly id: Id;
|
|
316
326
|
readonly layer: (definition: AnalyticsEngineQueryDefinition) => Layer.Layer<Self, never, HttpClient.HttpClient>;
|
|
317
|
-
readonly
|
|
327
|
+
readonly layerFetch: (definition: AnalyticsEngineQueryDefinition) => Layer.Layer<Self>;
|
|
318
328
|
readonly layerConfig: (config?: Config.Config<AnalyticsEngineQueryDefinition>) => Layer.Layer<Self, Config.ConfigError, HttpClient.HttpClient>;
|
|
319
|
-
readonly
|
|
329
|
+
readonly layerFetchConfig: (config?: Config.Config<AnalyticsEngineQueryDefinition>) => Layer.Layer<Self, Config.ConfigError>;
|
|
320
330
|
}
|
|
321
331
|
declare const makeQueryClient: (definition: AnalyticsEngineQueryDefinition) => Effect.Effect<AnalyticsEngineQueryClient, never, HttpClient.HttpClient>;
|
|
322
332
|
declare const isAnalyticsEngineDataset: (value: unknown) => value is AnalyticsEngineBinding;
|
|
@@ -327,16 +337,16 @@ declare const queryConfig: (options?: QueryConfigOptions) => Config.Config<{
|
|
|
327
337
|
apiBaseUrl: string;
|
|
328
338
|
}>;
|
|
329
339
|
declare const queryLayer: <Self>(tag: Context.Service<Self, AnalyticsEngineQueryClient>, definition: AnalyticsEngineQueryDefinition) => Layer.Layer<Self, never, HttpClient.HttpClient>;
|
|
330
|
-
declare const
|
|
340
|
+
declare const layerFetch: <Self>(tag: Context.Service<Self, AnalyticsEngineQueryClient>, definition: AnalyticsEngineQueryDefinition) => Layer.Layer<Self, never, never>;
|
|
331
341
|
declare const queryLayerConfig: <Self>(tag: Context.Service<Self, AnalyticsEngineQueryClient>, config?: Config.Config<AnalyticsEngineQueryDefinition>) => Layer.Layer<Self, Config.ConfigError, HttpClient.HttpClient>;
|
|
332
|
-
declare const
|
|
333
|
-
declare const layer$15: <Self>(tag: Context.Service<Self, AnalyticsEngineClient>, definition: LayerOptions$
|
|
334
|
-
declare const make$15: <Id extends string>(id: Id) => TagClass$
|
|
342
|
+
declare const layerFetchConfig: <Self>(tag: Context.Service<Self, AnalyticsEngineQueryClient>, config?: Config.Config<AnalyticsEngineQueryDefinition>) => Layer.Layer<Self, Config.ConfigError, never>;
|
|
343
|
+
declare const layer$15: <Self>(tag: Context.Service<Self, AnalyticsEngineClient>, definition: LayerOptions$15) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
344
|
+
declare const make$15: <Id extends string>(id: Id) => TagClass$13<AnalyticsEngineService<Id>, Id>;
|
|
335
345
|
declare const makeQuery: <Id extends string>(id: Id) => QueryTagClass<AnalyticsEngineQueryService<Id>, Id>;
|
|
336
|
-
declare const Tag$
|
|
346
|
+
declare const Tag$14: <Self>() => <Id extends string>(id: Id) => TagClass$13<Self, Id>;
|
|
337
347
|
declare const QueryTag: <Self>() => <Id extends string>(id: Id) => QueryTagClass<Self, Id>;
|
|
338
348
|
declare namespace BrowserRendering_d_exports {
|
|
339
|
-
export { BrowserRenderingBinding, BrowserRenderingBrowserClient, BrowserRenderingBrowserLike, BrowserRenderingClient, BrowserRenderingConnect, BrowserRenderingDefinition, BrowserRenderingLaunch, BrowserRenderingOperationError, BrowserRenderingPageClient, BrowserRenderingPageLike, BrowserRenderingService, LayerOptions$
|
|
349
|
+
export { BrowserRenderingBinding, BrowserRenderingBrowserClient, BrowserRenderingBrowserLike, BrowserRenderingClient, BrowserRenderingConnect, BrowserRenderingDefinition, BrowserRenderingLaunch, BrowserRenderingOperationError, BrowserRenderingPageClient, BrowserRenderingPageLike, BrowserRenderingService, LayerOptions$14 as LayerOptions, Tag$13 as Tag, TagClass$12 as TagClass, isBrowserRenderingBinding, layer$14 as layer, make$14 as make, makeClient$11 as makeClient };
|
|
340
350
|
}
|
|
341
351
|
declare const BrowserRenderingOperationError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
342
352
|
readonly _tag: "BrowserRenderingOperationError";
|
|
@@ -346,7 +356,9 @@ declare class BrowserRenderingOperationError extends BrowserRenderingOperationEr
|
|
|
346
356
|
readonly binding: string;
|
|
347
357
|
readonly operation: string;
|
|
348
358
|
readonly cause: unknown;
|
|
349
|
-
}> {
|
|
359
|
+
}> {
|
|
360
|
+
get message(): string;
|
|
361
|
+
}
|
|
350
362
|
/** Typed Browser Rendering binding definition. */
|
|
351
363
|
interface BrowserRenderingDefinition {
|
|
352
364
|
/** Binding name as configured in `wrangler.jsonc`. */
|
|
@@ -390,7 +402,7 @@ interface BrowserRenderingBrowserClient<Browser extends BrowserRenderingBrowserL
|
|
|
390
402
|
interface BrowserRenderingClient<RawBinding extends BrowserRenderingBinding = BrowserRenderingBinding> {
|
|
391
403
|
readonly launchWith: <Browser extends BrowserRenderingBrowserLike<Page>, Page extends BrowserRenderingPageLike = BrowserRenderingPageLike, LaunchOptions = unknown>(launch: BrowserRenderingLaunch<RawBinding, Browser, LaunchOptions>, options?: LaunchOptions) => Effect.Effect<BrowserRenderingBrowserClient<Browser, Page>, BrowserRenderingOperationError>;
|
|
392
404
|
readonly connectWith: <Browser extends BrowserRenderingBrowserLike<Page>, Page extends BrowserRenderingPageLike = BrowserRenderingPageLike, ConnectOptions = unknown>(connect: BrowserRenderingConnect<RawBinding, Browser, ConnectOptions>, options?: ConnectOptions) => Effect.Effect<BrowserRenderingBrowserClient<Browser, Page>, BrowserRenderingOperationError>;
|
|
393
|
-
readonly
|
|
405
|
+
readonly rawUnsafe: Effect.Effect<RawBinding>;
|
|
394
406
|
readonly definition: BrowserRenderingDefinition;
|
|
395
407
|
}
|
|
396
408
|
declare const BrowserRenderingServiceTypeId: unique symbol;
|
|
@@ -400,18 +412,18 @@ interface BrowserRenderingService<Id extends string> {
|
|
|
400
412
|
readonly id: Id;
|
|
401
413
|
};
|
|
402
414
|
}
|
|
403
|
-
type LayerOptions$
|
|
415
|
+
type LayerOptions$14 = {
|
|
404
416
|
readonly binding: string;
|
|
405
417
|
};
|
|
406
|
-
interface TagClass$
|
|
418
|
+
interface TagClass$12<Self, Id extends string> extends Context.ServiceClass<Self, Id, BrowserRenderingClient> {
|
|
407
419
|
readonly id: Id;
|
|
408
|
-
readonly layer: (options: LayerOptions$
|
|
420
|
+
readonly layer: (options: LayerOptions$14) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
409
421
|
}
|
|
410
422
|
declare const isBrowserRenderingBinding: (value: unknown) => value is BrowserRenderingBinding;
|
|
411
423
|
declare const makeClient$11: <RawBinding extends BrowserRenderingBinding = BrowserRenderingBinding>(definition: BrowserRenderingDefinition) => (binding: RawBinding) => BrowserRenderingClient<RawBinding>;
|
|
412
424
|
declare const layer$14: <Self>(tag: Context.Service<Self, BrowserRenderingClient>, definition: BrowserRenderingDefinition) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
413
|
-
declare const make$14: <Id extends string>(id: Id) => TagClass$
|
|
414
|
-
declare const Tag$
|
|
425
|
+
declare const make$14: <Id extends string>(id: Id) => TagClass$12<BrowserRenderingService<Id>, Id>;
|
|
426
|
+
declare const Tag$13: <Self>() => <Id extends string>(id: Id) => TagClass$12<Self, Id>;
|
|
415
427
|
declare namespace Cache_d_exports {
|
|
416
428
|
export { CacheClient, CacheOperation, CacheOperationError, CacheQueryOptions, CacheRequest, CacheStorage, CacheStorageClient, layer$13 as layer, layerFrom, makeCacheClient, makeClient$10 as makeClient };
|
|
417
429
|
}
|
|
@@ -429,7 +441,9 @@ declare class CacheOperationError extends CacheOperationError_base<{
|
|
|
429
441
|
readonly cache: string;
|
|
430
442
|
readonly operation: CacheOperation;
|
|
431
443
|
readonly cause: unknown;
|
|
432
|
-
}> {
|
|
444
|
+
}> {
|
|
445
|
+
get message(): string;
|
|
446
|
+
}
|
|
433
447
|
/** Effect wrapper around one Cloudflare `Cache` instance. */
|
|
434
448
|
interface CacheClient {
|
|
435
449
|
/** Cache name (`default` for `caches.default`). */
|
|
@@ -441,7 +455,7 @@ interface CacheClient {
|
|
|
441
455
|
/** Deletes a cached response and reports whether it existed. */
|
|
442
456
|
readonly delete: (request: CacheRequest, options?: CacheQueryOptions) => Effect.Effect<boolean, CacheOperationError>;
|
|
443
457
|
/** Access to the native Cloudflare `Cache` instance. */
|
|
444
|
-
readonly
|
|
458
|
+
readonly rawUnsafe: Effect.Effect<CloudflareCache>;
|
|
445
459
|
}
|
|
446
460
|
/** Effect wrapper around Cloudflare's global `caches` object. */
|
|
447
461
|
interface CacheStorageClient {
|
|
@@ -450,7 +464,7 @@ interface CacheStorageClient {
|
|
|
450
464
|
/** Opens a named cache. */
|
|
451
465
|
readonly open: (name: string) => Effect.Effect<CacheClient, CacheOperationError>;
|
|
452
466
|
/** Access to the native Cloudflare `CacheStorage` instance. */
|
|
453
|
-
readonly
|
|
467
|
+
readonly rawUnsafe: Effect.Effect<CloudflareCacheStorage>;
|
|
454
468
|
}
|
|
455
469
|
declare const CacheStorage_base: Context.ServiceClass<CacheStorage, "effect-cf/CacheStorage", CacheStorageClient>;
|
|
456
470
|
/** Service for Cloudflare's global Cache API. */
|
|
@@ -475,7 +489,9 @@ declare const StorageOperationError_base: new <A extends Record<string, any> = {
|
|
|
475
489
|
declare class StorageOperationError extends StorageOperationError_base<{
|
|
476
490
|
readonly operation: string;
|
|
477
491
|
readonly cause: unknown;
|
|
478
|
-
}> {
|
|
492
|
+
}> {
|
|
493
|
+
get message(): string;
|
|
494
|
+
}
|
|
479
495
|
type StorageEffect<A> = Effect.Effect<A, StorageOperationError>;
|
|
480
496
|
/**
|
|
481
497
|
* Effect wrapper for Cloudflare SQL cursor operations.
|
|
@@ -606,14 +622,18 @@ declare const DurableWebSocketSendError_base: new <A extends Record<string, any>
|
|
|
606
622
|
/** Error raised when sending on a Durable Object websocket fails. */
|
|
607
623
|
declare class DurableWebSocketSendError extends DurableWebSocketSendError_base<{
|
|
608
624
|
readonly cause: unknown;
|
|
609
|
-
}> {
|
|
625
|
+
}> {
|
|
626
|
+
get message(): string;
|
|
627
|
+
}
|
|
610
628
|
declare const DurableWebSocketCloseError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
611
629
|
readonly _tag: "DurableWebSocketCloseError";
|
|
612
630
|
} & Readonly<A>;
|
|
613
631
|
/** Error raised when closing a Durable Object websocket fails. */
|
|
614
632
|
declare class DurableWebSocketCloseError extends DurableWebSocketCloseError_base<{
|
|
615
633
|
readonly cause: unknown;
|
|
616
|
-
}> {
|
|
634
|
+
}> {
|
|
635
|
+
get message(): string;
|
|
636
|
+
}
|
|
617
637
|
declare const DurableWebSocketAttachmentError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
618
638
|
readonly _tag: "DurableWebSocketAttachmentError";
|
|
619
639
|
} & Readonly<A>;
|
|
@@ -621,7 +641,9 @@ declare const DurableWebSocketAttachmentError_base: new <A extends Record<string
|
|
|
621
641
|
declare class DurableWebSocketAttachmentError extends DurableWebSocketAttachmentError_base<{
|
|
622
642
|
readonly operation: "serialize" | "deserialize";
|
|
623
643
|
readonly cause: unknown;
|
|
624
|
-
}> {
|
|
644
|
+
}> {
|
|
645
|
+
get message(): string;
|
|
646
|
+
}
|
|
625
647
|
/** Effect-native wrapper around a hibernatable Durable Object websocket. */
|
|
626
648
|
interface DurableWebSocket<Attachment = unknown> {
|
|
627
649
|
/** Underlying Cloudflare websocket. */
|
|
@@ -666,7 +688,7 @@ interface AcceptedUpgrade<Attachment = unknown> {
|
|
|
666
688
|
* return response.response;
|
|
667
689
|
* ```
|
|
668
690
|
*/
|
|
669
|
-
declare const acceptUpgrade: <Attachment = unknown>(options?: AcceptUpgradeOptions<Attachment>) => Effect.Effect<AcceptedUpgrade<Attachment>,
|
|
691
|
+
declare const acceptUpgrade: <Attachment = unknown>(options?: AcceptUpgradeOptions<Attachment> | undefined) => Effect.Effect<AcceptedUpgrade<Attachment>, DurableWebSocketAttachmentError, DurableObjectState>;
|
|
670
692
|
type AttachmentInvalidPolicy = "ignore" | "ignore-and-close" | "fail";
|
|
671
693
|
interface AttachmentRehydrateOptions {
|
|
672
694
|
/** Optional Durable Object websocket tag filter. */
|
|
@@ -697,464 +719,142 @@ declare const handlers: <R = never, E = unknown>(options: DurableWebSocketHandle
|
|
|
697
719
|
webSocketClose: ((socket: DurableWebSocket, code: number, reason: string, wasClean: boolean) => Effect.Effect<void, E, R>) | undefined;
|
|
698
720
|
webSocketError: ((socket: DurableWebSocket, error: unknown) => Effect.Effect<void, E, R>) | undefined;
|
|
699
721
|
};
|
|
700
|
-
declare namespace
|
|
701
|
-
export {
|
|
722
|
+
declare namespace Rpc_d_exports {
|
|
723
|
+
export { DisposableValue, MethodArgs, MethodKey, MethodReturn, Provider, Result$1 as Result, RpcStub, RpcTarget, Serializable, Stub, Stubable, Stubify, dispose, isDisposable, resolve, scoped };
|
|
702
724
|
}
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
/**
|
|
727
|
-
* Runs an Effect inside Cloudflare's `blockConcurrencyWhile` gate and lets
|
|
728
|
-
* Effect failures reject the callback.
|
|
729
|
-
*
|
|
730
|
-
* Use this only when Cloudflare's reset-on-throw behavior is intentional. The
|
|
731
|
-
* platform also resets the Durable Object if the callback exceeds the
|
|
732
|
-
* documented timeout (currently 30 seconds).
|
|
733
|
-
*/
|
|
734
|
-
blockConcurrencyWhileOrReset<A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, E, R>;
|
|
735
|
-
/** Accepts a websocket connection for hibernation-capable Durable Objects. */
|
|
736
|
-
acceptWebSocket(ws: DurableWebSocket, tags?: Array<string>): Effect.Effect<void>;
|
|
737
|
-
/** Lists active sockets, optionally filtered by tag. */
|
|
738
|
-
getWebSockets(tag?: string): Effect.Effect<Array<DurableWebSocket>>;
|
|
739
|
-
/** Configures automatic request/response handling for sockets. */
|
|
740
|
-
setWebSocketAutoResponse(pair?: WebSocketRequestResponsePair): Effect.Effect<void>;
|
|
741
|
-
/** Gets the configured websocket auto-response pair. */
|
|
742
|
-
getWebSocketAutoResponse: Effect.Effect<WebSocketRequestResponsePair | null>;
|
|
743
|
-
/** Timestamp of the last automatic websocket response for a socket. */
|
|
744
|
-
getWebSocketAutoResponseTimestamp(ws: DurableWebSocket): Effect.Effect<Date | null>;
|
|
745
|
-
/** Sets the timeout for hibernatable websocket events. */
|
|
746
|
-
setHibernatableWebSocketEventTimeout(timeoutMs?: number): Effect.Effect<void>;
|
|
747
|
-
/** Gets the timeout for hibernatable websocket events. */
|
|
748
|
-
getHibernatableWebSocketEventTimeout: Effect.Effect<number | null>;
|
|
749
|
-
/** Reads tags attached to a websocket. */
|
|
750
|
-
getTags(ws: DurableWebSocket): Effect.Effect<Array<string>>;
|
|
751
|
-
/**
|
|
752
|
-
* Forcibly resets the Durable Object. Cloudflare logs an uncaught Error using
|
|
753
|
-
* the optional reason, and the method is not available in `wrangler dev` local
|
|
754
|
-
* development according to the Durable Object State docs.
|
|
755
|
-
*/
|
|
756
|
-
abort(reason?: string): Effect.Effect<void>;
|
|
725
|
+
type Stubable = Rpc.Stubable;
|
|
726
|
+
type Stub<T extends Stubable> = Rpc.Stub<T>;
|
|
727
|
+
type Provider<T extends object, Reserved extends string = never> = Rpc.Provider<T, Reserved>;
|
|
728
|
+
type BaseType = void | undefined | null | boolean | number | bigint | string | TypedArray | ArrayBuffer | DataView | Date | Error | RegExp | ReadableStream<Uint8Array> | WritableStream<Uint8Array> | Request | Response | Headers;
|
|
729
|
+
type Serializable<T> = BaseType | Map<T extends Map<infer Key, unknown> ? Serializable<Key> : never, T extends Map<unknown, infer Value> ? Serializable<Value> : never> | Set<T extends Set<infer Value> ? Serializable<Value> : never> | ReadonlyArray<T extends ReadonlyArray<infer Value> ? Serializable<Value> : never> | { [Key in keyof T]: Key extends number | string ? Serializable<T[Key]> : never; } | Stub<Stubable> | Stubable;
|
|
730
|
+
type Stubify<T> = T extends Stubable ? Stub<T> : T extends Map<infer Key, infer Value> ? Map<Stubify<Key>, Stubify<Value>> : T extends Set<infer Value> ? Set<Stubify<Value>> : T extends Array<infer Value> ? Array<Stubify<Value>> : T extends ReadonlyArray<infer Value> ? ReadonlyArray<Stubify<Value>> : T extends BaseType ? T : T extends {
|
|
731
|
+
[key: string | number]: unknown;
|
|
732
|
+
} ? { [Key in keyof T]: Stubify<T[Key]>; } : T;
|
|
733
|
+
type MaybeProvider<T> = T extends object ? Provider<T> : unknown;
|
|
734
|
+
type MaybeDisposable<T> = T extends object ? Disposable : unknown;
|
|
735
|
+
type Result$1<T> = T extends Stubable ? Promise<Stub<T>> & Provider<T> : T extends Serializable<T> ? Promise<Stubify<T> & MaybeDisposable<T>> & MaybeProvider<T> : never;
|
|
736
|
+
type MethodKey<Api> = { [Key in keyof Api]-?: Key extends string ? Api[Key] extends ((...args: Array<any>) => unknown) ? Key : never : never; }[keyof Api];
|
|
737
|
+
type MethodArgs<Api, Method extends keyof Api> = Api[Method] extends ((...args: infer Args) => unknown) ? Args : never;
|
|
738
|
+
type MethodReturn<Api, Method extends keyof Api> = Api[Method] extends ((...args: Array<any>) => infer Return) ? Return : never;
|
|
739
|
+
type DisposableValue = {
|
|
740
|
+
[Symbol.dispose](): void;
|
|
741
|
+
};
|
|
742
|
+
declare const isDisposable: (value: unknown) => value is DisposableValue;
|
|
743
|
+
declare const dispose: (value: unknown) => Effect.Effect<void>;
|
|
744
|
+
declare const resolve: <A>(value: A) => Effect.Effect<Awaited<A>, unknown>;
|
|
745
|
+
declare const scoped: <A>(value: A) => Effect.Effect<Awaited<A>, unknown, Scope.Scope>;
|
|
746
|
+
declare namespace RpcDefinition_d_exports {
|
|
747
|
+
export { Definition$7 as Definition, Method$3 as Method, Methods$2 as Methods, NoReservedMethods$2 as NoReservedMethods, ReservedMethodName$5 as ReservedMethodName, RpcArgumentCountError, RpcArgumentDecodeError, RpcArgumentEncodeError, RpcReservedMethodNameError, RpcSuccessDecodeError, RpcSuccessEncodeError, ServiceFreeSchema$2 as ServiceFreeSchema, WireError, assertNoReservedMethods, decodeArgs, decodeSuccess, decodeWireError, encodeArgs, encodeSuccess, encodeWireError, isWireError, make$13 as make, method$2 as method, reservedMethodNames };
|
|
757
748
|
}
|
|
758
|
-
declare const
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
declare
|
|
768
|
-
|
|
749
|
+
declare const RpcReservedMethodNameError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
750
|
+
readonly _tag: "RpcReservedMethodNameError";
|
|
751
|
+
} & Readonly<A>;
|
|
752
|
+
declare class RpcReservedMethodNameError extends RpcReservedMethodNameError_base<{
|
|
753
|
+
readonly definition: string;
|
|
754
|
+
readonly method: string;
|
|
755
|
+
}> {
|
|
756
|
+
get message(): string;
|
|
757
|
+
}
|
|
758
|
+
declare const RpcArgumentCountError_base: Schema.Class<RpcArgumentCountError, Schema.TaggedStruct<"RpcArgumentCountError", {
|
|
759
|
+
readonly definition: Schema.String;
|
|
760
|
+
readonly method: Schema.String;
|
|
761
|
+
readonly expected: Schema.Number;
|
|
762
|
+
readonly actual: Schema.Number;
|
|
763
|
+
}>, import("effect/Cause").YieldableError>;
|
|
764
|
+
declare class RpcArgumentCountError extends RpcArgumentCountError_base {
|
|
765
|
+
get message(): string;
|
|
766
|
+
}
|
|
767
|
+
declare const RpcArgumentDecodeError_base: Schema.Class<RpcArgumentDecodeError, Schema.TaggedStruct<"RpcArgumentDecodeError", {
|
|
768
|
+
readonly definition: Schema.String;
|
|
769
|
+
readonly method: Schema.String;
|
|
770
|
+
readonly cause: Schema.Defect;
|
|
771
|
+
}>, import("effect/Cause").YieldableError>;
|
|
772
|
+
declare class RpcArgumentDecodeError extends RpcArgumentDecodeError_base {
|
|
773
|
+
get message(): string;
|
|
769
774
|
}
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
* explicit attributes win over `OTEL_SERVICE_NAME`, `OTEL_SERVICE_VERSION`, and
|
|
780
|
-
* `OTEL_RESOURCE_ATTRIBUTES`. Omit an option to let operators set it from the
|
|
781
|
-
* environment.
|
|
782
|
-
*/
|
|
783
|
-
interface ResourceOptions {
|
|
784
|
-
/** Explicit service name. Takes precedence over OTEL environment variables. */
|
|
785
|
-
readonly serviceName?: string;
|
|
786
|
-
/** Explicit service version. Takes precedence over OTEL environment variables. */
|
|
787
|
-
readonly serviceVersion?: string;
|
|
788
|
-
/** Additional resource attributes attached to exported telemetry. */
|
|
789
|
-
readonly attributes?: Record<string, unknown>;
|
|
775
|
+
declare const RpcArgumentEncodeError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
776
|
+
readonly _tag: "RpcArgumentEncodeError";
|
|
777
|
+
} & Readonly<A>;
|
|
778
|
+
declare class RpcArgumentEncodeError extends RpcArgumentEncodeError_base<{
|
|
779
|
+
readonly definition: string;
|
|
780
|
+
readonly method: string;
|
|
781
|
+
readonly cause: unknown;
|
|
782
|
+
}> {
|
|
783
|
+
get message(): string;
|
|
790
784
|
}
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
readonly
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
785
|
+
declare const RpcSuccessDecodeError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
786
|
+
readonly _tag: "RpcSuccessDecodeError";
|
|
787
|
+
} & Readonly<A>;
|
|
788
|
+
declare class RpcSuccessDecodeError extends RpcSuccessDecodeError_base<{
|
|
789
|
+
readonly definition: string;
|
|
790
|
+
readonly method: string;
|
|
791
|
+
readonly cause: unknown;
|
|
792
|
+
}> {
|
|
793
|
+
get message(): string;
|
|
794
|
+
}
|
|
795
|
+
declare const RpcSuccessEncodeError_base: Schema.Class<RpcSuccessEncodeError, Schema.TaggedStruct<"RpcSuccessEncodeError", {
|
|
796
|
+
readonly definition: Schema.String;
|
|
797
|
+
readonly method: Schema.String;
|
|
798
|
+
readonly cause: Schema.Defect;
|
|
799
|
+
}>, import("effect/Cause").YieldableError>;
|
|
800
|
+
declare class RpcSuccessEncodeError extends RpcSuccessEncodeError_base {
|
|
801
|
+
get message(): string;
|
|
802
|
+
}
|
|
803
|
+
/** Errors raised server-side that must survive the Cloudflare RPC wire. */
|
|
804
|
+
type WireError = RpcArgumentCountError | RpcArgumentDecodeError | RpcSuccessEncodeError;
|
|
805
|
+
declare const isWireError: (error: unknown) => error is WireError;
|
|
806
|
+
/**
|
|
807
|
+
* Encodes package RPC errors into a plain `Error` envelope so their tags
|
|
808
|
+
* survive Cloudflare RPC serialization, which drops custom error properties.
|
|
809
|
+
*/
|
|
810
|
+
declare const encodeWireError: (error: unknown) => unknown;
|
|
811
|
+
/** Restores package RPC errors from the {@link encodeWireError} envelope. */
|
|
812
|
+
declare const decodeWireError: (cause: unknown) => unknown;
|
|
813
|
+
declare const reservedMethodNames: Set<string>;
|
|
814
|
+
type ReservedMethodName$5 = "constructor" | "fetch" | "connect" | "alarm" | "webSocketMessage" | "webSocketClose" | "webSocketError" | "then" | "dup" | "dispose" | "serialize" | "deserialize";
|
|
815
|
+
type ServiceFreeSchema$2 = Schema.Codec<any, any, never, never>;
|
|
816
|
+
interface Method$3<Args extends ReadonlyArray<ServiceFreeSchema$2> = ReadonlyArray<ServiceFreeSchema$2>, Success extends ServiceFreeSchema$2 = ServiceFreeSchema$2> {
|
|
817
|
+
readonly args: Args;
|
|
818
|
+
readonly success: Success;
|
|
817
819
|
}
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
820
|
+
declare namespace Method$3 {
|
|
821
|
+
export type Any = Method$3<ReadonlyArray<ServiceFreeSchema$2>, ServiceFreeSchema$2>;
|
|
822
|
+
type ArgsFromSchemas<Args extends ReadonlyArray<ServiceFreeSchema$2>> = Args extends readonly [] ? [] : Args extends readonly [infer Head extends ServiceFreeSchema$2, ...infer Tail extends ReadonlyArray<ServiceFreeSchema$2>] ? [Schema.Schema.Type<Head>, ...ArgsFromSchemas<Tail>] : Array<Schema.Schema.Type<Args[number]>>;
|
|
823
|
+
/** Method schemas cross the wire through their canonical JSON codec. */
|
|
824
|
+
type EncodedArgsFromSchemas<Args extends ReadonlyArray<ServiceFreeSchema$2>> = { [Index in keyof Args]: Schema.Json; };
|
|
825
|
+
export type Args<Self extends Any> = ArgsFromSchemas<Self["args"]>;
|
|
826
|
+
export type EncodedArgs<Self extends Any> = EncodedArgsFromSchemas<Self["args"]>;
|
|
827
|
+
export type Success<Self extends Any> = Schema.Schema.Type<Self["success"]>;
|
|
828
|
+
export type EncodedSuccess<Self extends Any> = Schema.Json;
|
|
829
|
+
export {};
|
|
822
830
|
}
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
readonly
|
|
827
|
-
|
|
828
|
-
* Include the Durable Object id as `cloudflare.durable_object.id`.
|
|
829
|
-
*
|
|
830
|
-
* This is disabled by default because object ids can be high-cardinality.
|
|
831
|
-
*/
|
|
832
|
-
readonly includeObjectId?: boolean;
|
|
831
|
+
type Methods$2 = Record<string, Method$3.Any>;
|
|
832
|
+
type NoReservedMethods$2<MethodsShape extends Methods$2, Reserved extends string = ReservedMethodName$5> = Extract<keyof MethodsShape, Reserved> extends never ? MethodsShape : never;
|
|
833
|
+
interface Definition$7<Id extends string = string, MethodsShape extends Methods$2 = Methods$2> {
|
|
834
|
+
readonly id: Id;
|
|
835
|
+
readonly methods: MethodsShape;
|
|
833
836
|
}
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
* installed as the primary `ConfigProvider`; outside Cloudflare, the ambient
|
|
840
|
-
* Effect `ConfigProvider` remains the fallback.
|
|
841
|
-
*/
|
|
842
|
-
declare const layer$12: (options?: LayerOptions$15) => Layer.Layer<never, never, never>;
|
|
843
|
-
/** Base OTLP telemetry layer forced to JSON serialization. */
|
|
844
|
-
declare const layerJson: (options?: Omit<LayerOptions$15, "serialization">) => Layer.Layer<never, never, never>;
|
|
845
|
-
/** Base OTLP telemetry layer forced to protobuf serialization. */
|
|
846
|
-
declare const layerProtobuf: (options?: Omit<LayerOptions$15, "serialization">) => Layer.Layer<never, never, never>;
|
|
847
|
-
/**
|
|
848
|
-
* OTLP layer with Cloudflare Worker resource attributes.
|
|
849
|
-
*
|
|
850
|
-
* Provide this layer at runtime scope for long-lived metrics aggregation, or at
|
|
851
|
-
* handler scope when traces/logs should flush as the Cloudflare event finishes.
|
|
852
|
-
*/
|
|
853
|
-
declare const workerLayer: (options?: WorkerLayerOptions) => Layer.Layer<never, never, never>;
|
|
854
|
-
/**
|
|
855
|
-
* OTLP layer with Cloudflare Durable Object resource attributes.
|
|
856
|
-
*
|
|
857
|
-
* The layer reads {@link DurableObjectState} so it can optionally include the
|
|
858
|
-
* Durable Object id. Prefer leaving `includeObjectId` disabled unless the
|
|
859
|
-
* backend can tolerate high-cardinality resource attributes.
|
|
860
|
-
*/
|
|
861
|
-
declare const durableObjectLayer: (options?: DurableObjectLayerOptions) => Layer.Layer<never, never, DurableObjectState>;
|
|
862
|
-
declare namespace ContainerNamespace_d_exports {
|
|
863
|
-
export { ContainerInstanceClient, ContainerNamespace, ContainerNamespaceClient, ContainerNamespaceDefinition, ContainerNamespaceResource, ContainerNamespaceService, ContainerNamespaceStaticClient, ContainerOperationError, ContainerReadinessOptions, ContainerSignal, ContainerStartAndWaitForPortsOptions, ContainerStartOptions, ContainerState, ContainerStub, ContainerWaitOptions, LayerOptions$14 as LayerOptions, Tag$14 as Tag, TagClass$13 as TagClass, isContainerNamespaceResource, layer$11 as layer, make$13 as make, makeClient$9 as makeClient };
|
|
837
|
+
declare namespace Definition$7 {
|
|
838
|
+
type Any = Definition$7<string, Methods$2>;
|
|
839
|
+
type ServerApi<Self extends Any> = { readonly [Key in keyof Self["methods"]]: (...args: Method$3.Args<Self["methods"][Key]>) => Promise<Method$3.Success<Self["methods"][Key]>>; };
|
|
840
|
+
type Api<Self extends Any, Reserved extends string = never> = Provider<ServerApi<Self>, Reserved>;
|
|
841
|
+
type MethodNames<Self extends Any> = Extract<keyof Self["methods"], string>;
|
|
864
842
|
}
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
readonly
|
|
871
|
-
readonly
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
}
|
|
880
|
-
/** Serializable timeout settings used while waiting for Container ports. */
|
|
881
|
-
interface ContainerReadinessOptions {
|
|
882
|
-
readonly instanceGetTimeoutMS?: number;
|
|
883
|
-
readonly portReadyTimeoutMS?: number;
|
|
884
|
-
readonly waitInterval?: number;
|
|
885
|
-
}
|
|
886
|
-
/** Options for starting a Container and waiting for its ports. */
|
|
887
|
-
interface ContainerStartAndWaitForPortsOptions {
|
|
888
|
-
readonly startOptions?: ContainerStartOptions;
|
|
889
|
-
readonly ports?: number | Array<number>;
|
|
890
|
-
readonly cancellationOptions?: ContainerReadinessOptions;
|
|
891
|
-
}
|
|
892
|
-
/** Serializable state reported by a Cloudflare Container instance. */
|
|
893
|
-
declare const ContainerState: Schema.Union<readonly [Schema.Struct<{
|
|
894
|
-
readonly lastChange: Schema.Finite;
|
|
895
|
-
readonly status: Schema.Literals<readonly ["running", "stopping", "stopped", "healthy"]>;
|
|
896
|
-
}>, Schema.Struct<{
|
|
897
|
-
readonly lastChange: Schema.Finite;
|
|
898
|
-
readonly status: Schema.Literal<"stopped_with_code">;
|
|
899
|
-
readonly exitCode: Schema.optionalKey<Schema.Int>;
|
|
900
|
-
}>]>;
|
|
901
|
-
type ContainerState = typeof ContainerState.Type;
|
|
902
|
-
/**
|
|
903
|
-
* Native Container stub shape exposed by a Container namespace binding.
|
|
904
|
-
*
|
|
905
|
-
* This is structural so using Container bindings does not make
|
|
906
|
-
* `@cloudflare/containers` a runtime dependency of effect-cf.
|
|
907
|
-
*/
|
|
908
|
-
interface ContainerStub {
|
|
909
|
-
fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
|
|
910
|
-
getState(): Promise<ContainerState>;
|
|
911
|
-
start(options?: ContainerStartOptions, waitOptions?: ContainerWaitOptions): Promise<void>;
|
|
912
|
-
startAndWaitForPorts(options?: ContainerStartAndWaitForPortsOptions): Promise<void>;
|
|
913
|
-
stop(signal?: ContainerSignal): Promise<void>;
|
|
914
|
-
destroy(): Promise<void>;
|
|
915
|
-
}
|
|
916
|
-
/** Native Container namespace binding shape. */
|
|
917
|
-
interface ContainerNamespaceResource {
|
|
918
|
-
getByName(name: string, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions): ContainerStub;
|
|
919
|
-
}
|
|
920
|
-
/** Container namespace binding metadata. */
|
|
921
|
-
interface ContainerNamespaceDefinition {
|
|
922
|
-
/** Binding name as configured in `wrangler.jsonc`. */
|
|
923
|
-
readonly binding: string;
|
|
924
|
-
}
|
|
925
|
-
declare const ContainerOperationError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
926
|
-
readonly _tag: "ContainerOperationError";
|
|
927
|
-
} & Readonly<A>;
|
|
928
|
-
/** Failure raised when invoking a named Container operation. */
|
|
929
|
-
declare class ContainerOperationError extends ContainerOperationError_base<{
|
|
930
|
-
readonly binding: string;
|
|
931
|
-
readonly instance: string;
|
|
932
|
-
readonly operation: string;
|
|
933
|
-
readonly cause: unknown;
|
|
934
|
-
}> {}
|
|
935
|
-
/** Effect-wrapped client for one named Container instance. */
|
|
936
|
-
interface ContainerInstanceClient {
|
|
937
|
-
readonly unsafeRaw: Effect.Effect<ContainerStub, ContainerOperationError>;
|
|
938
|
-
readonly state: Effect.Effect<ContainerState, ContainerOperationError>;
|
|
939
|
-
readonly fetch: (input: RequestInfo | URL, init?: RequestInit) => Effect.Effect<Response, ContainerOperationError>;
|
|
940
|
-
readonly start: (options?: ContainerStartOptions, waitOptions?: ContainerWaitOptions) => Effect.Effect<void, ContainerOperationError>;
|
|
941
|
-
readonly startAndWaitForPorts: (options?: ContainerStartAndWaitForPortsOptions) => Effect.Effect<void, ContainerOperationError>;
|
|
942
|
-
readonly stop: (signal?: ContainerSignal) => Effect.Effect<void, ContainerOperationError>;
|
|
943
|
-
readonly destroy: Effect.Effect<void, ContainerOperationError>;
|
|
944
|
-
}
|
|
945
|
-
/** Effect client for a Container namespace binding. */
|
|
946
|
-
interface ContainerNamespaceClient {
|
|
947
|
-
readonly definition: ContainerNamespaceDefinition;
|
|
948
|
-
readonly getByName: (name: string, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions) => Effect.Effect<ContainerInstanceClient, ContainerOperationError>;
|
|
949
|
-
readonly byName: (name: string, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions) => ContainerInstanceClient;
|
|
950
|
-
readonly unsafeRaw: Effect.Effect<ContainerNamespaceResource>;
|
|
951
|
-
}
|
|
952
|
-
type ContainerNamespaceStaticClient<R> = {
|
|
953
|
-
readonly getByName: (name: string, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions) => Effect.Effect<ContainerInstanceClient, ContainerOperationError, R>;
|
|
954
|
-
readonly byName: (name: string, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions) => {
|
|
955
|
-
readonly state: Effect.Effect<ContainerState, ContainerOperationError, R>;
|
|
956
|
-
readonly fetch: (input: RequestInfo | URL, init?: RequestInit) => Effect.Effect<Response, ContainerOperationError, R>;
|
|
957
|
-
readonly start: (options?: ContainerStartOptions, waitOptions?: ContainerWaitOptions) => Effect.Effect<void, ContainerOperationError, R>;
|
|
958
|
-
readonly startAndWaitForPorts: (options?: ContainerStartAndWaitForPortsOptions) => Effect.Effect<void, ContainerOperationError, R>;
|
|
959
|
-
readonly stop: (signal?: ContainerSignal) => Effect.Effect<void, ContainerOperationError, R>;
|
|
960
|
-
readonly destroy: Effect.Effect<void, ContainerOperationError, R>;
|
|
961
|
-
readonly unsafeRaw: Effect.Effect<ContainerStub, ContainerOperationError, R>;
|
|
962
|
-
};
|
|
963
|
-
readonly unsafeRaw: () => Effect.Effect<ContainerNamespaceResource, never, R>;
|
|
964
|
-
};
|
|
965
|
-
type LayerOptions$14 = {
|
|
966
|
-
readonly binding: string;
|
|
967
|
-
};
|
|
968
|
-
interface TagClass$13<Self, Id extends string> extends Context.ServiceClass<Self, Id, ContainerNamespaceClient>, ContainerNamespaceStaticClient<Self> {
|
|
969
|
-
readonly id: Id;
|
|
970
|
-
readonly layer: (options: LayerOptions$14) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
971
|
-
}
|
|
972
|
-
declare const isContainerNamespaceResource: (value: unknown) => value is ContainerNamespaceResource;
|
|
973
|
-
declare const makeClient$9: (definition: ContainerNamespaceDefinition) => (namespace: ContainerNamespaceResource) => ContainerNamespaceClient;
|
|
974
|
-
declare const layer$11: <Self>(tag: Context.Service<Self, ContainerNamespaceClient>, definition: ContainerNamespaceDefinition) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
975
|
-
declare const make$13: <Id extends string>(id: Id) => TagClass$13<ContainerNamespaceService<Id>, Id>;
|
|
976
|
-
declare const ContainerNamespaceServiceTypeId: unique symbol;
|
|
977
|
-
/** Nominal service marker for Container namespaces created with {@link make}. */
|
|
978
|
-
interface ContainerNamespaceService<Id extends string> {
|
|
979
|
-
readonly [ContainerNamespaceServiceTypeId]: {
|
|
980
|
-
readonly id: Id;
|
|
981
|
-
};
|
|
982
|
-
}
|
|
983
|
-
/** Creates a typed Effect service for a Cloudflare Container namespace. */
|
|
984
|
-
declare const Tag$14: <Self>() => <Id extends string>(id: Id) => TagClass$13<Self, Id>;
|
|
985
|
-
declare const ContainerNamespace: typeof Tag$14;
|
|
986
|
-
declare namespace D1_d_exports {
|
|
987
|
-
export { D1Definition, D1Service, D1SqlLayerOptions, Service$1 as Service, make$12 as make };
|
|
988
|
-
}
|
|
989
|
-
/** Typed D1 binding definition. */
|
|
990
|
-
interface D1Definition {
|
|
991
|
-
/** Binding name as configured in `wrangler.jsonc`. */
|
|
992
|
-
readonly binding: string;
|
|
993
|
-
}
|
|
994
|
-
/** Options forwarded to `@effect/sql-d1` when building a SQL client layer. */
|
|
995
|
-
type D1SqlLayerOptions = Omit<D1Client.D1ClientConfig, "db">;
|
|
996
|
-
declare const D1ServiceTypeId: unique symbol;
|
|
997
|
-
/** Nominal service marker for D1 services created with {@link make}. */
|
|
998
|
-
interface D1Service<Id extends string> {
|
|
999
|
-
readonly [D1ServiceTypeId]: {
|
|
1000
|
-
readonly id: Id;
|
|
1001
|
-
};
|
|
1002
|
-
}
|
|
1003
|
-
/**
|
|
1004
|
-
* Creates a typed D1 service tag plus Effect helpers.
|
|
1005
|
-
*/
|
|
1006
|
-
declare const make$12: <Id extends string>(id: Id, definition: D1Definition) => BindingService<D1Service<Id>, Id, D1Database> & {
|
|
1007
|
-
"effect-cf/D1": "effect-cf/D1";
|
|
1008
|
-
definition: D1Definition;
|
|
1009
|
-
sqlLayer: (options?: D1SqlLayerOptions) => Layer.Layer<D1Client.D1Client | import("effect/unstable/sql/SqlClient").SqlClient, BindingNotFoundError | BindingValidationError | import("effect/Config").ConfigError, WorkerEnvironment>;
|
|
1010
|
-
};
|
|
1011
|
-
/**
|
|
1012
|
-
* Builds a D1 service around a Cloudflare D1 database binding.
|
|
1013
|
-
*
|
|
1014
|
-
* The returned service exposes the raw `D1Database` binding and `sqlLayer(...)`
|
|
1015
|
-
* for providing `effect/unstable/sql` via `@effect/sql-d1`.
|
|
1016
|
-
*
|
|
1017
|
-
* @example
|
|
1018
|
-
* ```ts
|
|
1019
|
-
* class TodoDatabase extends D1.Service<TodoDatabase>()("TodoDatabase", {
|
|
1020
|
-
* binding: "TODO_DB",
|
|
1021
|
-
* }) {}
|
|
1022
|
-
*
|
|
1023
|
-
* const SqlLive = TodoDatabase.sqlLayer();
|
|
1024
|
-
* ```
|
|
1025
|
-
*/
|
|
1026
|
-
declare const Service$1: <Self>() => <Id extends string>(id: Id, definition: D1Definition) => BindingService<Self, Id, D1Database> & {
|
|
1027
|
-
"effect-cf/D1": "effect-cf/D1";
|
|
1028
|
-
definition: D1Definition;
|
|
1029
|
-
sqlLayer: (options?: D1SqlLayerOptions) => Layer.Layer<D1Client.D1Client | import("effect/unstable/sql/SqlClient").SqlClient, BindingNotFoundError | BindingValidationError | import("effect/Config").ConfigError, WorkerEnvironment | Exclude<Exclude<Self, import("effect/Scope").Scope>, Self>>;
|
|
1030
|
-
};
|
|
1031
|
-
declare namespace Rpc_d_exports {
|
|
1032
|
-
export { DisposableValue, MethodArgs, MethodKey, MethodReturn, Provider, Result$1 as Result, RpcStub, RpcTarget, Serializable, Stub, Stubable, Stubify, dispose, isDisposable, resolve, scoped };
|
|
1033
|
-
}
|
|
1034
|
-
type Stubable = Rpc.Stubable;
|
|
1035
|
-
type Stub<T extends Stubable> = Rpc.Stub<T>;
|
|
1036
|
-
type Provider<T extends object, Reserved extends string = never> = Rpc.Provider<T, Reserved>;
|
|
1037
|
-
type BaseType = void | undefined | null | boolean | number | bigint | string | TypedArray | ArrayBuffer | DataView | Date | Error | RegExp | ReadableStream<Uint8Array> | WritableStream<Uint8Array> | Request | Response | Headers;
|
|
1038
|
-
type Serializable<T> = BaseType | Map<T extends Map<infer Key, unknown> ? Serializable<Key> : never, T extends Map<unknown, infer Value> ? Serializable<Value> : never> | Set<T extends Set<infer Value> ? Serializable<Value> : never> | ReadonlyArray<T extends ReadonlyArray<infer Value> ? Serializable<Value> : never> | { [Key in keyof T]: Key extends number | string ? Serializable<T[Key]> : never; } | Stub<Stubable> | Stubable;
|
|
1039
|
-
type Stubify<T> = T extends Stubable ? Stub<T> : T extends Map<infer Key, infer Value> ? Map<Stubify<Key>, Stubify<Value>> : T extends Set<infer Value> ? Set<Stubify<Value>> : T extends Array<infer Value> ? Array<Stubify<Value>> : T extends ReadonlyArray<infer Value> ? ReadonlyArray<Stubify<Value>> : T extends BaseType ? T : T extends {
|
|
1040
|
-
[key: string | number]: unknown;
|
|
1041
|
-
} ? { [Key in keyof T]: Stubify<T[Key]>; } : T;
|
|
1042
|
-
type MaybeProvider<T> = T extends object ? Provider<T> : unknown;
|
|
1043
|
-
type MaybeDisposable<T> = T extends object ? Disposable : unknown;
|
|
1044
|
-
type Result$1<T> = T extends Stubable ? Promise<Stub<T>> & Provider<T> : T extends Serializable<T> ? Promise<Stubify<T> & MaybeDisposable<T>> & MaybeProvider<T> : never;
|
|
1045
|
-
type MethodKey<Api> = { [Key in keyof Api]-?: Key extends string ? Api[Key] extends ((...args: Array<any>) => unknown) ? Key : never : never; }[keyof Api];
|
|
1046
|
-
type MethodArgs<Api, Method extends keyof Api> = Api[Method] extends ((...args: infer Args) => unknown) ? Args : never;
|
|
1047
|
-
type MethodReturn<Api, Method extends keyof Api> = Api[Method] extends ((...args: Array<any>) => infer Return) ? Return : never;
|
|
1048
|
-
type DisposableValue = {
|
|
1049
|
-
[Symbol.dispose](): void;
|
|
1050
|
-
};
|
|
1051
|
-
declare const isDisposable: (value: unknown) => value is DisposableValue;
|
|
1052
|
-
declare const dispose: (value: unknown) => Effect.Effect<void>;
|
|
1053
|
-
declare const resolve: <A>(value: A) => Effect.Effect<Awaited<A>, unknown>;
|
|
1054
|
-
declare const scoped: <A>(value: A) => Effect.Effect<Awaited<A>, unknown, Scope.Scope>;
|
|
1055
|
-
declare namespace RpcDefinition_d_exports {
|
|
1056
|
-
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$11 as make, method$4 as method, reservedMethodNames };
|
|
1057
|
-
}
|
|
1058
|
-
declare const RpcReservedMethodNameError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
1059
|
-
readonly _tag: "RpcReservedMethodNameError";
|
|
1060
|
-
} & Readonly<A>;
|
|
1061
|
-
declare class RpcReservedMethodNameError extends RpcReservedMethodNameError_base<{
|
|
1062
|
-
readonly definition: string;
|
|
1063
|
-
readonly method: string;
|
|
1064
|
-
}> {}
|
|
1065
|
-
declare const RpcArgumentCountError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
1066
|
-
readonly _tag: "RpcArgumentCountError";
|
|
1067
|
-
} & Readonly<A>;
|
|
1068
|
-
declare class RpcArgumentCountError extends RpcArgumentCountError_base<{
|
|
1069
|
-
readonly definition: string;
|
|
1070
|
-
readonly method: string;
|
|
1071
|
-
readonly expected: number;
|
|
1072
|
-
readonly actual: number;
|
|
1073
|
-
}> {}
|
|
1074
|
-
declare const RpcArgumentDecodeError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
1075
|
-
readonly _tag: "RpcArgumentDecodeError";
|
|
1076
|
-
} & Readonly<A>;
|
|
1077
|
-
declare class RpcArgumentDecodeError extends RpcArgumentDecodeError_base<{
|
|
1078
|
-
readonly definition: string;
|
|
1079
|
-
readonly method: string;
|
|
1080
|
-
readonly index: number;
|
|
1081
|
-
readonly cause: unknown;
|
|
1082
|
-
}> {}
|
|
1083
|
-
declare const RpcArgumentEncodeError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
1084
|
-
readonly _tag: "RpcArgumentEncodeError";
|
|
1085
|
-
} & Readonly<A>;
|
|
1086
|
-
declare class RpcArgumentEncodeError extends RpcArgumentEncodeError_base<{
|
|
1087
|
-
readonly definition: string;
|
|
1088
|
-
readonly method: string;
|
|
1089
|
-
readonly index: number;
|
|
1090
|
-
readonly cause: unknown;
|
|
1091
|
-
}> {}
|
|
1092
|
-
declare const RpcSuccessDecodeError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
1093
|
-
readonly _tag: "RpcSuccessDecodeError";
|
|
1094
|
-
} & Readonly<A>;
|
|
1095
|
-
declare class RpcSuccessDecodeError extends RpcSuccessDecodeError_base<{
|
|
1096
|
-
readonly definition: string;
|
|
1097
|
-
readonly method: string;
|
|
1098
|
-
readonly cause: unknown;
|
|
1099
|
-
}> {}
|
|
1100
|
-
declare const RpcSuccessEncodeError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
1101
|
-
readonly _tag: "RpcSuccessEncodeError";
|
|
1102
|
-
} & Readonly<A>;
|
|
1103
|
-
declare class RpcSuccessEncodeError extends RpcSuccessEncodeError_base<{
|
|
1104
|
-
readonly definition: string;
|
|
1105
|
-
readonly method: string;
|
|
1106
|
-
readonly cause: unknown;
|
|
1107
|
-
}> {}
|
|
1108
|
-
declare const reservedMethodNames: Set<string>;
|
|
1109
|
-
type ReservedMethodName$6 = "constructor" | "fetch" | "connect" | "alarm" | "webSocketMessage" | "webSocketClose" | "webSocketError" | "then" | "dup" | "dispose" | "serialize" | "deserialize";
|
|
1110
|
-
type ServiceFreeSchema$4 = Schema.Codec<any, any, never, never>;
|
|
1111
|
-
interface Method$5<Args extends ReadonlyArray<ServiceFreeSchema$4> = ReadonlyArray<ServiceFreeSchema$4>, Success extends ServiceFreeSchema$4 = ServiceFreeSchema$4> {
|
|
1112
|
-
readonly args: Args;
|
|
1113
|
-
readonly success: Success;
|
|
1114
|
-
}
|
|
1115
|
-
declare namespace Method$5 {
|
|
1116
|
-
export type Any = Method$5<ReadonlyArray<ServiceFreeSchema$4>, ServiceFreeSchema$4>;
|
|
1117
|
-
type ArgsFromSchemas<Args extends ReadonlyArray<ServiceFreeSchema$4>> = Args extends readonly [] ? [] : Args extends readonly [infer Head extends ServiceFreeSchema$4, ...infer Tail extends ReadonlyArray<ServiceFreeSchema$4>] ? [Schema.Schema.Type<Head>, ...ArgsFromSchemas<Tail>] : Array<Schema.Schema.Type<Args[number]>>;
|
|
1118
|
-
type EncodedArgsFromSchemas<Args extends ReadonlyArray<ServiceFreeSchema$4>> = Args extends readonly [] ? [] : Args extends readonly [infer Head extends ServiceFreeSchema$4, ...infer Tail extends ReadonlyArray<ServiceFreeSchema$4>] ? [Schema.Codec.Encoded<Head>, ...EncodedArgsFromSchemas<Tail>] : Array<Schema.Codec.Encoded<Args[number]>>;
|
|
1119
|
-
export type Args<Self extends Any> = ArgsFromSchemas<Self["args"]>;
|
|
1120
|
-
export type EncodedArgs<Self extends Any> = EncodedArgsFromSchemas<Self["args"]>;
|
|
1121
|
-
export type Success<Self extends Any> = Schema.Schema.Type<Self["success"]>;
|
|
1122
|
-
export type EncodedSuccess<Self extends Any> = Schema.Codec.Encoded<Self["success"]>;
|
|
1123
|
-
export {};
|
|
1124
|
-
}
|
|
1125
|
-
type Methods$4 = Record<string, Method$5.Any>;
|
|
1126
|
-
type NoReservedMethods$4<MethodsShape extends Methods$4, Reserved extends string = ReservedMethodName$6> = Extract<keyof MethodsShape, Reserved> extends never ? MethodsShape : never;
|
|
1127
|
-
interface Definition$9<Id extends string = string, MethodsShape extends Methods$4 = Methods$4> {
|
|
1128
|
-
readonly id: Id;
|
|
1129
|
-
readonly methods: MethodsShape;
|
|
1130
|
-
}
|
|
1131
|
-
declare namespace Definition$9 {
|
|
1132
|
-
type Any = Definition$9<string, Methods$4>;
|
|
1133
|
-
type ServerApi<Self extends Any> = { readonly [Key in keyof Self["methods"]]: (...args: Method$5.Args<Self["methods"][Key]>) => Promise<Method$5.Success<Self["methods"][Key]>>; };
|
|
1134
|
-
type Api<Self extends Any, Reserved extends string = never> = Provider<ServerApi<Self>, Reserved>;
|
|
1135
|
-
type MethodNames<Self extends Any> = Extract<keyof Self["methods"], string>;
|
|
1136
|
-
}
|
|
1137
|
-
declare class ReservedMethodNameError extends Error {
|
|
1138
|
-
readonly method: string;
|
|
1139
|
-
readonly target: string;
|
|
1140
|
-
constructor(target: string, method: string);
|
|
1141
|
-
}
|
|
1142
|
-
declare const assertNoReservedMethods: (target: string, methods: Record<string, unknown>, reserved: ReadonlySet<string>) => void;
|
|
1143
|
-
declare function method$4<Success extends ServiceFreeSchema$4>(definition: {
|
|
1144
|
-
readonly success: Success;
|
|
1145
|
-
}): Method$5<readonly [], Success>;
|
|
1146
|
-
declare function method$4<const Args extends ReadonlyArray<ServiceFreeSchema$4>, Success extends ServiceFreeSchema$4>(definition: {
|
|
1147
|
-
readonly args: Args;
|
|
1148
|
-
readonly success: Success;
|
|
1149
|
-
}): Method$5<Args, Success>;
|
|
1150
|
-
declare const assertNoReservedMethodNames: (definition: Definition$9.Any) => Effect.Effect<void, RpcReservedMethodNameError>;
|
|
1151
|
-
declare const decodeArgs: <const Self extends Definition$9.Any, MethodName extends Definition$9.MethodNames<Self>>(definition: Self, methodName: MethodName, args: ReadonlyArray<unknown>) => Effect.Effect<Method$5.Args<Self["methods"][MethodName]>, RpcArgumentCountError | RpcArgumentDecodeError>;
|
|
1152
|
-
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>;
|
|
1153
|
-
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>;
|
|
1154
|
-
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>;
|
|
1155
|
-
declare const make$11: <Id extends string, const MethodsShape extends Methods$4>(id: Id, methods: MethodsShape) => Definition$9<Id, MethodsShape>;
|
|
1156
|
-
declare namespace QueueBinding_d_exports {
|
|
1157
|
-
export { MessageSendRequest, QueueBindingClient, QueueBindingDefinition, QueueMetrics, QueueOperationError, QueueProducer, QueueSendBatchOptions, QueueSendBatchResponse, QueueSendOptions, QueueSendResponse, isQueue, layer$10 as layer, makeClient$8 as makeClient };
|
|
843
|
+
declare const assertNoReservedMethods: (target: string, methods: Record<string, unknown>, reserved: ReadonlySet<string>) => void;
|
|
844
|
+
declare function method$2<Success extends ServiceFreeSchema$2>(definition: {
|
|
845
|
+
readonly success: Success;
|
|
846
|
+
}): Method$3<readonly [], Success>;
|
|
847
|
+
declare function method$2<const Args extends ReadonlyArray<ServiceFreeSchema$2>, Success extends ServiceFreeSchema$2>(definition: {
|
|
848
|
+
readonly args: Args;
|
|
849
|
+
readonly success: Success;
|
|
850
|
+
}): Method$3<Args, Success>;
|
|
851
|
+
declare const decodeArgs: <const Self extends Definition$7.Any, MethodName extends Definition$7.MethodNames<Self>>(definition: Self, methodName: MethodName, args: readonly unknown[]) => Effect.Effect<Self["methods"][MethodName]["args"] extends (infer T) ? T extends Self["methods"][MethodName]["args"] ? T extends readonly [] ? [] : T extends readonly [infer Head extends ServiceFreeSchema$2, ...infer Tail extends readonly ServiceFreeSchema$2[]] ? [Schema.Schema.Type<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends ServiceFreeSchema$2, ...infer Tail extends readonly ServiceFreeSchema$2[]] ? [Schema.Schema.Type<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends ServiceFreeSchema$2, ...infer Tail extends readonly ServiceFreeSchema$2[]] ? [Schema.Schema.Type<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends ServiceFreeSchema$2, ...infer Tail extends readonly ServiceFreeSchema$2[]] ? [Schema.Schema.Type<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends ServiceFreeSchema$2, ...infer Tail extends readonly ServiceFreeSchema$2[]] ? [Schema.Schema.Type<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends ServiceFreeSchema$2, ...infer Tail extends readonly ServiceFreeSchema$2[]] ? [Schema.Schema.Type<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends ServiceFreeSchema$2, ...infer Tail extends readonly ServiceFreeSchema$2[]] ? [Schema.Schema.Type<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends ServiceFreeSchema$2, ...infer Tail extends readonly ServiceFreeSchema$2[]] ? [Schema.Schema.Type<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends ServiceFreeSchema$2, ...infer Tail extends readonly ServiceFreeSchema$2[]] ? [Schema.Schema.Type<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends ServiceFreeSchema$2, ...infer Tail extends readonly ServiceFreeSchema$2[]] ? [Schema.Schema.Type<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends ServiceFreeSchema$2, ...infer Tail extends readonly ServiceFreeSchema$2[]] ? [Schema.Schema.Type<Head>, ... /*elided*/ any] : Schema.Schema.Type<Tail[number]>[]] : Schema.Schema.Type<Tail[number]>[]] : Schema.Schema.Type<Tail[number]>[]] : Schema.Schema.Type<Tail[number]>[]] : Schema.Schema.Type<Tail[number]>[]] : Schema.Schema.Type<Tail[number]>[]] : Schema.Schema.Type<Tail[number]>[]] : Schema.Schema.Type<Tail[number]>[]] : Schema.Schema.Type<Tail[number]>[]] : Schema.Schema.Type<Tail[number]>[]] : Schema.Schema.Type<T[number]>[] : never : never, RpcArgumentCountError | RpcArgumentDecodeError, never>;
|
|
852
|
+
declare const encodeArgs: <const Self extends Definition$7.Any, MethodName extends Definition$7.MethodNames<Self>>(definition: Self, methodName: MethodName, args: Self["methods"][MethodName]["args"] extends (infer T) ? T extends Self["methods"][MethodName]["args"] ? T extends readonly [] ? [] : T extends readonly [infer Head extends ServiceFreeSchema$2, ...infer Tail extends readonly ServiceFreeSchema$2[]] ? [Schema.Schema.Type<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends ServiceFreeSchema$2, ...infer Tail extends readonly ServiceFreeSchema$2[]] ? [Schema.Schema.Type<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends ServiceFreeSchema$2, ...infer Tail extends readonly ServiceFreeSchema$2[]] ? [Schema.Schema.Type<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends ServiceFreeSchema$2, ...infer Tail extends readonly ServiceFreeSchema$2[]] ? [Schema.Schema.Type<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends ServiceFreeSchema$2, ...infer Tail extends readonly ServiceFreeSchema$2[]] ? [Schema.Schema.Type<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends ServiceFreeSchema$2, ...infer Tail extends readonly ServiceFreeSchema$2[]] ? [Schema.Schema.Type<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends ServiceFreeSchema$2, ...infer Tail extends readonly ServiceFreeSchema$2[]] ? [Schema.Schema.Type<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends ServiceFreeSchema$2, ...infer Tail extends readonly ServiceFreeSchema$2[]] ? [Schema.Schema.Type<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends ServiceFreeSchema$2, ...infer Tail extends readonly ServiceFreeSchema$2[]] ? [Schema.Schema.Type<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends ServiceFreeSchema$2, ...infer Tail extends readonly ServiceFreeSchema$2[]] ? [Schema.Schema.Type<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends ServiceFreeSchema$2, ...infer Tail extends readonly ServiceFreeSchema$2[]] ? [Schema.Schema.Type<Head>, ... /*elided*/ any] : Schema.Schema.Type<Tail[number]>[]] : Schema.Schema.Type<Tail[number]>[]] : Schema.Schema.Type<Tail[number]>[]] : Schema.Schema.Type<Tail[number]>[]] : Schema.Schema.Type<Tail[number]>[]] : Schema.Schema.Type<Tail[number]>[]] : Schema.Schema.Type<Tail[number]>[]] : Schema.Schema.Type<Tail[number]>[]] : Schema.Schema.Type<Tail[number]>[]] : Schema.Schema.Type<Tail[number]>[]] : Schema.Schema.Type<T[number]>[] : never : never) => Effect.Effect<Self["methods"][MethodName]["args"] extends (infer T_1 extends readonly ServiceFreeSchema$2[]) ? { [Index in keyof T_1]: Schema.Json; } : never, RpcArgumentCountError | RpcArgumentEncodeError, never>;
|
|
853
|
+
declare const encodeSuccess: <const Self extends Definition$7.Any, MethodName extends Definition$7.MethodNames<Self>>(definition: Self, methodName: MethodName, value: Method$3.Success<Self["methods"][MethodName]>) => Effect.Effect<Method$3.EncodedSuccess<Self["methods"][MethodName]>, RpcSuccessEncodeError>;
|
|
854
|
+
declare const decodeSuccess: <const Self extends Definition$7.Any, MethodName extends Definition$7.MethodNames<Self>>(definition: Self, methodName: MethodName, value: unknown) => Effect.Effect<Method$3.Success<Self["methods"][MethodName]>, RpcSuccessDecodeError>;
|
|
855
|
+
declare const make$13: <Id extends string, const MethodsShape extends Methods$2>(id: Id, methods: MethodsShape) => Definition$7<Id, MethodsShape>;
|
|
856
|
+
declare namespace QueueBinding_d_exports {
|
|
857
|
+
export { MessageSendRequest, QueueBindingClient, QueueBindingDefinition, QueueMetrics, QueueOperationError, QueueProducer, QueueSendBatchOptions, QueueSendBatchResponse, QueueSendOptions, QueueSendResponse, isQueue, layer$12 as layer, makeClient$9 as makeClient };
|
|
1158
858
|
}
|
|
1159
859
|
type QueueSendOptions = CloudflareQueueSendOptions;
|
|
1160
860
|
type QueueSendResponse = CloudflareQueueSendResponse;
|
|
@@ -1163,17 +863,17 @@ type QueueSendBatchResponse = CloudflareQueueSendBatchResponse;
|
|
|
1163
863
|
type QueueMetrics = CloudflareQueueMetrics;
|
|
1164
864
|
type MessageSendRequest<Body> = CloudflareMessageSendRequest<Body>;
|
|
1165
865
|
type QueueProducer<Body> = Pick<CloudflareQueue<Body>, "send"> & Partial<Pick<CloudflareQueue<Body>, "sendBatch" | "metrics">>;
|
|
1166
|
-
interface QueueBindingDefinition<Message extends ServiceFreeSchema$
|
|
866
|
+
interface QueueBindingDefinition<Message extends ServiceFreeSchema$2> {
|
|
1167
867
|
/** Binding name as configured in `wrangler.jsonc`. */
|
|
1168
868
|
readonly binding: string;
|
|
1169
869
|
/** Codec used to encode messages before sending them to Cloudflare Queues. */
|
|
1170
870
|
readonly message: Message;
|
|
1171
871
|
}
|
|
1172
|
-
interface QueueBindingClient<Message extends ServiceFreeSchema$
|
|
872
|
+
interface QueueBindingClient<Message extends ServiceFreeSchema$2> {
|
|
1173
873
|
readonly send: (message: Schema.Schema.Type<Message>, options?: QueueSendOptions) => Effect.Effect<void, QueueOperationError | Schema.SchemaError>;
|
|
1174
874
|
readonly sendBatch: (messages: Iterable<MessageSendRequest<Schema.Schema.Type<Message>>>, options?: QueueSendBatchOptions) => Effect.Effect<void, QueueOperationError | Schema.SchemaError>;
|
|
1175
875
|
readonly metrics: () => Effect.Effect<QueueMetrics, QueueOperationError>;
|
|
1176
|
-
readonly
|
|
876
|
+
readonly rawUnsafe: Effect.Effect<CloudflareQueue<Schema.Codec.Encoded<Message>>>;
|
|
1177
877
|
}
|
|
1178
878
|
declare const QueueOperationError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
1179
879
|
readonly _tag: "QueueOperationError";
|
|
@@ -1185,46 +885,46 @@ declare class QueueOperationError extends QueueOperationError_base<{
|
|
|
1185
885
|
readonly message: string;
|
|
1186
886
|
}> {}
|
|
1187
887
|
declare const isQueue: <Body>(value: unknown) => value is QueueProducer<Body>;
|
|
1188
|
-
declare const makeClient$
|
|
1189
|
-
declare const layer$
|
|
888
|
+
declare const makeClient$9: <Message extends ServiceFreeSchema$2>(definition: QueueBindingDefinition<Message>) => ((queue: QueueProducer<Schema.Codec.Encoded<Message>>) => QueueBindingClient<Message>);
|
|
889
|
+
declare const layer$12: <Self, Message extends ServiceFreeSchema$2>(tag: Context.Service<Self, QueueBindingClient<Message>>, definition: QueueBindingDefinition<Message>) => import("effect/Layer").Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
1190
890
|
declare namespace QueueDefinition_d_exports {
|
|
1191
|
-
export { Definition$
|
|
891
|
+
export { Definition$6 as Definition, Handler$3 as Handler, LayerOptions$13 as LayerOptions, Options$5 as Options, Queue$1 as Queue, Tag$12 as Tag, TagClass$11 as TagClass, implement$5 as implement, make$12 as make };
|
|
1192
892
|
}
|
|
1193
|
-
interface Definition$
|
|
893
|
+
interface Definition$6<Id extends string = string, Message extends ServiceFreeSchema$2 = ServiceFreeSchema$2> {
|
|
1194
894
|
readonly id: Id;
|
|
1195
895
|
readonly message: Message;
|
|
1196
896
|
}
|
|
1197
|
-
declare namespace Definition$
|
|
1198
|
-
type Any = Definition$
|
|
897
|
+
declare namespace Definition$6 {
|
|
898
|
+
type Any = Definition$6<string, ServiceFreeSchema$2>;
|
|
1199
899
|
}
|
|
1200
|
-
type Handler$3<ROut, Self extends Definition$
|
|
1201
|
-
interface Options$
|
|
900
|
+
type Handler$3<ROut, Self extends Definition$6.Any> = (batch: QueueBatch<Schema.Schema.Type<Self["message"]>>) => Effect.Effect<void, unknown, ExecutionContext | WorkerContext | WorkerEnvironment | Scope.Scope | ROut>;
|
|
901
|
+
interface Options$5<ROut, Self extends Definition$6.Any> extends Omit<WorkerOptions<ROut, Record<never, never>>, "queue" | "rpc"> {
|
|
1202
902
|
readonly queue: Handler$3<ROut, Self>;
|
|
1203
903
|
readonly rpc?: never;
|
|
1204
904
|
}
|
|
1205
905
|
type LayerOptions$13 = {
|
|
1206
906
|
readonly binding: string;
|
|
1207
907
|
};
|
|
1208
|
-
interface TagClass$
|
|
908
|
+
interface TagClass$11<Self, Id extends string, Message extends ServiceFreeSchema$2> extends Context.ServiceClass<Self, `effect-cf/Queue/${Id}`, QueueBindingClient<Message>> {
|
|
1209
909
|
readonly id: Id;
|
|
1210
910
|
readonly message: Message;
|
|
1211
|
-
readonly make: <ROut, LayerError>(layer: Layer.Layer<ROut, LayerError, ExecutionContext | WorkerContext | WorkerEnvironment>, options: Options$
|
|
911
|
+
readonly make: <ROut, LayerError>(layer: Layer.Layer<ROut, LayerError, ExecutionContext | WorkerContext | WorkerEnvironment>, options: Options$5<ROut, Definition$6<Id, Message>>) => WorkerClass<Record<never, never>, ROut>;
|
|
1212
912
|
readonly layer: (options: LayerOptions$13) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
1213
913
|
readonly send: (message: Schema.Schema.Type<Message>, options?: QueueSendOptions) => Effect.Effect<void, QueueOperationError | Schema.SchemaError, Self>;
|
|
1214
914
|
readonly sendBatch: (messages: Iterable<MessageSendRequest<Schema.Schema.Type<Message>>>, options?: QueueSendBatchOptions) => Effect.Effect<void, QueueOperationError | Schema.SchemaError, Self>;
|
|
1215
915
|
readonly metrics: () => Effect.Effect<QueueMetrics, QueueOperationError, Self>;
|
|
1216
|
-
readonly
|
|
916
|
+
readonly rawUnsafe: Effect.Effect<globalThis.Queue<Schema.Codec.Encoded<Message>>, never, Self>;
|
|
1217
917
|
}
|
|
1218
|
-
declare const make$
|
|
918
|
+
declare const make$12: <Id extends string, Message extends ServiceFreeSchema$2>(id: Id, definition: {
|
|
1219
919
|
readonly message: Message;
|
|
1220
|
-
}) => TagClass$
|
|
1221
|
-
declare const Tag$
|
|
920
|
+
}) => TagClass$11<Definition$6<Id, Message>, Id, Message>;
|
|
921
|
+
declare const Tag$12: <Self>() => <Id extends string, Message extends ServiceFreeSchema$2>(id: Id, definition: {
|
|
1222
922
|
readonly message: Message;
|
|
1223
|
-
}) => TagClass$
|
|
1224
|
-
declare const Queue$1: typeof Tag$
|
|
1225
|
-
declare const implement$
|
|
923
|
+
}) => TagClass$11<Self, Id, Message>;
|
|
924
|
+
declare const Queue$1: typeof Tag$12;
|
|
925
|
+
declare const implement$5: <ROut, const Self extends Definition$6.Any>(_definition: Self, handler: Handler$3<ROut, Self>) => Handler$3<ROut, Self>;
|
|
1226
926
|
declare namespace Queue_d_exports {
|
|
1227
|
-
export { Definition$
|
|
927
|
+
export { Definition$5 as Definition, Handler$2 as Handler, LayerOptions$12 as LayerOptions, Options$4 as Options, QueueBatch, QueueHandler, QueueMessage, QueueMessageDecodeError, QueueOptions, Tag$11 as Tag, TagClass$10 as TagClass, decodeBatch, fromMessage, fromMessageBatch, implement$4 as implement };
|
|
1228
928
|
}
|
|
1229
929
|
interface QueueMessage<Body> {
|
|
1230
930
|
readonly raw: globalThis.Message<unknown>;
|
|
@@ -1251,7 +951,9 @@ declare class QueueMessageDecodeError extends QueueMessageDecodeError_base<{
|
|
|
1251
951
|
readonly messageId: string;
|
|
1252
952
|
readonly index: number;
|
|
1253
953
|
readonly cause: unknown;
|
|
1254
|
-
}> {
|
|
954
|
+
}> {
|
|
955
|
+
get message(): string;
|
|
956
|
+
}
|
|
1255
957
|
type RuntimeContext$2<ROut> = ExecutionContext | WorkerContext | WorkerEnvironment | ROut;
|
|
1256
958
|
type QueueHandlerContext<ROut> = RuntimeContext$2<ROut> | Scope.Scope;
|
|
1257
959
|
type QueueHandler<ROut, Body = unknown> = (batch: QueueBatch<Body>) => Effect.Effect<void, unknown, QueueHandlerContext<ROut>>;
|
|
@@ -1269,128 +971,47 @@ declare const fromMessage: <Body>(message: globalThis.Message<unknown>, body: Bo
|
|
|
1269
971
|
};
|
|
1270
972
|
declare const fromMessageBatch: <Body>(batch: globalThis.MessageBatch<unknown>, messages: ReadonlyArray<QueueMessage<Body>>) => QueueBatch<Body>;
|
|
1271
973
|
declare const decodeBatch: <Body>(batch: globalThis.MessageBatch<unknown>, decodeBody: (body: unknown) => Effect.Effect<Body, unknown>) => Effect.Effect<QueueBatch<Body>, QueueMessageDecodeError>;
|
|
1272
|
-
type Definition$
|
|
1273
|
-
declare namespace Definition$
|
|
1274
|
-
type Any = Definition$
|
|
974
|
+
type Definition$5<Id extends string = string, Message extends Definition$6.Any["message"] = Definition$6.Any["message"]> = Definition$6<Id, Message>;
|
|
975
|
+
declare namespace Definition$5 {
|
|
976
|
+
type Any = Definition$6.Any;
|
|
1275
977
|
}
|
|
1276
978
|
type LayerOptions$12 = LayerOptions$13;
|
|
1277
|
-
type TagClass$
|
|
1278
|
-
declare const Tag$
|
|
979
|
+
type TagClass$10<Self, Id extends string, Message extends Definition$6.Any["message"]> = TagClass$11<Self, Id, Message>;
|
|
980
|
+
declare const Tag$11: <Self>() => <Id extends string, Message extends Definition$6.Any["message"]>(id: Id, definition: {
|
|
1279
981
|
readonly message: Message;
|
|
1280
|
-
}) => TagClass$
|
|
1281
|
-
declare const implement$
|
|
1282
|
-
type Handler$2<ROut, Self extends Definition$
|
|
1283
|
-
type Options$
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
type
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
export type Any = Method$4<ReadonlyArray<ServiceFreeSchema$3>, ServiceFreeSchema$3>;
|
|
1294
|
-
type ArgsFromSchemas<Args extends ReadonlyArray<ServiceFreeSchema$3>> = Args extends readonly [] ? [] : Args extends readonly [infer Head extends ServiceFreeSchema$3, ...infer Tail extends ReadonlyArray<ServiceFreeSchema$3>] ? [Schema.Schema.Type<Head>, ...ArgsFromSchemas<Tail>] : Array<Schema.Schema.Type<Args[number]>>;
|
|
1295
|
-
type EncodedArgsFromSchemas<Args extends ReadonlyArray<ServiceFreeSchema$3>> = Args extends readonly [] ? [] : Args extends readonly [infer Head extends ServiceFreeSchema$3, ...infer Tail extends ReadonlyArray<ServiceFreeSchema$3>] ? [Schema.Codec.Encoded<Head>, ...EncodedArgsFromSchemas<Tail>] : Array<Schema.Codec.Encoded<Args[number]>>;
|
|
1296
|
-
export type Args<Self extends Any> = ArgsFromSchemas<Self["args"]>;
|
|
1297
|
-
export type EncodedArgs<Self extends Any> = EncodedArgsFromSchemas<Self["args"]>;
|
|
1298
|
-
export type Success<Self extends Any> = Schema.Schema.Type<Self["success"]>;
|
|
1299
|
-
export type EncodedSuccess<Self extends Any> = Schema.Codec.Encoded<Self["success"]>;
|
|
1300
|
-
export {};
|
|
982
|
+
}) => TagClass$10<Self, Id, Message>;
|
|
983
|
+
declare const implement$4: typeof implement$5;
|
|
984
|
+
type Handler$2<ROut, Self extends Definition$6.Any> = Handler$3<ROut, Self>;
|
|
985
|
+
type Options$4<ROut, Self extends Definition$6.Any> = Options$5<ROut, Self>;
|
|
986
|
+
//#endregion
|
|
987
|
+
//#region src/internal/RpcInvocation.d.ts
|
|
988
|
+
type AnyArgs = Array<any>;
|
|
989
|
+
type AsyncMethodKey<Api> = { [Key in keyof Api]-?: Key extends string ? Api[Key] extends ((...args: AnyArgs) => Promise<unknown>) ? Key : never : never; }[keyof Api];
|
|
990
|
+
type AsyncMethodArgs<Api, Method extends keyof Api> = Api[Method] extends ((...args: infer Args) => Promise<unknown>) ? Args : never;
|
|
991
|
+
type AsyncMethodSuccess<Api, Method extends keyof Api> = Api[Method] extends ((...args: AnyArgs) => Promise<infer A>) ? A : never;
|
|
992
|
+
type AsyncMethodCloudflareReturn<Api, Method extends keyof Api> = Result$1<AsyncMethodSuccess<Api, Method>>;
|
|
993
|
+
declare namespace ServiceBinding_d_exports {
|
|
994
|
+
export { Service$1 as Service, ServiceBindingClient, ServiceBindingDefinition, ServiceBindingEffectClient, ServiceBindingFetchError, ServiceBindingRpcError, ServiceBindingStaticClient, ServiceFetcher, isServiceBindingClient, layer$11 as layer, makeClient$8 as makeClient, makeDirectMethods$1 as makeDirectMethods };
|
|
1301
995
|
}
|
|
1302
|
-
|
|
996
|
+
declare const TypeId$2: "effect-cf/ServiceBinding";
|
|
1303
997
|
/**
|
|
1304
|
-
*
|
|
1305
|
-
*
|
|
1306
|
-
* Create with {@link make} and reuse to type both worker implementations and
|
|
1307
|
-
* service bindings in other workers.
|
|
998
|
+
* Minimum shape for a Cloudflare service binding.
|
|
1308
999
|
*/
|
|
1309
|
-
interface
|
|
1310
|
-
|
|
1311
|
-
readonly methods: MethodsShape;
|
|
1312
|
-
}
|
|
1313
|
-
declare namespace Definition$6 {
|
|
1314
|
-
type Any = Definition$6<string, Methods$3>;
|
|
1000
|
+
interface ServiceFetcher {
|
|
1001
|
+
fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
|
|
1315
1002
|
}
|
|
1316
|
-
type
|
|
1317
|
-
type
|
|
1003
|
+
type RpcClient$1<Api> = { readonly [Key in keyof Api as Key extends string ? Api[Key] extends ((...args: Array<any>) => unknown) ? Key : never : never]: Api[Key]; };
|
|
1004
|
+
type ReservedMethodName$4 = ReservedMethodName$3 | "fetch";
|
|
1318
1005
|
/**
|
|
1319
|
-
*
|
|
1006
|
+
* Native Cloudflare service object including optional RPC methods.
|
|
1320
1007
|
*/
|
|
1321
|
-
type
|
|
1322
|
-
type
|
|
1323
|
-
|
|
1324
|
-
* Effect handlers for each RPC method in a worker definition.
|
|
1325
|
-
*/
|
|
1326
|
-
type Handlers$3<ROut, Self extends Definition$6.Any> = { readonly [Key in keyof Self["methods"]]: (...args: Method$4.Args<Self["methods"][Key]>) => WorkerRpcHandler<ROut, Method$4.Success<Self["methods"][Key]>>; };
|
|
1327
|
-
/**
|
|
1328
|
-
* Worker constructor options for a specific RPC definition.
|
|
1329
|
-
*/
|
|
1330
|
-
interface Options$5<ROut, Self extends Definition$6.Any, REvent = never, EventLayerError = never> extends Omit<WorkerOptions<ROut, REvent, EventLayerError, Handlers$3<ROut | REvent, Self>>, "rpc"> {
|
|
1331
|
-
readonly rpc: Handlers$3<ROut | REvent, Self>;
|
|
1332
|
-
}
|
|
1333
|
-
type LayerOptions$11 = {
|
|
1334
|
-
readonly binding: string;
|
|
1335
|
-
};
|
|
1336
|
-
type TagClass$10<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>> & {
|
|
1337
|
-
readonly id: Id;
|
|
1338
|
-
readonly methods: MethodsShape;
|
|
1339
|
-
readonly make: <ROut, LayerError, REvent = never, EventLayerError = never>(layer: Layer.Layer<ROut, LayerError, ExecutionContext | WorkerContext | WorkerEnvironment>, options: Options$5<ROut, Definition$6<Id, MethodsShape>, REvent, EventLayerError>) => WorkerClass<Handlers$3<ROut | REvent, Definition$6<Id, MethodsShape>>, ROut | REvent>;
|
|
1340
|
-
readonly layer: (options: LayerOptions$11) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
1341
|
-
};
|
|
1342
|
-
/**
|
|
1343
|
-
* Defines a single RPC method schema in a worker definition.
|
|
1344
|
-
*/
|
|
1345
|
-
declare const method$3: {
|
|
1346
|
-
<Success extends ServiceFreeSchema$3>(definition: {
|
|
1347
|
-
readonly success: Success;
|
|
1348
|
-
}): Method$4<readonly [], Success>;
|
|
1349
|
-
<const Args extends ReadonlyArray<ServiceFreeSchema$3>, Success extends ServiceFreeSchema$3>(definition: {
|
|
1350
|
-
readonly args: Args;
|
|
1351
|
-
readonly success: Success;
|
|
1352
|
-
}): Method$4<Args, Success>;
|
|
1353
|
-
};
|
|
1354
|
-
declare const make$9: <Id extends string, const MethodsShape extends Methods$3>(id: Id, methods: MethodsShape & NoReservedMethods$3<MethodsShape>) => TagClass$10<Definition$6<Id, MethodsShape>, Id, MethodsShape>;
|
|
1355
|
-
declare const Tag$11: <Self>() => <Id extends string, const MethodsShape extends Methods$3>(id: Id, methods: MethodsShape & NoReservedMethods$3<MethodsShape>) => TagClass$10<Self, Id, MethodsShape>;
|
|
1356
|
-
declare const Worker: typeof Tag$11;
|
|
1357
|
-
/**
|
|
1358
|
-
* Helper for implementing handlers with the exact method shape of a definition.
|
|
1359
|
-
*/
|
|
1360
|
-
declare const implement$5: <ROut, const Self extends Definition$6.Any>(_definition: Self, handlers: Handlers$3<ROut, Self>) => Handlers$3<ROut, Self>;
|
|
1361
|
-
/**
|
|
1362
|
-
* Convenience alias for a single worker RPC handler Effect.
|
|
1363
|
-
*/
|
|
1364
|
-
type HandlerEffect$3<ROut, Self extends Definition$6.Any, Key extends keyof Self["methods"]> = WorkerRpcHandler<ROut, Method$4.Success<Self["methods"][Key]>>;
|
|
1365
|
-
//#endregion
|
|
1366
|
-
//#region src/internal/RpcInvocation.d.ts
|
|
1367
|
-
type AnyArgs = Array<any>;
|
|
1368
|
-
type AsyncMethodKey<Api> = { [Key in keyof Api]-?: Key extends string ? Api[Key] extends ((...args: AnyArgs) => Promise<unknown>) ? Key : never : never; }[keyof Api];
|
|
1369
|
-
type AsyncMethodArgs<Api, Method extends keyof Api> = Api[Method] extends ((...args: infer Args) => Promise<unknown>) ? Args : never;
|
|
1370
|
-
type AsyncMethodSuccess<Api, Method extends keyof Api> = Api[Method] extends ((...args: AnyArgs) => Promise<infer A>) ? A : never;
|
|
1371
|
-
type AsyncMethodCloudflareReturn<Api, Method extends keyof Api> = Result$1<AsyncMethodSuccess<Api, Method>>;
|
|
1372
|
-
declare namespace ServiceBinding_d_exports {
|
|
1373
|
-
export { Service, ServiceBindingClient, ServiceBindingDefinition, ServiceBindingEffectClient, ServiceBindingFetchError, ServiceBindingRpcError, ServiceBindingStaticClient, ServiceFetcher, isServiceBindingClient, layer$9 as layer, makeClient$7 as makeClient, makeDirectMethods$1 as makeDirectMethods };
|
|
1374
|
-
}
|
|
1375
|
-
declare const TypeId$1: "effect-cf/ServiceBinding";
|
|
1376
|
-
/**
|
|
1377
|
-
* Minimum shape for a Cloudflare service binding.
|
|
1378
|
-
*/
|
|
1379
|
-
interface ServiceFetcher {
|
|
1380
|
-
fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
|
|
1381
|
-
}
|
|
1382
|
-
type RpcClient$1<Api> = { readonly [Key in keyof Api as Key extends string ? Api[Key] extends ((...args: Array<any>) => unknown) ? Key : never : never]: Api[Key]; };
|
|
1383
|
-
type ReservedMethodName$4 = ReservedMethodName$5 | "fetch";
|
|
1384
|
-
/**
|
|
1385
|
-
* Native Cloudflare service object including optional RPC methods.
|
|
1386
|
-
*/
|
|
1387
|
-
type ServiceBindingClient<Api extends object> = ServiceFetcher & RpcClient$1<Provider<Api, ReservedMethodName$4>>;
|
|
1388
|
-
type ApiFromDefinition<Definition> = Definition extends Definition$6.Any ? ServerApi$4<Definition> : never;
|
|
1389
|
-
type ApiOrDefinition<Api extends object, Definition> = [Api] extends [never] ? ApiFromDefinition<Definition> : Api;
|
|
1008
|
+
type ServiceBindingClient<Api extends object> = ServiceFetcher & RpcClient$1<Provider<Api, ReservedMethodName$4>>;
|
|
1009
|
+
type ApiFromDefinition<Definition> = Definition extends Definition$4.Any ? ServerApi$2<Definition> : never;
|
|
1010
|
+
type ApiOrDefinition<Api extends object, Definition> = [Api] extends [never] ? ApiFromDefinition<Definition> : Api;
|
|
1390
1011
|
/**
|
|
1391
1012
|
* Binding metadata used to create an Effect service from a Worker binding.
|
|
1392
1013
|
*/
|
|
1393
|
-
interface ServiceBindingDefinition<Definition extends Definition$
|
|
1014
|
+
interface ServiceBindingDefinition<Definition extends Definition$4.Any | undefined = undefined> {
|
|
1394
1015
|
/** Binding name as configured in `wrangler.jsonc`. */
|
|
1395
1016
|
readonly binding: string;
|
|
1396
1017
|
/** Optional RPC schema used for argument/result encoding. */
|
|
@@ -1405,7 +1026,9 @@ declare const ServiceBindingFetchError_base: new <A extends Record<string, any>
|
|
|
1405
1026
|
declare class ServiceBindingFetchError extends ServiceBindingFetchError_base<{
|
|
1406
1027
|
readonly binding: string;
|
|
1407
1028
|
readonly cause: unknown;
|
|
1408
|
-
}> {
|
|
1029
|
+
}> {
|
|
1030
|
+
get message(): string;
|
|
1031
|
+
}
|
|
1409
1032
|
declare const ServiceBindingRpcError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
1410
1033
|
readonly _tag: "ServiceBindingRpcError";
|
|
1411
1034
|
} & Readonly<A>;
|
|
@@ -1416,15 +1039,17 @@ declare class ServiceBindingRpcError extends ServiceBindingRpcError_base<{
|
|
|
1416
1039
|
readonly binding: string;
|
|
1417
1040
|
readonly method: string;
|
|
1418
1041
|
readonly cause: unknown;
|
|
1419
|
-
}> {
|
|
1042
|
+
}> {
|
|
1043
|
+
get message(): string;
|
|
1044
|
+
}
|
|
1420
1045
|
type ServiceMethodKey<Api> = AsyncMethodKey<Api>;
|
|
1421
1046
|
type ServiceMethodArgs<Api, Method extends keyof Api> = AsyncMethodArgs<Api, Method>;
|
|
1422
1047
|
type ServiceMethodSuccess<Api, Method extends keyof Api> = AsyncMethodSuccess<Api, Method>;
|
|
1423
1048
|
type ServiceMethodCloudflareReturn<Api, Method extends keyof Api> = AsyncMethodCloudflareReturn<Api, Method>;
|
|
1424
1049
|
type ServiceCall<R, Api> = <Method extends ServiceMethodKey<Api>>(method: Method, ...args: ServiceMethodArgs<Api, Method>) => Effect.Effect<ServiceMethodSuccess<Api, Method>, ServiceBindingRpcError, R>;
|
|
1425
|
-
type DefinitionDirectMethods<R, Definition extends Definition$
|
|
1426
|
-
type DirectMethods$1<R, Definition> = Definition extends Definition$
|
|
1427
|
-
type ServiceBindingEffectClient<Api extends object, Definition extends Definition$
|
|
1050
|
+
type DefinitionDirectMethods<R, Definition extends Definition$4.Any> = { readonly [Method in Definition$7.MethodNames<Definition>]: (...args: Method$3.Args<Definition["methods"][Method]>) => Effect.Effect<Method$3.Success<Definition["methods"][Method]>, ServiceBindingRpcError, R>; };
|
|
1051
|
+
type DirectMethods$1<R, Definition> = Definition extends Definition$4.Any ? DefinitionDirectMethods<R, Definition> : {};
|
|
1052
|
+
type ServiceBindingEffectClient<Api extends object, Definition extends Definition$4.Any | undefined = undefined> = DirectMethods$1<never, Definition> & {
|
|
1428
1053
|
/**
|
|
1429
1054
|
* Forwards an HTTP request to the bound Worker service.
|
|
1430
1055
|
*
|
|
@@ -1509,15 +1134,15 @@ type ServiceBindingEffectClient<Api extends object, Definition extends Definitio
|
|
|
1509
1134
|
*/
|
|
1510
1135
|
readonly scopedCall: <Method extends ServiceMethodKey<Api>>(method: Method, ...args: ServiceMethodArgs<Api, Method>) => Effect.Effect<Awaited<ServiceMethodSuccess<Api, Method>>, unknown, Scope.Scope>;
|
|
1511
1136
|
};
|
|
1512
|
-
type ServiceBindingStaticClient<R, Api extends object, Definition extends Definition$
|
|
1137
|
+
type ServiceBindingStaticClient<R, Api extends object, Definition extends Definition$4.Any | undefined = undefined> = DirectMethods$1<R, Definition> & {
|
|
1513
1138
|
readonly fetch: (input: RequestInfo | URL, init?: RequestInit) => Effect.Effect<globalThis.Response, ServiceBindingFetchError, R>;
|
|
1514
1139
|
readonly rpc: <Method extends ServiceMethodKey<Api>>(method: Method, ...args: ServiceMethodArgs<Api, Method>) => Effect.Effect<ServiceMethodCloudflareReturn<Api, Method>, ServiceBindingRpcError, R>;
|
|
1515
1140
|
readonly call: <Method extends ServiceMethodKey<Api>>(method: Method, ...args: ServiceMethodArgs<Api, Method>) => Effect.Effect<ServiceMethodSuccess<Api, Method>, ServiceBindingRpcError, R>;
|
|
1516
1141
|
readonly scopedCall: <Method extends ServiceMethodKey<Api>>(method: Method, ...args: ServiceMethodArgs<Api, Method>) => Effect.Effect<Awaited<ServiceMethodSuccess<Api, Method>>, unknown, Scope.Scope | R>;
|
|
1517
1142
|
};
|
|
1518
1143
|
declare const isServiceBindingClient: <Api extends object>(value: unknown) => value is ServiceBindingClient<Api>;
|
|
1519
|
-
declare const makeClient$
|
|
1520
|
-
declare const layer$
|
|
1144
|
+
declare const makeClient$8: <Api extends object, const Definition extends Definition$4.Any | undefined = undefined>(definition: ServiceBindingDefinition<Definition>) => ((service: ServiceBindingClient<Api>) => ServiceBindingEffectClient<Api, Definition>);
|
|
1145
|
+
declare const layer$11: <Self, Api extends object, const Definition extends Definition$4.Any | undefined = undefined>(tag: Context.Service<Self, ServiceBindingEffectClient<Api, Definition>>, definition: ServiceBindingDefinition<Definition>) => import("effect/Layer").Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
1521
1146
|
/**
|
|
1522
1147
|
* Creates a typed Effect service for a Worker service binding.
|
|
1523
1148
|
*
|
|
@@ -1547,24 +1172,121 @@ declare const layer$9: <Self, Api extends object, const Definition extends Defin
|
|
|
1547
1172
|
* });
|
|
1548
1173
|
* ```
|
|
1549
1174
|
*/
|
|
1550
|
-
declare const Service: <Self, Api extends object = never>() => <Id extends string, const Definition extends Definition$
|
|
1551
|
-
readonly [TypeId$
|
|
1175
|
+
declare const Service$1: <Self, Api extends object = never>() => <Id extends string, const Definition extends Definition$4.Any | undefined = undefined>(id: Id, definition: ServiceBindingDefinition<Definition>) => BindingService<Self, Id, ServiceBindingEffectClient<ApiOrDefinition<Api, Definition>, Definition>> & DirectMethods$1<Self, Definition> & {
|
|
1176
|
+
readonly [TypeId$2]: typeof TypeId$2;
|
|
1552
1177
|
readonly definition: ServiceBindingDefinition<Definition>;
|
|
1553
|
-
readonly fetch: (input:
|
|
1554
|
-
readonly rpc: <Method extends ServiceMethodKey<ApiOrDefinition<Api, Definition>>>(method: Method, ...args:
|
|
1555
|
-
readonly call: <Method extends ServiceMethodKey<ApiOrDefinition<Api, Definition>>>(method: Method, ...args:
|
|
1556
|
-
readonly scopedCall: <Method extends ServiceMethodKey<ApiOrDefinition<Api, Definition>>>(method: Method, ...args:
|
|
1178
|
+
readonly fetch: (input: URL | RequestInfo<unknown, CfProperties<unknown>>, init?: RequestInit<CfProperties<unknown>> | undefined) => Effect.Effect<Response, ServiceBindingFetchError, Self>;
|
|
1179
|
+
readonly rpc: <Method extends ServiceMethodKey<ApiOrDefinition<Api, Definition>>>(method: Method, ...args: AsyncMethodArgs<ApiOrDefinition<Api, Definition>, Method>) => Effect.Effect<Result$1<AsyncMethodSuccess<ApiOrDefinition<Api, Definition>, Method>>, ServiceBindingRpcError, Self>;
|
|
1180
|
+
readonly call: <Method extends ServiceMethodKey<ApiOrDefinition<Api, Definition>>>(method: Method, ...args: AsyncMethodArgs<ApiOrDefinition<Api, Definition>, Method>) => Effect.Effect<AsyncMethodSuccess<ApiOrDefinition<Api, Definition>, Method>, ServiceBindingRpcError, Self>;
|
|
1181
|
+
readonly scopedCall: <Method extends ServiceMethodKey<ApiOrDefinition<Api, Definition>>>(method: Method, ...args: AsyncMethodArgs<ApiOrDefinition<Api, Definition>, Method>) => Effect.Effect<Awaited<AsyncMethodSuccess<ApiOrDefinition<Api, Definition>, Method>>, unknown, Self | Scope.Scope>;
|
|
1182
|
+
};
|
|
1183
|
+
declare const makeDirectMethods$1: <R, Api, Definition extends Definition$4.Any | undefined>(rpcDefinition: Definition | undefined, call: ServiceCall<R, Api>) => DirectMethods$1<R, Definition>;
|
|
1184
|
+
declare namespace WorkerDefinition_d_exports {
|
|
1185
|
+
export { Api$1 as Api, Definition$4 as Definition, HandlerEffect$1 as HandlerEffect, Handlers$1 as Handlers, LayerOptions$11 as LayerOptions, Method$2 as Method, Methods$1 as Methods, NoReservedMethods$1 as NoReservedMethods, Options$3 as Options, ReservedMethodName$3 as ReservedMethodName, ServerApi$2 as ServerApi, ServiceFreeSchema$1 as ServiceFreeSchema, Tag$10 as Tag, TagClass$9 as TagClass, Worker, implement$3 as implement, make$11 as make, method$1 as method };
|
|
1186
|
+
}
|
|
1187
|
+
type ServiceFreeSchema$1 = Schema.Codec<any, any, never, never>;
|
|
1188
|
+
interface Method$2<Args extends ReadonlyArray<ServiceFreeSchema$1> = ReadonlyArray<ServiceFreeSchema$1>, Success extends ServiceFreeSchema$1 = ServiceFreeSchema$1> {
|
|
1189
|
+
readonly args: Args;
|
|
1190
|
+
readonly success: Success;
|
|
1191
|
+
}
|
|
1192
|
+
declare namespace Method$2 {
|
|
1193
|
+
export type Any = Method$2<ReadonlyArray<ServiceFreeSchema$1>, ServiceFreeSchema$1>;
|
|
1194
|
+
type ArgsFromSchemas<Args extends ReadonlyArray<ServiceFreeSchema$1>> = Args extends readonly [] ? [] : Args extends readonly [infer Head extends ServiceFreeSchema$1, ...infer Tail extends ReadonlyArray<ServiceFreeSchema$1>] ? [Schema.Schema.Type<Head>, ...ArgsFromSchemas<Tail>] : Array<Schema.Schema.Type<Args[number]>>;
|
|
1195
|
+
/** Method schemas cross the wire through their canonical JSON codec. */
|
|
1196
|
+
type EncodedArgsFromSchemas<Args extends ReadonlyArray<ServiceFreeSchema$1>> = { [Index in keyof Args]: Schema.Json; };
|
|
1197
|
+
export type Args<Self extends Any> = ArgsFromSchemas<Self["args"]>;
|
|
1198
|
+
export type EncodedArgs<Self extends Any> = EncodedArgsFromSchemas<Self["args"]>;
|
|
1199
|
+
export type Success<Self extends Any> = Schema.Schema.Type<Self["success"]>;
|
|
1200
|
+
export type EncodedSuccess<Self extends Any> = Schema.Json;
|
|
1201
|
+
export {};
|
|
1202
|
+
}
|
|
1203
|
+
type Methods$1 = Record<string, Method$2.Any>;
|
|
1204
|
+
/**
|
|
1205
|
+
* RPC contract for a Worker service.
|
|
1206
|
+
*
|
|
1207
|
+
* Create with {@link make} and reuse to type both worker implementations and
|
|
1208
|
+
* service bindings in other workers.
|
|
1209
|
+
*/
|
|
1210
|
+
interface Definition$4<Id extends string = string, MethodsShape extends Methods$1 = Methods$1> {
|
|
1211
|
+
readonly id: Id;
|
|
1212
|
+
readonly methods: MethodsShape;
|
|
1213
|
+
}
|
|
1214
|
+
declare namespace Definition$4 {
|
|
1215
|
+
type Any = Definition$4<string, Methods$1>;
|
|
1216
|
+
}
|
|
1217
|
+
type ReservedMethodName$3 = ReservedMethodName$2;
|
|
1218
|
+
type NoReservedMethods$1<MethodsShape extends Methods$1> = Extract<keyof MethodsShape, ReservedMethodName$3> extends never ? MethodsShape : never;
|
|
1219
|
+
/**
|
|
1220
|
+
* Promise-based client API derived from a {@link Definition}.
|
|
1221
|
+
*/
|
|
1222
|
+
type ServerApi$2<Self extends Definition$4.Any> = { readonly [Key in keyof Self["methods"]]: (...args: Method$2.Args<Self["methods"][Key]>) => Promise<Method$2.Success<Self["methods"][Key]>>; };
|
|
1223
|
+
type Api$1<Self extends Definition$4.Any> = Provider<ServerApi$2<Self>, ReservedMethodName$3>;
|
|
1224
|
+
/**
|
|
1225
|
+
* Effect handlers for each RPC method in a worker definition.
|
|
1226
|
+
*/
|
|
1227
|
+
type Handlers$1<ROut, Self extends Definition$4.Any> = { readonly [Key in keyof Self["methods"]]: (...args: Method$2.Args<Self["methods"][Key]>) => WorkerRpcHandler<ROut, Method$2.Success<Self["methods"][Key]>>; };
|
|
1228
|
+
/**
|
|
1229
|
+
* Worker constructor options for a specific RPC definition.
|
|
1230
|
+
*/
|
|
1231
|
+
interface Options$3<ROut, Self extends Definition$4.Any, REvent = never, EventLayerError = never> extends Omit<WorkerOptions<ROut, REvent, EventLayerError, Handlers$1<ROut | REvent, Self>>, "rpc"> {
|
|
1232
|
+
readonly rpc: Handlers$1<ROut | REvent, Self>;
|
|
1233
|
+
}
|
|
1234
|
+
type LayerOptions$11 = {
|
|
1235
|
+
readonly binding: string;
|
|
1236
|
+
};
|
|
1237
|
+
type TagClass$9<Self, Id extends string, MethodsShape extends Methods$1> = Context.ServiceClass<Self, Id, ServiceBindingEffectClient<Api$1<Definition$4<Id, MethodsShape>>, Definition$4<Id, MethodsShape>>> & ServiceBindingStaticClient<Self, Api$1<Definition$4<Id, MethodsShape>>, Definition$4<Id, MethodsShape>> & {
|
|
1238
|
+
readonly id: Id;
|
|
1239
|
+
readonly methods: MethodsShape;
|
|
1240
|
+
readonly make: <ROut, LayerError, REvent = never, EventLayerError = never>(layer: Layer.Layer<ROut, LayerError, ExecutionContext | WorkerContext | WorkerEnvironment>, options: Options$3<ROut, Definition$4<Id, MethodsShape>, REvent, EventLayerError>) => WorkerClass<Handlers$1<ROut | REvent, Definition$4<Id, MethodsShape>>, ROut | REvent>;
|
|
1241
|
+
readonly layer: (options: LayerOptions$11) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
1557
1242
|
};
|
|
1558
|
-
|
|
1243
|
+
/**
|
|
1244
|
+
* Defines a single RPC method schema in a worker definition.
|
|
1245
|
+
*/
|
|
1246
|
+
declare const method$1: {
|
|
1247
|
+
<Success extends ServiceFreeSchema$1>(definition: {
|
|
1248
|
+
readonly success: Success;
|
|
1249
|
+
}): Method$2<readonly [], Success>;
|
|
1250
|
+
<const Args extends ReadonlyArray<ServiceFreeSchema$1>, Success extends ServiceFreeSchema$1>(definition: {
|
|
1251
|
+
readonly args: Args;
|
|
1252
|
+
readonly success: Success;
|
|
1253
|
+
}): Method$2<Args, Success>;
|
|
1254
|
+
};
|
|
1255
|
+
declare const make$11: <Id extends string, const MethodsShape extends Methods$1>(id: Id, methods: MethodsShape & NoReservedMethods$1<MethodsShape>) => TagClass$9<Definition$4<Id, MethodsShape>, Id, MethodsShape>;
|
|
1256
|
+
declare const Tag$10: <Self>() => <Id extends string, const MethodsShape extends Methods$1>(id: Id, methods: MethodsShape & NoReservedMethods$1<MethodsShape>) => TagClass$9<Self, Id, MethodsShape>;
|
|
1257
|
+
declare const Worker: typeof Tag$10;
|
|
1258
|
+
/**
|
|
1259
|
+
* Helper for implementing handlers with the exact method shape of a definition.
|
|
1260
|
+
*/
|
|
1261
|
+
declare const implement$3: <ROut, const Self extends Definition$4.Any>(_definition: Self, handlers: Handlers$1<ROut, Self>) => Handlers$1<ROut, Self>;
|
|
1262
|
+
/**
|
|
1263
|
+
* Convenience alias for a single worker RPC handler Effect.
|
|
1264
|
+
*/
|
|
1265
|
+
type HandlerEffect$1<ROut, Self extends Definition$4.Any, Key extends keyof Self["methods"]> = WorkerRpcHandler<ROut, Method$2.Success<Self["methods"][Key]>>;
|
|
1559
1266
|
declare namespace Worker_d_exports {
|
|
1560
|
-
export { Api$
|
|
1267
|
+
export { Api$1 as Api, Definition$4 as Definition, ExecutionContext, FetchHandler, FetchWorkerOptions, HandlerEffect$1 as HandlerEffect, Handlers$1 as Handlers, LayerOptions$11 as LayerOptions, Method$2 as Method, Methods$1 as Methods, NativeRequest, NoReservedMethods$1 as NoReservedMethods, Options$3 as Options, ReservedMethodName$2 as ReservedMethodName, RpcHandlers$1 as RpcHandlers, ServerApi$2 as ServerApi, ServiceFreeSchema$1 as ServiceFreeSchema, Tag$10 as Tag, TagClass$9 as TagClass, WorkerClass, WorkerContext, WorkerContextService, WorkerContextWaitUntilOptions, WorkerFetchSuccess, WorkerHandler, WorkerOptions, WorkerRpc, WorkerRpcHandler, WorkerRpcShape, implement$3 as implement, isWebSocketUpgrade, make$10 as make, makeFetchHandler, method$1 as method };
|
|
1561
1268
|
}
|
|
1562
1269
|
declare const ExecutionContext_base: Context.ServiceClass<ExecutionContext, "effect-cf/ExecutionContext", globalThis.ExecutionContext<unknown>>;
|
|
1270
|
+
/**
|
|
1271
|
+
* Access to Cloudflare's native `ExecutionContext`.
|
|
1272
|
+
*/
|
|
1563
1273
|
declare class ExecutionContext extends ExecutionContext_base {}
|
|
1274
|
+
/**
|
|
1275
|
+
* Options for {@link WorkerContextService.waitUntil}.
|
|
1276
|
+
*/
|
|
1564
1277
|
interface WorkerContextWaitUntilOptions<E, R> {
|
|
1278
|
+
/**
|
|
1279
|
+
* Failure mode for the background effect: `"observe"` (default) logs or
|
|
1280
|
+
* routes the failure to `onFailure`, while `"propagate"` also rejects the
|
|
1281
|
+
* native `waitUntil` promise.
|
|
1282
|
+
*/
|
|
1565
1283
|
readonly mode?: "observe" | "propagate";
|
|
1284
|
+
/** Custom failure handler for the background effect. */
|
|
1566
1285
|
readonly onFailure?: (cause: Cause.Cause<E>) => Effect.Effect<void, never, R>;
|
|
1567
1286
|
}
|
|
1287
|
+
/**
|
|
1288
|
+
* Effect wrapper around `ExecutionContext` background APIs.
|
|
1289
|
+
*/
|
|
1568
1290
|
interface WorkerContextService {
|
|
1569
1291
|
readonly raw: globalThis.ExecutionContext;
|
|
1570
1292
|
waitUntil<A, E, R, R2 = never>(effect: Effect.Effect<A, E, R>, options?: WorkerContextWaitUntilOptions<E, R2>): Effect.Effect<void, never, R | R2>;
|
|
@@ -1572,20 +1294,55 @@ interface WorkerContextService {
|
|
|
1572
1294
|
readonly passThroughOnException: Effect.Effect<void>;
|
|
1573
1295
|
}
|
|
1574
1296
|
declare const WorkerContext_base: Context.ServiceClass<WorkerContext, "effect-cf/WorkerContext", WorkerContextService>;
|
|
1297
|
+
/**
|
|
1298
|
+
* Service used inside handlers to schedule background work via `waitUntil`.
|
|
1299
|
+
*
|
|
1300
|
+
* @example
|
|
1301
|
+
* ```ts
|
|
1302
|
+
* const handler = Effect.gen(function* () {
|
|
1303
|
+
* const ctx = yield* Worker.WorkerContext;
|
|
1304
|
+
* yield* ctx.waitUntil(Effect.log("flush analytics"));
|
|
1305
|
+
* return new Response("ok");
|
|
1306
|
+
* });
|
|
1307
|
+
* ```
|
|
1308
|
+
*/
|
|
1575
1309
|
declare class WorkerContext extends WorkerContext_base {}
|
|
1576
1310
|
declare const NativeRequest_base: Context.ServiceClass<NativeRequest, "effect-cf/NativeRequest", Request<unknown, CfProperties<unknown>>>;
|
|
1311
|
+
/**
|
|
1312
|
+
* Access to the incoming `Request` currently handled by a worker or Durable Object fetch.
|
|
1313
|
+
*/
|
|
1577
1314
|
declare class NativeRequest extends NativeRequest_base {}
|
|
1315
|
+
/**
|
|
1316
|
+
* Returns `true` when the request is a websocket upgrade request.
|
|
1317
|
+
*/
|
|
1578
1318
|
declare const isWebSocketUpgrade: (request: Request) => boolean;
|
|
1579
|
-
type ReservedMethodName$
|
|
1319
|
+
type ReservedMethodName$2 = ReservedMethodName$5 | "fetch" | "connect" | "queue" | "scheduled" | "tail" | "tailStream" | "test" | "trace" | "alarm" | "webSocketMessage" | "webSocketClose" | "webSocketError";
|
|
1580
1320
|
type WorkerBaseContext<ROut> = ExecutionContext | WorkerContext | WorkerEnvironment | ROut;
|
|
1581
1321
|
type WorkerFetchContext<ROut> = WorkerBaseContext<ROut> | NativeRequest | HttpServerRequest.HttpServerRequest | Scope.Scope;
|
|
1582
1322
|
type WorkerRpcContext<ROut> = WorkerBaseContext<ROut> | Scope.Scope;
|
|
1323
|
+
/**
|
|
1324
|
+
* Successful result of a worker fetch handler: either a native `Response`
|
|
1325
|
+
* (returned to Cloudflare untouched) or an Effect `HttpServerResponse`
|
|
1326
|
+
* (rendered through the Effect HTTP pipeline).
|
|
1327
|
+
*/
|
|
1583
1328
|
type WorkerFetchSuccess = Response | HttpServerResponse.HttpServerResponse;
|
|
1329
|
+
/**
|
|
1330
|
+
* Effect type for `fetch` handlers executed by {@link make}.
|
|
1331
|
+
*/
|
|
1584
1332
|
type WorkerHandler<ROut, A = WorkerFetchSuccess> = Effect.Effect<A, unknown, WorkerFetchContext<ROut>>;
|
|
1333
|
+
/**
|
|
1334
|
+
* Effect type for worker RPC handlers.
|
|
1335
|
+
*/
|
|
1585
1336
|
type WorkerRpcHandler<ROut, A = unknown> = Effect.Effect<A, unknown, WorkerRpcContext<ROut>>;
|
|
1337
|
+
/**
|
|
1338
|
+
* Shape of worker RPC handlers passed to {@link make}.
|
|
1339
|
+
*/
|
|
1586
1340
|
type WorkerRpc<ROut> = Record<string, (...args: Array<any>) => WorkerRpcHandler<ROut>>;
|
|
1587
1341
|
type WorkerRpcShape<Rpc extends WorkerRpc<ROut>, ROut> = { readonly [Key in keyof Rpc]: Rpc[Key] extends ((...args: infer Args) => Effect.Effect<infer A, unknown, WorkerRpcContext<ROut>>) ? (...args: Args) => Promise<A> : never; };
|
|
1588
|
-
type RpcHandlers$1<ROut, Api> = { readonly [Key in keyof Api as Key extends keyof WorkerEntrypoint ? never : Key extends string ? Key extends ReservedMethodName$
|
|
1342
|
+
type RpcHandlers$1<ROut, Api> = { readonly [Key in keyof Api as Key extends keyof WorkerEntrypoint ? never : Key extends string ? Key extends ReservedMethodName$2 ? never : [Api[Key]] extends [never] ? never : Api[Key] extends ((...args: Array<any>) => Promise<unknown>) ? Key : never : never]: Api[Key] extends ((...args: infer Args) => Promise<infer A>) ? (...args: Args) => WorkerRpcHandler<ROut, A> : never; };
|
|
1343
|
+
/**
|
|
1344
|
+
* Options for creating a worker class with Effect handlers.
|
|
1345
|
+
*/
|
|
1589
1346
|
interface WorkerOptions<RRuntime, REvent = never, EventLayerError = never, Rpc extends WorkerRpc<RRuntime | REvent> = Record<never, never>> {
|
|
1590
1347
|
/**
|
|
1591
1348
|
* Layer provided around each Cloudflare event handled by this Worker.
|
|
@@ -1595,71 +1352,428 @@ interface WorkerOptions<RRuntime, REvent = never, EventLayerError = never, Rpc e
|
|
|
1595
1352
|
* trace/log exporters that should flush at event completion.
|
|
1596
1353
|
*/
|
|
1597
1354
|
readonly eventLayer?: Layer.Layer<REvent, EventLayerError, WorkerBaseContext<RRuntime>>;
|
|
1355
|
+
/** Main request handler. */
|
|
1598
1356
|
readonly fetch?: Effect.Effect<WorkerFetchSuccess, unknown, WorkerFetchContext<RRuntime | REvent>>;
|
|
1357
|
+
/** Queue consumer handler invoked per message batch. */
|
|
1599
1358
|
readonly queue?: QueueHandler<RRuntime | REvent>;
|
|
1359
|
+
/** Optional RPC methods exposed as class instance methods. */
|
|
1600
1360
|
readonly rpc?: Rpc;
|
|
1601
1361
|
}
|
|
1602
1362
|
type FetchWorkerOptions<RRuntime, REvent = never, EventLayerError = never> = Omit<WorkerOptions<RRuntime, REvent, EventLayerError, Record<never, never>>, "rpc"> & {
|
|
1603
1363
|
readonly rpc?: never;
|
|
1604
1364
|
};
|
|
1365
|
+
/**
|
|
1366
|
+
* Cloudflare `WorkerEntrypoint` constructor produced by {@link make}.
|
|
1367
|
+
*/
|
|
1605
1368
|
type WorkerClass<Rpc extends WorkerRpc<ROut>, ROut> = new (ctx: globalThis.ExecutionContext, env: WorkerEnv) => WorkerEntrypoint<WorkerEnv> & {
|
|
1606
1369
|
fetch(request: Request): Promise<Response>;
|
|
1607
1370
|
queue(batch: globalThis.MessageBatch): Promise<void>;
|
|
1608
1371
|
} & WorkerRpcShape<Rpc, ROut>;
|
|
1372
|
+
/**
|
|
1373
|
+
* `ExportedHandler`-compatible fetch object produced by {@link makeFetchHandler}.
|
|
1374
|
+
*/
|
|
1609
1375
|
interface FetchHandler<Env extends WorkerEnv = WorkerEnv> {
|
|
1610
1376
|
readonly fetch: (request: Request, env: Env, ctx: globalThis.ExecutionContext) => Promise<Response>;
|
|
1611
1377
|
}
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1378
|
+
/**
|
|
1379
|
+
* Creates a Cloudflare worker class backed by a single managed Effect runtime.
|
|
1380
|
+
*
|
|
1381
|
+
* The runtime layer is built when Cloudflare constructs the class and reused
|
|
1382
|
+
* for every event the instance handles. Layer finalizers do not run when the
|
|
1383
|
+
* isolate is evicted; Cloudflare provides no shutdown hook. Use `eventLayer`
|
|
1384
|
+
* for resources that must be finalized per event.
|
|
1385
|
+
*
|
|
1386
|
+
* @example
|
|
1387
|
+
* ```ts
|
|
1388
|
+
* export default Worker.make(Layer.empty, {
|
|
1389
|
+
* fetch: Effect.succeed(new Response("ok")),
|
|
1390
|
+
* });
|
|
1391
|
+
* ```
|
|
1392
|
+
*/
|
|
1393
|
+
declare function make$10<ROut, LayerError>(layer: Layer.Layer<ROut, LayerError, ExecutionContext | WorkerContext | WorkerEnvironment>, fetch: WorkerHandler<ROut>): WorkerClass<Record<never, never>, ROut>;
|
|
1394
|
+
declare function make$10<ROut, LayerError, REvent = never, EventLayerError = never, const Rpc extends WorkerRpc<ROut | REvent> = Record<never, never>>(layer: Layer.Layer<ROut, LayerError, ExecutionContext | WorkerContext | WorkerEnvironment>, options: WorkerOptions<ROut, REvent, EventLayerError, Rpc>): WorkerClass<Rpc, ROut | REvent>;
|
|
1395
|
+
/**
|
|
1396
|
+
* Creates an `ExportedHandler`-compatible `{ fetch }` object backed by
|
|
1397
|
+
* {@link make}.
|
|
1398
|
+
*
|
|
1399
|
+
* The Effect runtime is cached per `env` identity, so the user layer builds
|
|
1400
|
+
* once per isolate instead of once per request. `ExecutionContext`-backed
|
|
1401
|
+
* services (`Worker.ExecutionContext`, `Worker.WorkerContext`) are still
|
|
1402
|
+
* provided fresh for every request. Layer finalizers do not run when the
|
|
1403
|
+
* isolate is evicted; Cloudflare provides no shutdown hook. Use `eventLayer`
|
|
1404
|
+
* for resources that must be finalized per event.
|
|
1405
|
+
*/
|
|
1615
1406
|
declare const makeFetchHandler: <ROut, LayerError, REvent = never, EventLayerError = never, Env extends WorkerEnv = WorkerEnv>(layer: Layer.Layer<ROut, LayerError, ExecutionContext | WorkerContext | WorkerEnvironment>, options: FetchWorkerOptions<ROut, REvent, EventLayerError>) => FetchHandler<Env>;
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
readonly args: Args;
|
|
1619
|
-
readonly success: Success;
|
|
1407
|
+
declare namespace DurableObjectState_d_exports {
|
|
1408
|
+
export { DurableObjectState, DurableObjectStateService, fromDurableObjectState };
|
|
1620
1409
|
}
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1410
|
+
/**
|
|
1411
|
+
* Effect-friendly wrapper around Cloudflare `DurableObjectState`.
|
|
1412
|
+
*/
|
|
1413
|
+
interface DurableObjectStateService {
|
|
1414
|
+
/** Underlying Cloudflare state instance. */
|
|
1415
|
+
readonly raw: globalThis.DurableObjectState;
|
|
1416
|
+
/** Durable Object id for the current instance. */
|
|
1417
|
+
readonly id: globalThis.DurableObjectId;
|
|
1418
|
+
/** Wrapped storage API. */
|
|
1419
|
+
readonly storage: DurableObjectStorage;
|
|
1420
|
+
/** Registers background work with Cloudflare's lifecycle. */
|
|
1421
|
+
waitUntil(promise: Promise<unknown>): Effect.Effect<void>;
|
|
1422
|
+
/**
|
|
1423
|
+
* Runs a background Effect via Cloudflare's `waitUntil` with the caller's
|
|
1424
|
+
* Effect context, mirroring `WorkerContext.waitUntil` failure modes:
|
|
1425
|
+
* `"observe"` (default) logs or routes failures to `onFailure`, while
|
|
1426
|
+
* `"propagate"` also rejects the native `waitUntil` promise.
|
|
1427
|
+
*/
|
|
1428
|
+
waitUntil<A, E, R, R2 = never>(effect: Effect.Effect<A, E, R>, options?: WorkerContextWaitUntilOptions<E, R2>): Effect.Effect<void, never, R | R2>;
|
|
1429
|
+
/**
|
|
1430
|
+
* Runs an Effect inside Cloudflare's `blockConcurrencyWhile` gate.
|
|
1431
|
+
*
|
|
1432
|
+
* Cloudflare resets a Durable Object if the callback throws/rejects, or if the
|
|
1433
|
+
* callback exceeds the platform timeout (currently documented as 30 seconds).
|
|
1434
|
+
* This safe default resolves the callback with the Effect `Exit` for typed
|
|
1435
|
+
* Effect failures and resumes that `Exit` afterward, so typed failures remain
|
|
1436
|
+
* ordinary Effect failures instead of resetting the Durable Object. Defects
|
|
1437
|
+
* and interruptions still reject the callback.
|
|
1438
|
+
*/
|
|
1439
|
+
blockConcurrencyWhile<A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, E, R>;
|
|
1440
|
+
/**
|
|
1441
|
+
* Runs an Effect inside Cloudflare's `blockConcurrencyWhile` gate and lets
|
|
1442
|
+
* Effect failures reject the callback.
|
|
1443
|
+
*
|
|
1444
|
+
* Use this only when Cloudflare's reset-on-throw behavior is intentional. The
|
|
1445
|
+
* platform also resets the Durable Object if the callback exceeds the
|
|
1446
|
+
* documented timeout (currently 30 seconds).
|
|
1447
|
+
*/
|
|
1448
|
+
blockConcurrencyWhileOrReset<A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, E, R>;
|
|
1449
|
+
/** Accepts a websocket connection for hibernation-capable Durable Objects. */
|
|
1450
|
+
acceptWebSocket(ws: DurableWebSocket, tags?: Array<string>): Effect.Effect<void>;
|
|
1451
|
+
/** Lists active sockets, optionally filtered by tag. */
|
|
1452
|
+
getWebSockets(tag?: string): Effect.Effect<Array<DurableWebSocket>>;
|
|
1453
|
+
/** Configures automatic request/response handling for sockets. */
|
|
1454
|
+
setWebSocketAutoResponse(pair?: WebSocketRequestResponsePair): Effect.Effect<void>;
|
|
1455
|
+
/** Gets the configured websocket auto-response pair. */
|
|
1456
|
+
getWebSocketAutoResponse: Effect.Effect<WebSocketRequestResponsePair | null>;
|
|
1457
|
+
/** Timestamp of the last automatic websocket response for a socket. */
|
|
1458
|
+
getWebSocketAutoResponseTimestamp(ws: DurableWebSocket): Effect.Effect<Date | null>;
|
|
1459
|
+
/** Sets the timeout for hibernatable websocket events. */
|
|
1460
|
+
setHibernatableWebSocketEventTimeout(timeoutMs?: number): Effect.Effect<void>;
|
|
1461
|
+
/** Gets the timeout for hibernatable websocket events. */
|
|
1462
|
+
getHibernatableWebSocketEventTimeout: Effect.Effect<number | null>;
|
|
1463
|
+
/** Reads tags attached to a websocket. */
|
|
1464
|
+
getTags(ws: DurableWebSocket): Effect.Effect<Array<string>>;
|
|
1465
|
+
/**
|
|
1466
|
+
* Forcibly resets the Durable Object. Cloudflare logs an uncaught Error using
|
|
1467
|
+
* the optional reason, and the method is not available in `wrangler dev` local
|
|
1468
|
+
* development according to the Durable Object State docs.
|
|
1469
|
+
*/
|
|
1470
|
+
abort(reason?: string): Effect.Effect<void>;
|
|
1627
1471
|
}
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1472
|
+
declare const DurableObjectState_base: Context.ServiceClass<DurableObjectState, "effect-cf/DurableObjectState", DurableObjectStateService>;
|
|
1473
|
+
/**
|
|
1474
|
+
* Context tag for accessing the current Durable Object state service.
|
|
1475
|
+
*/
|
|
1476
|
+
declare class DurableObjectState extends DurableObjectState_base {}
|
|
1477
|
+
/**
|
|
1478
|
+
* Wraps a native Cloudflare `DurableObjectState` as a {@link DurableObjectStateService}.
|
|
1479
|
+
*/
|
|
1480
|
+
declare const fromDurableObjectState: (state: globalThis.DurableObjectState) => DurableObjectStateService;
|
|
1481
|
+
declare namespace CloudflareOtlp_d_exports {
|
|
1482
|
+
export { DurableObjectLayerOptions, LayerOptions$10 as LayerOptions, ResourceOptions, Serialization, Signal, WorkerLayerOptions, layer$10 as layer, layerDurableObject, layerJson, layerProtobuf, layerWorker };
|
|
1633
1483
|
}
|
|
1634
|
-
|
|
1635
|
-
|
|
1484
|
+
/** Telemetry signal groups supported by the Cloudflare OTLP layers. */
|
|
1485
|
+
type Signal = "logs" | "traces" | "metrics";
|
|
1486
|
+
/** OTLP payload serialization used by the Effect OTLP exporters. */
|
|
1487
|
+
type Serialization = "json" | "protobuf";
|
|
1488
|
+
/**
|
|
1489
|
+
* Resource metadata shared by Worker and Durable Object OTLP layers.
|
|
1490
|
+
*
|
|
1491
|
+
* Precedence follows Effect's `OtlpResource.fromConfig`: explicit
|
|
1492
|
+
* `serviceName`/`serviceVersion` win over matching explicit `attributes`, and
|
|
1493
|
+
* explicit attributes win over `OTEL_SERVICE_NAME`, `OTEL_SERVICE_VERSION`, and
|
|
1494
|
+
* `OTEL_RESOURCE_ATTRIBUTES`. Omit an option to let operators set it from the
|
|
1495
|
+
* environment.
|
|
1496
|
+
*/
|
|
1497
|
+
interface ResourceOptions {
|
|
1498
|
+
/** Explicit service name. Takes precedence over OTEL environment variables. */
|
|
1499
|
+
readonly serviceName?: string;
|
|
1500
|
+
/** Explicit service version. Takes precedence over OTEL environment variables. */
|
|
1501
|
+
readonly serviceVersion?: string;
|
|
1502
|
+
/** Additional resource attributes attached to exported telemetry. */
|
|
1503
|
+
readonly attributes?: Record<string, unknown>;
|
|
1504
|
+
}
|
|
1505
|
+
/** Options shared by all Cloudflare OTLP telemetry layers. */
|
|
1506
|
+
interface LayerOptions$10 {
|
|
1507
|
+
/**
|
|
1508
|
+
* Telemetry signals to export. Defaults to logs, traces, and metrics.
|
|
1509
|
+
*
|
|
1510
|
+
* Each selected signal is still controlled by standard OTEL exporter config,
|
|
1511
|
+
* such as `OTEL_TRACES_EXPORTER=otlp`.
|
|
1512
|
+
*/
|
|
1513
|
+
readonly signals?: ReadonlyArray<Signal>;
|
|
1514
|
+
/** OTLP payload serialization. Defaults to protobuf. */
|
|
1515
|
+
readonly serialization?: Serialization;
|
|
1516
|
+
/** Resource metadata forwarded to Effect's OTLP resource resolver. */
|
|
1517
|
+
readonly resource?: ResourceOptions;
|
|
1518
|
+
/**
|
|
1519
|
+
* Explicit headers for every selected signal.
|
|
1520
|
+
*
|
|
1521
|
+
* When omitted, Effect reads `OTEL_EXPORTER_OTLP_HEADERS` and the
|
|
1522
|
+
* signal-specific `OTEL_EXPORTER_OTLP_*_HEADERS` variables.
|
|
1523
|
+
*/
|
|
1524
|
+
readonly headers?: Headers$1.Input;
|
|
1525
|
+
/** Exclude log records emitted for spans when exporting logs. */
|
|
1526
|
+
readonly loggerExcludeLogSpans?: boolean;
|
|
1527
|
+
/** Merge the OTLP logger with existing loggers instead of replacing them. */
|
|
1528
|
+
readonly loggerMergeWithExisting?: boolean;
|
|
1529
|
+
/** Custom trace context lookup used by the Effect OTLP tracer. */
|
|
1530
|
+
readonly tracerContext?: <X>(primitive: Tracer.EffectPrimitive<X>, span: Tracer.AnySpan) => X;
|
|
1636
1531
|
}
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
readonly rpc: Handlers$2<ROut | REvent, Self>;
|
|
1532
|
+
/** Resource metadata specific to Cloudflare Workers. */
|
|
1533
|
+
interface WorkerLayerOptions extends LayerOptions$10 {
|
|
1534
|
+
/** Cloudflare Worker name to attach as `cloudflare.worker.name`. */
|
|
1535
|
+
readonly workerName?: string;
|
|
1642
1536
|
}
|
|
1643
|
-
|
|
1644
|
-
|
|
1537
|
+
/** Resource metadata specific to Cloudflare Durable Objects. */
|
|
1538
|
+
interface DurableObjectLayerOptions extends LayerOptions$10 {
|
|
1539
|
+
/** Durable Object class name to attach as `cloudflare.durable_object.class`. */
|
|
1540
|
+
readonly className?: string;
|
|
1541
|
+
/**
|
|
1542
|
+
* Include the Durable Object id as `cloudflare.durable_object.id`.
|
|
1543
|
+
*
|
|
1544
|
+
* This is disabled by default because object ids can be high-cardinality.
|
|
1545
|
+
*/
|
|
1546
|
+
readonly includeObjectId?: boolean;
|
|
1547
|
+
}
|
|
1548
|
+
/**
|
|
1549
|
+
* Base OTLP telemetry layer for Cloudflare-compatible runtimes.
|
|
1550
|
+
*
|
|
1551
|
+
* Standard OpenTelemetry environment variables are resolved by Effect's OTLP
|
|
1552
|
+
* layers. In Cloudflare Workers and Durable Objects, the current `env` object is
|
|
1553
|
+
* installed as the primary `ConfigProvider`; outside Cloudflare, the ambient
|
|
1554
|
+
* Effect `ConfigProvider` remains the fallback.
|
|
1555
|
+
*
|
|
1556
|
+
* The layer provides {@link OtlpExporter.Flusher} for draining buffered
|
|
1557
|
+
* telemetry before the isolate freezes.
|
|
1558
|
+
*/
|
|
1559
|
+
declare const layer$10: (options?: LayerOptions$10) => Layer.Layer<OtlpExporter.Flusher>;
|
|
1560
|
+
/** Base OTLP telemetry layer forced to JSON serialization. */
|
|
1561
|
+
declare const layerJson: (options?: Omit<LayerOptions$10, "serialization">) => Layer.Layer<OtlpExporter.Flusher>;
|
|
1562
|
+
/** Base OTLP telemetry layer forced to protobuf serialization. */
|
|
1563
|
+
declare const layerProtobuf: (options?: Omit<LayerOptions$10, "serialization">) => Layer.Layer<OtlpExporter.Flusher>;
|
|
1564
|
+
/**
|
|
1565
|
+
* OTLP layer with Cloudflare Worker resource attributes.
|
|
1566
|
+
*
|
|
1567
|
+
* Provide this layer at runtime scope for long-lived metrics aggregation, or at
|
|
1568
|
+
* handler scope when traces/logs should flush as the Cloudflare event finishes.
|
|
1569
|
+
*/
|
|
1570
|
+
declare const layerWorker: (options?: WorkerLayerOptions) => Layer.Layer<OtlpExporter.Flusher>;
|
|
1571
|
+
/**
|
|
1572
|
+
* OTLP layer with Cloudflare Durable Object resource attributes.
|
|
1573
|
+
*
|
|
1574
|
+
* The layer reads {@link DurableObjectState} so it can optionally include the
|
|
1575
|
+
* Durable Object id. Prefer leaving `includeObjectId` disabled unless the
|
|
1576
|
+
* backend can tolerate high-cardinality resource attributes.
|
|
1577
|
+
*/
|
|
1578
|
+
declare const layerDurableObject: (options?: DurableObjectLayerOptions) => Layer.Layer<OtlpExporter.Flusher, never, DurableObjectState>;
|
|
1579
|
+
declare namespace ContainerNamespace_d_exports {
|
|
1580
|
+
export { ContainerInstanceClient, ContainerNamespace, ContainerNamespaceClient, ContainerNamespaceDefinition, ContainerNamespaceResource, ContainerNamespaceService, ContainerNamespaceStaticClient, ContainerOperationError, ContainerReadinessOptions, ContainerSignal, ContainerStartAndWaitForPortsOptions, ContainerStartOptions, ContainerState, ContainerStopSignal, ContainerStub, ContainerStubOf, ContainerWaitOptions, LayerOptions$9 as LayerOptions, Tag$9 as Tag, TagClass$8 as TagClass, isContainerNamespaceResource, layer$9 as layer, make$9 as make, makeClient$7 as makeClient };
|
|
1581
|
+
}
|
|
1582
|
+
/** Named signal accepted by Cloudflare Container instances. */
|
|
1583
|
+
type ContainerSignal = "SIGKILL" | "SIGINT" | "SIGTERM";
|
|
1584
|
+
/** Named or numeric signal accepted by Container `stop()`. */
|
|
1585
|
+
type ContainerStopSignal = ContainerSignal | number;
|
|
1586
|
+
/** Per-instance Container startup configuration. */
|
|
1587
|
+
interface ContainerStartOptions {
|
|
1588
|
+
readonly envVars?: Record<string, string>;
|
|
1589
|
+
readonly entrypoint?: Array<string>;
|
|
1590
|
+
readonly enableInternet?: boolean;
|
|
1591
|
+
readonly labels?: Record<string, string>;
|
|
1592
|
+
}
|
|
1593
|
+
/** Serializable retry settings used while starting a Container. */
|
|
1594
|
+
interface ContainerWaitOptions {
|
|
1595
|
+
readonly portToCheck: number;
|
|
1596
|
+
readonly retries?: number;
|
|
1597
|
+
readonly waitInterval?: number;
|
|
1598
|
+
}
|
|
1599
|
+
/** Serializable timeout settings used while waiting for Container ports. */
|
|
1600
|
+
interface ContainerReadinessOptions {
|
|
1601
|
+
readonly instanceGetTimeoutMS?: number;
|
|
1602
|
+
readonly portReadyTimeoutMS?: number;
|
|
1603
|
+
readonly waitInterval?: number;
|
|
1604
|
+
}
|
|
1605
|
+
/** Options for starting a Container and waiting for its ports. */
|
|
1606
|
+
interface ContainerStartAndWaitForPortsOptions {
|
|
1607
|
+
readonly startOptions?: ContainerStartOptions;
|
|
1608
|
+
readonly ports?: number | Array<number>;
|
|
1609
|
+
readonly cancellationOptions?: ContainerReadinessOptions;
|
|
1610
|
+
}
|
|
1611
|
+
/** Serializable state reported by a Cloudflare Container instance. */
|
|
1612
|
+
declare const ContainerState: Schema.Union<readonly [Schema.Struct<{
|
|
1613
|
+
readonly lastChange: Schema.Finite;
|
|
1614
|
+
readonly status: Schema.Literals<readonly ["running", "stopping", "stopped", "healthy"]>;
|
|
1615
|
+
}>, Schema.Struct<{
|
|
1616
|
+
readonly lastChange: Schema.Finite;
|
|
1617
|
+
readonly status: Schema.Literal<"stopped_with_code">;
|
|
1618
|
+
readonly exitCode: Schema.optionalKey<Schema.Int>;
|
|
1619
|
+
}>]>;
|
|
1620
|
+
type ContainerState = typeof ContainerState.Type;
|
|
1621
|
+
/**
|
|
1622
|
+
* Native Container stub shape exposed by a Container namespace binding.
|
|
1623
|
+
*
|
|
1624
|
+
* This is structural so using Container bindings does not make
|
|
1625
|
+
* `@cloudflare/containers` a runtime dependency of effect-cf.
|
|
1626
|
+
*/
|
|
1627
|
+
interface ContainerStub {
|
|
1628
|
+
fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
|
|
1629
|
+
getState(): Promise<ContainerState>;
|
|
1630
|
+
start(options?: ContainerStartOptions, waitOptions?: ContainerWaitOptions): Promise<void>;
|
|
1631
|
+
startAndWaitForPorts(options?: ContainerStartAndWaitForPortsOptions): Promise<void>;
|
|
1632
|
+
waitForPort(options: ContainerWaitOptions): Promise<number>;
|
|
1633
|
+
stop(signal?: ContainerStopSignal): Promise<void>;
|
|
1634
|
+
destroy(): Promise<void>;
|
|
1635
|
+
setAllowedHosts(hosts: Array<string>): Promise<void>;
|
|
1636
|
+
setDeniedHosts(hosts: Array<string>): Promise<void>;
|
|
1637
|
+
allowHost(hostname: string): Promise<void>;
|
|
1638
|
+
denyHost(hostname: string): Promise<void>;
|
|
1639
|
+
removeAllowedHost(hostname: string): Promise<void>;
|
|
1640
|
+
removeDeniedHost(hostname: string): Promise<void>;
|
|
1641
|
+
}
|
|
1642
|
+
/** Native Container namespace binding shape. */
|
|
1643
|
+
interface ContainerNamespaceResource {
|
|
1644
|
+
getByName(name: string, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions): ContainerStub;
|
|
1645
|
+
}
|
|
1646
|
+
/** Exact native stub type produced by a Container namespace binding. */
|
|
1647
|
+
type ContainerStubOf<Namespace extends ContainerNamespaceResource> = ReturnType<Namespace["getByName"]>;
|
|
1648
|
+
/** Container namespace binding metadata. */
|
|
1649
|
+
interface ContainerNamespaceDefinition {
|
|
1650
|
+
/** Binding name as configured in `wrangler.jsonc`. */
|
|
1651
|
+
readonly binding: string;
|
|
1652
|
+
}
|
|
1653
|
+
declare const ContainerOperationError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
1654
|
+
readonly _tag: "ContainerOperationError";
|
|
1655
|
+
} & Readonly<A>;
|
|
1656
|
+
/** Failure raised when invoking a named Container operation. */
|
|
1657
|
+
declare class ContainerOperationError extends ContainerOperationError_base<{
|
|
1658
|
+
readonly binding: string;
|
|
1659
|
+
readonly instance: string;
|
|
1660
|
+
readonly operation: string;
|
|
1661
|
+
readonly cause: unknown;
|
|
1662
|
+
}> {
|
|
1663
|
+
get message(): string;
|
|
1664
|
+
}
|
|
1665
|
+
/** Effect-wrapped client for one named Container instance. */
|
|
1666
|
+
interface ContainerInstanceClient<Stub extends ContainerStub = ContainerStub> {
|
|
1667
|
+
readonly rawUnsafe: Effect.Effect<Stub, ContainerOperationError>;
|
|
1668
|
+
readonly state: Effect.Effect<ContainerState, ContainerOperationError>;
|
|
1669
|
+
readonly fetch: (input: RequestInfo | URL, init?: RequestInit) => Effect.Effect<Response, ContainerOperationError>;
|
|
1670
|
+
readonly start: (options?: ContainerStartOptions, waitOptions?: ContainerWaitOptions) => Effect.Effect<void, ContainerOperationError>;
|
|
1671
|
+
readonly startAndWaitForPorts: (options?: ContainerStartAndWaitForPortsOptions) => Effect.Effect<void, ContainerOperationError>;
|
|
1672
|
+
readonly waitForPort: (options: ContainerWaitOptions) => Effect.Effect<number, ContainerOperationError>;
|
|
1673
|
+
readonly stop: (signal?: ContainerStopSignal) => Effect.Effect<void, ContainerOperationError>;
|
|
1674
|
+
readonly destroy: Effect.Effect<void, ContainerOperationError>;
|
|
1675
|
+
readonly setAllowedHosts: (hosts: ReadonlyArray<string>) => Effect.Effect<void, ContainerOperationError>;
|
|
1676
|
+
readonly setDeniedHosts: (hosts: ReadonlyArray<string>) => Effect.Effect<void, ContainerOperationError>;
|
|
1677
|
+
readonly allowHost: (hostname: string) => Effect.Effect<void, ContainerOperationError>;
|
|
1678
|
+
readonly denyHost: (hostname: string) => Effect.Effect<void, ContainerOperationError>;
|
|
1679
|
+
readonly removeAllowedHost: (hostname: string) => Effect.Effect<void, ContainerOperationError>;
|
|
1680
|
+
readonly removeDeniedHost: (hostname: string) => Effect.Effect<void, ContainerOperationError>;
|
|
1681
|
+
}
|
|
1682
|
+
/** Effect client for a Container namespace binding. */
|
|
1683
|
+
interface ContainerNamespaceClient<Namespace extends ContainerNamespaceResource = ContainerNamespaceResource> {
|
|
1684
|
+
readonly definition: ContainerNamespaceDefinition;
|
|
1685
|
+
readonly getByName: (name: string, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions) => Effect.Effect<ContainerInstanceClient<ContainerStubOf<Namespace>>, ContainerOperationError>;
|
|
1686
|
+
readonly byName: (name: string, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions) => ContainerInstanceClient<ContainerStubOf<Namespace>>;
|
|
1687
|
+
readonly rawUnsafe: Effect.Effect<Namespace>;
|
|
1688
|
+
}
|
|
1689
|
+
type ContainerNamespaceStaticClient<R, Namespace extends ContainerNamespaceResource = ContainerNamespaceResource> = {
|
|
1690
|
+
readonly getByName: (name: string, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions) => Effect.Effect<ContainerInstanceClient<ContainerStubOf<Namespace>>, ContainerOperationError, R>;
|
|
1691
|
+
readonly byName: (name: string, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions) => {
|
|
1692
|
+
readonly state: Effect.Effect<ContainerState, ContainerOperationError, R>;
|
|
1693
|
+
readonly fetch: (input: RequestInfo | URL, init?: RequestInit) => Effect.Effect<Response, ContainerOperationError, R>;
|
|
1694
|
+
readonly start: (options?: ContainerStartOptions, waitOptions?: ContainerWaitOptions) => Effect.Effect<void, ContainerOperationError, R>;
|
|
1695
|
+
readonly startAndWaitForPorts: (options?: ContainerStartAndWaitForPortsOptions) => Effect.Effect<void, ContainerOperationError, R>;
|
|
1696
|
+
readonly waitForPort: (options: ContainerWaitOptions) => Effect.Effect<number, ContainerOperationError, R>;
|
|
1697
|
+
readonly stop: (signal?: ContainerStopSignal) => Effect.Effect<void, ContainerOperationError, R>;
|
|
1698
|
+
readonly destroy: Effect.Effect<void, ContainerOperationError, R>;
|
|
1699
|
+
readonly setAllowedHosts: (hosts: ReadonlyArray<string>) => Effect.Effect<void, ContainerOperationError, R>;
|
|
1700
|
+
readonly setDeniedHosts: (hosts: ReadonlyArray<string>) => Effect.Effect<void, ContainerOperationError, R>;
|
|
1701
|
+
readonly allowHost: (hostname: string) => Effect.Effect<void, ContainerOperationError, R>;
|
|
1702
|
+
readonly denyHost: (hostname: string) => Effect.Effect<void, ContainerOperationError, R>;
|
|
1703
|
+
readonly removeAllowedHost: (hostname: string) => Effect.Effect<void, ContainerOperationError, R>;
|
|
1704
|
+
readonly removeDeniedHost: (hostname: string) => Effect.Effect<void, ContainerOperationError, R>;
|
|
1705
|
+
readonly rawUnsafe: Effect.Effect<ContainerStubOf<Namespace>, ContainerOperationError, R>;
|
|
1706
|
+
};
|
|
1707
|
+
readonly rawUnsafe: Effect.Effect<Namespace, never, R>;
|
|
1708
|
+
};
|
|
1709
|
+
type LayerOptions$9 = {
|
|
1710
|
+
readonly binding: string;
|
|
1711
|
+
};
|
|
1712
|
+
interface TagClass$8<Self, Id extends string, Namespace extends ContainerNamespaceResource = ContainerNamespaceResource> extends Context.ServiceClass<Self, `effect-cf/Container/${Id}`, ContainerNamespaceClient<Namespace>>, ContainerNamespaceStaticClient<Self, Namespace> {
|
|
1645
1713
|
readonly id: Id;
|
|
1646
|
-
readonly
|
|
1647
|
-
|
|
1648
|
-
|
|
1714
|
+
readonly layer: (options: LayerOptions$9) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
1715
|
+
}
|
|
1716
|
+
declare const isContainerNamespaceResource: (value: unknown) => value is ContainerNamespaceResource;
|
|
1717
|
+
declare const makeClient$7: (definition: ContainerNamespaceDefinition) => <Namespace extends ContainerNamespaceResource>(namespace: Namespace) => ContainerNamespaceClient<Namespace>;
|
|
1718
|
+
declare const layer$9: <Self, Namespace extends ContainerNamespaceResource>(tag: Context.Service<Self, ContainerNamespaceClient<Namespace>>, definition: ContainerNamespaceDefinition) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
1719
|
+
declare const make$9: <Id extends string>(id: Id) => TagClass$8<ContainerNamespaceService<Id>, Id, ContainerNamespaceResource>;
|
|
1720
|
+
declare const ContainerNamespaceServiceTypeId: unique symbol;
|
|
1721
|
+
/** Nominal service marker for Container namespaces created with {@link make}. */
|
|
1722
|
+
interface ContainerNamespaceService<Id extends string> {
|
|
1723
|
+
readonly [ContainerNamespaceServiceTypeId]: {
|
|
1724
|
+
readonly id: Id;
|
|
1725
|
+
};
|
|
1726
|
+
}
|
|
1727
|
+
/** Creates a typed Effect service for a Cloudflare Container namespace. */
|
|
1728
|
+
declare const Tag$9: <Self, Namespace extends ContainerNamespaceResource = ContainerNamespaceResource>() => <Id extends string>(id: Id) => TagClass$8<Self, Id, Namespace>;
|
|
1729
|
+
declare const ContainerNamespace: typeof Tag$9;
|
|
1730
|
+
declare namespace D1_d_exports {
|
|
1731
|
+
export { D1Definition, D1Service, D1SqlLayerOptions, Service, TypeId$1 as TypeId, make$8 as make };
|
|
1732
|
+
}
|
|
1733
|
+
declare const TypeId$1: "~effect-cf/D1";
|
|
1734
|
+
type TypeId$1 = typeof TypeId$1;
|
|
1735
|
+
/** Typed D1 binding definition. */
|
|
1736
|
+
interface D1Definition {
|
|
1737
|
+
/** Binding name as configured in `wrangler.jsonc`. */
|
|
1738
|
+
readonly binding: string;
|
|
1739
|
+
}
|
|
1740
|
+
/** Options forwarded to `@effect/sql-d1` when building a SQL client layer. */
|
|
1741
|
+
type D1SqlLayerOptions = Omit<D1Client.D1ClientConfig, "db">;
|
|
1742
|
+
declare const D1ServiceTypeId: unique symbol;
|
|
1743
|
+
/** Nominal service marker for D1 services created with {@link make}. */
|
|
1744
|
+
interface D1Service<Id extends string> {
|
|
1745
|
+
readonly [D1ServiceTypeId]: {
|
|
1746
|
+
readonly id: Id;
|
|
1747
|
+
};
|
|
1748
|
+
}
|
|
1749
|
+
/**
|
|
1750
|
+
* Creates a typed D1 service tag plus Effect helpers.
|
|
1751
|
+
*/
|
|
1752
|
+
declare const make$8: <Id extends string>(id: Id, definition: D1Definition) => BindingService<D1Service<Id>, Id, D1Database> & {
|
|
1753
|
+
"~effect-cf/D1": "~effect-cf/D1";
|
|
1754
|
+
definition: D1Definition;
|
|
1755
|
+
sqlLayer: (options?: D1SqlLayerOptions) => Layer.Layer<D1Client.D1Client | SqlClient.SqlClient, Config.ConfigError | BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
1649
1756
|
};
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1757
|
+
/**
|
|
1758
|
+
* Builds a D1 service around a Cloudflare D1 database binding.
|
|
1759
|
+
*
|
|
1760
|
+
* The returned service exposes the raw `D1Database` binding and `sqlLayer(...)`
|
|
1761
|
+
* for providing `effect/unstable/sql` via `@effect/sql-d1`.
|
|
1762
|
+
*
|
|
1763
|
+
* @example
|
|
1764
|
+
* ```ts
|
|
1765
|
+
* class TodoDatabase extends D1.Service<TodoDatabase>()("TodoDatabase", {
|
|
1766
|
+
* binding: "TODO_DB",
|
|
1767
|
+
* }) {}
|
|
1768
|
+
*
|
|
1769
|
+
* const SqlLive = TodoDatabase.sqlLayer();
|
|
1770
|
+
* ```
|
|
1771
|
+
*/
|
|
1772
|
+
declare const Service: <Self>() => <Id extends string>(id: Id, definition: D1Definition) => BindingService<Self, Id, D1Database> & {
|
|
1773
|
+
"~effect-cf/D1": "~effect-cf/D1";
|
|
1774
|
+
definition: D1Definition;
|
|
1775
|
+
sqlLayer: (options?: D1SqlLayerOptions) => Layer.Layer<D1Client.D1Client | SqlClient.SqlClient, Config.ConfigError | BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
1660
1776
|
};
|
|
1661
|
-
declare const implement$4: <ROut, const Self extends Definition$5.Any>(_definition: Self, handlers: Handlers$2<ROut, Self>) => Handlers$2<ROut, Self>;
|
|
1662
|
-
type HandlerEffect$2<ROut, Self extends Definition$5.Any, Key extends keyof Self["methods"]> = WorkerRpcHandler<ROut, Method$3.Success<Self["methods"][Key]>>;
|
|
1663
1777
|
declare namespace DurableObjectNamespace_d_exports {
|
|
1664
1778
|
export { DurableObjectFetchError, DurableObjectNamespaceBindingDefinition, DurableObjectNamespaceClient, DurableObjectNamespaceDefinition, DurableObjectNamespaceEffectClient, DurableObjectNamespaceStaticClient, DurableObjectRpcError, DurableObjectStubClient, isDurableObjectNamespaceClient, layer$8 as layer, makeClient$6 as makeClient, makeDirectMethods };
|
|
1665
1779
|
}
|
|
@@ -1667,11 +1781,11 @@ interface DurableObjectFetcher {
|
|
|
1667
1781
|
fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
|
|
1668
1782
|
}
|
|
1669
1783
|
type RpcClient<Api> = { readonly [Key in keyof Api as Key extends string ? Api[Key] extends ((...args: Array<any>) => unknown) ? Key : never : never]: Api[Key]; };
|
|
1670
|
-
type ReservedMethodName$
|
|
1784
|
+
type ReservedMethodName$1 = ReservedMethodName | "fetch";
|
|
1671
1785
|
/**
|
|
1672
1786
|
* Cloudflare Durable Object stub, optionally enriched with RPC methods.
|
|
1673
1787
|
*/
|
|
1674
|
-
type DurableObjectStubClient<Api extends object> = DurableObjectFetcher & RpcClient<Provider<Api, ReservedMethodName$
|
|
1788
|
+
type DurableObjectStubClient<Api extends object> = DurableObjectFetcher & RpcClient<Provider<Api, ReservedMethodName$1>> & {
|
|
1675
1789
|
readonly id: globalThis.DurableObjectId;
|
|
1676
1790
|
readonly name?: string;
|
|
1677
1791
|
};
|
|
@@ -1701,7 +1815,7 @@ interface DurableObjectNamespaceDefinition {
|
|
|
1701
1815
|
/**
|
|
1702
1816
|
* Namespace binding metadata with optional RPC schema.
|
|
1703
1817
|
*/
|
|
1704
|
-
interface DurableObjectNamespaceBindingDefinition<Definition extends Definition$
|
|
1818
|
+
interface DurableObjectNamespaceBindingDefinition<Definition extends Definition$3.Any | undefined = undefined> {
|
|
1705
1819
|
/** Binding name as configured in `wrangler.jsonc`. */
|
|
1706
1820
|
readonly binding: string;
|
|
1707
1821
|
/** Optional RPC schema used for argument/result encoding. */
|
|
@@ -1717,7 +1831,9 @@ declare class DurableObjectRpcError extends DurableObjectRpcError_base<{
|
|
|
1717
1831
|
readonly binding: string;
|
|
1718
1832
|
readonly method: string;
|
|
1719
1833
|
readonly cause: unknown;
|
|
1720
|
-
}> {
|
|
1834
|
+
}> {
|
|
1835
|
+
get message(): string;
|
|
1836
|
+
}
|
|
1721
1837
|
declare const DurableObjectFetchError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
1722
1838
|
readonly _tag: "DurableObjectFetchError";
|
|
1723
1839
|
} & Readonly<A>;
|
|
@@ -1727,22 +1843,24 @@ declare const DurableObjectFetchError_base: new <A extends Record<string, any> =
|
|
|
1727
1843
|
declare class DurableObjectFetchError extends DurableObjectFetchError_base<{
|
|
1728
1844
|
readonly binding: string;
|
|
1729
1845
|
readonly cause: unknown;
|
|
1730
|
-
}> {
|
|
1846
|
+
}> {
|
|
1847
|
+
get message(): string;
|
|
1848
|
+
}
|
|
1731
1849
|
type StubMethodKey<Api> = AsyncMethodKey<Api>;
|
|
1732
1850
|
type StubMethodArgs<Api, Method extends keyof Api> = AsyncMethodArgs<Api, Method>;
|
|
1733
1851
|
type StubMethodSuccess<Api, Method extends keyof Api> = AsyncMethodSuccess<Api, Method>;
|
|
1734
1852
|
type StubMethodCloudflareReturn<Api, Method extends keyof Api> = AsyncMethodCloudflareReturn<Api, Method>;
|
|
1735
1853
|
type StubCall<R, Api extends object> = <Method extends StubMethodKey<Api>>(stub: DurableObjectStubClient<Api>, method: Method, ...args: StubMethodArgs<Api, Method>) => Effect.Effect<StubMethodSuccess<Api, Method>, DurableObjectRpcError, R>;
|
|
1736
|
-
type DefinitionNamespaceDirectMethods<R, Api extends object, Definition extends Definition$
|
|
1737
|
-
type DefinitionDurableObjectDirectClient<R, Definition extends Definition$
|
|
1854
|
+
type DefinitionNamespaceDirectMethods<R, Api extends object, Definition extends Definition$3.Any> = { readonly [Method in Definition$7.MethodNames<Definition>]: (stub: DurableObjectStubClient<Api>, ...args: Method$3.Args<Definition["methods"][Method]>) => Effect.Effect<Method$3.Success<Definition["methods"][Method]>, DurableObjectRpcError, R>; };
|
|
1855
|
+
type DefinitionDurableObjectDirectClient<R, Definition extends Definition$3.Any> = {
|
|
1738
1856
|
readonly fetch: (input: RequestInfo | URL, init?: RequestInit) => Effect.Effect<globalThis.Response, DurableObjectFetchError, R>;
|
|
1739
|
-
} & { readonly [Method in Definition$
|
|
1740
|
-
type DefinitionNamespaceDirectClientMethods<R, Definition extends Definition$
|
|
1857
|
+
} & { readonly [Method in Definition$7.MethodNames<Definition>]: (...args: Method$3.Args<Definition["methods"][Method]>) => Effect.Effect<Method$3.Success<Definition["methods"][Method]>, DurableObjectRpcError, R>; };
|
|
1858
|
+
type DefinitionNamespaceDirectClientMethods<R, Definition extends Definition$3.Any> = {
|
|
1741
1859
|
readonly byName: (name: string, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions) => DefinitionDurableObjectDirectClient<R, Definition>;
|
|
1742
1860
|
readonly byId: (id: globalThis.DurableObjectId, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions) => DefinitionDurableObjectDirectClient<R, Definition>;
|
|
1743
1861
|
};
|
|
1744
|
-
type DirectMethods<R, Api extends object, Definition> = Definition extends Definition$
|
|
1745
|
-
type DurableObjectNamespaceEffectClient<Api extends object, Definition extends Definition$
|
|
1862
|
+
type DirectMethods<R, Api extends object, Definition> = Definition extends Definition$3.Any ? DefinitionNamespaceDirectMethods<R, Api, Definition> & DefinitionNamespaceDirectClientMethods<R, Definition> : {};
|
|
1863
|
+
type DurableObjectNamespaceEffectClient<Api extends object, Definition extends Definition$3.Any | undefined = undefined> = DirectMethods<never, Api, Definition> & {
|
|
1746
1864
|
/** Creates a globally unique Durable Object id. */
|
|
1747
1865
|
readonly newUniqueId: (options?: globalThis.DurableObjectNamespaceNewUniqueIdOptions) => Effect.Effect<globalThis.DurableObjectId>;
|
|
1748
1866
|
/** Deterministically maps a name to a Durable Object id. */
|
|
@@ -1849,9 +1967,9 @@ type DurableObjectNamespaceEffectClient<Api extends object, Definition extends D
|
|
|
1849
1967
|
* Prefer the typed helpers above unless Cloudflare exposes a platform feature
|
|
1850
1968
|
* that is not wrapped by effect-cf yet.
|
|
1851
1969
|
*/
|
|
1852
|
-
readonly
|
|
1970
|
+
readonly rawUnsafe: Effect.Effect<DurableObjectNamespaceClient<Api>>;
|
|
1853
1971
|
};
|
|
1854
|
-
type DurableObjectNamespaceStaticClient<R, Api extends object, Definition extends Definition$
|
|
1972
|
+
type DurableObjectNamespaceStaticClient<R, Api extends object, Definition extends Definition$3.Any | undefined = undefined> = DirectMethods<R, Api, Definition> & {
|
|
1855
1973
|
readonly newUniqueId: (options?: globalThis.DurableObjectNamespaceNewUniqueIdOptions) => Effect.Effect<globalThis.DurableObjectId, never, R>;
|
|
1856
1974
|
readonly idFromName: (name: string) => Effect.Effect<globalThis.DurableObjectId, never, R>;
|
|
1857
1975
|
readonly idFromString: (id: string) => Effect.Effect<globalThis.DurableObjectId, never, R>;
|
|
@@ -1862,97 +1980,98 @@ type DurableObjectNamespaceStaticClient<R, Api extends object, Definition extend
|
|
|
1862
1980
|
readonly rpc: <Method extends StubMethodKey<Api>>(stub: DurableObjectStubClient<Api>, method: Method, ...args: StubMethodArgs<Api, Method>) => Effect.Effect<StubMethodCloudflareReturn<Api, Method>, DurableObjectRpcError, R>;
|
|
1863
1981
|
readonly call: <Method extends StubMethodKey<Api>>(stub: DurableObjectStubClient<Api>, method: Method, ...args: StubMethodArgs<Api, Method>) => Effect.Effect<StubMethodSuccess<Api, Method>, DurableObjectRpcError, R>;
|
|
1864
1982
|
readonly scopedCall: <Method extends StubMethodKey<Api>>(stub: DurableObjectStubClient<Api>, method: Method, ...args: StubMethodArgs<Api, Method>) => Effect.Effect<Awaited<StubMethodSuccess<Api, Method>>, unknown, Scope.Scope | R>;
|
|
1865
|
-
readonly
|
|
1983
|
+
readonly rawUnsafe: () => Effect.Effect<DurableObjectNamespaceClient<Api>, never, R>;
|
|
1866
1984
|
};
|
|
1867
1985
|
declare const isDurableObjectNamespaceClient: <Api extends object>(value: unknown) => value is DurableObjectNamespaceClient<Api>;
|
|
1868
|
-
declare const makeClient$6: <Api extends object, const Definition extends Definition$
|
|
1869
|
-
declare const layer$8: <Self, Api extends object, const Definition extends Definition$
|
|
1870
|
-
declare const makeDirectMethods: <R, Api extends object, Definition extends Definition$
|
|
1986
|
+
declare const makeClient$6: <Api extends object, const Definition extends Definition$3.Any | undefined = undefined>(definition: DurableObjectNamespaceBindingDefinition<Definition>) => ((namespace: DurableObjectNamespaceClient<Api>) => DurableObjectNamespaceEffectClient<Api, Definition>);
|
|
1987
|
+
declare const layer$8: <Self, Api extends object, const Definition extends Definition$3.Any | undefined = undefined>(tag: Context.Service<Self, DurableObjectNamespaceEffectClient<Api, Definition>>, definition: DurableObjectNamespaceBindingDefinition<Definition>) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
1988
|
+
declare const makeDirectMethods: <R, Api extends object, Definition extends Definition$3.Any | undefined>(rpcDefinition: Definition | undefined, helpers: {
|
|
1871
1989
|
readonly call: StubCall<R, Api>;
|
|
1872
1990
|
readonly fetch: (stub: DurableObjectStubClient<Api>, input: RequestInfo | URL, init?: RequestInit) => Effect.Effect<globalThis.Response, DurableObjectFetchError, R>;
|
|
1873
1991
|
readonly get: (id: globalThis.DurableObjectId, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions) => Effect.Effect<DurableObjectStubClient<Api>, never, R>;
|
|
1874
1992
|
readonly getByName: (name: string, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions) => Effect.Effect<DurableObjectStubClient<Api>, never, R>;
|
|
1875
1993
|
}) => DirectMethods<R, Api, Definition>;
|
|
1876
1994
|
declare namespace DurableObjectDefinition_d_exports {
|
|
1877
|
-
export { Api
|
|
1995
|
+
export { Api, Definition$3 as Definition, DurableObject$1 as DurableObject, HandlerEffect, Handlers, LayerOptions$8 as LayerOptions, Method$1 as Method, Methods, NoReservedMethods, Options$2 as Options, ReservedMethodName, ServerApi$1 as ServerApi, ServiceFreeSchema, Tag$8 as Tag, TagClass$7 as TagClass, implement$2 as implement, make$7 as make, method };
|
|
1878
1996
|
}
|
|
1879
|
-
type ServiceFreeSchema
|
|
1880
|
-
interface Method$
|
|
1997
|
+
type ServiceFreeSchema = Schema.Codec<any, any, never, never>;
|
|
1998
|
+
interface Method$1<Args extends ReadonlyArray<ServiceFreeSchema> = ReadonlyArray<ServiceFreeSchema>, Success extends ServiceFreeSchema = ServiceFreeSchema> {
|
|
1881
1999
|
readonly args: Args;
|
|
1882
2000
|
readonly success: Success;
|
|
1883
2001
|
}
|
|
1884
|
-
declare namespace Method$
|
|
1885
|
-
export type Any = Method$
|
|
1886
|
-
type ArgsFromSchemas<Args extends ReadonlyArray<ServiceFreeSchema
|
|
1887
|
-
|
|
2002
|
+
declare namespace Method$1 {
|
|
2003
|
+
export type Any = Method$1<ReadonlyArray<ServiceFreeSchema>, ServiceFreeSchema>;
|
|
2004
|
+
type ArgsFromSchemas<Args extends ReadonlyArray<ServiceFreeSchema>> = Args extends readonly [] ? [] : Args extends readonly [infer Head extends ServiceFreeSchema, ...infer Tail extends ReadonlyArray<ServiceFreeSchema>] ? [Schema.Schema.Type<Head>, ...ArgsFromSchemas<Tail>] : Array<Schema.Schema.Type<Args[number]>>;
|
|
2005
|
+
/** Method schemas cross the wire through their canonical JSON codec. */
|
|
2006
|
+
type EncodedArgsFromSchemas<Args extends ReadonlyArray<ServiceFreeSchema>> = { [Index in keyof Args]: Schema.Json; };
|
|
1888
2007
|
export type Args<Self extends Any> = ArgsFromSchemas<Self["args"]>;
|
|
1889
2008
|
export type EncodedArgs<Self extends Any> = EncodedArgsFromSchemas<Self["args"]>;
|
|
1890
2009
|
export type Success<Self extends Any> = Schema.Schema.Type<Self["success"]>;
|
|
1891
|
-
export type EncodedSuccess<Self extends Any> = Schema.
|
|
2010
|
+
export type EncodedSuccess<Self extends Any> = Schema.Json;
|
|
1892
2011
|
export {};
|
|
1893
2012
|
}
|
|
1894
|
-
type Methods
|
|
2013
|
+
type Methods = Record<string, Method$1.Any>;
|
|
1895
2014
|
/**
|
|
1896
2015
|
* RPC contract for a Durable Object class.
|
|
1897
2016
|
*/
|
|
1898
|
-
interface Definition$
|
|
2017
|
+
interface Definition$3<Id extends string = string, MethodsShape extends Methods = Methods> {
|
|
1899
2018
|
readonly id: Id;
|
|
1900
2019
|
readonly methods: MethodsShape;
|
|
1901
2020
|
}
|
|
1902
|
-
declare namespace Definition$
|
|
1903
|
-
type Any = Definition$
|
|
2021
|
+
declare namespace Definition$3 {
|
|
2022
|
+
type Any = Definition$3<string, Methods>;
|
|
1904
2023
|
}
|
|
1905
|
-
type ReservedMethodName
|
|
1906
|
-
type NoReservedMethods
|
|
2024
|
+
type ReservedMethodName = ReservedMethodName$5 | "fetch" | "alarm" | "webSocketMessage" | "webSocketClose" | "webSocketError";
|
|
2025
|
+
type NoReservedMethods<MethodsShape extends Methods> = Extract<keyof MethodsShape, ReservedMethodName> extends never ? MethodsShape : never;
|
|
1907
2026
|
/**
|
|
1908
2027
|
* Promise-based client API derived from a Durable Object definition.
|
|
1909
2028
|
*/
|
|
1910
|
-
type ServerApi$
|
|
1911
|
-
type Api
|
|
2029
|
+
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]>>; };
|
|
2030
|
+
type Api<Self extends Definition$3.Any> = Provider<ServerApi$1<Self>, ReservedMethodName>;
|
|
1912
2031
|
/**
|
|
1913
2032
|
* Effect handlers for each RPC method in a Durable Object definition.
|
|
1914
2033
|
*/
|
|
1915
|
-
type Handlers
|
|
2034
|
+
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]>>; };
|
|
1916
2035
|
/**
|
|
1917
2036
|
* Durable Object constructor options for a specific RPC definition.
|
|
1918
2037
|
*/
|
|
1919
|
-
interface Options$
|
|
1920
|
-
readonly rpc: Handlers
|
|
2038
|
+
interface Options$2<ROut, Self extends Definition$3.Any, REvent = never, EventLayerError = never> extends Omit<DurableObjectOptions<ROut, REvent, EventLayerError, Handlers<ROut | REvent, Self>>, "rpc"> {
|
|
2039
|
+
readonly rpc: Handlers<ROut | REvent, Self>;
|
|
1921
2040
|
}
|
|
1922
|
-
type LayerOptions$
|
|
2041
|
+
type LayerOptions$8 = {
|
|
1923
2042
|
readonly binding: string;
|
|
1924
2043
|
};
|
|
1925
|
-
type TagClass$
|
|
2044
|
+
type TagClass$7<Self, Id extends string, MethodsShape extends Methods> = Context.ServiceClass<Self, `effect-cf/DurableObject/${Id}`, DurableObjectNamespaceEffectClient<Api<Definition$3<Id, MethodsShape>>, Definition$3<Id, MethodsShape>>> & DurableObjectNamespaceStaticClient<Self, Api<Definition$3<Id, MethodsShape>>, Definition$3<Id, MethodsShape>> & {
|
|
1926
2045
|
readonly id: Id;
|
|
1927
2046
|
readonly methods: MethodsShape;
|
|
1928
|
-
readonly make: <ROut, LayerError, REvent = never, EventLayerError = never>(layer: Layer.Layer<ROut, LayerError, DurableObjectState | WorkerEnvironment>, options: Options$
|
|
1929
|
-
readonly layer: (options: LayerOptions$
|
|
2047
|
+
readonly make: <ROut, LayerError, REvent = never, EventLayerError = never>(layer: Layer.Layer<ROut, LayerError, DurableObjectState | WorkerEnvironment>, options: Options$2<ROut, Definition$3<Id, MethodsShape>, REvent, EventLayerError>) => DurableObjectClass<Handlers<ROut | REvent, Definition$3<Id, MethodsShape>>, ROut | REvent>;
|
|
2048
|
+
readonly layer: (options: LayerOptions$8) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
1930
2049
|
};
|
|
1931
2050
|
/**
|
|
1932
2051
|
* Defines a single RPC method schema in a Durable Object definition.
|
|
1933
2052
|
*/
|
|
1934
|
-
declare const method
|
|
1935
|
-
<Success extends ServiceFreeSchema
|
|
2053
|
+
declare const method: {
|
|
2054
|
+
<Success extends ServiceFreeSchema>(definition: {
|
|
1936
2055
|
readonly success: Success;
|
|
1937
|
-
}): Method$
|
|
1938
|
-
<const Args extends ReadonlyArray<ServiceFreeSchema
|
|
2056
|
+
}): Method$1<readonly [], Success>;
|
|
2057
|
+
<const Args extends ReadonlyArray<ServiceFreeSchema>, Success extends ServiceFreeSchema>(definition: {
|
|
1939
2058
|
readonly args: Args;
|
|
1940
2059
|
readonly success: Success;
|
|
1941
|
-
}): Method$
|
|
2060
|
+
}): Method$1<Args, Success>;
|
|
1942
2061
|
};
|
|
1943
|
-
declare const make$7: <Id extends string, const MethodsShape extends Methods
|
|
1944
|
-
declare const Tag$
|
|
1945
|
-
declare const DurableObject$1: typeof Tag$
|
|
2062
|
+
declare const make$7: <Id extends string, const MethodsShape extends Methods>(id: Id, methods: MethodsShape & NoReservedMethods<MethodsShape>) => TagClass$7<Definition$3<Id, MethodsShape>, Id, MethodsShape>;
|
|
2063
|
+
declare const Tag$8: <Self>() => <Id extends string, const MethodsShape extends Methods>(id: Id, methods: MethodsShape & NoReservedMethods<MethodsShape>) => TagClass$7<Self, Id, MethodsShape>;
|
|
2064
|
+
declare const DurableObject$1: typeof Tag$8;
|
|
1946
2065
|
/**
|
|
1947
2066
|
* Helper for implementing handlers with the exact method shape of a definition.
|
|
1948
2067
|
*/
|
|
1949
|
-
declare const implement$
|
|
2068
|
+
declare const implement$2: <ROut, const Self extends Definition$3.Any>(_definition: Self, handlers: Handlers<ROut, Self>) => Handlers<ROut, Self>;
|
|
1950
2069
|
/**
|
|
1951
2070
|
* Convenience alias for a single Durable Object RPC handler Effect.
|
|
1952
2071
|
*/
|
|
1953
|
-
type HandlerEffect
|
|
2072
|
+
type HandlerEffect<ROut, Self extends Definition$3.Any, Key extends keyof Self["methods"]> = DurableObjectHandler<ROut, Method$1.Success<Self["methods"][Key]>>;
|
|
1954
2073
|
declare namespace DurableObject_d_exports {
|
|
1955
|
-
export { Api, Definition$3 as Definition, DurableObjectClass, DurableObjectHandler, DurableObjectOptions, DurableObjectRpc, DurableObjectRpcShape, HandlerEffect, Handlers, LayerOptions$8 as LayerOptions, Method$1 as Method, Methods, NoReservedMethods, Options$2 as Options, ReservedMethodName, RpcHandlers, ServerApi$1 as ServerApi, ServiceFreeSchema, Tag$8 as Tag, TagClass$7 as TagClass,
|
|
2074
|
+
export { Api, Definition$3 as Definition, DurableObjectClass, DurableObjectHandler, DurableObjectOptions, DurableObjectRpc, DurableObjectRpcShape, HandlerEffect, Handlers, LayerOptions$8 as LayerOptions, Method$1 as Method, Methods, NoReservedMethods, Options$2 as Options, ReservedMethodName, RpcHandlers, ServerApi$1 as ServerApi, ServiceFreeSchema, Tag$8 as Tag, TagClass$7 as TagClass, implement$2 as implement, make$6 as make, method };
|
|
1956
2075
|
}
|
|
1957
2076
|
type RuntimeContext$1<ROut> = DurableObjectState | WorkerEnvironment | ROut;
|
|
1958
2077
|
type HandlerContext<ROut> = RuntimeContext$1<ROut> | Scope.Scope;
|
|
@@ -2013,54 +2132,6 @@ type DurableObjectClass<Rpc extends DurableObjectRpc<ROut>, ROut> = new (state:
|
|
|
2013
2132
|
* Creates a Durable Object class backed by a single managed Effect runtime.
|
|
2014
2133
|
*/
|
|
2015
2134
|
declare const make$6: <ROut, LayerError, REvent = never, EventLayerError = never, const Rpc extends DurableObjectRpc<ROut | REvent> = Record<never, never>>(layer: Layer.Layer<ROut, LayerError, DurableObjectState | WorkerEnvironment>, options?: DurableObjectOptions<ROut, REvent, EventLayerError, Rpc>) => DurableObjectClass<Rpc, ROut | REvent>;
|
|
2016
|
-
type ServiceFreeSchema = Schema.Codec<any, any, never, never>;
|
|
2017
|
-
interface Method$1<Args extends ReadonlyArray<ServiceFreeSchema> = ReadonlyArray<ServiceFreeSchema>, Success extends ServiceFreeSchema = ServiceFreeSchema> {
|
|
2018
|
-
readonly args: Args;
|
|
2019
|
-
readonly success: Success;
|
|
2020
|
-
}
|
|
2021
|
-
declare namespace Method$1 {
|
|
2022
|
-
export type Any = Method$1<ReadonlyArray<ServiceFreeSchema>, ServiceFreeSchema>;
|
|
2023
|
-
type ArgsFromSchemas<Args extends ReadonlyArray<ServiceFreeSchema>> = Args extends readonly [] ? [] : Args extends readonly [infer Head extends ServiceFreeSchema, ...infer Tail extends ReadonlyArray<ServiceFreeSchema>] ? [Schema.Schema.Type<Head>, ...ArgsFromSchemas<Tail>] : Array<Schema.Schema.Type<Args[number]>>;
|
|
2024
|
-
export type Args<Self extends Any> = ArgsFromSchemas<Self["args"]>;
|
|
2025
|
-
export type Success<Self extends Any> = Schema.Schema.Type<Self["success"]>;
|
|
2026
|
-
export {};
|
|
2027
|
-
}
|
|
2028
|
-
type Methods = Record<string, Method$1.Any>;
|
|
2029
|
-
type ReservedMethodName = ReservedMethodName$1;
|
|
2030
|
-
type NoReservedMethods<MethodsShape extends Methods> = Extract<keyof MethodsShape, ReservedMethodName> extends never ? MethodsShape : never;
|
|
2031
|
-
interface Definition$3<Id extends string = string, MethodsShape extends Methods = Methods> {
|
|
2032
|
-
readonly id: Id;
|
|
2033
|
-
readonly methods: MethodsShape;
|
|
2034
|
-
}
|
|
2035
|
-
declare namespace Definition$3 {
|
|
2036
|
-
type Any = Definition$3<string, Methods>;
|
|
2037
|
-
}
|
|
2038
|
-
type LayerOptions$8 = LayerOptions$9;
|
|
2039
|
-
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]>>; };
|
|
2040
|
-
type Api<Self extends Definition$3.Any> = Provider<ServerApi$1<Self>, ReservedMethodName>;
|
|
2041
|
-
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]>>; };
|
|
2042
|
-
interface Options$2<ROut, Self extends Definition$3.Any, REvent = never, EventLayerError = never> extends Omit<DurableObjectOptions<ROut, REvent, EventLayerError, Handlers<ROut | REvent, Self>>, "rpc"> {
|
|
2043
|
-
readonly rpc: Handlers<ROut | REvent, Self>;
|
|
2044
|
-
}
|
|
2045
|
-
type TagClass$7<Self, Id extends string, MethodsShape extends Methods> = Context.ServiceClass<Self, Id, DurableObjectNamespaceEffectClient<Api<Definition$3<Id, MethodsShape>>, Definition$3<Id, MethodsShape>>> & DurableObjectNamespaceStaticClient<Self, Api<Definition$3<Id, MethodsShape>>, Definition$3<Id, MethodsShape>> & {
|
|
2046
|
-
readonly id: Id;
|
|
2047
|
-
readonly methods: MethodsShape;
|
|
2048
|
-
readonly make: <ROut, LayerError, REvent = never, EventLayerError = never>(layer: Layer.Layer<ROut, LayerError, DurableObjectState | WorkerEnvironment>, options: Options$2<ROut, Definition$3<Id, MethodsShape>, REvent, EventLayerError>) => DurableObjectClass<Handlers<ROut | REvent, Definition$3<Id, MethodsShape>>, ROut | REvent>;
|
|
2049
|
-
readonly layer: (options: LayerOptions$8) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
2050
|
-
};
|
|
2051
|
-
type TagFactory = <Self>() => <Id extends string, const MethodsShape extends Methods>(id: Id, methods: MethodsShape & NoReservedMethods<MethodsShape>) => TagClass$7<Self, Id, MethodsShape>;
|
|
2052
|
-
declare const Tag$8: TagFactory;
|
|
2053
|
-
declare const method: {
|
|
2054
|
-
<Success extends ServiceFreeSchema>(definition: {
|
|
2055
|
-
readonly success: Success;
|
|
2056
|
-
}): Method$1<readonly [], Success>;
|
|
2057
|
-
<const Args extends ReadonlyArray<ServiceFreeSchema>, Success extends ServiceFreeSchema>(definition: {
|
|
2058
|
-
readonly args: Args;
|
|
2059
|
-
readonly success: Success;
|
|
2060
|
-
}): Method$1<Args, Success>;
|
|
2061
|
-
};
|
|
2062
|
-
declare const implement$2: <ROut, const Self extends Definition$3.Any>(_definition: Self, handlers: Handlers<ROut, Self>) => Handlers<ROut, Self>;
|
|
2063
|
-
type HandlerEffect<ROut, Self extends Definition$3.Any, Key extends keyof Self["methods"]> = DurableObjectHandler<ROut, Method$1.Success<Self["methods"][Key]>>;
|
|
2064
2135
|
declare namespace DurableObjectAlarm_d_exports {
|
|
2065
2136
|
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 };
|
|
2066
2137
|
}
|
|
@@ -2077,32 +2148,42 @@ declare const InvalidAlarmRefError_base: new <A extends Record<string, any> = {}
|
|
|
2077
2148
|
} & Readonly<A>;
|
|
2078
2149
|
declare class InvalidAlarmRefError extends InvalidAlarmRefError_base<{
|
|
2079
2150
|
readonly cause: unknown;
|
|
2080
|
-
}> {
|
|
2151
|
+
}> {
|
|
2152
|
+
get message(): string;
|
|
2153
|
+
}
|
|
2081
2154
|
declare const InvalidAlarmPayloadError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
2082
2155
|
readonly _tag: "InvalidAlarmPayloadError";
|
|
2083
2156
|
} & Readonly<A>;
|
|
2084
2157
|
declare class InvalidAlarmPayloadError extends InvalidAlarmPayloadError_base<{
|
|
2085
2158
|
readonly cause: unknown;
|
|
2086
|
-
}> {
|
|
2159
|
+
}> {
|
|
2160
|
+
get message(): string;
|
|
2161
|
+
}
|
|
2087
2162
|
declare const InvalidRepeatEveryError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
2088
2163
|
readonly _tag: "InvalidRepeatEveryError";
|
|
2089
2164
|
} & Readonly<A>;
|
|
2090
2165
|
declare class InvalidRepeatEveryError extends InvalidRepeatEveryError_base<{
|
|
2091
2166
|
readonly cause: unknown;
|
|
2092
|
-
}> {
|
|
2167
|
+
}> {
|
|
2168
|
+
get message(): string;
|
|
2169
|
+
}
|
|
2093
2170
|
declare const InvalidProcessDueAlarmsOptionsError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
2094
2171
|
readonly _tag: "InvalidProcessDueAlarmsOptionsError";
|
|
2095
2172
|
} & Readonly<A>;
|
|
2096
2173
|
declare class InvalidProcessDueAlarmsOptionsError extends InvalidProcessDueAlarmsOptionsError_base<{
|
|
2097
2174
|
readonly cause: unknown;
|
|
2098
|
-
}> {
|
|
2175
|
+
}> {
|
|
2176
|
+
get message(): string;
|
|
2177
|
+
}
|
|
2099
2178
|
declare const StoredAlarmDecodeError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
2100
2179
|
readonly _tag: "StoredAlarmDecodeError";
|
|
2101
2180
|
} & Readonly<A>;
|
|
2102
2181
|
declare class StoredAlarmDecodeError extends StoredAlarmDecodeError_base<{
|
|
2103
2182
|
readonly cause: unknown;
|
|
2104
2183
|
readonly storageId: string;
|
|
2105
|
-
}> {
|
|
2184
|
+
}> {
|
|
2185
|
+
get message(): string;
|
|
2186
|
+
}
|
|
2106
2187
|
type DurableObjectAlarmError = InvalidAlarmPayloadError | InvalidAlarmRefError | InvalidProcessDueAlarmsOptionsError | InvalidRepeatEveryError | StorageOperationError | StoredAlarmDecodeError;
|
|
2107
2188
|
/**
|
|
2108
2189
|
* Events handled by `processDueAlarms`.
|
|
@@ -2416,12 +2497,12 @@ declare class DurableObjectRpcWebSocket extends DurableObjectRpcWebSocket_base {
|
|
|
2416
2497
|
/**
|
|
2417
2498
|
* Builds a layer that bridges Durable Object websocket events to `RpcServer.Protocol`.
|
|
2418
2499
|
*/
|
|
2419
|
-
declare const layer$7: (options?: LayerOptions$7) => Layer.Layer<
|
|
2500
|
+
declare const layer$7: (options?: LayerOptions$7) => Layer.Layer<RpcServer.Protocol | DurableObjectRpcWebSocket, never, DurableObjectState | RpcSerialization.RpcSerialization>;
|
|
2420
2501
|
declare namespace DurableObjectSqlite_d_exports {
|
|
2421
2502
|
export { SqliteLayerOptions, layer$6 as layer };
|
|
2422
2503
|
}
|
|
2423
2504
|
/** Options forwarded to `@effect/sql-sqlite-do` when building a SQL client layer. */
|
|
2424
|
-
type SqliteLayerOptions = Omit<SqliteClient.SqliteClientConfig, "db">;
|
|
2505
|
+
type SqliteLayerOptions = Omit<SqliteClient.SqliteClientConfig, "db" | "storage">;
|
|
2425
2506
|
/**
|
|
2426
2507
|
* Provides `effect/unstable/sql` from the current Durable Object SQLite storage.
|
|
2427
2508
|
*
|
|
@@ -2433,7 +2514,7 @@ type SqliteLayerOptions = Omit<SqliteClient.SqliteClientConfig, "db">;
|
|
|
2433
2514
|
* );
|
|
2434
2515
|
* ```
|
|
2435
2516
|
*/
|
|
2436
|
-
declare const layer$6: (options?: SqliteLayerOptions) => Layer.Layer<
|
|
2517
|
+
declare const layer$6: (options?: SqliteLayerOptions) => Layer.Layer<SqliteClient.SqliteClient | SqlClient.SqlClient, never, DurableObjectState>;
|
|
2437
2518
|
declare namespace Email_d_exports {
|
|
2438
2519
|
export { EmailAddress, EmailAttachment, EmailBinding, EmailClient, EmailDefinition, EmailErrorCode, EmailMessage, EmailMessageBuilder, EmailOperationError, EmailRecipients, EmailSendError, EmailSendInput, EmailSendOptions, EmailSendResult, EmailService, EmailValidationError, EmailViolation, LayerOptions$6 as LayerOptions, Tag$7 as Tag, TagClass$6 as TagClass, emailErrorCodes, isEmailBinding, isEmailMessageBuilder, layer$5 as layer, make$5 as make, makeClient$5 as makeClient, sendLimits, validateMessage };
|
|
2439
2520
|
}
|
|
@@ -2450,7 +2531,14 @@ declare const sendLimits: {
|
|
|
2450
2531
|
/** Allowlisted custom headers, excluding `X-` prefixed headers. */
|
|
2451
2532
|
readonly maxAllowlistHeaders: 20;
|
|
2452
2533
|
};
|
|
2453
|
-
/**
|
|
2534
|
+
/**
|
|
2535
|
+
* Error codes reported by Cloudflare Email Sending.
|
|
2536
|
+
*
|
|
2537
|
+
* Surfaced on {@link EmailOperationError} `code` on a best-effort basis: the
|
|
2538
|
+
* runtime attaches them as a non-standard `code` property on thrown errors,
|
|
2539
|
+
* which may be missing depending on the runtime or dev-time proxying
|
|
2540
|
+
* (miniflare remote bindings serialize errors and can strip it).
|
|
2541
|
+
*/
|
|
2454
2542
|
declare const emailErrorCodes: readonly ["E_VALIDATION_ERROR", "E_FIELD_MISSING", "E_TOO_MANY_RECIPIENTS", "E_TOO_MANY_ATTACHMENTS", "E_SENDER_NOT_VERIFIED", "E_RECIPIENT_NOT_ALLOWED", "E_RECIPIENT_SUPPRESSED", "E_SENDER_DOMAIN_NOT_AVAILABLE", "E_CONTENT_TOO_LARGE", "E_DELIVERY_FAILED", "E_RATE_LIMIT_EXCEEDED", "E_DAILY_LIMIT_EXCEEDED", "E_INTERNAL_SERVER_ERROR", "E_HEADER_NOT_ALLOWED", "E_HEADER_USE_API_FIELD", "E_HEADER_VALUE_INVALID", "E_HEADER_VALUE_TOO_LONG", "E_HEADER_NAME_INVALID", "E_HEADERS_TOO_LARGE", "E_HEADERS_TOO_MANY"];
|
|
2455
2543
|
/** A documented Cloudflare Email Sending error code. */
|
|
2456
2544
|
type EmailErrorCode = (typeof emailErrorCodes)[number];
|
|
@@ -2462,9 +2550,17 @@ declare class EmailOperationError extends EmailOperationError_base<{
|
|
|
2462
2550
|
readonly binding: string;
|
|
2463
2551
|
readonly operation: string;
|
|
2464
2552
|
readonly cause: unknown;
|
|
2465
|
-
/**
|
|
2553
|
+
/**
|
|
2554
|
+
* Cloudflare error code taken from the thrown error, when present.
|
|
2555
|
+
*
|
|
2556
|
+
* Best-effort: may be `undefined` depending on the runtime or dev-time
|
|
2557
|
+
* proxying — miniflare remote bindings (`"remote": true`) serialize thrown
|
|
2558
|
+
* errors and can strip the non-standard `code` property.
|
|
2559
|
+
*/
|
|
2466
2560
|
readonly code?: EmailErrorCode | (string & {});
|
|
2467
|
-
}> {
|
|
2561
|
+
}> {
|
|
2562
|
+
get message(): string;
|
|
2563
|
+
}
|
|
2468
2564
|
/** A single message field that violates a documented Email Sending limit. */
|
|
2469
2565
|
interface EmailViolation {
|
|
2470
2566
|
readonly path: string;
|
|
@@ -2480,7 +2576,9 @@ declare class EmailValidationError extends EmailValidationError_base<{
|
|
|
2480
2576
|
readonly binding: string;
|
|
2481
2577
|
readonly operation: string;
|
|
2482
2578
|
readonly violations: ReadonlyArray<EmailViolation>;
|
|
2483
|
-
}> {
|
|
2579
|
+
}> {
|
|
2580
|
+
get message(): string;
|
|
2581
|
+
}
|
|
2484
2582
|
/** Typed Cloudflare Send Email binding definition. */
|
|
2485
2583
|
interface EmailDefinition {
|
|
2486
2584
|
/** Binding name as configured in `wrangler.jsonc`. */
|
|
@@ -2504,7 +2602,7 @@ interface EmailClient {
|
|
|
2504
2602
|
(message: EmailMessage): Effect.Effect<EmailSendResult, EmailSendError>;
|
|
2505
2603
|
(builder: EmailMessageBuilder): Effect.Effect<EmailSendResult, EmailSendError>;
|
|
2506
2604
|
};
|
|
2507
|
-
readonly
|
|
2605
|
+
readonly rawUnsafe: Effect.Effect<EmailBinding>;
|
|
2508
2606
|
readonly definition: EmailDefinition;
|
|
2509
2607
|
}
|
|
2510
2608
|
declare const EmailServiceTypeId: unique symbol;
|
|
@@ -2539,9 +2637,10 @@ declare const layer$5: <Self>(tag: Context.Service<Self, EmailClient>, definitio
|
|
|
2539
2637
|
declare const make$5: <Id extends string>(id: Id) => TagClass$6<EmailService<Id>, Id>;
|
|
2540
2638
|
declare const Tag$7: <Self>() => <Id extends string>(id: Id) => TagClass$6<Self, Id>;
|
|
2541
2639
|
declare namespace Images_d_exports {
|
|
2542
|
-
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$5 as LayerOptions, ProcessOptions, Step, Steps, Tag$6 as Tag, TagClass$5 as TagClass, draw, empty, isImagesBinding, layer$4 as layer, make$4 as make, makeClient$4 as makeClient, transform };
|
|
2640
|
+
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$5 as LayerOptions, ProcessOptions, Step, Steps, Tag$6 as Tag, TagClass$5 as TagClass, TypeId, draw, empty, isImagesBinding, layer$4 as layer, make$4 as make, makeClient$4 as makeClient, transform };
|
|
2543
2641
|
}
|
|
2544
|
-
declare const TypeId: "effect-cf/Images/Steps";
|
|
2642
|
+
declare const TypeId: "~effect-cf/Images/Steps";
|
|
2643
|
+
type TypeId = typeof TypeId;
|
|
2545
2644
|
declare const ImagesOperationError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
2546
2645
|
readonly _tag: "ImagesOperationError";
|
|
2547
2646
|
} & Readonly<A>;
|
|
@@ -2550,7 +2649,9 @@ declare class ImagesOperationError extends ImagesOperationError_base<{
|
|
|
2550
2649
|
readonly binding: string;
|
|
2551
2650
|
readonly operation: string;
|
|
2552
2651
|
readonly cause: unknown;
|
|
2553
|
-
}> {
|
|
2652
|
+
}> {
|
|
2653
|
+
get message(): string;
|
|
2654
|
+
}
|
|
2554
2655
|
/** Typed Cloudflare Images binding definition. */
|
|
2555
2656
|
interface ImagesDefinition {
|
|
2556
2657
|
/** Binding name as configured in `wrangler.jsonc`. */
|
|
@@ -2580,6 +2681,65 @@ type Step = Data.TaggedEnum<{
|
|
|
2580
2681
|
};
|
|
2581
2682
|
readonly Draw: DrawStepOptions;
|
|
2582
2683
|
}>;
|
|
2684
|
+
declare const Step: {
|
|
2685
|
+
readonly $is: <Tag extends "Draw" | "Transform">(tag: Tag) => (u: unknown) => u is Extract<{
|
|
2686
|
+
readonly _tag: "Draw";
|
|
2687
|
+
readonly image: ReadableStream<Uint8Array> | CloudflareImageTransformer;
|
|
2688
|
+
readonly options?: ImageDrawOptions;
|
|
2689
|
+
}, {
|
|
2690
|
+
readonly _tag: Tag;
|
|
2691
|
+
}> | Extract<{
|
|
2692
|
+
readonly _tag: "Transform";
|
|
2693
|
+
readonly transform: ImageTransform;
|
|
2694
|
+
}, {
|
|
2695
|
+
readonly _tag: Tag;
|
|
2696
|
+
}>;
|
|
2697
|
+
readonly $match: {
|
|
2698
|
+
<Cases extends { readonly [Tag in "Draw" | "Transform"]: (args: Extract<{
|
|
2699
|
+
readonly _tag: "Draw";
|
|
2700
|
+
readonly image: ReadableStream<Uint8Array> | CloudflareImageTransformer;
|
|
2701
|
+
readonly options?: ImageDrawOptions;
|
|
2702
|
+
} | {
|
|
2703
|
+
readonly _tag: "Transform";
|
|
2704
|
+
readonly transform: ImageTransform;
|
|
2705
|
+
}, {
|
|
2706
|
+
readonly _tag: Tag;
|
|
2707
|
+
}>) => any; }>(cases: Cases): (value: {
|
|
2708
|
+
readonly _tag: "Draw";
|
|
2709
|
+
readonly image: ReadableStream<Uint8Array> | CloudflareImageTransformer;
|
|
2710
|
+
readonly options?: ImageDrawOptions;
|
|
2711
|
+
} | {
|
|
2712
|
+
readonly _tag: "Transform";
|
|
2713
|
+
readonly transform: ImageTransform;
|
|
2714
|
+
}) => import("effect/Unify").Unify<ReturnType<Cases["Draw" | "Transform"]>>;
|
|
2715
|
+
<Cases extends { readonly [Tag in "Draw" | "Transform"]: (args: Extract<{
|
|
2716
|
+
readonly _tag: "Draw";
|
|
2717
|
+
readonly image: ReadableStream<Uint8Array> | CloudflareImageTransformer;
|
|
2718
|
+
readonly options?: ImageDrawOptions;
|
|
2719
|
+
} | {
|
|
2720
|
+
readonly _tag: "Transform";
|
|
2721
|
+
readonly transform: ImageTransform;
|
|
2722
|
+
}, {
|
|
2723
|
+
readonly _tag: Tag;
|
|
2724
|
+
}>) => any; }>(value: {
|
|
2725
|
+
readonly _tag: "Draw";
|
|
2726
|
+
readonly image: ReadableStream<Uint8Array> | CloudflareImageTransformer;
|
|
2727
|
+
readonly options?: ImageDrawOptions;
|
|
2728
|
+
} | {
|
|
2729
|
+
readonly _tag: "Transform";
|
|
2730
|
+
readonly transform: ImageTransform;
|
|
2731
|
+
}, cases: Cases): import("effect/Unify").Unify<ReturnType<Cases["Draw" | "Transform"]>>;
|
|
2732
|
+
};
|
|
2733
|
+
readonly Draw: Data.TaggedEnum.ConstructorFrom<{
|
|
2734
|
+
readonly _tag: "Draw";
|
|
2735
|
+
readonly image: ReadableStream<Uint8Array> | CloudflareImageTransformer;
|
|
2736
|
+
readonly options?: ImageDrawOptions;
|
|
2737
|
+
}, "_tag">;
|
|
2738
|
+
readonly Transform: Data.TaggedEnum.ConstructorFrom<{
|
|
2739
|
+
readonly _tag: "Transform";
|
|
2740
|
+
readonly transform: ImageTransform;
|
|
2741
|
+
}, "_tag">;
|
|
2742
|
+
};
|
|
2583
2743
|
interface Steps {
|
|
2584
2744
|
readonly [TypeId]: typeof TypeId;
|
|
2585
2745
|
readonly steps: ReadonlyArray<Step>;
|
|
@@ -2606,7 +2766,7 @@ interface HostedImagesClient {
|
|
|
2606
2766
|
readonly image: (imageId: string) => ImageHandleClient;
|
|
2607
2767
|
readonly upload: (image: ImageUploadValue, options?: ImageUploadOptions) => Effect.Effect<ImageMetadata, ImagesOperationError>;
|
|
2608
2768
|
readonly list: (options?: ImageListOptions) => Effect.Effect<ImageList, ImagesOperationError>;
|
|
2609
|
-
readonly
|
|
2769
|
+
readonly rawUnsafe: Effect.Effect<CloudflareHostedImagesBinding>;
|
|
2610
2770
|
}
|
|
2611
2771
|
interface ImagesRuntimeBinding {
|
|
2612
2772
|
readonly info: (image: ImageInputValue, options?: ImageInputOptions) => Promise<ImageInfoResponse>;
|
|
@@ -2618,7 +2778,7 @@ interface ImagesClient {
|
|
|
2618
2778
|
readonly input: (image: ImageInputValue, options?: ImageInputOptions) => Effect.Effect<CloudflareImageTransformer, ImagesOperationError>;
|
|
2619
2779
|
readonly process: (steps: Steps, options: ProcessOptions) => Effect.Effect<ImagesTransformationResultClient, ImagesOperationError>;
|
|
2620
2780
|
readonly hosted: Option.Option<HostedImagesClient>;
|
|
2621
|
-
readonly
|
|
2781
|
+
readonly rawUnsafe: Effect.Effect<ImagesRuntimeBinding>;
|
|
2622
2782
|
readonly definition: ImagesDefinition;
|
|
2623
2783
|
}
|
|
2624
2784
|
declare const ImagesServiceTypeId: unique symbol;
|
|
@@ -2637,27 +2797,35 @@ interface TagClass$5<Self, Id extends string> extends Context.ServiceClass<Self,
|
|
|
2637
2797
|
}
|
|
2638
2798
|
/** Empty Images transformation pipeline. */
|
|
2639
2799
|
declare const empty: Steps;
|
|
2640
|
-
declare
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2800
|
+
declare const transform: {
|
|
2801
|
+
(transform: ImageTransform): (steps: Steps) => Steps;
|
|
2802
|
+
(steps: Steps, transform: ImageTransform): Steps;
|
|
2803
|
+
};
|
|
2804
|
+
declare const draw: {
|
|
2805
|
+
(draw: DrawStepOptions): (steps: Steps) => Steps;
|
|
2806
|
+
(steps: Steps, draw: DrawStepOptions): Steps;
|
|
2807
|
+
};
|
|
2644
2808
|
declare const isImagesBinding: (value: unknown) => value is ImagesRuntimeBinding;
|
|
2645
2809
|
declare const makeClient$4: (definition: ImagesDefinition) => (images: ImagesRuntimeBinding) => ImagesClient;
|
|
2646
2810
|
declare const layer$4: <Self>(tag: Context.Service<Self, ImagesClient>, definition: ImagesDefinition) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
2647
2811
|
declare const make$4: <Id extends string>(id: Id) => TagClass$5<ImagesService<Id>, Id>;
|
|
2648
2812
|
declare const Tag$6: <Self>() => <Id extends string>(id: Id) => TagClass$5<Self, Id>;
|
|
2649
2813
|
declare namespace Kv_d_exports {
|
|
2650
|
-
export { Definition$2 as Definition, KvClient, KvDefinition, KvListKey, KvListOptions, KvListResult, KvOperationError, KvPutOptions, KvWithMetadata, LayerOptions$4 as LayerOptions, Tag$5 as Tag, TagClass$4 as TagClass, isKvNamespace, layer$3 as layer, makeClient$3 as makeClient };
|
|
2814
|
+
export { Definition$2 as Definition, KvClient, KvDefinition, KvListKey, KvListOptions, KvListResult, KvOperation, KvOperationError, KvPutOptions, KvWithMetadata, LayerOptions$4 as LayerOptions, Tag$5 as Tag, TagClass$4 as TagClass, isKvNamespace, layer$3 as layer, makeClient$3 as makeClient };
|
|
2651
2815
|
}
|
|
2816
|
+
/** KV operation represented by {@link KvOperationError}. */
|
|
2817
|
+
type KvOperation = "put" | "get" | "getWithMetadata" | "list" | "delete";
|
|
2652
2818
|
declare const KvOperationError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
2653
2819
|
readonly _tag: "KvOperationError";
|
|
2654
2820
|
} & Readonly<A>;
|
|
2655
2821
|
/** Error raised when a KV operation fails. */
|
|
2656
2822
|
declare class KvOperationError extends KvOperationError_base<{
|
|
2657
2823
|
readonly binding: string;
|
|
2658
|
-
readonly operation:
|
|
2824
|
+
readonly operation: KvOperation;
|
|
2659
2825
|
readonly cause: unknown;
|
|
2660
|
-
}> {
|
|
2826
|
+
}> {
|
|
2827
|
+
get message(): string;
|
|
2828
|
+
}
|
|
2661
2829
|
/** `KVNamespace.put` options. */
|
|
2662
2830
|
type KvPutOptions = CloudflareKVNamespacePutOptions;
|
|
2663
2831
|
/** `KVNamespace.list` options with optional metadata decoding schema. */
|
|
@@ -2712,8 +2880,8 @@ interface KvClient<Key, Value, EncodedValue> {
|
|
|
2712
2880
|
readonly get: (key: Key) => Effect.Effect<Option.Option<Value>, KvOperationError | Schema.SchemaError>;
|
|
2713
2881
|
readonly getWithMetadata: <Metadata>(key: Key, metadataSchema: Schema.Codec<Metadata, unknown>) => Effect.Effect<Option.Option<KvWithMetadata<Value, Metadata>>, KvOperationError | Schema.SchemaError>;
|
|
2714
2882
|
readonly list: <Metadata = unknown>(options?: KvListOptions<Metadata>) => Effect.Effect<KvListResult<Key, Metadata>, KvOperationError | Schema.SchemaError>;
|
|
2715
|
-
readonly
|
|
2716
|
-
readonly
|
|
2883
|
+
readonly delete: (key: Key) => Effect.Effect<void, KvOperationError | Schema.SchemaError>;
|
|
2884
|
+
readonly rawUnsafe: Effect.Effect<KVNamespace>;
|
|
2717
2885
|
readonly definition: KvDefinition<Key, Value, EncodedValue>;
|
|
2718
2886
|
}
|
|
2719
2887
|
type LayerOptions$4 = {
|
|
@@ -2733,17 +2901,21 @@ declare const Tag$5: <Self>() => <Id extends string, Key, Value, EncodedValue>(i
|
|
|
2733
2901
|
readonly value: Schema.Codec<Value, EncodedValue>;
|
|
2734
2902
|
}) => TagClass$4<Self, Id, Key, Value, EncodedValue>;
|
|
2735
2903
|
declare namespace R2_d_exports {
|
|
2736
|
-
export { LayerOptions$3 as LayerOptions, R2Client, R2Definition, R2GetOptions, R2ListOptions, R2MultipartOptions, R2MultipartUploadClient, R2ObjectBodyClient, R2OperationError, R2PutOptions, R2PutValue, R2Service, R2UploadPartOptions, R2UploadPartValue, Tag$4 as Tag, TagClass$3 as TagClass, isR2Bucket, layer$2 as layer, make$3 as make, makeClient$2 as makeClient };
|
|
2904
|
+
export { LayerOptions$3 as LayerOptions, R2Client, R2Definition, R2GetOptions, R2ListOptions, R2MultipartOptions, R2MultipartUploadClient, R2ObjectBodyClient, R2Operation, R2OperationError, R2PutOptions, R2PutValue, R2Service, R2UploadPartOptions, R2UploadPartValue, Tag$4 as Tag, TagClass$3 as TagClass, isR2Bucket, layer$2 as layer, make$3 as make, makeClient$2 as makeClient };
|
|
2737
2905
|
}
|
|
2906
|
+
/** R2 operation represented by {@link R2OperationError}. */
|
|
2907
|
+
type R2Operation = "head" | "get" | "put" | "delete" | "list" | "createMultipartUpload" | "resumeMultipartUpload" | "uploadPart" | "abortMultipartUpload" | "completeMultipartUpload" | "arrayBuffer" | "bytes" | "text" | "json" | "blob";
|
|
2738
2908
|
declare const R2OperationError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
2739
2909
|
readonly _tag: "R2OperationError";
|
|
2740
2910
|
} & Readonly<A>;
|
|
2741
2911
|
/** Error raised when an R2 operation fails. */
|
|
2742
2912
|
declare class R2OperationError extends R2OperationError_base<{
|
|
2743
2913
|
readonly binding: string;
|
|
2744
|
-
readonly operation:
|
|
2914
|
+
readonly operation: R2Operation;
|
|
2745
2915
|
readonly cause: unknown;
|
|
2746
|
-
}> {
|
|
2916
|
+
}> {
|
|
2917
|
+
get message(): string;
|
|
2918
|
+
}
|
|
2747
2919
|
/** Typed R2 bucket binding definition. */
|
|
2748
2920
|
interface R2Definition {
|
|
2749
2921
|
/** Binding name as configured in `wrangler.jsonc`. */
|
|
@@ -2790,7 +2962,7 @@ interface R2Client {
|
|
|
2790
2962
|
readonly resumeMultipartUpload: (key: string, uploadId: string) => Effect.Effect<R2MultipartUploadClient, R2OperationError>;
|
|
2791
2963
|
readonly delete: (keys: string | ReadonlyArray<string>) => Effect.Effect<void, R2OperationError>;
|
|
2792
2964
|
readonly list: (options?: R2ListOptions) => Effect.Effect<CloudflareR2Objects, R2OperationError>;
|
|
2793
|
-
readonly
|
|
2965
|
+
readonly rawUnsafe: Effect.Effect<CloudflareR2Bucket>;
|
|
2794
2966
|
readonly definition: R2Definition;
|
|
2795
2967
|
}
|
|
2796
2968
|
declare const R2ServiceTypeId: unique symbol;
|
|
@@ -2812,8 +2984,72 @@ declare const makeClient$2: (definition: R2Definition) => ((bucket: CloudflareR2
|
|
|
2812
2984
|
declare const layer$2: <Self>(tag: Context.Service<Self, R2Client>, definition: R2Definition) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
2813
2985
|
declare const make$3: <Id extends string>(id: Id) => TagClass$3<R2Service<Id>, Id>;
|
|
2814
2986
|
declare const Tag$4: <Self>() => <Id extends string>(id: Id) => TagClass$3<Self, Id>;
|
|
2987
|
+
declare namespace Vectorize_d_exports {
|
|
2988
|
+
export { LayerOptions$2 as LayerOptions, Tag$3 as Tag, TagClass$2 as TagClass, VectorizeBinding, VectorizeClient, VectorizeDefinition, VectorizeIndexDetails, VectorizeIndexInfo, VectorizeMatch, VectorizeMatches, VectorizeMutation, VectorizeOperation, VectorizeOperationError, VectorizeQueryOptions, VectorizeService, VectorizeValues, VectorizeVector, VectorizeVectorMetadata, VectorizeVectorMetadataFilter, VectorizeVectorMetadataValue, isVectorizeBinding, layer$1 as layer, make$2 as make, makeClient$1 as makeClient };
|
|
2989
|
+
}
|
|
2990
|
+
/** Vectorize operation represented by {@link VectorizeOperationError}. */
|
|
2991
|
+
type VectorizeOperation = "describe" | "query" | "queryById" | "insert" | "upsert" | "deleteByIds" | "getByIds";
|
|
2992
|
+
declare const VectorizeOperationError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
2993
|
+
readonly _tag: "VectorizeOperationError";
|
|
2994
|
+
} & Readonly<A>;
|
|
2995
|
+
/** Error raised when a Vectorize operation fails. */
|
|
2996
|
+
declare class VectorizeOperationError extends VectorizeOperationError_base<{
|
|
2997
|
+
readonly binding: string;
|
|
2998
|
+
readonly operation: VectorizeOperation;
|
|
2999
|
+
readonly cause: unknown;
|
|
3000
|
+
}> {
|
|
3001
|
+
get message(): string;
|
|
3002
|
+
}
|
|
3003
|
+
/** Typed Vectorize binding definition. */
|
|
3004
|
+
interface VectorizeDefinition {
|
|
3005
|
+
/** Binding name as configured in `wrangler.jsonc`. */
|
|
3006
|
+
readonly binding: string;
|
|
3007
|
+
}
|
|
3008
|
+
type VectorizeBinding = CloudflareVectorize | CloudflareVectorizeIndex;
|
|
3009
|
+
type VectorizeVector = CloudflareVectorizeVector;
|
|
3010
|
+
type VectorizeVectorMetadata = CloudflareVectorizeVectorMetadata;
|
|
3011
|
+
type VectorizeVectorMetadataValue = CloudflareVectorizeVectorMetadataValue;
|
|
3012
|
+
type VectorizeVectorMetadataFilter = CloudflareVectorizeVectorMetadataFilter;
|
|
3013
|
+
type VectorizeQueryOptions = CloudflareVectorizeQueryOptions;
|
|
3014
|
+
type VectorizeMatches = CloudflareVectorizeMatches;
|
|
3015
|
+
type VectorizeMatch = CloudflareVectorizeMatch;
|
|
3016
|
+
type VectorizeIndexInfo = CloudflareVectorizeIndexInfo;
|
|
3017
|
+
type VectorizeIndexDetails = CloudflareVectorizeIndexDetails;
|
|
3018
|
+
type VectorizeMutation = CloudflareVectorizeAsyncMutation | CloudflareVectorizeVectorMutation;
|
|
3019
|
+
type VectorizeValues = Float32Array | Float64Array | ReadonlyArray<number>;
|
|
3020
|
+
interface VectorizeClient {
|
|
3021
|
+
readonly describe: Effect.Effect<VectorizeIndexInfo | VectorizeIndexDetails, VectorizeOperationError>;
|
|
3022
|
+
readonly query: (vector: VectorizeValues, options?: VectorizeQueryOptions) => Effect.Effect<VectorizeMatches, VectorizeOperationError>;
|
|
3023
|
+
readonly queryById: (vectorId: string, options?: VectorizeQueryOptions) => Effect.Effect<VectorizeMatches, VectorizeOperationError>;
|
|
3024
|
+
readonly insert: (vectors: ReadonlyArray<VectorizeVector>) => Effect.Effect<VectorizeMutation, VectorizeOperationError>;
|
|
3025
|
+
readonly upsert: (vectors: ReadonlyArray<VectorizeVector>) => Effect.Effect<VectorizeMutation, VectorizeOperationError>;
|
|
3026
|
+
readonly deleteByIds: (ids: ReadonlyArray<string>) => Effect.Effect<VectorizeMutation, VectorizeOperationError>;
|
|
3027
|
+
readonly delete: (ids: ReadonlyArray<string>) => Effect.Effect<VectorizeMutation, VectorizeOperationError>;
|
|
3028
|
+
readonly getByIds: (ids: ReadonlyArray<string>) => Effect.Effect<ReadonlyArray<VectorizeVector>, VectorizeOperationError>;
|
|
3029
|
+
readonly rawUnsafe: Effect.Effect<VectorizeBinding>;
|
|
3030
|
+
readonly definition: VectorizeDefinition;
|
|
3031
|
+
}
|
|
3032
|
+
declare const VectorizeServiceTypeId: unique symbol;
|
|
3033
|
+
/** Nominal service marker for Vectorize services created with {@link make}. */
|
|
3034
|
+
interface VectorizeService<Id extends string> {
|
|
3035
|
+
readonly [VectorizeServiceTypeId]: {
|
|
3036
|
+
readonly id: Id;
|
|
3037
|
+
};
|
|
3038
|
+
}
|
|
3039
|
+
type LayerOptions$2 = {
|
|
3040
|
+
readonly binding: string;
|
|
3041
|
+
};
|
|
3042
|
+
interface TagClass$2<Self, Id extends string> extends Context.ServiceClass<Self, Id, VectorizeClient> {
|
|
3043
|
+
readonly id: Id;
|
|
3044
|
+
readonly layer: (options: LayerOptions$2) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
3045
|
+
}
|
|
3046
|
+
declare const isVectorizeBinding: (value: unknown) => value is VectorizeBinding;
|
|
3047
|
+
declare const makeClient$1: (definition: VectorizeDefinition) => (index: VectorizeBinding) => VectorizeClient;
|
|
3048
|
+
declare const layer$1: <Self>(tag: Context.Service<Self, VectorizeClient>, definition: VectorizeDefinition) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
3049
|
+
declare const make$2: <Id extends string>(id: Id) => TagClass$2<VectorizeService<Id>, Id>;
|
|
3050
|
+
declare const Tag$3: <Self>() => <Id extends string>(id: Id) => TagClass$2<Self, Id>;
|
|
2815
3051
|
declare namespace WorkflowBinding_d_exports {
|
|
2816
|
-
export { WorkflowBindingClient, WorkflowBindingDefinition, WorkflowInstance, WorkflowInstanceCreateBatchOptions, WorkflowInstanceCreateOptions, WorkflowInstanceEvent, WorkflowInstanceRestartOptions, WorkflowInstanceStatus, WorkflowInstanceStatusName, WorkflowOperationError, WorkflowResultDecodeError, isWorkflow, layer
|
|
3052
|
+
export { WorkflowBindingClient, WorkflowBindingDefinition, WorkflowInstance, WorkflowInstanceCreateBatchOptions, WorkflowInstanceCreateOptions, WorkflowInstanceEvent, WorkflowInstanceRestartOptions, WorkflowInstanceStatus, WorkflowInstanceStatusName, WorkflowOperationError, WorkflowResultDecodeError, isWorkflow, layer, makeClient };
|
|
2817
3053
|
}
|
|
2818
3054
|
type WorkflowInstanceCreateOptions<Payload> = Omit<CloudflareWorkflowInstanceCreateOptions<Payload>, "params">;
|
|
2819
3055
|
type WorkflowInstanceCreateBatchOptions<Payload, EncodedPayload = unknown> = ReadonlyArray<{
|
|
@@ -2849,7 +3085,7 @@ interface WorkflowInstanceEvent {
|
|
|
2849
3085
|
readonly type: string;
|
|
2850
3086
|
readonly payload: unknown;
|
|
2851
3087
|
}
|
|
2852
|
-
interface WorkflowBindingDefinition<Payload extends ServiceFreeSchema$
|
|
3088
|
+
interface WorkflowBindingDefinition<Payload extends ServiceFreeSchema$2, Result extends ServiceFreeSchema$2> {
|
|
2853
3089
|
/** Binding name as configured in `wrangler.jsonc`. */
|
|
2854
3090
|
readonly binding: string;
|
|
2855
3091
|
/** Codec used to encode payloads passed to `Workflow.create`. */
|
|
@@ -2857,11 +3093,11 @@ interface WorkflowBindingDefinition<Payload extends ServiceFreeSchema$4, Result
|
|
|
2857
3093
|
/** Codec used to decode completed workflow status output. */
|
|
2858
3094
|
readonly result: Result;
|
|
2859
3095
|
}
|
|
2860
|
-
interface WorkflowBindingClient<Payload extends ServiceFreeSchema$
|
|
3096
|
+
interface WorkflowBindingClient<Payload extends ServiceFreeSchema$2, Result extends ServiceFreeSchema$2> {
|
|
2861
3097
|
readonly create: (payload: Schema.Schema.Type<Payload>, options?: WorkflowInstanceCreateOptions<Schema.Codec.Encoded<Payload>>) => Effect.Effect<WorkflowInstance<Schema.Schema.Type<Result>>, WorkflowOperationError | Schema.SchemaError>;
|
|
2862
3098
|
readonly createBatch: (batch: WorkflowInstanceCreateBatchOptions<Schema.Schema.Type<Payload>, Schema.Codec.Encoded<Payload>>) => Effect.Effect<ReadonlyArray<WorkflowInstance<Schema.Schema.Type<Result>>>, WorkflowOperationError | Schema.SchemaError>;
|
|
2863
3099
|
readonly get: (instanceId: string) => Effect.Effect<WorkflowInstance<Schema.Schema.Type<Result>>, WorkflowOperationError>;
|
|
2864
|
-
readonly
|
|
3100
|
+
readonly rawUnsafe: Effect.Effect<CloudflareWorkflow<Schema.Codec.Encoded<Payload>>>;
|
|
2865
3101
|
}
|
|
2866
3102
|
declare const WorkflowOperationError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
2867
3103
|
readonly _tag: "WorkflowOperationError";
|
|
@@ -2870,7 +3106,9 @@ declare class WorkflowOperationError extends WorkflowOperationError_base<{
|
|
|
2870
3106
|
readonly binding: string;
|
|
2871
3107
|
readonly operation: string;
|
|
2872
3108
|
readonly cause: unknown;
|
|
2873
|
-
}> {
|
|
3109
|
+
}> {
|
|
3110
|
+
get message(): string;
|
|
3111
|
+
}
|
|
2874
3112
|
declare const WorkflowResultDecodeError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
2875
3113
|
readonly _tag: "WorkflowResultDecodeError";
|
|
2876
3114
|
} & Readonly<A>;
|
|
@@ -2878,51 +3116,53 @@ declare class WorkflowResultDecodeError extends WorkflowResultDecodeError_base<{
|
|
|
2878
3116
|
readonly binding: string;
|
|
2879
3117
|
readonly instanceId: string;
|
|
2880
3118
|
readonly cause: unknown;
|
|
2881
|
-
}> {
|
|
3119
|
+
}> {
|
|
3120
|
+
get message(): string;
|
|
3121
|
+
}
|
|
2882
3122
|
declare const isWorkflow: <Payload>(value: unknown) => value is CloudflareWorkflow<Payload>;
|
|
2883
|
-
declare const makeClient
|
|
2884
|
-
declare const layer
|
|
3123
|
+
declare const makeClient: <Payload extends ServiceFreeSchema$2, Result extends ServiceFreeSchema$2>(definition: WorkflowBindingDefinition<Payload, Result>) => ((workflow: CloudflareWorkflow<Schema.Codec.Encoded<Payload>>) => WorkflowBindingClient<Payload, Result>);
|
|
3124
|
+
declare const layer: <Self, Payload extends ServiceFreeSchema$2, Result extends ServiceFreeSchema$2>(tag: Context.Service<Self, WorkflowBindingClient<Payload, Result>>, definition: WorkflowBindingDefinition<Payload, Result>) => import("effect/Layer").Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
2885
3125
|
declare namespace WorkflowDefinition_d_exports {
|
|
2886
|
-
export { Definition$1 as Definition, Handler$1 as Handler, LayerOptions$
|
|
3126
|
+
export { Definition$1 as Definition, Handler$1 as Handler, LayerOptions$1 as LayerOptions, Options$1 as Options, Tag$2 as Tag, TagClass$1 as TagClass, Workflow, implement$1 as implement, make$1 as make };
|
|
2887
3127
|
}
|
|
2888
|
-
interface Definition$1<Id extends string = string, Payload extends ServiceFreeSchema$
|
|
3128
|
+
interface Definition$1<Id extends string = string, Payload extends ServiceFreeSchema$2 = ServiceFreeSchema$2, Result extends ServiceFreeSchema$2 = ServiceFreeSchema$2> {
|
|
2889
3129
|
readonly id: Id;
|
|
2890
3130
|
readonly payload: Payload;
|
|
2891
3131
|
readonly result: Result;
|
|
2892
3132
|
}
|
|
2893
3133
|
declare namespace Definition$1 {
|
|
2894
|
-
type Any = Definition$1<string, ServiceFreeSchema$
|
|
3134
|
+
type Any = Definition$1<string, ServiceFreeSchema$2, ServiceFreeSchema$2>;
|
|
2895
3135
|
}
|
|
2896
3136
|
type Handler$1<ROut, Self extends Definition$1.Any> = (payload: Schema.Schema.Type<Self["payload"]>) => Effect.Effect<Schema.Schema.Type<Self["result"]>, unknown, WorkflowRunContext<ROut>>;
|
|
2897
3137
|
interface Options$1<ROut, Self extends Definition$1.Any> {
|
|
2898
3138
|
readonly run: Handler$1<ROut, Self>;
|
|
2899
3139
|
}
|
|
2900
|
-
type LayerOptions$
|
|
3140
|
+
type LayerOptions$1 = {
|
|
2901
3141
|
readonly binding: string;
|
|
2902
3142
|
};
|
|
2903
|
-
interface TagClass$
|
|
3143
|
+
interface TagClass$1<Self, Id extends string, Payload extends ServiceFreeSchema$2, Result extends ServiceFreeSchema$2> extends Context.ServiceClass<Self, `effect-cf/Workflow/${Id}`, WorkflowBindingClient<Payload, Result>> {
|
|
2904
3144
|
readonly id: Id;
|
|
2905
3145
|
readonly payload: Payload;
|
|
2906
3146
|
readonly result: Result;
|
|
2907
3147
|
readonly make: <ROut, LayerError>(layer: Layer.Layer<ROut, LayerError, ExecutionContext | WorkerContext | WorkerEnvironment>, options: Options$1<ROut, Definition$1<Id, Payload, Result>>) => WorkflowClass<Schema.Codec.Encoded<Payload>, Schema.Codec.Encoded<Result>, ROut>;
|
|
2908
|
-
readonly layer: (options: LayerOptions$
|
|
3148
|
+
readonly layer: (options: LayerOptions$1) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
2909
3149
|
readonly create: (payload: Schema.Schema.Type<Payload>, options?: WorkflowInstanceCreateOptions<Schema.Codec.Encoded<Payload>>) => Effect.Effect<WorkflowInstance<Schema.Schema.Type<Result>>, WorkflowOperationError | Schema.SchemaError, Self>;
|
|
2910
3150
|
readonly createBatch: (batch: WorkflowInstanceCreateBatchOptions<Schema.Schema.Type<Payload>, Schema.Codec.Encoded<Payload>>) => Effect.Effect<ReadonlyArray<WorkflowInstance<Schema.Schema.Type<Result>>>, WorkflowOperationError | Schema.SchemaError, Self>;
|
|
2911
3151
|
readonly get: (instanceId: string) => Effect.Effect<WorkflowInstance<Schema.Schema.Type<Result>>, WorkflowOperationError, Self>;
|
|
2912
|
-
readonly
|
|
3152
|
+
readonly rawUnsafe: Effect.Effect<globalThis.Workflow<Schema.Codec.Encoded<Payload>>, never, Self>;
|
|
2913
3153
|
}
|
|
2914
|
-
declare const make$
|
|
3154
|
+
declare const make$1: <Id extends string, Payload extends ServiceFreeSchema$2, Result extends ServiceFreeSchema$2>(id: Id, definition: {
|
|
2915
3155
|
readonly payload: Payload;
|
|
2916
3156
|
readonly result: Result;
|
|
2917
|
-
}) => TagClass$
|
|
2918
|
-
declare const Tag$
|
|
3157
|
+
}) => TagClass$1<Definition$1<Id, Payload, Result>, Id, Payload, Result>;
|
|
3158
|
+
declare const Tag$2: <Self>() => <Id extends string, Payload extends ServiceFreeSchema$2, Result extends ServiceFreeSchema$2>(id: Id, definition: {
|
|
2919
3159
|
readonly payload: Payload;
|
|
2920
3160
|
readonly result: Result;
|
|
2921
|
-
}) => TagClass$
|
|
2922
|
-
declare const Workflow: typeof Tag$
|
|
3161
|
+
}) => TagClass$1<Self, Id, Payload, Result>;
|
|
3162
|
+
declare const Workflow: typeof Tag$2;
|
|
2923
3163
|
declare const implement$1: <ROut, const Self extends Definition$1.Any>(_definition: Self, handler: Handler$1<ROut, Self>) => Handler$1<ROut, Self>;
|
|
2924
3164
|
declare namespace Workflow_d_exports {
|
|
2925
|
-
export { Definition, Handler, LayerOptions
|
|
3165
|
+
export { Definition, Handler, LayerOptions, Options, Tag$1 as Tag, TagClass, WorkflowClass, WorkflowEvent$1 as WorkflowEvent, WorkflowEventService, WorkflowHandler, WorkflowOptions, WorkflowRunContext, WorkflowStep$1 as WorkflowStep, WorkflowStepContext$1 as WorkflowStepContext, WorkflowStepError, WorkflowStepService, implement, make, sleep, sleepUntil, step, waitForEvent };
|
|
2926
3166
|
}
|
|
2927
3167
|
interface WorkflowEventService<Payload = unknown> {
|
|
2928
3168
|
readonly raw: WorkflowEvent<unknown>;
|
|
@@ -2933,15 +3173,26 @@ interface WorkflowEventService<Payload = unknown> {
|
|
|
2933
3173
|
}
|
|
2934
3174
|
declare const WorkflowEvent_base: Context.ServiceClass<WorkflowEvent$1, "effect-cf/WorkflowEvent", WorkflowEventService<unknown>>;
|
|
2935
3175
|
declare class WorkflowEvent$1 extends WorkflowEvent_base {}
|
|
3176
|
+
declare const WorkflowStepError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
3177
|
+
readonly _tag: "WorkflowStepError";
|
|
3178
|
+
} & Readonly<A>;
|
|
3179
|
+
/** Failure raised when a Cloudflare Workflow step operation rejects. */
|
|
3180
|
+
declare class WorkflowStepError extends WorkflowStepError_base<{
|
|
3181
|
+
readonly step?: string;
|
|
3182
|
+
readonly operation: string;
|
|
3183
|
+
readonly cause: unknown;
|
|
3184
|
+
}> {
|
|
3185
|
+
get message(): string;
|
|
3186
|
+
}
|
|
2936
3187
|
interface WorkflowStepService {
|
|
2937
3188
|
readonly raw: WorkflowStep;
|
|
2938
|
-
do<A, E, R>(name: string, effect: Effect.Effect<A, E, R>, config?: WorkflowStepConfig): Effect.Effect<A,
|
|
2939
|
-
readonly sleep: (name: string, duration: WorkflowSleepDuration) => Effect.Effect<void,
|
|
2940
|
-
readonly sleepUntil: (name: string, timestamp: Date | number) => Effect.Effect<void,
|
|
3189
|
+
do<A, E, R>(name: string, effect: Effect.Effect<A, E, R>, config?: WorkflowStepConfig): Effect.Effect<A, WorkflowStepError, Exclude<R, WorkflowStepContext$1>>;
|
|
3190
|
+
readonly sleep: (name: string, duration: WorkflowSleepDuration) => Effect.Effect<void, WorkflowStepError>;
|
|
3191
|
+
readonly sleepUntil: (name: string, timestamp: Date | number) => Effect.Effect<void, WorkflowStepError>;
|
|
2941
3192
|
readonly waitForEvent: <Payload>(name: string, options: {
|
|
2942
3193
|
readonly type: string;
|
|
2943
3194
|
readonly timeout?: WorkflowTimeoutDuration | number;
|
|
2944
|
-
}) => Effect.Effect<WorkflowStepEvent<Payload>,
|
|
3195
|
+
}) => Effect.Effect<WorkflowStepEvent<Payload>, WorkflowStepError>;
|
|
2945
3196
|
}
|
|
2946
3197
|
declare const WorkflowStep_base: Context.ServiceClass<WorkflowStep$1, "effect-cf/WorkflowStep", WorkflowStepService>;
|
|
2947
3198
|
declare class WorkflowStep$1 extends WorkflowStep_base {}
|
|
@@ -2956,86 +3207,26 @@ interface WorkflowOptions<ROut, Payload = unknown, Result = unknown> {
|
|
|
2956
3207
|
type WorkflowClass<Payload, Result, _ROut> = new (ctx: globalThis.ExecutionContext, env: WorkerEnv) => WorkflowEntrypoint<WorkerEnv, Payload> & {
|
|
2957
3208
|
run(event: Readonly<WorkflowEvent<Payload>>, step: WorkflowStep): Promise<Result>;
|
|
2958
3209
|
};
|
|
2959
|
-
declare const make
|
|
2960
|
-
declare const step: <A, E, R>(name: string, effect: Effect.Effect<A, E, R>, config?: WorkflowStepConfig) => Effect.Effect<A,
|
|
2961
|
-
declare const sleep: (name: string, duration: WorkflowSleepDuration) => Effect.Effect<void,
|
|
2962
|
-
declare const sleepUntil: (name: string, timestamp: Date | number) => Effect.Effect<void,
|
|
3210
|
+
declare const make: <ROut, LayerError, Payload = unknown, Result = unknown>(layer: Layer.Layer<ROut, LayerError, ExecutionContext | WorkerContext | WorkerEnvironment>, options: WorkflowOptions<ROut, Payload, Result>) => WorkflowClass<Payload, Result, ROut>;
|
|
3211
|
+
declare const step: <A, E, R>(name: string, effect: Effect.Effect<A, E, R>, config?: WorkflowStepConfig) => Effect.Effect<A, WorkflowStepError, WorkflowStep$1 | Exclude<R, WorkflowStepContext$1>>;
|
|
3212
|
+
declare const sleep: (name: string, duration: WorkflowSleepDuration) => Effect.Effect<void, WorkflowStepError, WorkflowStep$1>;
|
|
3213
|
+
declare const sleepUntil: (name: string, timestamp: Date | number) => Effect.Effect<void, WorkflowStepError, WorkflowStep$1>;
|
|
2963
3214
|
declare const waitForEvent: <Payload>(name: string, options: {
|
|
2964
3215
|
readonly type: string;
|
|
2965
3216
|
readonly timeout?: WorkflowTimeoutDuration | number;
|
|
2966
|
-
}) => Effect.Effect<WorkflowStepEvent<Payload>,
|
|
3217
|
+
}) => Effect.Effect<WorkflowStepEvent<Payload>, WorkflowStepError, WorkflowStep$1>;
|
|
2967
3218
|
type Definition<Id extends string = string, Payload extends Definition$1.Any["payload"] = Definition$1.Any["payload"], Result extends Definition$1.Any["result"] = Definition$1.Any["result"]> = Definition$1<Id, Payload, Result>;
|
|
2968
3219
|
declare namespace Definition {
|
|
2969
3220
|
type Any = Definition$1.Any;
|
|
2970
3221
|
}
|
|
2971
|
-
type LayerOptions
|
|
2972
|
-
type TagClass
|
|
2973
|
-
declare const Tag$
|
|
3222
|
+
type LayerOptions = LayerOptions$1;
|
|
3223
|
+
type TagClass<Self, Id extends string, Payload extends Definition$1.Any["payload"], Result extends Definition$1.Any["result"]> = TagClass$1<Self, Id, Payload, Result>;
|
|
3224
|
+
declare const Tag$1: <Self>() => <Id extends string, Payload extends Definition$1.Any["payload"], Result extends Definition$1.Any["result"]>(id: Id, definition: {
|
|
2974
3225
|
readonly payload: Payload;
|
|
2975
3226
|
readonly result: Result;
|
|
2976
|
-
}) => TagClass
|
|
3227
|
+
}) => TagClass<Self, Id, Payload, Result>;
|
|
2977
3228
|
declare const implement: typeof implement$1;
|
|
2978
3229
|
type Handler<ROut, Self extends Definition$1.Any> = Handler$1<ROut, Self>;
|
|
2979
3230
|
type Options<ROut, Self extends Definition$1.Any> = Options$1<ROut, Self>;
|
|
2980
|
-
declare namespace Vectorize_d_exports {
|
|
2981
|
-
export { LayerOptions, Tag$1 as Tag, TagClass, VectorizeBinding, VectorizeClient, VectorizeDefinition, VectorizeIndexDetails, VectorizeIndexInfo, VectorizeMatch, VectorizeMatches, VectorizeMutation, VectorizeOperationError, VectorizeQueryOptions, VectorizeService, VectorizeValues, VectorizeVector, VectorizeVectorMetadata, VectorizeVectorMetadataFilter, VectorizeVectorMetadataValue, isVectorizeBinding, layer, make, makeClient };
|
|
2982
|
-
}
|
|
2983
|
-
declare const VectorizeOperationError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
2984
|
-
readonly _tag: "VectorizeOperationError";
|
|
2985
|
-
} & Readonly<A>;
|
|
2986
|
-
/** Error raised when a Vectorize operation fails. */
|
|
2987
|
-
declare class VectorizeOperationError extends VectorizeOperationError_base<{
|
|
2988
|
-
readonly binding: string;
|
|
2989
|
-
readonly operation: string;
|
|
2990
|
-
readonly cause: unknown;
|
|
2991
|
-
}> {}
|
|
2992
|
-
/** Typed Vectorize binding definition. */
|
|
2993
|
-
interface VectorizeDefinition {
|
|
2994
|
-
/** Binding name as configured in `wrangler.jsonc`. */
|
|
2995
|
-
readonly binding: string;
|
|
2996
|
-
}
|
|
2997
|
-
type VectorizeBinding = CloudflareVectorize | CloudflareVectorizeIndex;
|
|
2998
|
-
type VectorizeVector = CloudflareVectorizeVector;
|
|
2999
|
-
type VectorizeVectorMetadata = CloudflareVectorizeVectorMetadata;
|
|
3000
|
-
type VectorizeVectorMetadataValue = CloudflareVectorizeVectorMetadataValue;
|
|
3001
|
-
type VectorizeVectorMetadataFilter = CloudflareVectorizeVectorMetadataFilter;
|
|
3002
|
-
type VectorizeQueryOptions = CloudflareVectorizeQueryOptions;
|
|
3003
|
-
type VectorizeMatches = CloudflareVectorizeMatches;
|
|
3004
|
-
type VectorizeMatch = CloudflareVectorizeMatch;
|
|
3005
|
-
type VectorizeIndexInfo = CloudflareVectorizeIndexInfo;
|
|
3006
|
-
type VectorizeIndexDetails = CloudflareVectorizeIndexDetails;
|
|
3007
|
-
type VectorizeMutation = CloudflareVectorizeAsyncMutation | CloudflareVectorizeVectorMutation;
|
|
3008
|
-
type VectorizeValues = Float32Array | Float64Array | ReadonlyArray<number>;
|
|
3009
|
-
interface VectorizeClient {
|
|
3010
|
-
readonly describe: Effect.Effect<VectorizeIndexInfo | VectorizeIndexDetails, VectorizeOperationError>;
|
|
3011
|
-
readonly query: (vector: VectorizeValues, options?: VectorizeQueryOptions) => Effect.Effect<VectorizeMatches, VectorizeOperationError>;
|
|
3012
|
-
readonly queryById: (vectorId: string, options?: VectorizeQueryOptions) => Effect.Effect<VectorizeMatches, VectorizeOperationError>;
|
|
3013
|
-
readonly insert: (vectors: ReadonlyArray<VectorizeVector>) => Effect.Effect<VectorizeMutation, VectorizeOperationError>;
|
|
3014
|
-
readonly upsert: (vectors: ReadonlyArray<VectorizeVector>) => Effect.Effect<VectorizeMutation, VectorizeOperationError>;
|
|
3015
|
-
readonly deleteByIds: (ids: ReadonlyArray<string>) => Effect.Effect<VectorizeMutation, VectorizeOperationError>;
|
|
3016
|
-
readonly delete: (ids: ReadonlyArray<string>) => Effect.Effect<VectorizeMutation, VectorizeOperationError>;
|
|
3017
|
-
readonly getByIds: (ids: ReadonlyArray<string>) => Effect.Effect<ReadonlyArray<VectorizeVector>, VectorizeOperationError>;
|
|
3018
|
-
readonly unsafeRaw: Effect.Effect<VectorizeBinding>;
|
|
3019
|
-
readonly definition: VectorizeDefinition;
|
|
3020
|
-
}
|
|
3021
|
-
declare const VectorizeServiceTypeId: unique symbol;
|
|
3022
|
-
/** Nominal service marker for Vectorize services created with {@link make}. */
|
|
3023
|
-
interface VectorizeService<Id extends string> {
|
|
3024
|
-
readonly [VectorizeServiceTypeId]: {
|
|
3025
|
-
readonly id: Id;
|
|
3026
|
-
};
|
|
3027
|
-
}
|
|
3028
|
-
type LayerOptions = {
|
|
3029
|
-
readonly binding: string;
|
|
3030
|
-
};
|
|
3031
|
-
interface TagClass<Self, Id extends string> extends Context.ServiceClass<Self, Id, VectorizeClient> {
|
|
3032
|
-
readonly id: Id;
|
|
3033
|
-
readonly layer: (options: LayerOptions) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
3034
|
-
}
|
|
3035
|
-
declare const isVectorizeBinding: (value: unknown) => value is VectorizeBinding;
|
|
3036
|
-
declare const makeClient: (definition: VectorizeDefinition) => (index: VectorizeBinding) => VectorizeClient;
|
|
3037
|
-
declare const layer: <Self>(tag: Context.Service<Self, VectorizeClient>, definition: VectorizeDefinition) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
3038
|
-
declare const make: <Id extends string>(id: Id) => TagClass<VectorizeService<Id>, Id>;
|
|
3039
|
-
declare const Tag$1: <Self>() => <Id extends string>(id: Id) => TagClass<Self, Id>;
|
|
3040
3231
|
//#endregion
|
|
3041
|
-
export { AiGateway_d_exports as AiGateway, AnalyticsEngine_d_exports as AnalyticsEngine, Binding_d_exports as Binding, BrowserRendering_d_exports as BrowserRendering, Cache_d_exports as Cache, CloudflareOtlp_d_exports as CloudflareOtlp, ContainerNamespace_d_exports as ContainerNamespace, D1_d_exports as D1, DurableObject_d_exports as DurableObject, DurableObjectAlarm_d_exports as DurableObjectAlarm, DurableObjectDefinition_d_exports as DurableObjectDefinition, DurableObjectNamespace_d_exports as DurableObjectNamespace, DurableObjectRpcWebSocket_d_exports as DurableObjectRpcWebSocket, DurableObjectSqlite_d_exports as DurableObjectSqlite, DurableObjectState_d_exports as DurableObjectState, DurableObjectStorage_d_exports as DurableObjectStorage, DurableObjectWebSocket_d_exports as DurableObjectWebSocket, Email_d_exports as Email, Hyperdrive_d_exports as Hyperdrive, Images_d_exports as Images, Kv_d_exports as Kv, Queue_d_exports as Queue, QueueBinding_d_exports as QueueBinding, QueueDefinition_d_exports as QueueDefinition, R2_d_exports as R2, Rpc_d_exports as Rpc, RpcDefinition_d_exports as RpcDefinition, ServiceBinding_d_exports as ServiceBinding, Vectorize_d_exports as Vectorize, Worker_d_exports as Worker, WorkerConfig, WorkerDefinition_d_exports as WorkerDefinition, type WorkerEnv, WorkerEnvironment, WorkersAi_d_exports as WorkersAi, Workflow_d_exports as Workflow, WorkflowBinding_d_exports as WorkflowBinding, WorkflowDefinition_d_exports as WorkflowDefinition };
|
|
3232
|
+
export { AiGateway_d_exports as AiGateway, AnalyticsEngine_d_exports as AnalyticsEngine, Binding_d_exports as Binding, BrowserRendering_d_exports as BrowserRendering, Cache_d_exports as Cache, CloudflareOtlp_d_exports as CloudflareOtlp, ContainerNamespace_d_exports as ContainerNamespace, D1_d_exports as D1, DurableObject_d_exports as DurableObject, DurableObjectAlarm_d_exports as DurableObjectAlarm, DurableObjectDefinition_d_exports as DurableObjectDefinition, DurableObjectNamespace_d_exports as DurableObjectNamespace, DurableObjectRpcWebSocket_d_exports as DurableObjectRpcWebSocket, DurableObjectSqlite_d_exports as DurableObjectSqlite, DurableObjectState_d_exports as DurableObjectState, DurableObjectStorage_d_exports as DurableObjectStorage, DurableObjectWebSocket_d_exports as DurableObjectWebSocket, Email_d_exports as Email, Environment_d_exports as Environment, Hyperdrive_d_exports as Hyperdrive, Images_d_exports as Images, Kv_d_exports as Kv, Queue_d_exports as Queue, QueueBinding_d_exports as QueueBinding, QueueDefinition_d_exports as QueueDefinition, R2_d_exports as R2, Rpc_d_exports as Rpc, RpcDefinition_d_exports as RpcDefinition, ServiceBinding_d_exports as ServiceBinding, Vectorize_d_exports as Vectorize, Worker_d_exports as Worker, WorkerConfig, WorkerDefinition_d_exports as WorkerDefinition, type WorkerEnv, WorkerEnvironment, WorkersAi_d_exports as WorkersAi, Workflow_d_exports as Workflow, WorkflowBinding_d_exports as WorkflowBinding, WorkflowDefinition_d_exports as WorkflowDefinition };
|