effect-cf 0.20.1 → 0.22.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 +44 -0
- package/README.md +2 -2
- 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 +708 -549
- package/dist/index.mjs +924 -587
- 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 +87 -55
- 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 +6 -9
- 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 +14 -2
- 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. */
|
|
@@ -765,7 +787,7 @@ declare class DurableObjectState extends DurableObjectState_base {}
|
|
|
765
787
|
*/
|
|
766
788
|
declare const fromDurableObjectState: (state: globalThis.DurableObjectState) => DurableObjectStateService;
|
|
767
789
|
declare namespace CloudflareOtlp_d_exports {
|
|
768
|
-
export { DurableObjectLayerOptions, LayerOptions$
|
|
790
|
+
export { DurableObjectLayerOptions, LayerOptions$13 as LayerOptions, ResourceOptions, Serialization, Signal, WorkerLayerOptions, layer$12 as layer, layerDurableObject, layerJson, layerProtobuf, layerWorker };
|
|
769
791
|
}
|
|
770
792
|
/** Telemetry signal groups supported by the Cloudflare OTLP layers. */
|
|
771
793
|
type Signal = "logs" | "traces" | "metrics";
|
|
@@ -789,7 +811,7 @@ interface ResourceOptions {
|
|
|
789
811
|
readonly attributes?: Record<string, unknown>;
|
|
790
812
|
}
|
|
791
813
|
/** Options shared by all Cloudflare OTLP telemetry layers. */
|
|
792
|
-
interface LayerOptions$
|
|
814
|
+
interface LayerOptions$13 {
|
|
793
815
|
/**
|
|
794
816
|
* Telemetry signals to export. Defaults to logs, traces, and metrics.
|
|
795
817
|
*
|
|
@@ -816,12 +838,12 @@ interface LayerOptions$15 {
|
|
|
816
838
|
readonly tracerContext?: <X>(primitive: Tracer.EffectPrimitive<X>, span: Tracer.AnySpan) => X;
|
|
817
839
|
}
|
|
818
840
|
/** Resource metadata specific to Cloudflare Workers. */
|
|
819
|
-
interface WorkerLayerOptions extends LayerOptions$
|
|
841
|
+
interface WorkerLayerOptions extends LayerOptions$13 {
|
|
820
842
|
/** Cloudflare Worker name to attach as `cloudflare.worker.name`. */
|
|
821
843
|
readonly workerName?: string;
|
|
822
844
|
}
|
|
823
845
|
/** Resource metadata specific to Cloudflare Durable Objects. */
|
|
824
|
-
interface DurableObjectLayerOptions extends LayerOptions$
|
|
846
|
+
interface DurableObjectLayerOptions extends LayerOptions$13 {
|
|
825
847
|
/** Durable Object class name to attach as `cloudflare.durable_object.class`. */
|
|
826
848
|
readonly className?: string;
|
|
827
849
|
/**
|
|
@@ -838,19 +860,22 @@ interface DurableObjectLayerOptions extends LayerOptions$15 {
|
|
|
838
860
|
* layers. In Cloudflare Workers and Durable Objects, the current `env` object is
|
|
839
861
|
* installed as the primary `ConfigProvider`; outside Cloudflare, the ambient
|
|
840
862
|
* Effect `ConfigProvider` remains the fallback.
|
|
863
|
+
*
|
|
864
|
+
* The layer provides {@link OtlpExporter.Flusher} for draining buffered
|
|
865
|
+
* telemetry before the isolate freezes.
|
|
841
866
|
*/
|
|
842
|
-
declare const layer$12: (options?: LayerOptions$
|
|
867
|
+
declare const layer$12: (options?: LayerOptions$13) => Layer.Layer<OtlpExporter.Flusher>;
|
|
843
868
|
/** Base OTLP telemetry layer forced to JSON serialization. */
|
|
844
|
-
declare const layerJson: (options?: Omit<LayerOptions$
|
|
869
|
+
declare const layerJson: (options?: Omit<LayerOptions$13, "serialization">) => Layer.Layer<OtlpExporter.Flusher>;
|
|
845
870
|
/** Base OTLP telemetry layer forced to protobuf serialization. */
|
|
846
|
-
declare const layerProtobuf: (options?: Omit<LayerOptions$
|
|
871
|
+
declare const layerProtobuf: (options?: Omit<LayerOptions$13, "serialization">) => Layer.Layer<OtlpExporter.Flusher>;
|
|
847
872
|
/**
|
|
848
873
|
* OTLP layer with Cloudflare Worker resource attributes.
|
|
849
874
|
*
|
|
850
875
|
* Provide this layer at runtime scope for long-lived metrics aggregation, or at
|
|
851
876
|
* handler scope when traces/logs should flush as the Cloudflare event finishes.
|
|
852
877
|
*/
|
|
853
|
-
declare const
|
|
878
|
+
declare const layerWorker: (options?: WorkerLayerOptions) => Layer.Layer<OtlpExporter.Flusher>;
|
|
854
879
|
/**
|
|
855
880
|
* OTLP layer with Cloudflare Durable Object resource attributes.
|
|
856
881
|
*
|
|
@@ -858,9 +883,9 @@ declare const workerLayer: (options?: WorkerLayerOptions) => Layer.Layer<never,
|
|
|
858
883
|
* Durable Object id. Prefer leaving `includeObjectId` disabled unless the
|
|
859
884
|
* backend can tolerate high-cardinality resource attributes.
|
|
860
885
|
*/
|
|
861
|
-
declare const
|
|
886
|
+
declare const layerDurableObject: (options?: DurableObjectLayerOptions) => Layer.Layer<OtlpExporter.Flusher, never, DurableObjectState>;
|
|
862
887
|
declare namespace ContainerNamespace_d_exports {
|
|
863
|
-
export { ContainerInstanceClient, ContainerNamespace, ContainerNamespaceClient, ContainerNamespaceDefinition, ContainerNamespaceResource, ContainerNamespaceService, ContainerNamespaceStaticClient, ContainerOperationError, ContainerReadinessOptions, ContainerSignal, ContainerStartAndWaitForPortsOptions, ContainerStartOptions, ContainerState, ContainerStub, ContainerWaitOptions, LayerOptions$
|
|
888
|
+
export { ContainerInstanceClient, ContainerNamespace, ContainerNamespaceClient, ContainerNamespaceDefinition, ContainerNamespaceResource, ContainerNamespaceService, ContainerNamespaceStaticClient, ContainerOperationError, ContainerReadinessOptions, ContainerSignal, ContainerStartAndWaitForPortsOptions, ContainerStartOptions, ContainerState, ContainerStub, ContainerWaitOptions, LayerOptions$12 as LayerOptions, Tag$12 as Tag, TagClass$11 as TagClass, isContainerNamespaceResource, layer$11 as layer, make$13 as make, makeClient$9 as makeClient };
|
|
864
889
|
}
|
|
865
890
|
/** Signal accepted by Cloudflare Container instances. */
|
|
866
891
|
type ContainerSignal = "SIGKILL" | "SIGINT" | "SIGTERM";
|
|
@@ -931,10 +956,12 @@ declare class ContainerOperationError extends ContainerOperationError_base<{
|
|
|
931
956
|
readonly instance: string;
|
|
932
957
|
readonly operation: string;
|
|
933
958
|
readonly cause: unknown;
|
|
934
|
-
}> {
|
|
959
|
+
}> {
|
|
960
|
+
get message(): string;
|
|
961
|
+
}
|
|
935
962
|
/** Effect-wrapped client for one named Container instance. */
|
|
936
963
|
interface ContainerInstanceClient {
|
|
937
|
-
readonly
|
|
964
|
+
readonly rawUnsafe: Effect.Effect<ContainerStub, ContainerOperationError>;
|
|
938
965
|
readonly state: Effect.Effect<ContainerState, ContainerOperationError>;
|
|
939
966
|
readonly fetch: (input: RequestInfo | URL, init?: RequestInit) => Effect.Effect<Response, ContainerOperationError>;
|
|
940
967
|
readonly start: (options?: ContainerStartOptions, waitOptions?: ContainerWaitOptions) => Effect.Effect<void, ContainerOperationError>;
|
|
@@ -947,7 +974,7 @@ interface ContainerNamespaceClient {
|
|
|
947
974
|
readonly definition: ContainerNamespaceDefinition;
|
|
948
975
|
readonly getByName: (name: string, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions) => Effect.Effect<ContainerInstanceClient, ContainerOperationError>;
|
|
949
976
|
readonly byName: (name: string, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions) => ContainerInstanceClient;
|
|
950
|
-
readonly
|
|
977
|
+
readonly rawUnsafe: Effect.Effect<ContainerNamespaceResource>;
|
|
951
978
|
}
|
|
952
979
|
type ContainerNamespaceStaticClient<R> = {
|
|
953
980
|
readonly getByName: (name: string, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions) => Effect.Effect<ContainerInstanceClient, ContainerOperationError, R>;
|
|
@@ -958,21 +985,21 @@ type ContainerNamespaceStaticClient<R> = {
|
|
|
958
985
|
readonly startAndWaitForPorts: (options?: ContainerStartAndWaitForPortsOptions) => Effect.Effect<void, ContainerOperationError, R>;
|
|
959
986
|
readonly stop: (signal?: ContainerSignal) => Effect.Effect<void, ContainerOperationError, R>;
|
|
960
987
|
readonly destroy: Effect.Effect<void, ContainerOperationError, R>;
|
|
961
|
-
readonly
|
|
988
|
+
readonly rawUnsafe: Effect.Effect<ContainerStub, ContainerOperationError, R>;
|
|
962
989
|
};
|
|
963
|
-
readonly
|
|
990
|
+
readonly rawUnsafe: Effect.Effect<ContainerNamespaceResource, never, R>;
|
|
964
991
|
};
|
|
965
|
-
type LayerOptions$
|
|
992
|
+
type LayerOptions$12 = {
|
|
966
993
|
readonly binding: string;
|
|
967
994
|
};
|
|
968
|
-
interface TagClass$
|
|
995
|
+
interface TagClass$11<Self, Id extends string> extends Context.ServiceClass<Self, `effect-cf/Container/${Id}`, ContainerNamespaceClient>, ContainerNamespaceStaticClient<Self> {
|
|
969
996
|
readonly id: Id;
|
|
970
|
-
readonly layer: (options: LayerOptions$
|
|
997
|
+
readonly layer: (options: LayerOptions$12) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
971
998
|
}
|
|
972
999
|
declare const isContainerNamespaceResource: (value: unknown) => value is ContainerNamespaceResource;
|
|
973
1000
|
declare const makeClient$9: (definition: ContainerNamespaceDefinition) => (namespace: ContainerNamespaceResource) => ContainerNamespaceClient;
|
|
974
1001
|
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$
|
|
1002
|
+
declare const make$13: <Id extends string>(id: Id) => TagClass$11<ContainerNamespaceService<Id>, Id>;
|
|
976
1003
|
declare const ContainerNamespaceServiceTypeId: unique symbol;
|
|
977
1004
|
/** Nominal service marker for Container namespaces created with {@link make}. */
|
|
978
1005
|
interface ContainerNamespaceService<Id extends string> {
|
|
@@ -981,11 +1008,13 @@ interface ContainerNamespaceService<Id extends string> {
|
|
|
981
1008
|
};
|
|
982
1009
|
}
|
|
983
1010
|
/** Creates a typed Effect service for a Cloudflare Container namespace. */
|
|
984
|
-
declare const Tag$
|
|
985
|
-
declare const ContainerNamespace: typeof Tag$
|
|
1011
|
+
declare const Tag$12: <Self>() => <Id extends string>(id: Id) => TagClass$11<Self, Id>;
|
|
1012
|
+
declare const ContainerNamespace: typeof Tag$12;
|
|
986
1013
|
declare namespace D1_d_exports {
|
|
987
|
-
export { D1Definition, D1Service, D1SqlLayerOptions, Service$1 as Service, make$12 as make };
|
|
1014
|
+
export { D1Definition, D1Service, D1SqlLayerOptions, Service$1 as Service, TypeId$2 as TypeId, make$12 as make };
|
|
988
1015
|
}
|
|
1016
|
+
declare const TypeId$2: "~effect-cf/D1";
|
|
1017
|
+
type TypeId$2 = typeof TypeId$2;
|
|
989
1018
|
/** Typed D1 binding definition. */
|
|
990
1019
|
interface D1Definition {
|
|
991
1020
|
/** Binding name as configured in `wrangler.jsonc`. */
|
|
@@ -1004,9 +1033,9 @@ interface D1Service<Id extends string> {
|
|
|
1004
1033
|
* Creates a typed D1 service tag plus Effect helpers.
|
|
1005
1034
|
*/
|
|
1006
1035
|
declare const make$12: <Id extends string>(id: Id, definition: D1Definition) => BindingService<D1Service<Id>, Id, D1Database> & {
|
|
1007
|
-
"effect-cf/D1": "effect-cf/D1";
|
|
1036
|
+
"~effect-cf/D1": "~effect-cf/D1";
|
|
1008
1037
|
definition: D1Definition;
|
|
1009
|
-
sqlLayer: (options?: D1SqlLayerOptions) => Layer.Layer<D1Client.D1Client |
|
|
1038
|
+
sqlLayer: (options?: D1SqlLayerOptions) => Layer.Layer<D1Client.D1Client | SqlClient.SqlClient, Config.ConfigError | BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
1010
1039
|
};
|
|
1011
1040
|
/**
|
|
1012
1041
|
* Builds a D1 service around a Cloudflare D1 database binding.
|
|
@@ -1024,9 +1053,9 @@ declare const make$12: <Id extends string>(id: Id, definition: D1Definition) =>
|
|
|
1024
1053
|
* ```
|
|
1025
1054
|
*/
|
|
1026
1055
|
declare const Service$1: <Self>() => <Id extends string>(id: Id, definition: D1Definition) => BindingService<Self, Id, D1Database> & {
|
|
1027
|
-
"effect-cf/D1": "effect-cf/D1";
|
|
1056
|
+
"~effect-cf/D1": "~effect-cf/D1";
|
|
1028
1057
|
definition: D1Definition;
|
|
1029
|
-
sqlLayer: (options?: D1SqlLayerOptions) => Layer.Layer<D1Client.D1Client |
|
|
1058
|
+
sqlLayer: (options?: D1SqlLayerOptions) => Layer.Layer<D1Client.D1Client | SqlClient.SqlClient, Config.ConfigError | BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
1030
1059
|
};
|
|
1031
1060
|
declare namespace Rpc_d_exports {
|
|
1032
1061
|
export { DisposableValue, MethodArgs, MethodKey, MethodReturn, Provider, Result$1 as Result, RpcStub, RpcTarget, Serializable, Stub, Stubable, Stubify, dispose, isDisposable, resolve, scoped };
|
|
@@ -1053,7 +1082,7 @@ declare const dispose: (value: unknown) => Effect.Effect<void>;
|
|
|
1053
1082
|
declare const resolve: <A>(value: A) => Effect.Effect<Awaited<A>, unknown>;
|
|
1054
1083
|
declare const scoped: <A>(value: A) => Effect.Effect<Awaited<A>, unknown, Scope.Scope>;
|
|
1055
1084
|
declare namespace RpcDefinition_d_exports {
|
|
1056
|
-
export { Definition$
|
|
1085
|
+
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$11 as make, method$2 as method, reservedMethodNames };
|
|
1057
1086
|
}
|
|
1058
1087
|
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
1088
|
readonly _tag: "RpcReservedMethodNameError";
|
|
@@ -1061,34 +1090,36 @@ declare const RpcReservedMethodNameError_base: new <A extends Record<string, any
|
|
|
1061
1090
|
declare class RpcReservedMethodNameError extends RpcReservedMethodNameError_base<{
|
|
1062
1091
|
readonly definition: string;
|
|
1063
1092
|
readonly method: string;
|
|
1064
|
-
}> {
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
readonly
|
|
1070
|
-
readonly
|
|
1071
|
-
readonly
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
readonly
|
|
1079
|
-
readonly
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1093
|
+
}> {
|
|
1094
|
+
get message(): string;
|
|
1095
|
+
}
|
|
1096
|
+
declare const RpcArgumentCountError_base: Schema.Class<RpcArgumentCountError, Schema.TaggedStruct<"RpcArgumentCountError", {
|
|
1097
|
+
readonly definition: Schema.String;
|
|
1098
|
+
readonly method: Schema.String;
|
|
1099
|
+
readonly expected: Schema.Number;
|
|
1100
|
+
readonly actual: Schema.Number;
|
|
1101
|
+
}>, import("effect/Cause").YieldableError>;
|
|
1102
|
+
declare class RpcArgumentCountError extends RpcArgumentCountError_base {
|
|
1103
|
+
get message(): string;
|
|
1104
|
+
}
|
|
1105
|
+
declare const RpcArgumentDecodeError_base: Schema.Class<RpcArgumentDecodeError, Schema.TaggedStruct<"RpcArgumentDecodeError", {
|
|
1106
|
+
readonly definition: Schema.String;
|
|
1107
|
+
readonly method: Schema.String;
|
|
1108
|
+
readonly cause: Schema.Defect;
|
|
1109
|
+
}>, import("effect/Cause").YieldableError>;
|
|
1110
|
+
declare class RpcArgumentDecodeError extends RpcArgumentDecodeError_base {
|
|
1111
|
+
get message(): string;
|
|
1112
|
+
}
|
|
1083
1113
|
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
1114
|
readonly _tag: "RpcArgumentEncodeError";
|
|
1085
1115
|
} & Readonly<A>;
|
|
1086
1116
|
declare class RpcArgumentEncodeError extends RpcArgumentEncodeError_base<{
|
|
1087
1117
|
readonly definition: string;
|
|
1088
1118
|
readonly method: string;
|
|
1089
|
-
readonly index: number;
|
|
1090
1119
|
readonly cause: unknown;
|
|
1091
|
-
}> {
|
|
1120
|
+
}> {
|
|
1121
|
+
get message(): string;
|
|
1122
|
+
}
|
|
1092
1123
|
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
1124
|
readonly _tag: "RpcSuccessDecodeError";
|
|
1094
1125
|
} & Readonly<A>;
|
|
@@ -1096,63 +1127,70 @@ declare class RpcSuccessDecodeError extends RpcSuccessDecodeError_base<{
|
|
|
1096
1127
|
readonly definition: string;
|
|
1097
1128
|
readonly method: string;
|
|
1098
1129
|
readonly cause: unknown;
|
|
1099
|
-
}> {
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
readonly
|
|
1105
|
-
readonly
|
|
1106
|
-
|
|
1107
|
-
|
|
1130
|
+
}> {
|
|
1131
|
+
get message(): string;
|
|
1132
|
+
}
|
|
1133
|
+
declare const RpcSuccessEncodeError_base: Schema.Class<RpcSuccessEncodeError, Schema.TaggedStruct<"RpcSuccessEncodeError", {
|
|
1134
|
+
readonly definition: Schema.String;
|
|
1135
|
+
readonly method: Schema.String;
|
|
1136
|
+
readonly cause: Schema.Defect;
|
|
1137
|
+
}>, import("effect/Cause").YieldableError>;
|
|
1138
|
+
declare class RpcSuccessEncodeError extends RpcSuccessEncodeError_base {
|
|
1139
|
+
get message(): string;
|
|
1140
|
+
}
|
|
1141
|
+
/** Errors raised server-side that must survive the Cloudflare RPC wire. */
|
|
1142
|
+
type WireError = RpcArgumentCountError | RpcArgumentDecodeError | RpcSuccessEncodeError;
|
|
1143
|
+
declare const isWireError: (error: unknown) => error is WireError;
|
|
1144
|
+
/**
|
|
1145
|
+
* Encodes package RPC errors into a plain `Error` envelope so their tags
|
|
1146
|
+
* survive Cloudflare RPC serialization, which drops custom error properties.
|
|
1147
|
+
*/
|
|
1148
|
+
declare const encodeWireError: (error: unknown) => unknown;
|
|
1149
|
+
/** Restores package RPC errors from the {@link encodeWireError} envelope. */
|
|
1150
|
+
declare const decodeWireError: (cause: unknown) => unknown;
|
|
1108
1151
|
declare const reservedMethodNames: Set<string>;
|
|
1109
|
-
type ReservedMethodName$
|
|
1110
|
-
type ServiceFreeSchema$
|
|
1111
|
-
interface Method$
|
|
1152
|
+
type ReservedMethodName$5 = "constructor" | "fetch" | "connect" | "alarm" | "webSocketMessage" | "webSocketClose" | "webSocketError" | "then" | "dup" | "dispose" | "serialize" | "deserialize";
|
|
1153
|
+
type ServiceFreeSchema$2 = Schema.Codec<any, any, never, never>;
|
|
1154
|
+
interface Method$3<Args extends ReadonlyArray<ServiceFreeSchema$2> = ReadonlyArray<ServiceFreeSchema$2>, Success extends ServiceFreeSchema$2 = ServiceFreeSchema$2> {
|
|
1112
1155
|
readonly args: Args;
|
|
1113
1156
|
readonly success: Success;
|
|
1114
1157
|
}
|
|
1115
|
-
declare namespace Method$
|
|
1116
|
-
export type Any = Method$
|
|
1117
|
-
type ArgsFromSchemas<Args extends ReadonlyArray<ServiceFreeSchema$
|
|
1118
|
-
|
|
1158
|
+
declare namespace Method$3 {
|
|
1159
|
+
export type Any = Method$3<ReadonlyArray<ServiceFreeSchema$2>, ServiceFreeSchema$2>;
|
|
1160
|
+
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]>>;
|
|
1161
|
+
/** Method schemas cross the wire through their canonical JSON codec. */
|
|
1162
|
+
type EncodedArgsFromSchemas<Args extends ReadonlyArray<ServiceFreeSchema$2>> = { [Index in keyof Args]: Schema.Json; };
|
|
1119
1163
|
export type Args<Self extends Any> = ArgsFromSchemas<Self["args"]>;
|
|
1120
1164
|
export type EncodedArgs<Self extends Any> = EncodedArgsFromSchemas<Self["args"]>;
|
|
1121
1165
|
export type Success<Self extends Any> = Schema.Schema.Type<Self["success"]>;
|
|
1122
|
-
export type EncodedSuccess<Self extends Any> = Schema.
|
|
1166
|
+
export type EncodedSuccess<Self extends Any> = Schema.Json;
|
|
1123
1167
|
export {};
|
|
1124
1168
|
}
|
|
1125
|
-
type Methods$
|
|
1126
|
-
type NoReservedMethods$
|
|
1127
|
-
interface Definition$
|
|
1169
|
+
type Methods$2 = Record<string, Method$3.Any>;
|
|
1170
|
+
type NoReservedMethods$2<MethodsShape extends Methods$2, Reserved extends string = ReservedMethodName$5> = Extract<keyof MethodsShape, Reserved> extends never ? MethodsShape : never;
|
|
1171
|
+
interface Definition$7<Id extends string = string, MethodsShape extends Methods$2 = Methods$2> {
|
|
1128
1172
|
readonly id: Id;
|
|
1129
1173
|
readonly methods: MethodsShape;
|
|
1130
1174
|
}
|
|
1131
|
-
declare namespace Definition$
|
|
1132
|
-
type Any = Definition$
|
|
1133
|
-
type ServerApi<Self extends Any> = { readonly [Key in keyof Self["methods"]]: (...args: Method$
|
|
1175
|
+
declare namespace Definition$7 {
|
|
1176
|
+
type Any = Definition$7<string, Methods$2>;
|
|
1177
|
+
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]>>; };
|
|
1134
1178
|
type Api<Self extends Any, Reserved extends string = never> = Provider<ServerApi<Self>, Reserved>;
|
|
1135
1179
|
type MethodNames<Self extends Any> = Extract<keyof Self["methods"], string>;
|
|
1136
1180
|
}
|
|
1137
|
-
declare class ReservedMethodNameError extends Error {
|
|
1138
|
-
readonly method: string;
|
|
1139
|
-
readonly target: string;
|
|
1140
|
-
constructor(target: string, method: string);
|
|
1141
|
-
}
|
|
1142
1181
|
declare const assertNoReservedMethods: (target: string, methods: Record<string, unknown>, reserved: ReadonlySet<string>) => void;
|
|
1143
|
-
declare function method$
|
|
1182
|
+
declare function method$2<Success extends ServiceFreeSchema$2>(definition: {
|
|
1144
1183
|
readonly success: Success;
|
|
1145
|
-
}): Method$
|
|
1146
|
-
declare function method$
|
|
1184
|
+
}): Method$3<readonly [], Success>;
|
|
1185
|
+
declare function method$2<const Args extends ReadonlyArray<ServiceFreeSchema$2>, Success extends ServiceFreeSchema$2>(definition: {
|
|
1147
1186
|
readonly args: Args;
|
|
1148
1187
|
readonly success: Success;
|
|
1149
|
-
}): Method$
|
|
1150
|
-
declare const
|
|
1151
|
-
declare const
|
|
1152
|
-
declare const
|
|
1153
|
-
declare const
|
|
1154
|
-
declare const
|
|
1155
|
-
declare const make$11: <Id extends string, const MethodsShape extends Methods$4>(id: Id, methods: MethodsShape) => Definition$9<Id, MethodsShape>;
|
|
1188
|
+
}): Method$3<Args, Success>;
|
|
1189
|
+
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>;
|
|
1190
|
+
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>;
|
|
1191
|
+
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>;
|
|
1192
|
+
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>;
|
|
1193
|
+
declare const make$11: <Id extends string, const MethodsShape extends Methods$2>(id: Id, methods: MethodsShape) => Definition$7<Id, MethodsShape>;
|
|
1156
1194
|
declare namespace QueueBinding_d_exports {
|
|
1157
1195
|
export { MessageSendRequest, QueueBindingClient, QueueBindingDefinition, QueueMetrics, QueueOperationError, QueueProducer, QueueSendBatchOptions, QueueSendBatchResponse, QueueSendOptions, QueueSendResponse, isQueue, layer$10 as layer, makeClient$8 as makeClient };
|
|
1158
1196
|
}
|
|
@@ -1163,17 +1201,17 @@ type QueueSendBatchResponse = CloudflareQueueSendBatchResponse;
|
|
|
1163
1201
|
type QueueMetrics = CloudflareQueueMetrics;
|
|
1164
1202
|
type MessageSendRequest<Body> = CloudflareMessageSendRequest<Body>;
|
|
1165
1203
|
type QueueProducer<Body> = Pick<CloudflareQueue<Body>, "send"> & Partial<Pick<CloudflareQueue<Body>, "sendBatch" | "metrics">>;
|
|
1166
|
-
interface QueueBindingDefinition<Message extends ServiceFreeSchema$
|
|
1204
|
+
interface QueueBindingDefinition<Message extends ServiceFreeSchema$2> {
|
|
1167
1205
|
/** Binding name as configured in `wrangler.jsonc`. */
|
|
1168
1206
|
readonly binding: string;
|
|
1169
1207
|
/** Codec used to encode messages before sending them to Cloudflare Queues. */
|
|
1170
1208
|
readonly message: Message;
|
|
1171
1209
|
}
|
|
1172
|
-
interface QueueBindingClient<Message extends ServiceFreeSchema$
|
|
1210
|
+
interface QueueBindingClient<Message extends ServiceFreeSchema$2> {
|
|
1173
1211
|
readonly send: (message: Schema.Schema.Type<Message>, options?: QueueSendOptions) => Effect.Effect<void, QueueOperationError | Schema.SchemaError>;
|
|
1174
1212
|
readonly sendBatch: (messages: Iterable<MessageSendRequest<Schema.Schema.Type<Message>>>, options?: QueueSendBatchOptions) => Effect.Effect<void, QueueOperationError | Schema.SchemaError>;
|
|
1175
1213
|
readonly metrics: () => Effect.Effect<QueueMetrics, QueueOperationError>;
|
|
1176
|
-
readonly
|
|
1214
|
+
readonly rawUnsafe: Effect.Effect<CloudflareQueue<Schema.Codec.Encoded<Message>>>;
|
|
1177
1215
|
}
|
|
1178
1216
|
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
1217
|
readonly _tag: "QueueOperationError";
|
|
@@ -1185,46 +1223,46 @@ declare class QueueOperationError extends QueueOperationError_base<{
|
|
|
1185
1223
|
readonly message: string;
|
|
1186
1224
|
}> {}
|
|
1187
1225
|
declare const isQueue: <Body>(value: unknown) => value is QueueProducer<Body>;
|
|
1188
|
-
declare const makeClient$8: <Message extends ServiceFreeSchema$
|
|
1189
|
-
declare const layer$10: <Self, Message extends ServiceFreeSchema$
|
|
1226
|
+
declare const makeClient$8: <Message extends ServiceFreeSchema$2>(definition: QueueBindingDefinition<Message>) => ((queue: QueueProducer<Schema.Codec.Encoded<Message>>) => QueueBindingClient<Message>);
|
|
1227
|
+
declare const layer$10: <Self, Message extends ServiceFreeSchema$2>(tag: Context.Service<Self, QueueBindingClient<Message>>, definition: QueueBindingDefinition<Message>) => import("effect/Layer").Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
1190
1228
|
declare namespace QueueDefinition_d_exports {
|
|
1191
|
-
export { Definition$
|
|
1229
|
+
export { Definition$6 as Definition, Handler$3 as Handler, LayerOptions$11 as LayerOptions, Options$5 as Options, Queue$1 as Queue, Tag$11 as Tag, TagClass$10 as TagClass, implement$5 as implement, make$10 as make };
|
|
1192
1230
|
}
|
|
1193
|
-
interface Definition$
|
|
1231
|
+
interface Definition$6<Id extends string = string, Message extends ServiceFreeSchema$2 = ServiceFreeSchema$2> {
|
|
1194
1232
|
readonly id: Id;
|
|
1195
1233
|
readonly message: Message;
|
|
1196
1234
|
}
|
|
1197
|
-
declare namespace Definition$
|
|
1198
|
-
type Any = Definition$
|
|
1235
|
+
declare namespace Definition$6 {
|
|
1236
|
+
type Any = Definition$6<string, ServiceFreeSchema$2>;
|
|
1199
1237
|
}
|
|
1200
|
-
type Handler$3<ROut, Self extends Definition$
|
|
1201
|
-
interface Options$
|
|
1238
|
+
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>;
|
|
1239
|
+
interface Options$5<ROut, Self extends Definition$6.Any> extends Omit<WorkerOptions<ROut, Record<never, never>>, "queue" | "rpc"> {
|
|
1202
1240
|
readonly queue: Handler$3<ROut, Self>;
|
|
1203
1241
|
readonly rpc?: never;
|
|
1204
1242
|
}
|
|
1205
|
-
type LayerOptions$
|
|
1243
|
+
type LayerOptions$11 = {
|
|
1206
1244
|
readonly binding: string;
|
|
1207
1245
|
};
|
|
1208
|
-
interface TagClass$
|
|
1246
|
+
interface TagClass$10<Self, Id extends string, Message extends ServiceFreeSchema$2> extends Context.ServiceClass<Self, `effect-cf/Queue/${Id}`, QueueBindingClient<Message>> {
|
|
1209
1247
|
readonly id: Id;
|
|
1210
1248
|
readonly message: Message;
|
|
1211
|
-
readonly make: <ROut, LayerError>(layer: Layer.Layer<ROut, LayerError, ExecutionContext | WorkerContext | WorkerEnvironment>, options: Options$
|
|
1212
|
-
readonly layer: (options: LayerOptions$
|
|
1249
|
+
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>;
|
|
1250
|
+
readonly layer: (options: LayerOptions$11) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
1213
1251
|
readonly send: (message: Schema.Schema.Type<Message>, options?: QueueSendOptions) => Effect.Effect<void, QueueOperationError | Schema.SchemaError, Self>;
|
|
1214
1252
|
readonly sendBatch: (messages: Iterable<MessageSendRequest<Schema.Schema.Type<Message>>>, options?: QueueSendBatchOptions) => Effect.Effect<void, QueueOperationError | Schema.SchemaError, Self>;
|
|
1215
1253
|
readonly metrics: () => Effect.Effect<QueueMetrics, QueueOperationError, Self>;
|
|
1216
|
-
readonly
|
|
1254
|
+
readonly rawUnsafe: Effect.Effect<globalThis.Queue<Schema.Codec.Encoded<Message>>, never, Self>;
|
|
1217
1255
|
}
|
|
1218
|
-
declare const make$10: <Id extends string, Message extends ServiceFreeSchema$
|
|
1256
|
+
declare const make$10: <Id extends string, Message extends ServiceFreeSchema$2>(id: Id, definition: {
|
|
1219
1257
|
readonly message: Message;
|
|
1220
|
-
}) => TagClass$
|
|
1221
|
-
declare const Tag$
|
|
1258
|
+
}) => TagClass$10<Definition$6<Id, Message>, Id, Message>;
|
|
1259
|
+
declare const Tag$11: <Self>() => <Id extends string, Message extends ServiceFreeSchema$2>(id: Id, definition: {
|
|
1222
1260
|
readonly message: Message;
|
|
1223
|
-
}) => TagClass$
|
|
1224
|
-
declare const Queue$1: typeof Tag$
|
|
1225
|
-
declare const implement$
|
|
1261
|
+
}) => TagClass$10<Self, Id, Message>;
|
|
1262
|
+
declare const Queue$1: typeof Tag$11;
|
|
1263
|
+
declare const implement$5: <ROut, const Self extends Definition$6.Any>(_definition: Self, handler: Handler$3<ROut, Self>) => Handler$3<ROut, Self>;
|
|
1226
1264
|
declare namespace Queue_d_exports {
|
|
1227
|
-
export { Definition$
|
|
1265
|
+
export { Definition$5 as Definition, Handler$2 as Handler, LayerOptions$10 as LayerOptions, Options$4 as Options, QueueBatch, QueueHandler, QueueMessage, QueueMessageDecodeError, QueueOptions, Tag$10 as Tag, TagClass$9 as TagClass, decodeBatch, fromMessage, fromMessageBatch, implement$4 as implement };
|
|
1228
1266
|
}
|
|
1229
1267
|
interface QueueMessage<Body> {
|
|
1230
1268
|
readonly raw: globalThis.Message<unknown>;
|
|
@@ -1251,7 +1289,9 @@ declare class QueueMessageDecodeError extends QueueMessageDecodeError_base<{
|
|
|
1251
1289
|
readonly messageId: string;
|
|
1252
1290
|
readonly index: number;
|
|
1253
1291
|
readonly cause: unknown;
|
|
1254
|
-
}> {
|
|
1292
|
+
}> {
|
|
1293
|
+
get message(): string;
|
|
1294
|
+
}
|
|
1255
1295
|
type RuntimeContext$2<ROut> = ExecutionContext | WorkerContext | WorkerEnvironment | ROut;
|
|
1256
1296
|
type QueueHandlerContext<ROut> = RuntimeContext$2<ROut> | Scope.Scope;
|
|
1257
1297
|
type QueueHandler<ROut, Body = unknown> = (batch: QueueBatch<Body>) => Effect.Effect<void, unknown, QueueHandlerContext<ROut>>;
|
|
@@ -1269,99 +1309,18 @@ declare const fromMessage: <Body>(message: globalThis.Message<unknown>, body: Bo
|
|
|
1269
1309
|
};
|
|
1270
1310
|
declare const fromMessageBatch: <Body>(batch: globalThis.MessageBatch<unknown>, messages: ReadonlyArray<QueueMessage<Body>>) => QueueBatch<Body>;
|
|
1271
1311
|
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$
|
|
1312
|
+
type Definition$5<Id extends string = string, Message extends Definition$6.Any["message"] = Definition$6.Any["message"]> = Definition$6<Id, Message>;
|
|
1313
|
+
declare namespace Definition$5 {
|
|
1314
|
+
type Any = Definition$6.Any;
|
|
1275
1315
|
}
|
|
1276
|
-
type LayerOptions$
|
|
1277
|
-
type TagClass$
|
|
1278
|
-
declare const Tag$
|
|
1316
|
+
type LayerOptions$10 = LayerOptions$11;
|
|
1317
|
+
type TagClass$9<Self, Id extends string, Message extends Definition$6.Any["message"]> = TagClass$10<Self, Id, Message>;
|
|
1318
|
+
declare const Tag$10: <Self>() => <Id extends string, Message extends Definition$6.Any["message"]>(id: Id, definition: {
|
|
1279
1319
|
readonly message: Message;
|
|
1280
|
-
}) => TagClass$
|
|
1281
|
-
declare const implement$
|
|
1282
|
-
type Handler$2<ROut, Self extends Definition$
|
|
1283
|
-
type Options$
|
|
1284
|
-
declare namespace WorkerDefinition_d_exports {
|
|
1285
|
-
export { Api$3 as Api, Definition$6 as Definition, HandlerEffect$3 as HandlerEffect, Handlers$3 as Handlers, LayerOptions$11 as LayerOptions, Method$4 as Method, Methods$3 as Methods, NoReservedMethods$3 as NoReservedMethods, Options$5 as Options, ReservedMethodName$5 as ReservedMethodName, ServerApi$4 as ServerApi, ServiceFreeSchema$3 as ServiceFreeSchema, Tag$11 as Tag, TagClass$10 as TagClass, Worker, implement$5 as implement, make$9 as make, method$3 as method };
|
|
1286
|
-
}
|
|
1287
|
-
type ServiceFreeSchema$3 = Schema.Codec<any, any, never, never>;
|
|
1288
|
-
interface Method$4<Args extends ReadonlyArray<ServiceFreeSchema$3> = ReadonlyArray<ServiceFreeSchema$3>, Success extends ServiceFreeSchema$3 = ServiceFreeSchema$3> {
|
|
1289
|
-
readonly args: Args;
|
|
1290
|
-
readonly success: Success;
|
|
1291
|
-
}
|
|
1292
|
-
declare namespace Method$4 {
|
|
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 {};
|
|
1301
|
-
}
|
|
1302
|
-
type Methods$3 = Record<string, Method$4.Any>;
|
|
1303
|
-
/**
|
|
1304
|
-
* RPC contract for a Worker service.
|
|
1305
|
-
*
|
|
1306
|
-
* Create with {@link make} and reuse to type both worker implementations and
|
|
1307
|
-
* service bindings in other workers.
|
|
1308
|
-
*/
|
|
1309
|
-
interface Definition$6<Id extends string = string, MethodsShape extends Methods$3 = Methods$3> {
|
|
1310
|
-
readonly id: Id;
|
|
1311
|
-
readonly methods: MethodsShape;
|
|
1312
|
-
}
|
|
1313
|
-
declare namespace Definition$6 {
|
|
1314
|
-
type Any = Definition$6<string, Methods$3>;
|
|
1315
|
-
}
|
|
1316
|
-
type ReservedMethodName$5 = ReservedMethodName$3;
|
|
1317
|
-
type NoReservedMethods$3<MethodsShape extends Methods$3> = Extract<keyof MethodsShape, ReservedMethodName$5> extends never ? MethodsShape : never;
|
|
1318
|
-
/**
|
|
1319
|
-
* Promise-based client API derived from a {@link Definition}.
|
|
1320
|
-
*/
|
|
1321
|
-
type ServerApi$4<Self extends Definition$6.Any> = { readonly [Key in keyof Self["methods"]]: (...args: Method$4.Args<Self["methods"][Key]>) => Promise<Method$4.Success<Self["methods"][Key]>>; };
|
|
1322
|
-
type Api$3<Self extends Definition$6.Any> = Provider<ServerApi$4<Self>, ReservedMethodName$5>;
|
|
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]>>;
|
|
1320
|
+
}) => TagClass$9<Self, Id, Message>;
|
|
1321
|
+
declare const implement$4: typeof implement$5;
|
|
1322
|
+
type Handler$2<ROut, Self extends Definition$6.Any> = Handler$3<ROut, Self>;
|
|
1323
|
+
type Options$4<ROut, Self extends Definition$6.Any> = Options$5<ROut, Self>;
|
|
1365
1324
|
//#endregion
|
|
1366
1325
|
//#region src/internal/RpcInvocation.d.ts
|
|
1367
1326
|
type AnyArgs = Array<any>;
|
|
@@ -1380,17 +1339,17 @@ interface ServiceFetcher {
|
|
|
1380
1339
|
fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
|
|
1381
1340
|
}
|
|
1382
1341
|
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$
|
|
1342
|
+
type ReservedMethodName$4 = ReservedMethodName$3 | "fetch";
|
|
1384
1343
|
/**
|
|
1385
1344
|
* Native Cloudflare service object including optional RPC methods.
|
|
1386
1345
|
*/
|
|
1387
1346
|
type ServiceBindingClient<Api extends object> = ServiceFetcher & RpcClient$1<Provider<Api, ReservedMethodName$4>>;
|
|
1388
|
-
type ApiFromDefinition<Definition> = Definition extends Definition$
|
|
1347
|
+
type ApiFromDefinition<Definition> = Definition extends Definition$4.Any ? ServerApi$2<Definition> : never;
|
|
1389
1348
|
type ApiOrDefinition<Api extends object, Definition> = [Api] extends [never] ? ApiFromDefinition<Definition> : Api;
|
|
1390
1349
|
/**
|
|
1391
1350
|
* Binding metadata used to create an Effect service from a Worker binding.
|
|
1392
1351
|
*/
|
|
1393
|
-
interface ServiceBindingDefinition<Definition extends Definition$
|
|
1352
|
+
interface ServiceBindingDefinition<Definition extends Definition$4.Any | undefined = undefined> {
|
|
1394
1353
|
/** Binding name as configured in `wrangler.jsonc`. */
|
|
1395
1354
|
readonly binding: string;
|
|
1396
1355
|
/** Optional RPC schema used for argument/result encoding. */
|
|
@@ -1405,7 +1364,9 @@ declare const ServiceBindingFetchError_base: new <A extends Record<string, any>
|
|
|
1405
1364
|
declare class ServiceBindingFetchError extends ServiceBindingFetchError_base<{
|
|
1406
1365
|
readonly binding: string;
|
|
1407
1366
|
readonly cause: unknown;
|
|
1408
|
-
}> {
|
|
1367
|
+
}> {
|
|
1368
|
+
get message(): string;
|
|
1369
|
+
}
|
|
1409
1370
|
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
1371
|
readonly _tag: "ServiceBindingRpcError";
|
|
1411
1372
|
} & Readonly<A>;
|
|
@@ -1416,15 +1377,17 @@ declare class ServiceBindingRpcError extends ServiceBindingRpcError_base<{
|
|
|
1416
1377
|
readonly binding: string;
|
|
1417
1378
|
readonly method: string;
|
|
1418
1379
|
readonly cause: unknown;
|
|
1419
|
-
}> {
|
|
1380
|
+
}> {
|
|
1381
|
+
get message(): string;
|
|
1382
|
+
}
|
|
1420
1383
|
type ServiceMethodKey<Api> = AsyncMethodKey<Api>;
|
|
1421
1384
|
type ServiceMethodArgs<Api, Method extends keyof Api> = AsyncMethodArgs<Api, Method>;
|
|
1422
1385
|
type ServiceMethodSuccess<Api, Method extends keyof Api> = AsyncMethodSuccess<Api, Method>;
|
|
1423
1386
|
type ServiceMethodCloudflareReturn<Api, Method extends keyof Api> = AsyncMethodCloudflareReturn<Api, Method>;
|
|
1424
1387
|
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$
|
|
1388
|
+
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>; };
|
|
1389
|
+
type DirectMethods$1<R, Definition> = Definition extends Definition$4.Any ? DefinitionDirectMethods<R, Definition> : {};
|
|
1390
|
+
type ServiceBindingEffectClient<Api extends object, Definition extends Definition$4.Any | undefined = undefined> = DirectMethods$1<never, Definition> & {
|
|
1428
1391
|
/**
|
|
1429
1392
|
* Forwards an HTTP request to the bound Worker service.
|
|
1430
1393
|
*
|
|
@@ -1509,15 +1472,15 @@ type ServiceBindingEffectClient<Api extends object, Definition extends Definitio
|
|
|
1509
1472
|
*/
|
|
1510
1473
|
readonly scopedCall: <Method extends ServiceMethodKey<Api>>(method: Method, ...args: ServiceMethodArgs<Api, Method>) => Effect.Effect<Awaited<ServiceMethodSuccess<Api, Method>>, unknown, Scope.Scope>;
|
|
1511
1474
|
};
|
|
1512
|
-
type ServiceBindingStaticClient<R, Api extends object, Definition extends Definition$
|
|
1475
|
+
type ServiceBindingStaticClient<R, Api extends object, Definition extends Definition$4.Any | undefined = undefined> = DirectMethods$1<R, Definition> & {
|
|
1513
1476
|
readonly fetch: (input: RequestInfo | URL, init?: RequestInit) => Effect.Effect<globalThis.Response, ServiceBindingFetchError, R>;
|
|
1514
1477
|
readonly rpc: <Method extends ServiceMethodKey<Api>>(method: Method, ...args: ServiceMethodArgs<Api, Method>) => Effect.Effect<ServiceMethodCloudflareReturn<Api, Method>, ServiceBindingRpcError, R>;
|
|
1515
1478
|
readonly call: <Method extends ServiceMethodKey<Api>>(method: Method, ...args: ServiceMethodArgs<Api, Method>) => Effect.Effect<ServiceMethodSuccess<Api, Method>, ServiceBindingRpcError, R>;
|
|
1516
1479
|
readonly scopedCall: <Method extends ServiceMethodKey<Api>>(method: Method, ...args: ServiceMethodArgs<Api, Method>) => Effect.Effect<Awaited<ServiceMethodSuccess<Api, Method>>, unknown, Scope.Scope | R>;
|
|
1517
1480
|
};
|
|
1518
1481
|
declare const isServiceBindingClient: <Api extends object>(value: unknown) => value is ServiceBindingClient<Api>;
|
|
1519
|
-
declare const makeClient$7: <Api extends object, const Definition extends Definition$
|
|
1520
|
-
declare const layer$9: <Self, Api extends object, const Definition extends Definition$
|
|
1482
|
+
declare const makeClient$7: <Api extends object, const Definition extends Definition$4.Any | undefined = undefined>(definition: ServiceBindingDefinition<Definition>) => ((service: ServiceBindingClient<Api>) => ServiceBindingEffectClient<Api, Definition>);
|
|
1483
|
+
declare const layer$9: <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
1484
|
/**
|
|
1522
1485
|
* Creates a typed Effect service for a Worker service binding.
|
|
1523
1486
|
*
|
|
@@ -1547,24 +1510,121 @@ declare const layer$9: <Self, Api extends object, const Definition extends Defin
|
|
|
1547
1510
|
* });
|
|
1548
1511
|
* ```
|
|
1549
1512
|
*/
|
|
1550
|
-
declare const Service: <Self, Api extends object = never>() => <Id extends string, const Definition extends Definition$
|
|
1513
|
+
declare const Service: <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> & {
|
|
1551
1514
|
readonly [TypeId$1]: typeof TypeId$1;
|
|
1552
1515
|
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:
|
|
1516
|
+
readonly fetch: (input: URL | RequestInfo<unknown, CfProperties<unknown>>, init?: RequestInit<CfProperties<unknown>> | undefined) => Effect.Effect<Response, ServiceBindingFetchError, Self>;
|
|
1517
|
+
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>;
|
|
1518
|
+
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>;
|
|
1519
|
+
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>;
|
|
1520
|
+
};
|
|
1521
|
+
declare const makeDirectMethods$1: <R, Api, Definition extends Definition$4.Any | undefined>(rpcDefinition: Definition | undefined, call: ServiceCall<R, Api>) => DirectMethods$1<R, Definition>;
|
|
1522
|
+
declare namespace WorkerDefinition_d_exports {
|
|
1523
|
+
export { Api$1 as Api, Definition$4 as Definition, HandlerEffect$1 as HandlerEffect, Handlers$1 as Handlers, LayerOptions$9 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$9 as Tag, TagClass$8 as TagClass, Worker, implement$3 as implement, make$9 as make, method$1 as method };
|
|
1524
|
+
}
|
|
1525
|
+
type ServiceFreeSchema$1 = Schema.Codec<any, any, never, never>;
|
|
1526
|
+
interface Method$2<Args extends ReadonlyArray<ServiceFreeSchema$1> = ReadonlyArray<ServiceFreeSchema$1>, Success extends ServiceFreeSchema$1 = ServiceFreeSchema$1> {
|
|
1527
|
+
readonly args: Args;
|
|
1528
|
+
readonly success: Success;
|
|
1529
|
+
}
|
|
1530
|
+
declare namespace Method$2 {
|
|
1531
|
+
export type Any = Method$2<ReadonlyArray<ServiceFreeSchema$1>, ServiceFreeSchema$1>;
|
|
1532
|
+
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]>>;
|
|
1533
|
+
/** Method schemas cross the wire through their canonical JSON codec. */
|
|
1534
|
+
type EncodedArgsFromSchemas<Args extends ReadonlyArray<ServiceFreeSchema$1>> = { [Index in keyof Args]: Schema.Json; };
|
|
1535
|
+
export type Args<Self extends Any> = ArgsFromSchemas<Self["args"]>;
|
|
1536
|
+
export type EncodedArgs<Self extends Any> = EncodedArgsFromSchemas<Self["args"]>;
|
|
1537
|
+
export type Success<Self extends Any> = Schema.Schema.Type<Self["success"]>;
|
|
1538
|
+
export type EncodedSuccess<Self extends Any> = Schema.Json;
|
|
1539
|
+
export {};
|
|
1540
|
+
}
|
|
1541
|
+
type Methods$1 = Record<string, Method$2.Any>;
|
|
1542
|
+
/**
|
|
1543
|
+
* RPC contract for a Worker service.
|
|
1544
|
+
*
|
|
1545
|
+
* Create with {@link make} and reuse to type both worker implementations and
|
|
1546
|
+
* service bindings in other workers.
|
|
1547
|
+
*/
|
|
1548
|
+
interface Definition$4<Id extends string = string, MethodsShape extends Methods$1 = Methods$1> {
|
|
1549
|
+
readonly id: Id;
|
|
1550
|
+
readonly methods: MethodsShape;
|
|
1551
|
+
}
|
|
1552
|
+
declare namespace Definition$4 {
|
|
1553
|
+
type Any = Definition$4<string, Methods$1>;
|
|
1554
|
+
}
|
|
1555
|
+
type ReservedMethodName$3 = ReservedMethodName$2;
|
|
1556
|
+
type NoReservedMethods$1<MethodsShape extends Methods$1> = Extract<keyof MethodsShape, ReservedMethodName$3> extends never ? MethodsShape : never;
|
|
1557
|
+
/**
|
|
1558
|
+
* Promise-based client API derived from a {@link Definition}.
|
|
1559
|
+
*/
|
|
1560
|
+
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]>>; };
|
|
1561
|
+
type Api$1<Self extends Definition$4.Any> = Provider<ServerApi$2<Self>, ReservedMethodName$3>;
|
|
1562
|
+
/**
|
|
1563
|
+
* Effect handlers for each RPC method in a worker definition.
|
|
1564
|
+
*/
|
|
1565
|
+
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]>>; };
|
|
1566
|
+
/**
|
|
1567
|
+
* Worker constructor options for a specific RPC definition.
|
|
1568
|
+
*/
|
|
1569
|
+
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"> {
|
|
1570
|
+
readonly rpc: Handlers$1<ROut | REvent, Self>;
|
|
1571
|
+
}
|
|
1572
|
+
type LayerOptions$9 = {
|
|
1573
|
+
readonly binding: string;
|
|
1574
|
+
};
|
|
1575
|
+
type TagClass$8<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>> & {
|
|
1576
|
+
readonly id: Id;
|
|
1577
|
+
readonly methods: MethodsShape;
|
|
1578
|
+
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>;
|
|
1579
|
+
readonly layer: (options: LayerOptions$9) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
1580
|
+
};
|
|
1581
|
+
/**
|
|
1582
|
+
* Defines a single RPC method schema in a worker definition.
|
|
1583
|
+
*/
|
|
1584
|
+
declare const method$1: {
|
|
1585
|
+
<Success extends ServiceFreeSchema$1>(definition: {
|
|
1586
|
+
readonly success: Success;
|
|
1587
|
+
}): Method$2<readonly [], Success>;
|
|
1588
|
+
<const Args extends ReadonlyArray<ServiceFreeSchema$1>, Success extends ServiceFreeSchema$1>(definition: {
|
|
1589
|
+
readonly args: Args;
|
|
1590
|
+
readonly success: Success;
|
|
1591
|
+
}): Method$2<Args, Success>;
|
|
1557
1592
|
};
|
|
1558
|
-
declare const
|
|
1593
|
+
declare const make$9: <Id extends string, const MethodsShape extends Methods$1>(id: Id, methods: MethodsShape & NoReservedMethods$1<MethodsShape>) => TagClass$8<Definition$4<Id, MethodsShape>, Id, MethodsShape>;
|
|
1594
|
+
declare const Tag$9: <Self>() => <Id extends string, const MethodsShape extends Methods$1>(id: Id, methods: MethodsShape & NoReservedMethods$1<MethodsShape>) => TagClass$8<Self, Id, MethodsShape>;
|
|
1595
|
+
declare const Worker: typeof Tag$9;
|
|
1596
|
+
/**
|
|
1597
|
+
* Helper for implementing handlers with the exact method shape of a definition.
|
|
1598
|
+
*/
|
|
1599
|
+
declare const implement$3: <ROut, const Self extends Definition$4.Any>(_definition: Self, handlers: Handlers$1<ROut, Self>) => Handlers$1<ROut, Self>;
|
|
1600
|
+
/**
|
|
1601
|
+
* Convenience alias for a single worker RPC handler Effect.
|
|
1602
|
+
*/
|
|
1603
|
+
type HandlerEffect$1<ROut, Self extends Definition$4.Any, Key extends keyof Self["methods"]> = WorkerRpcHandler<ROut, Method$2.Success<Self["methods"][Key]>>;
|
|
1559
1604
|
declare namespace Worker_d_exports {
|
|
1560
|
-
export { Api$
|
|
1605
|
+
export { Api$1 as Api, Definition$4 as Definition, ExecutionContext, FetchHandler, FetchWorkerOptions, HandlerEffect$1 as HandlerEffect, Handlers$1 as Handlers, LayerOptions$9 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$9 as Tag, TagClass$8 as TagClass, WorkerClass, WorkerContext, WorkerContextService, WorkerContextWaitUntilOptions, WorkerFetchSuccess, WorkerHandler, WorkerOptions, WorkerRpc, WorkerRpcHandler, WorkerRpcShape, implement$3 as implement, isWebSocketUpgrade, make$8 as make, makeFetchHandler, method$1 as method };
|
|
1561
1606
|
}
|
|
1562
1607
|
declare const ExecutionContext_base: Context.ServiceClass<ExecutionContext, "effect-cf/ExecutionContext", globalThis.ExecutionContext<unknown>>;
|
|
1608
|
+
/**
|
|
1609
|
+
* Access to Cloudflare's native `ExecutionContext`.
|
|
1610
|
+
*/
|
|
1563
1611
|
declare class ExecutionContext extends ExecutionContext_base {}
|
|
1612
|
+
/**
|
|
1613
|
+
* Options for {@link WorkerContextService.waitUntil}.
|
|
1614
|
+
*/
|
|
1564
1615
|
interface WorkerContextWaitUntilOptions<E, R> {
|
|
1616
|
+
/**
|
|
1617
|
+
* Failure mode for the background effect: `"observe"` (default) logs or
|
|
1618
|
+
* routes the failure to `onFailure`, while `"propagate"` also rejects the
|
|
1619
|
+
* native `waitUntil` promise.
|
|
1620
|
+
*/
|
|
1565
1621
|
readonly mode?: "observe" | "propagate";
|
|
1622
|
+
/** Custom failure handler for the background effect. */
|
|
1566
1623
|
readonly onFailure?: (cause: Cause.Cause<E>) => Effect.Effect<void, never, R>;
|
|
1567
1624
|
}
|
|
1625
|
+
/**
|
|
1626
|
+
* Effect wrapper around `ExecutionContext` background APIs.
|
|
1627
|
+
*/
|
|
1568
1628
|
interface WorkerContextService {
|
|
1569
1629
|
readonly raw: globalThis.ExecutionContext;
|
|
1570
1630
|
waitUntil<A, E, R, R2 = never>(effect: Effect.Effect<A, E, R>, options?: WorkerContextWaitUntilOptions<E, R2>): Effect.Effect<void, never, R | R2>;
|
|
@@ -1572,20 +1632,55 @@ interface WorkerContextService {
|
|
|
1572
1632
|
readonly passThroughOnException: Effect.Effect<void>;
|
|
1573
1633
|
}
|
|
1574
1634
|
declare const WorkerContext_base: Context.ServiceClass<WorkerContext, "effect-cf/WorkerContext", WorkerContextService>;
|
|
1635
|
+
/**
|
|
1636
|
+
* Service used inside handlers to schedule background work via `waitUntil`.
|
|
1637
|
+
*
|
|
1638
|
+
* @example
|
|
1639
|
+
* ```ts
|
|
1640
|
+
* const handler = Effect.gen(function* () {
|
|
1641
|
+
* const ctx = yield* Worker.WorkerContext;
|
|
1642
|
+
* yield* ctx.waitUntil(Effect.log("flush analytics"));
|
|
1643
|
+
* return new Response("ok");
|
|
1644
|
+
* });
|
|
1645
|
+
* ```
|
|
1646
|
+
*/
|
|
1575
1647
|
declare class WorkerContext extends WorkerContext_base {}
|
|
1576
1648
|
declare const NativeRequest_base: Context.ServiceClass<NativeRequest, "effect-cf/NativeRequest", Request<unknown, CfProperties<unknown>>>;
|
|
1649
|
+
/**
|
|
1650
|
+
* Access to the incoming `Request` currently handled by a worker or Durable Object fetch.
|
|
1651
|
+
*/
|
|
1577
1652
|
declare class NativeRequest extends NativeRequest_base {}
|
|
1653
|
+
/**
|
|
1654
|
+
* Returns `true` when the request is a websocket upgrade request.
|
|
1655
|
+
*/
|
|
1578
1656
|
declare const isWebSocketUpgrade: (request: Request) => boolean;
|
|
1579
|
-
type ReservedMethodName$
|
|
1657
|
+
type ReservedMethodName$2 = ReservedMethodName$5 | "fetch" | "connect" | "queue" | "scheduled" | "tail" | "tailStream" | "test" | "trace" | "alarm" | "webSocketMessage" | "webSocketClose" | "webSocketError";
|
|
1580
1658
|
type WorkerBaseContext<ROut> = ExecutionContext | WorkerContext | WorkerEnvironment | ROut;
|
|
1581
1659
|
type WorkerFetchContext<ROut> = WorkerBaseContext<ROut> | NativeRequest | HttpServerRequest.HttpServerRequest | Scope.Scope;
|
|
1582
1660
|
type WorkerRpcContext<ROut> = WorkerBaseContext<ROut> | Scope.Scope;
|
|
1661
|
+
/**
|
|
1662
|
+
* Successful result of a worker fetch handler: either a native `Response`
|
|
1663
|
+
* (returned to Cloudflare untouched) or an Effect `HttpServerResponse`
|
|
1664
|
+
* (rendered through the Effect HTTP pipeline).
|
|
1665
|
+
*/
|
|
1583
1666
|
type WorkerFetchSuccess = Response | HttpServerResponse.HttpServerResponse;
|
|
1667
|
+
/**
|
|
1668
|
+
* Effect type for `fetch` handlers executed by {@link make}.
|
|
1669
|
+
*/
|
|
1584
1670
|
type WorkerHandler<ROut, A = WorkerFetchSuccess> = Effect.Effect<A, unknown, WorkerFetchContext<ROut>>;
|
|
1671
|
+
/**
|
|
1672
|
+
* Effect type for worker RPC handlers.
|
|
1673
|
+
*/
|
|
1585
1674
|
type WorkerRpcHandler<ROut, A = unknown> = Effect.Effect<A, unknown, WorkerRpcContext<ROut>>;
|
|
1675
|
+
/**
|
|
1676
|
+
* Shape of worker RPC handlers passed to {@link make}.
|
|
1677
|
+
*/
|
|
1586
1678
|
type WorkerRpc<ROut> = Record<string, (...args: Array<any>) => WorkerRpcHandler<ROut>>;
|
|
1587
1679
|
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$
|
|
1680
|
+
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; };
|
|
1681
|
+
/**
|
|
1682
|
+
* Options for creating a worker class with Effect handlers.
|
|
1683
|
+
*/
|
|
1589
1684
|
interface WorkerOptions<RRuntime, REvent = never, EventLayerError = never, Rpc extends WorkerRpc<RRuntime | REvent> = Record<never, never>> {
|
|
1590
1685
|
/**
|
|
1591
1686
|
* Layer provided around each Cloudflare event handled by this Worker.
|
|
@@ -1595,71 +1690,58 @@ interface WorkerOptions<RRuntime, REvent = never, EventLayerError = never, Rpc e
|
|
|
1595
1690
|
* trace/log exporters that should flush at event completion.
|
|
1596
1691
|
*/
|
|
1597
1692
|
readonly eventLayer?: Layer.Layer<REvent, EventLayerError, WorkerBaseContext<RRuntime>>;
|
|
1693
|
+
/** Main request handler. */
|
|
1598
1694
|
readonly fetch?: Effect.Effect<WorkerFetchSuccess, unknown, WorkerFetchContext<RRuntime | REvent>>;
|
|
1695
|
+
/** Queue consumer handler invoked per message batch. */
|
|
1599
1696
|
readonly queue?: QueueHandler<RRuntime | REvent>;
|
|
1697
|
+
/** Optional RPC methods exposed as class instance methods. */
|
|
1600
1698
|
readonly rpc?: Rpc;
|
|
1601
1699
|
}
|
|
1602
1700
|
type FetchWorkerOptions<RRuntime, REvent = never, EventLayerError = never> = Omit<WorkerOptions<RRuntime, REvent, EventLayerError, Record<never, never>>, "rpc"> & {
|
|
1603
1701
|
readonly rpc?: never;
|
|
1604
1702
|
};
|
|
1703
|
+
/**
|
|
1704
|
+
* Cloudflare `WorkerEntrypoint` constructor produced by {@link make}.
|
|
1705
|
+
*/
|
|
1605
1706
|
type WorkerClass<Rpc extends WorkerRpc<ROut>, ROut> = new (ctx: globalThis.ExecutionContext, env: WorkerEnv) => WorkerEntrypoint<WorkerEnv> & {
|
|
1606
1707
|
fetch(request: Request): Promise<Response>;
|
|
1607
1708
|
queue(batch: globalThis.MessageBatch): Promise<void>;
|
|
1608
1709
|
} & WorkerRpcShape<Rpc, ROut>;
|
|
1710
|
+
/**
|
|
1711
|
+
* `ExportedHandler`-compatible fetch object produced by {@link makeFetchHandler}.
|
|
1712
|
+
*/
|
|
1609
1713
|
interface FetchHandler<Env extends WorkerEnv = WorkerEnv> {
|
|
1610
1714
|
readonly fetch: (request: Request, env: Env, ctx: globalThis.ExecutionContext) => Promise<Response>;
|
|
1611
1715
|
}
|
|
1612
|
-
|
|
1716
|
+
/**
|
|
1717
|
+
* Creates a Cloudflare worker class backed by a single managed Effect runtime.
|
|
1718
|
+
*
|
|
1719
|
+
* The runtime layer is built when Cloudflare constructs the class and reused
|
|
1720
|
+
* for every event the instance handles. Layer finalizers do not run when the
|
|
1721
|
+
* isolate is evicted; Cloudflare provides no shutdown hook. Use `eventLayer`
|
|
1722
|
+
* for resources that must be finalized per event.
|
|
1723
|
+
*
|
|
1724
|
+
* @example
|
|
1725
|
+
* ```ts
|
|
1726
|
+
* export default Worker.make(Layer.empty, {
|
|
1727
|
+
* fetch: Effect.succeed(new Response("ok")),
|
|
1728
|
+
* });
|
|
1729
|
+
* ```
|
|
1730
|
+
*/
|
|
1613
1731
|
declare function make$8<ROut, LayerError>(layer: Layer.Layer<ROut, LayerError, ExecutionContext | WorkerContext | WorkerEnvironment>, fetch: WorkerHandler<ROut>): WorkerClass<Record<never, never>, ROut>;
|
|
1614
1732
|
declare function make$8<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>;
|
|
1733
|
+
/**
|
|
1734
|
+
* Creates an `ExportedHandler`-compatible `{ fetch }` object backed by
|
|
1735
|
+
* {@link make}.
|
|
1736
|
+
*
|
|
1737
|
+
* The Effect runtime is cached per `env` identity, so the user layer builds
|
|
1738
|
+
* once per isolate instead of once per request. `ExecutionContext`-backed
|
|
1739
|
+
* services (`Worker.ExecutionContext`, `Worker.WorkerContext`) are still
|
|
1740
|
+
* provided fresh for every request. Layer finalizers do not run when the
|
|
1741
|
+
* isolate is evicted; Cloudflare provides no shutdown hook. Use `eventLayer`
|
|
1742
|
+
* for resources that must be finalized per event.
|
|
1743
|
+
*/
|
|
1615
1744
|
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
|
-
type ServiceFreeSchema$2 = Schema.Codec<any, any, never, never>;
|
|
1617
|
-
interface Method$3<Args extends ReadonlyArray<ServiceFreeSchema$2> = ReadonlyArray<ServiceFreeSchema$2>, Success extends ServiceFreeSchema$2 = ServiceFreeSchema$2> {
|
|
1618
|
-
readonly args: Args;
|
|
1619
|
-
readonly success: Success;
|
|
1620
|
-
}
|
|
1621
|
-
declare namespace Method$3 {
|
|
1622
|
-
export type Any = Method$3<ReadonlyArray<ServiceFreeSchema$2>, ServiceFreeSchema$2>;
|
|
1623
|
-
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]>>;
|
|
1624
|
-
export type Args<Self extends Any> = ArgsFromSchemas<Self["args"]>;
|
|
1625
|
-
export type Success<Self extends Any> = Schema.Schema.Type<Self["success"]>;
|
|
1626
|
-
export {};
|
|
1627
|
-
}
|
|
1628
|
-
type Methods$2 = Record<string, Method$3.Any>;
|
|
1629
|
-
type NoReservedMethods$2<MethodsShape extends Methods$2> = Extract<keyof MethodsShape, ReservedMethodName$3> extends never ? MethodsShape : never;
|
|
1630
|
-
interface Definition$5<Id extends string = string, MethodsShape extends Methods$2 = Methods$2> {
|
|
1631
|
-
readonly id: Id;
|
|
1632
|
-
readonly methods: MethodsShape;
|
|
1633
|
-
}
|
|
1634
|
-
declare namespace Definition$5 {
|
|
1635
|
-
type Any = Definition$5<string, Methods$2>;
|
|
1636
|
-
}
|
|
1637
|
-
type ServerApi$3<Self extends Definition$5.Any> = { readonly [Key in keyof Self["methods"]]: (...args: Method$3.Args<Self["methods"][Key]>) => Promise<Method$3.Success<Self["methods"][Key]>>; };
|
|
1638
|
-
type Api$2<Self extends Definition$5.Any> = Provider<ServerApi$3<Self>, ReservedMethodName$3>;
|
|
1639
|
-
type Handlers$2<ROut, Self extends Definition$5.Any> = { readonly [Key in keyof Self["methods"]]: (...args: Method$3.Args<Self["methods"][Key]>) => WorkerRpcHandler<ROut, Method$3.Success<Self["methods"][Key]>>; };
|
|
1640
|
-
interface Options$4<ROut, Self extends Definition$5.Any, REvent = never, EventLayerError = never> extends Omit<WorkerOptions<ROut, REvent, EventLayerError, Handlers$2<ROut | REvent, Self>>, "rpc"> {
|
|
1641
|
-
readonly rpc: Handlers$2<ROut | REvent, Self>;
|
|
1642
|
-
}
|
|
1643
|
-
type LayerOptions$10 = LayerOptions$11;
|
|
1644
|
-
type TagClass$9<Self, Id extends string, MethodsShape extends Methods$2> = Context.ServiceClass<Self, Id, ServiceBindingEffectClient<Api$2<Definition$5<Id, MethodsShape>>, Definition$5<Id, MethodsShape>>> & ServiceBindingStaticClient<Self, Api$2<Definition$5<Id, MethodsShape>>, Definition$5<Id, MethodsShape>> & {
|
|
1645
|
-
readonly id: Id;
|
|
1646
|
-
readonly methods: MethodsShape;
|
|
1647
|
-
readonly make: <ROut, LayerError, REvent = never, EventLayerError = never>(layer: Layer.Layer<ROut, LayerError, ExecutionContext | WorkerContext | WorkerEnvironment>, options: Options$4<ROut, Definition$5<Id, MethodsShape>, REvent, EventLayerError>) => WorkerClass<Handlers$2<ROut | REvent, Definition$5<Id, MethodsShape>>, ROut | REvent>;
|
|
1648
|
-
readonly layer: (options: LayerOptions$10) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
1649
|
-
};
|
|
1650
|
-
type TagFactory$1 = <Self>() => <Id extends string, const MethodsShape extends Methods$2>(id: Id, methods: MethodsShape & NoReservedMethods$2<MethodsShape>) => TagClass$9<Self, Id, MethodsShape>;
|
|
1651
|
-
declare const Tag$10: TagFactory$1;
|
|
1652
|
-
declare const method$2: {
|
|
1653
|
-
<Success extends ServiceFreeSchema$2>(definition: {
|
|
1654
|
-
readonly success: Success;
|
|
1655
|
-
}): Method$3<readonly [], Success>;
|
|
1656
|
-
<const Args extends ReadonlyArray<ServiceFreeSchema$2>, Success extends ServiceFreeSchema$2>(definition: {
|
|
1657
|
-
readonly args: Args;
|
|
1658
|
-
readonly success: Success;
|
|
1659
|
-
}): Method$3<Args, Success>;
|
|
1660
|
-
};
|
|
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
1745
|
declare namespace DurableObjectNamespace_d_exports {
|
|
1664
1746
|
export { DurableObjectFetchError, DurableObjectNamespaceBindingDefinition, DurableObjectNamespaceClient, DurableObjectNamespaceDefinition, DurableObjectNamespaceEffectClient, DurableObjectNamespaceStaticClient, DurableObjectRpcError, DurableObjectStubClient, isDurableObjectNamespaceClient, layer$8 as layer, makeClient$6 as makeClient, makeDirectMethods };
|
|
1665
1747
|
}
|
|
@@ -1667,11 +1749,11 @@ interface DurableObjectFetcher {
|
|
|
1667
1749
|
fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
|
|
1668
1750
|
}
|
|
1669
1751
|
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$
|
|
1752
|
+
type ReservedMethodName$1 = ReservedMethodName | "fetch";
|
|
1671
1753
|
/**
|
|
1672
1754
|
* Cloudflare Durable Object stub, optionally enriched with RPC methods.
|
|
1673
1755
|
*/
|
|
1674
|
-
type DurableObjectStubClient<Api extends object> = DurableObjectFetcher & RpcClient<Provider<Api, ReservedMethodName$
|
|
1756
|
+
type DurableObjectStubClient<Api extends object> = DurableObjectFetcher & RpcClient<Provider<Api, ReservedMethodName$1>> & {
|
|
1675
1757
|
readonly id: globalThis.DurableObjectId;
|
|
1676
1758
|
readonly name?: string;
|
|
1677
1759
|
};
|
|
@@ -1701,7 +1783,7 @@ interface DurableObjectNamespaceDefinition {
|
|
|
1701
1783
|
/**
|
|
1702
1784
|
* Namespace binding metadata with optional RPC schema.
|
|
1703
1785
|
*/
|
|
1704
|
-
interface DurableObjectNamespaceBindingDefinition<Definition extends Definition$
|
|
1786
|
+
interface DurableObjectNamespaceBindingDefinition<Definition extends Definition$3.Any | undefined = undefined> {
|
|
1705
1787
|
/** Binding name as configured in `wrangler.jsonc`. */
|
|
1706
1788
|
readonly binding: string;
|
|
1707
1789
|
/** Optional RPC schema used for argument/result encoding. */
|
|
@@ -1717,7 +1799,9 @@ declare class DurableObjectRpcError extends DurableObjectRpcError_base<{
|
|
|
1717
1799
|
readonly binding: string;
|
|
1718
1800
|
readonly method: string;
|
|
1719
1801
|
readonly cause: unknown;
|
|
1720
|
-
}> {
|
|
1802
|
+
}> {
|
|
1803
|
+
get message(): string;
|
|
1804
|
+
}
|
|
1721
1805
|
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
1806
|
readonly _tag: "DurableObjectFetchError";
|
|
1723
1807
|
} & Readonly<A>;
|
|
@@ -1727,22 +1811,24 @@ declare const DurableObjectFetchError_base: new <A extends Record<string, any> =
|
|
|
1727
1811
|
declare class DurableObjectFetchError extends DurableObjectFetchError_base<{
|
|
1728
1812
|
readonly binding: string;
|
|
1729
1813
|
readonly cause: unknown;
|
|
1730
|
-
}> {
|
|
1814
|
+
}> {
|
|
1815
|
+
get message(): string;
|
|
1816
|
+
}
|
|
1731
1817
|
type StubMethodKey<Api> = AsyncMethodKey<Api>;
|
|
1732
1818
|
type StubMethodArgs<Api, Method extends keyof Api> = AsyncMethodArgs<Api, Method>;
|
|
1733
1819
|
type StubMethodSuccess<Api, Method extends keyof Api> = AsyncMethodSuccess<Api, Method>;
|
|
1734
1820
|
type StubMethodCloudflareReturn<Api, Method extends keyof Api> = AsyncMethodCloudflareReturn<Api, Method>;
|
|
1735
1821
|
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$
|
|
1822
|
+
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>; };
|
|
1823
|
+
type DefinitionDurableObjectDirectClient<R, Definition extends Definition$3.Any> = {
|
|
1738
1824
|
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$
|
|
1825
|
+
} & { readonly [Method in Definition$7.MethodNames<Definition>]: (...args: Method$3.Args<Definition["methods"][Method]>) => Effect.Effect<Method$3.Success<Definition["methods"][Method]>, DurableObjectRpcError, R>; };
|
|
1826
|
+
type DefinitionNamespaceDirectClientMethods<R, Definition extends Definition$3.Any> = {
|
|
1741
1827
|
readonly byName: (name: string, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions) => DefinitionDurableObjectDirectClient<R, Definition>;
|
|
1742
1828
|
readonly byId: (id: globalThis.DurableObjectId, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions) => DefinitionDurableObjectDirectClient<R, Definition>;
|
|
1743
1829
|
};
|
|
1744
|
-
type DirectMethods<R, Api extends object, Definition> = Definition extends Definition$
|
|
1745
|
-
type DurableObjectNamespaceEffectClient<Api extends object, Definition extends Definition$
|
|
1830
|
+
type DirectMethods<R, Api extends object, Definition> = Definition extends Definition$3.Any ? DefinitionNamespaceDirectMethods<R, Api, Definition> & DefinitionNamespaceDirectClientMethods<R, Definition> : {};
|
|
1831
|
+
type DurableObjectNamespaceEffectClient<Api extends object, Definition extends Definition$3.Any | undefined = undefined> = DirectMethods<never, Api, Definition> & {
|
|
1746
1832
|
/** Creates a globally unique Durable Object id. */
|
|
1747
1833
|
readonly newUniqueId: (options?: globalThis.DurableObjectNamespaceNewUniqueIdOptions) => Effect.Effect<globalThis.DurableObjectId>;
|
|
1748
1834
|
/** Deterministically maps a name to a Durable Object id. */
|
|
@@ -1849,9 +1935,9 @@ type DurableObjectNamespaceEffectClient<Api extends object, Definition extends D
|
|
|
1849
1935
|
* Prefer the typed helpers above unless Cloudflare exposes a platform feature
|
|
1850
1936
|
* that is not wrapped by effect-cf yet.
|
|
1851
1937
|
*/
|
|
1852
|
-
readonly
|
|
1938
|
+
readonly rawUnsafe: Effect.Effect<DurableObjectNamespaceClient<Api>>;
|
|
1853
1939
|
};
|
|
1854
|
-
type DurableObjectNamespaceStaticClient<R, Api extends object, Definition extends Definition$
|
|
1940
|
+
type DurableObjectNamespaceStaticClient<R, Api extends object, Definition extends Definition$3.Any | undefined = undefined> = DirectMethods<R, Api, Definition> & {
|
|
1855
1941
|
readonly newUniqueId: (options?: globalThis.DurableObjectNamespaceNewUniqueIdOptions) => Effect.Effect<globalThis.DurableObjectId, never, R>;
|
|
1856
1942
|
readonly idFromName: (name: string) => Effect.Effect<globalThis.DurableObjectId, never, R>;
|
|
1857
1943
|
readonly idFromString: (id: string) => Effect.Effect<globalThis.DurableObjectId, never, R>;
|
|
@@ -1862,97 +1948,98 @@ type DurableObjectNamespaceStaticClient<R, Api extends object, Definition extend
|
|
|
1862
1948
|
readonly rpc: <Method extends StubMethodKey<Api>>(stub: DurableObjectStubClient<Api>, method: Method, ...args: StubMethodArgs<Api, Method>) => Effect.Effect<StubMethodCloudflareReturn<Api, Method>, DurableObjectRpcError, R>;
|
|
1863
1949
|
readonly call: <Method extends StubMethodKey<Api>>(stub: DurableObjectStubClient<Api>, method: Method, ...args: StubMethodArgs<Api, Method>) => Effect.Effect<StubMethodSuccess<Api, Method>, DurableObjectRpcError, R>;
|
|
1864
1950
|
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
|
|
1951
|
+
readonly rawUnsafe: () => Effect.Effect<DurableObjectNamespaceClient<Api>, never, R>;
|
|
1866
1952
|
};
|
|
1867
1953
|
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$
|
|
1954
|
+
declare const makeClient$6: <Api extends object, const Definition extends Definition$3.Any | undefined = undefined>(definition: DurableObjectNamespaceBindingDefinition<Definition>) => ((namespace: DurableObjectNamespaceClient<Api>) => DurableObjectNamespaceEffectClient<Api, Definition>);
|
|
1955
|
+
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>;
|
|
1956
|
+
declare const makeDirectMethods: <R, Api extends object, Definition extends Definition$3.Any | undefined>(rpcDefinition: Definition | undefined, helpers: {
|
|
1871
1957
|
readonly call: StubCall<R, Api>;
|
|
1872
1958
|
readonly fetch: (stub: DurableObjectStubClient<Api>, input: RequestInfo | URL, init?: RequestInit) => Effect.Effect<globalThis.Response, DurableObjectFetchError, R>;
|
|
1873
1959
|
readonly get: (id: globalThis.DurableObjectId, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions) => Effect.Effect<DurableObjectStubClient<Api>, never, R>;
|
|
1874
1960
|
readonly getByName: (name: string, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions) => Effect.Effect<DurableObjectStubClient<Api>, never, R>;
|
|
1875
1961
|
}) => DirectMethods<R, Api, Definition>;
|
|
1876
1962
|
declare namespace DurableObjectDefinition_d_exports {
|
|
1877
|
-
export { Api
|
|
1963
|
+
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
1964
|
}
|
|
1879
|
-
type ServiceFreeSchema
|
|
1880
|
-
interface Method$
|
|
1965
|
+
type ServiceFreeSchema = Schema.Codec<any, any, never, never>;
|
|
1966
|
+
interface Method$1<Args extends ReadonlyArray<ServiceFreeSchema> = ReadonlyArray<ServiceFreeSchema>, Success extends ServiceFreeSchema = ServiceFreeSchema> {
|
|
1881
1967
|
readonly args: Args;
|
|
1882
1968
|
readonly success: Success;
|
|
1883
1969
|
}
|
|
1884
|
-
declare namespace Method$
|
|
1885
|
-
export type Any = Method$
|
|
1886
|
-
type ArgsFromSchemas<Args extends ReadonlyArray<ServiceFreeSchema
|
|
1887
|
-
|
|
1970
|
+
declare namespace Method$1 {
|
|
1971
|
+
export type Any = Method$1<ReadonlyArray<ServiceFreeSchema>, ServiceFreeSchema>;
|
|
1972
|
+
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]>>;
|
|
1973
|
+
/** Method schemas cross the wire through their canonical JSON codec. */
|
|
1974
|
+
type EncodedArgsFromSchemas<Args extends ReadonlyArray<ServiceFreeSchema>> = { [Index in keyof Args]: Schema.Json; };
|
|
1888
1975
|
export type Args<Self extends Any> = ArgsFromSchemas<Self["args"]>;
|
|
1889
1976
|
export type EncodedArgs<Self extends Any> = EncodedArgsFromSchemas<Self["args"]>;
|
|
1890
1977
|
export type Success<Self extends Any> = Schema.Schema.Type<Self["success"]>;
|
|
1891
|
-
export type EncodedSuccess<Self extends Any> = Schema.
|
|
1978
|
+
export type EncodedSuccess<Self extends Any> = Schema.Json;
|
|
1892
1979
|
export {};
|
|
1893
1980
|
}
|
|
1894
|
-
type Methods
|
|
1981
|
+
type Methods = Record<string, Method$1.Any>;
|
|
1895
1982
|
/**
|
|
1896
1983
|
* RPC contract for a Durable Object class.
|
|
1897
1984
|
*/
|
|
1898
|
-
interface Definition$
|
|
1985
|
+
interface Definition$3<Id extends string = string, MethodsShape extends Methods = Methods> {
|
|
1899
1986
|
readonly id: Id;
|
|
1900
1987
|
readonly methods: MethodsShape;
|
|
1901
1988
|
}
|
|
1902
|
-
declare namespace Definition$
|
|
1903
|
-
type Any = Definition$
|
|
1989
|
+
declare namespace Definition$3 {
|
|
1990
|
+
type Any = Definition$3<string, Methods>;
|
|
1904
1991
|
}
|
|
1905
|
-
type ReservedMethodName
|
|
1906
|
-
type NoReservedMethods
|
|
1992
|
+
type ReservedMethodName = ReservedMethodName$5 | "fetch" | "alarm" | "webSocketMessage" | "webSocketClose" | "webSocketError";
|
|
1993
|
+
type NoReservedMethods<MethodsShape extends Methods> = Extract<keyof MethodsShape, ReservedMethodName> extends never ? MethodsShape : never;
|
|
1907
1994
|
/**
|
|
1908
1995
|
* Promise-based client API derived from a Durable Object definition.
|
|
1909
1996
|
*/
|
|
1910
|
-
type ServerApi$
|
|
1911
|
-
type Api
|
|
1997
|
+
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]>>; };
|
|
1998
|
+
type Api<Self extends Definition$3.Any> = Provider<ServerApi$1<Self>, ReservedMethodName>;
|
|
1912
1999
|
/**
|
|
1913
2000
|
* Effect handlers for each RPC method in a Durable Object definition.
|
|
1914
2001
|
*/
|
|
1915
|
-
type Handlers
|
|
2002
|
+
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
2003
|
/**
|
|
1917
2004
|
* Durable Object constructor options for a specific RPC definition.
|
|
1918
2005
|
*/
|
|
1919
|
-
interface Options$
|
|
1920
|
-
readonly rpc: Handlers
|
|
2006
|
+
interface Options$2<ROut, Self extends Definition$3.Any, REvent = never, EventLayerError = never> extends Omit<DurableObjectOptions<ROut, REvent, EventLayerError, Handlers<ROut | REvent, Self>>, "rpc"> {
|
|
2007
|
+
readonly rpc: Handlers<ROut | REvent, Self>;
|
|
1921
2008
|
}
|
|
1922
|
-
type LayerOptions$
|
|
2009
|
+
type LayerOptions$8 = {
|
|
1923
2010
|
readonly binding: string;
|
|
1924
2011
|
};
|
|
1925
|
-
type TagClass$
|
|
2012
|
+
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
2013
|
readonly id: Id;
|
|
1927
2014
|
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$
|
|
2015
|
+
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>;
|
|
2016
|
+
readonly layer: (options: LayerOptions$8) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
1930
2017
|
};
|
|
1931
2018
|
/**
|
|
1932
2019
|
* Defines a single RPC method schema in a Durable Object definition.
|
|
1933
2020
|
*/
|
|
1934
|
-
declare const method
|
|
1935
|
-
<Success extends ServiceFreeSchema
|
|
2021
|
+
declare const method: {
|
|
2022
|
+
<Success extends ServiceFreeSchema>(definition: {
|
|
1936
2023
|
readonly success: Success;
|
|
1937
|
-
}): Method$
|
|
1938
|
-
<const Args extends ReadonlyArray<ServiceFreeSchema
|
|
2024
|
+
}): Method$1<readonly [], Success>;
|
|
2025
|
+
<const Args extends ReadonlyArray<ServiceFreeSchema>, Success extends ServiceFreeSchema>(definition: {
|
|
1939
2026
|
readonly args: Args;
|
|
1940
2027
|
readonly success: Success;
|
|
1941
|
-
}): Method$
|
|
2028
|
+
}): Method$1<Args, Success>;
|
|
1942
2029
|
};
|
|
1943
|
-
declare const make$7: <Id extends string, const MethodsShape extends Methods
|
|
1944
|
-
declare const Tag$
|
|
1945
|
-
declare const DurableObject$1: typeof Tag$
|
|
2030
|
+
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>;
|
|
2031
|
+
declare const Tag$8: <Self>() => <Id extends string, const MethodsShape extends Methods>(id: Id, methods: MethodsShape & NoReservedMethods<MethodsShape>) => TagClass$7<Self, Id, MethodsShape>;
|
|
2032
|
+
declare const DurableObject$1: typeof Tag$8;
|
|
1946
2033
|
/**
|
|
1947
2034
|
* Helper for implementing handlers with the exact method shape of a definition.
|
|
1948
2035
|
*/
|
|
1949
|
-
declare const implement$
|
|
2036
|
+
declare const implement$2: <ROut, const Self extends Definition$3.Any>(_definition: Self, handlers: Handlers<ROut, Self>) => Handlers<ROut, Self>;
|
|
1950
2037
|
/**
|
|
1951
2038
|
* Convenience alias for a single Durable Object RPC handler Effect.
|
|
1952
2039
|
*/
|
|
1953
|
-
type HandlerEffect
|
|
2040
|
+
type HandlerEffect<ROut, Self extends Definition$3.Any, Key extends keyof Self["methods"]> = DurableObjectHandler<ROut, Method$1.Success<Self["methods"][Key]>>;
|
|
1954
2041
|
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,
|
|
2042
|
+
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
2043
|
}
|
|
1957
2044
|
type RuntimeContext$1<ROut> = DurableObjectState | WorkerEnvironment | ROut;
|
|
1958
2045
|
type HandlerContext<ROut> = RuntimeContext$1<ROut> | Scope.Scope;
|
|
@@ -2013,54 +2100,6 @@ type DurableObjectClass<Rpc extends DurableObjectRpc<ROut>, ROut> = new (state:
|
|
|
2013
2100
|
* Creates a Durable Object class backed by a single managed Effect runtime.
|
|
2014
2101
|
*/
|
|
2015
2102
|
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
2103
|
declare namespace DurableObjectAlarm_d_exports {
|
|
2065
2104
|
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
2105
|
}
|
|
@@ -2077,32 +2116,42 @@ declare const InvalidAlarmRefError_base: new <A extends Record<string, any> = {}
|
|
|
2077
2116
|
} & Readonly<A>;
|
|
2078
2117
|
declare class InvalidAlarmRefError extends InvalidAlarmRefError_base<{
|
|
2079
2118
|
readonly cause: unknown;
|
|
2080
|
-
}> {
|
|
2119
|
+
}> {
|
|
2120
|
+
get message(): string;
|
|
2121
|
+
}
|
|
2081
2122
|
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
2123
|
readonly _tag: "InvalidAlarmPayloadError";
|
|
2083
2124
|
} & Readonly<A>;
|
|
2084
2125
|
declare class InvalidAlarmPayloadError extends InvalidAlarmPayloadError_base<{
|
|
2085
2126
|
readonly cause: unknown;
|
|
2086
|
-
}> {
|
|
2127
|
+
}> {
|
|
2128
|
+
get message(): string;
|
|
2129
|
+
}
|
|
2087
2130
|
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
2131
|
readonly _tag: "InvalidRepeatEveryError";
|
|
2089
2132
|
} & Readonly<A>;
|
|
2090
2133
|
declare class InvalidRepeatEveryError extends InvalidRepeatEveryError_base<{
|
|
2091
2134
|
readonly cause: unknown;
|
|
2092
|
-
}> {
|
|
2135
|
+
}> {
|
|
2136
|
+
get message(): string;
|
|
2137
|
+
}
|
|
2093
2138
|
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
2139
|
readonly _tag: "InvalidProcessDueAlarmsOptionsError";
|
|
2095
2140
|
} & Readonly<A>;
|
|
2096
2141
|
declare class InvalidProcessDueAlarmsOptionsError extends InvalidProcessDueAlarmsOptionsError_base<{
|
|
2097
2142
|
readonly cause: unknown;
|
|
2098
|
-
}> {
|
|
2143
|
+
}> {
|
|
2144
|
+
get message(): string;
|
|
2145
|
+
}
|
|
2099
2146
|
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
2147
|
readonly _tag: "StoredAlarmDecodeError";
|
|
2101
2148
|
} & Readonly<A>;
|
|
2102
2149
|
declare class StoredAlarmDecodeError extends StoredAlarmDecodeError_base<{
|
|
2103
2150
|
readonly cause: unknown;
|
|
2104
2151
|
readonly storageId: string;
|
|
2105
|
-
}> {
|
|
2152
|
+
}> {
|
|
2153
|
+
get message(): string;
|
|
2154
|
+
}
|
|
2106
2155
|
type DurableObjectAlarmError = InvalidAlarmPayloadError | InvalidAlarmRefError | InvalidProcessDueAlarmsOptionsError | InvalidRepeatEveryError | StorageOperationError | StoredAlarmDecodeError;
|
|
2107
2156
|
/**
|
|
2108
2157
|
* Events handled by `processDueAlarms`.
|
|
@@ -2416,12 +2465,12 @@ declare class DurableObjectRpcWebSocket extends DurableObjectRpcWebSocket_base {
|
|
|
2416
2465
|
/**
|
|
2417
2466
|
* Builds a layer that bridges Durable Object websocket events to `RpcServer.Protocol`.
|
|
2418
2467
|
*/
|
|
2419
|
-
declare const layer$7: (options?: LayerOptions$7) => Layer.Layer<
|
|
2468
|
+
declare const layer$7: (options?: LayerOptions$7) => Layer.Layer<RpcServer.Protocol | DurableObjectRpcWebSocket, never, DurableObjectState | RpcSerialization.RpcSerialization>;
|
|
2420
2469
|
declare namespace DurableObjectSqlite_d_exports {
|
|
2421
2470
|
export { SqliteLayerOptions, layer$6 as layer };
|
|
2422
2471
|
}
|
|
2423
2472
|
/** Options forwarded to `@effect/sql-sqlite-do` when building a SQL client layer. */
|
|
2424
|
-
type SqliteLayerOptions = Omit<SqliteClient.SqliteClientConfig, "db">;
|
|
2473
|
+
type SqliteLayerOptions = Omit<SqliteClient.SqliteClientConfig, "db" | "storage">;
|
|
2425
2474
|
/**
|
|
2426
2475
|
* Provides `effect/unstable/sql` from the current Durable Object SQLite storage.
|
|
2427
2476
|
*
|
|
@@ -2433,7 +2482,7 @@ type SqliteLayerOptions = Omit<SqliteClient.SqliteClientConfig, "db">;
|
|
|
2433
2482
|
* );
|
|
2434
2483
|
* ```
|
|
2435
2484
|
*/
|
|
2436
|
-
declare const layer$6: (options?: SqliteLayerOptions) => Layer.Layer<
|
|
2485
|
+
declare const layer$6: (options?: SqliteLayerOptions) => Layer.Layer<SqliteClient.SqliteClient | SqlClient.SqlClient, never, DurableObjectState>;
|
|
2437
2486
|
declare namespace Email_d_exports {
|
|
2438
2487
|
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
2488
|
}
|
|
@@ -2450,7 +2499,14 @@ declare const sendLimits: {
|
|
|
2450
2499
|
/** Allowlisted custom headers, excluding `X-` prefixed headers. */
|
|
2451
2500
|
readonly maxAllowlistHeaders: 20;
|
|
2452
2501
|
};
|
|
2453
|
-
/**
|
|
2502
|
+
/**
|
|
2503
|
+
* Error codes reported by Cloudflare Email Sending.
|
|
2504
|
+
*
|
|
2505
|
+
* Surfaced on {@link EmailOperationError} `code` on a best-effort basis: the
|
|
2506
|
+
* runtime attaches them as a non-standard `code` property on thrown errors,
|
|
2507
|
+
* which may be missing depending on the runtime or dev-time proxying
|
|
2508
|
+
* (miniflare remote bindings serialize errors and can strip it).
|
|
2509
|
+
*/
|
|
2454
2510
|
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
2511
|
/** A documented Cloudflare Email Sending error code. */
|
|
2456
2512
|
type EmailErrorCode = (typeof emailErrorCodes)[number];
|
|
@@ -2462,9 +2518,17 @@ declare class EmailOperationError extends EmailOperationError_base<{
|
|
|
2462
2518
|
readonly binding: string;
|
|
2463
2519
|
readonly operation: string;
|
|
2464
2520
|
readonly cause: unknown;
|
|
2465
|
-
/**
|
|
2521
|
+
/**
|
|
2522
|
+
* Cloudflare error code taken from the thrown error, when present.
|
|
2523
|
+
*
|
|
2524
|
+
* Best-effort: may be `undefined` depending on the runtime or dev-time
|
|
2525
|
+
* proxying — miniflare remote bindings (`"remote": true`) serialize thrown
|
|
2526
|
+
* errors and can strip the non-standard `code` property.
|
|
2527
|
+
*/
|
|
2466
2528
|
readonly code?: EmailErrorCode | (string & {});
|
|
2467
|
-
}> {
|
|
2529
|
+
}> {
|
|
2530
|
+
get message(): string;
|
|
2531
|
+
}
|
|
2468
2532
|
/** A single message field that violates a documented Email Sending limit. */
|
|
2469
2533
|
interface EmailViolation {
|
|
2470
2534
|
readonly path: string;
|
|
@@ -2480,7 +2544,9 @@ declare class EmailValidationError extends EmailValidationError_base<{
|
|
|
2480
2544
|
readonly binding: string;
|
|
2481
2545
|
readonly operation: string;
|
|
2482
2546
|
readonly violations: ReadonlyArray<EmailViolation>;
|
|
2483
|
-
}> {
|
|
2547
|
+
}> {
|
|
2548
|
+
get message(): string;
|
|
2549
|
+
}
|
|
2484
2550
|
/** Typed Cloudflare Send Email binding definition. */
|
|
2485
2551
|
interface EmailDefinition {
|
|
2486
2552
|
/** Binding name as configured in `wrangler.jsonc`. */
|
|
@@ -2504,7 +2570,7 @@ interface EmailClient {
|
|
|
2504
2570
|
(message: EmailMessage): Effect.Effect<EmailSendResult, EmailSendError>;
|
|
2505
2571
|
(builder: EmailMessageBuilder): Effect.Effect<EmailSendResult, EmailSendError>;
|
|
2506
2572
|
};
|
|
2507
|
-
readonly
|
|
2573
|
+
readonly rawUnsafe: Effect.Effect<EmailBinding>;
|
|
2508
2574
|
readonly definition: EmailDefinition;
|
|
2509
2575
|
}
|
|
2510
2576
|
declare const EmailServiceTypeId: unique symbol;
|
|
@@ -2539,9 +2605,10 @@ declare const layer$5: <Self>(tag: Context.Service<Self, EmailClient>, definitio
|
|
|
2539
2605
|
declare const make$5: <Id extends string>(id: Id) => TagClass$6<EmailService<Id>, Id>;
|
|
2540
2606
|
declare const Tag$7: <Self>() => <Id extends string>(id: Id) => TagClass$6<Self, Id>;
|
|
2541
2607
|
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 };
|
|
2608
|
+
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
2609
|
}
|
|
2544
|
-
declare const TypeId: "effect-cf/Images/Steps";
|
|
2610
|
+
declare const TypeId: "~effect-cf/Images/Steps";
|
|
2611
|
+
type TypeId = typeof TypeId;
|
|
2545
2612
|
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
2613
|
readonly _tag: "ImagesOperationError";
|
|
2547
2614
|
} & Readonly<A>;
|
|
@@ -2550,7 +2617,9 @@ declare class ImagesOperationError extends ImagesOperationError_base<{
|
|
|
2550
2617
|
readonly binding: string;
|
|
2551
2618
|
readonly operation: string;
|
|
2552
2619
|
readonly cause: unknown;
|
|
2553
|
-
}> {
|
|
2620
|
+
}> {
|
|
2621
|
+
get message(): string;
|
|
2622
|
+
}
|
|
2554
2623
|
/** Typed Cloudflare Images binding definition. */
|
|
2555
2624
|
interface ImagesDefinition {
|
|
2556
2625
|
/** Binding name as configured in `wrangler.jsonc`. */
|
|
@@ -2580,6 +2649,65 @@ type Step = Data.TaggedEnum<{
|
|
|
2580
2649
|
};
|
|
2581
2650
|
readonly Draw: DrawStepOptions;
|
|
2582
2651
|
}>;
|
|
2652
|
+
declare const Step: {
|
|
2653
|
+
readonly $is: <Tag extends "Draw" | "Transform">(tag: Tag) => (u: unknown) => u is Extract<{
|
|
2654
|
+
readonly _tag: "Draw";
|
|
2655
|
+
readonly image: ReadableStream<Uint8Array> | CloudflareImageTransformer;
|
|
2656
|
+
readonly options?: ImageDrawOptions;
|
|
2657
|
+
}, {
|
|
2658
|
+
readonly _tag: Tag;
|
|
2659
|
+
}> | Extract<{
|
|
2660
|
+
readonly _tag: "Transform";
|
|
2661
|
+
readonly transform: ImageTransform;
|
|
2662
|
+
}, {
|
|
2663
|
+
readonly _tag: Tag;
|
|
2664
|
+
}>;
|
|
2665
|
+
readonly $match: {
|
|
2666
|
+
<Cases extends { readonly [Tag in "Draw" | "Transform"]: (args: Extract<{
|
|
2667
|
+
readonly _tag: "Draw";
|
|
2668
|
+
readonly image: ReadableStream<Uint8Array> | CloudflareImageTransformer;
|
|
2669
|
+
readonly options?: ImageDrawOptions;
|
|
2670
|
+
} | {
|
|
2671
|
+
readonly _tag: "Transform";
|
|
2672
|
+
readonly transform: ImageTransform;
|
|
2673
|
+
}, {
|
|
2674
|
+
readonly _tag: Tag;
|
|
2675
|
+
}>) => any; }>(cases: Cases): (value: {
|
|
2676
|
+
readonly _tag: "Draw";
|
|
2677
|
+
readonly image: ReadableStream<Uint8Array> | CloudflareImageTransformer;
|
|
2678
|
+
readonly options?: ImageDrawOptions;
|
|
2679
|
+
} | {
|
|
2680
|
+
readonly _tag: "Transform";
|
|
2681
|
+
readonly transform: ImageTransform;
|
|
2682
|
+
}) => import("effect/Unify").Unify<ReturnType<Cases["Draw" | "Transform"]>>;
|
|
2683
|
+
<Cases extends { readonly [Tag in "Draw" | "Transform"]: (args: Extract<{
|
|
2684
|
+
readonly _tag: "Draw";
|
|
2685
|
+
readonly image: ReadableStream<Uint8Array> | CloudflareImageTransformer;
|
|
2686
|
+
readonly options?: ImageDrawOptions;
|
|
2687
|
+
} | {
|
|
2688
|
+
readonly _tag: "Transform";
|
|
2689
|
+
readonly transform: ImageTransform;
|
|
2690
|
+
}, {
|
|
2691
|
+
readonly _tag: Tag;
|
|
2692
|
+
}>) => any; }>(value: {
|
|
2693
|
+
readonly _tag: "Draw";
|
|
2694
|
+
readonly image: ReadableStream<Uint8Array> | CloudflareImageTransformer;
|
|
2695
|
+
readonly options?: ImageDrawOptions;
|
|
2696
|
+
} | {
|
|
2697
|
+
readonly _tag: "Transform";
|
|
2698
|
+
readonly transform: ImageTransform;
|
|
2699
|
+
}, cases: Cases): import("effect/Unify").Unify<ReturnType<Cases["Draw" | "Transform"]>>;
|
|
2700
|
+
};
|
|
2701
|
+
readonly Draw: Data.TaggedEnum.ConstructorFrom<{
|
|
2702
|
+
readonly _tag: "Draw";
|
|
2703
|
+
readonly image: ReadableStream<Uint8Array> | CloudflareImageTransformer;
|
|
2704
|
+
readonly options?: ImageDrawOptions;
|
|
2705
|
+
}, "_tag">;
|
|
2706
|
+
readonly Transform: Data.TaggedEnum.ConstructorFrom<{
|
|
2707
|
+
readonly _tag: "Transform";
|
|
2708
|
+
readonly transform: ImageTransform;
|
|
2709
|
+
}, "_tag">;
|
|
2710
|
+
};
|
|
2583
2711
|
interface Steps {
|
|
2584
2712
|
readonly [TypeId]: typeof TypeId;
|
|
2585
2713
|
readonly steps: ReadonlyArray<Step>;
|
|
@@ -2606,7 +2734,7 @@ interface HostedImagesClient {
|
|
|
2606
2734
|
readonly image: (imageId: string) => ImageHandleClient;
|
|
2607
2735
|
readonly upload: (image: ImageUploadValue, options?: ImageUploadOptions) => Effect.Effect<ImageMetadata, ImagesOperationError>;
|
|
2608
2736
|
readonly list: (options?: ImageListOptions) => Effect.Effect<ImageList, ImagesOperationError>;
|
|
2609
|
-
readonly
|
|
2737
|
+
readonly rawUnsafe: Effect.Effect<CloudflareHostedImagesBinding>;
|
|
2610
2738
|
}
|
|
2611
2739
|
interface ImagesRuntimeBinding {
|
|
2612
2740
|
readonly info: (image: ImageInputValue, options?: ImageInputOptions) => Promise<ImageInfoResponse>;
|
|
@@ -2618,7 +2746,7 @@ interface ImagesClient {
|
|
|
2618
2746
|
readonly input: (image: ImageInputValue, options?: ImageInputOptions) => Effect.Effect<CloudflareImageTransformer, ImagesOperationError>;
|
|
2619
2747
|
readonly process: (steps: Steps, options: ProcessOptions) => Effect.Effect<ImagesTransformationResultClient, ImagesOperationError>;
|
|
2620
2748
|
readonly hosted: Option.Option<HostedImagesClient>;
|
|
2621
|
-
readonly
|
|
2749
|
+
readonly rawUnsafe: Effect.Effect<ImagesRuntimeBinding>;
|
|
2622
2750
|
readonly definition: ImagesDefinition;
|
|
2623
2751
|
}
|
|
2624
2752
|
declare const ImagesServiceTypeId: unique symbol;
|
|
@@ -2637,27 +2765,35 @@ interface TagClass$5<Self, Id extends string> extends Context.ServiceClass<Self,
|
|
|
2637
2765
|
}
|
|
2638
2766
|
/** Empty Images transformation pipeline. */
|
|
2639
2767
|
declare const empty: Steps;
|
|
2640
|
-
declare
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2768
|
+
declare const transform: {
|
|
2769
|
+
(transform: ImageTransform): (steps: Steps) => Steps;
|
|
2770
|
+
(steps: Steps, transform: ImageTransform): Steps;
|
|
2771
|
+
};
|
|
2772
|
+
declare const draw: {
|
|
2773
|
+
(draw: DrawStepOptions): (steps: Steps) => Steps;
|
|
2774
|
+
(steps: Steps, draw: DrawStepOptions): Steps;
|
|
2775
|
+
};
|
|
2644
2776
|
declare const isImagesBinding: (value: unknown) => value is ImagesRuntimeBinding;
|
|
2645
2777
|
declare const makeClient$4: (definition: ImagesDefinition) => (images: ImagesRuntimeBinding) => ImagesClient;
|
|
2646
2778
|
declare const layer$4: <Self>(tag: Context.Service<Self, ImagesClient>, definition: ImagesDefinition) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
2647
2779
|
declare const make$4: <Id extends string>(id: Id) => TagClass$5<ImagesService<Id>, Id>;
|
|
2648
2780
|
declare const Tag$6: <Self>() => <Id extends string>(id: Id) => TagClass$5<Self, Id>;
|
|
2649
2781
|
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 };
|
|
2782
|
+
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
2783
|
}
|
|
2784
|
+
/** KV operation represented by {@link KvOperationError}. */
|
|
2785
|
+
type KvOperation = "put" | "get" | "getWithMetadata" | "list" | "delete";
|
|
2652
2786
|
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
2787
|
readonly _tag: "KvOperationError";
|
|
2654
2788
|
} & Readonly<A>;
|
|
2655
2789
|
/** Error raised when a KV operation fails. */
|
|
2656
2790
|
declare class KvOperationError extends KvOperationError_base<{
|
|
2657
2791
|
readonly binding: string;
|
|
2658
|
-
readonly operation:
|
|
2792
|
+
readonly operation: KvOperation;
|
|
2659
2793
|
readonly cause: unknown;
|
|
2660
|
-
}> {
|
|
2794
|
+
}> {
|
|
2795
|
+
get message(): string;
|
|
2796
|
+
}
|
|
2661
2797
|
/** `KVNamespace.put` options. */
|
|
2662
2798
|
type KvPutOptions = CloudflareKVNamespacePutOptions;
|
|
2663
2799
|
/** `KVNamespace.list` options with optional metadata decoding schema. */
|
|
@@ -2712,8 +2848,8 @@ interface KvClient<Key, Value, EncodedValue> {
|
|
|
2712
2848
|
readonly get: (key: Key) => Effect.Effect<Option.Option<Value>, KvOperationError | Schema.SchemaError>;
|
|
2713
2849
|
readonly getWithMetadata: <Metadata>(key: Key, metadataSchema: Schema.Codec<Metadata, unknown>) => Effect.Effect<Option.Option<KvWithMetadata<Value, Metadata>>, KvOperationError | Schema.SchemaError>;
|
|
2714
2850
|
readonly list: <Metadata = unknown>(options?: KvListOptions<Metadata>) => Effect.Effect<KvListResult<Key, Metadata>, KvOperationError | Schema.SchemaError>;
|
|
2715
|
-
readonly
|
|
2716
|
-
readonly
|
|
2851
|
+
readonly delete: (key: Key) => Effect.Effect<void, KvOperationError | Schema.SchemaError>;
|
|
2852
|
+
readonly rawUnsafe: Effect.Effect<KVNamespace>;
|
|
2717
2853
|
readonly definition: KvDefinition<Key, Value, EncodedValue>;
|
|
2718
2854
|
}
|
|
2719
2855
|
type LayerOptions$4 = {
|
|
@@ -2733,17 +2869,21 @@ declare const Tag$5: <Self>() => <Id extends string, Key, Value, EncodedValue>(i
|
|
|
2733
2869
|
readonly value: Schema.Codec<Value, EncodedValue>;
|
|
2734
2870
|
}) => TagClass$4<Self, Id, Key, Value, EncodedValue>;
|
|
2735
2871
|
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 };
|
|
2872
|
+
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
2873
|
}
|
|
2874
|
+
/** R2 operation represented by {@link R2OperationError}. */
|
|
2875
|
+
type R2Operation = "head" | "get" | "put" | "delete" | "list" | "createMultipartUpload" | "resumeMultipartUpload" | "uploadPart" | "abortMultipartUpload" | "completeMultipartUpload" | "arrayBuffer" | "bytes" | "text" | "json" | "blob";
|
|
2738
2876
|
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
2877
|
readonly _tag: "R2OperationError";
|
|
2740
2878
|
} & Readonly<A>;
|
|
2741
2879
|
/** Error raised when an R2 operation fails. */
|
|
2742
2880
|
declare class R2OperationError extends R2OperationError_base<{
|
|
2743
2881
|
readonly binding: string;
|
|
2744
|
-
readonly operation:
|
|
2882
|
+
readonly operation: R2Operation;
|
|
2745
2883
|
readonly cause: unknown;
|
|
2746
|
-
}> {
|
|
2884
|
+
}> {
|
|
2885
|
+
get message(): string;
|
|
2886
|
+
}
|
|
2747
2887
|
/** Typed R2 bucket binding definition. */
|
|
2748
2888
|
interface R2Definition {
|
|
2749
2889
|
/** Binding name as configured in `wrangler.jsonc`. */
|
|
@@ -2790,7 +2930,7 @@ interface R2Client {
|
|
|
2790
2930
|
readonly resumeMultipartUpload: (key: string, uploadId: string) => Effect.Effect<R2MultipartUploadClient, R2OperationError>;
|
|
2791
2931
|
readonly delete: (keys: string | ReadonlyArray<string>) => Effect.Effect<void, R2OperationError>;
|
|
2792
2932
|
readonly list: (options?: R2ListOptions) => Effect.Effect<CloudflareR2Objects, R2OperationError>;
|
|
2793
|
-
readonly
|
|
2933
|
+
readonly rawUnsafe: Effect.Effect<CloudflareR2Bucket>;
|
|
2794
2934
|
readonly definition: R2Definition;
|
|
2795
2935
|
}
|
|
2796
2936
|
declare const R2ServiceTypeId: unique symbol;
|
|
@@ -2812,8 +2952,72 @@ declare const makeClient$2: (definition: R2Definition) => ((bucket: CloudflareR2
|
|
|
2812
2952
|
declare const layer$2: <Self>(tag: Context.Service<Self, R2Client>, definition: R2Definition) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
2813
2953
|
declare const make$3: <Id extends string>(id: Id) => TagClass$3<R2Service<Id>, Id>;
|
|
2814
2954
|
declare const Tag$4: <Self>() => <Id extends string>(id: Id) => TagClass$3<Self, Id>;
|
|
2955
|
+
declare namespace Vectorize_d_exports {
|
|
2956
|
+
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 };
|
|
2957
|
+
}
|
|
2958
|
+
/** Vectorize operation represented by {@link VectorizeOperationError}. */
|
|
2959
|
+
type VectorizeOperation = "describe" | "query" | "queryById" | "insert" | "upsert" | "deleteByIds" | "getByIds";
|
|
2960
|
+
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 & {
|
|
2961
|
+
readonly _tag: "VectorizeOperationError";
|
|
2962
|
+
} & Readonly<A>;
|
|
2963
|
+
/** Error raised when a Vectorize operation fails. */
|
|
2964
|
+
declare class VectorizeOperationError extends VectorizeOperationError_base<{
|
|
2965
|
+
readonly binding: string;
|
|
2966
|
+
readonly operation: VectorizeOperation;
|
|
2967
|
+
readonly cause: unknown;
|
|
2968
|
+
}> {
|
|
2969
|
+
get message(): string;
|
|
2970
|
+
}
|
|
2971
|
+
/** Typed Vectorize binding definition. */
|
|
2972
|
+
interface VectorizeDefinition {
|
|
2973
|
+
/** Binding name as configured in `wrangler.jsonc`. */
|
|
2974
|
+
readonly binding: string;
|
|
2975
|
+
}
|
|
2976
|
+
type VectorizeBinding = CloudflareVectorize | CloudflareVectorizeIndex;
|
|
2977
|
+
type VectorizeVector = CloudflareVectorizeVector;
|
|
2978
|
+
type VectorizeVectorMetadata = CloudflareVectorizeVectorMetadata;
|
|
2979
|
+
type VectorizeVectorMetadataValue = CloudflareVectorizeVectorMetadataValue;
|
|
2980
|
+
type VectorizeVectorMetadataFilter = CloudflareVectorizeVectorMetadataFilter;
|
|
2981
|
+
type VectorizeQueryOptions = CloudflareVectorizeQueryOptions;
|
|
2982
|
+
type VectorizeMatches = CloudflareVectorizeMatches;
|
|
2983
|
+
type VectorizeMatch = CloudflareVectorizeMatch;
|
|
2984
|
+
type VectorizeIndexInfo = CloudflareVectorizeIndexInfo;
|
|
2985
|
+
type VectorizeIndexDetails = CloudflareVectorizeIndexDetails;
|
|
2986
|
+
type VectorizeMutation = CloudflareVectorizeAsyncMutation | CloudflareVectorizeVectorMutation;
|
|
2987
|
+
type VectorizeValues = Float32Array | Float64Array | ReadonlyArray<number>;
|
|
2988
|
+
interface VectorizeClient {
|
|
2989
|
+
readonly describe: Effect.Effect<VectorizeIndexInfo | VectorizeIndexDetails, VectorizeOperationError>;
|
|
2990
|
+
readonly query: (vector: VectorizeValues, options?: VectorizeQueryOptions) => Effect.Effect<VectorizeMatches, VectorizeOperationError>;
|
|
2991
|
+
readonly queryById: (vectorId: string, options?: VectorizeQueryOptions) => Effect.Effect<VectorizeMatches, VectorizeOperationError>;
|
|
2992
|
+
readonly insert: (vectors: ReadonlyArray<VectorizeVector>) => Effect.Effect<VectorizeMutation, VectorizeOperationError>;
|
|
2993
|
+
readonly upsert: (vectors: ReadonlyArray<VectorizeVector>) => Effect.Effect<VectorizeMutation, VectorizeOperationError>;
|
|
2994
|
+
readonly deleteByIds: (ids: ReadonlyArray<string>) => Effect.Effect<VectorizeMutation, VectorizeOperationError>;
|
|
2995
|
+
readonly delete: (ids: ReadonlyArray<string>) => Effect.Effect<VectorizeMutation, VectorizeOperationError>;
|
|
2996
|
+
readonly getByIds: (ids: ReadonlyArray<string>) => Effect.Effect<ReadonlyArray<VectorizeVector>, VectorizeOperationError>;
|
|
2997
|
+
readonly rawUnsafe: Effect.Effect<VectorizeBinding>;
|
|
2998
|
+
readonly definition: VectorizeDefinition;
|
|
2999
|
+
}
|
|
3000
|
+
declare const VectorizeServiceTypeId: unique symbol;
|
|
3001
|
+
/** Nominal service marker for Vectorize services created with {@link make}. */
|
|
3002
|
+
interface VectorizeService<Id extends string> {
|
|
3003
|
+
readonly [VectorizeServiceTypeId]: {
|
|
3004
|
+
readonly id: Id;
|
|
3005
|
+
};
|
|
3006
|
+
}
|
|
3007
|
+
type LayerOptions$2 = {
|
|
3008
|
+
readonly binding: string;
|
|
3009
|
+
};
|
|
3010
|
+
interface TagClass$2<Self, Id extends string> extends Context.ServiceClass<Self, Id, VectorizeClient> {
|
|
3011
|
+
readonly id: Id;
|
|
3012
|
+
readonly layer: (options: LayerOptions$2) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
3013
|
+
}
|
|
3014
|
+
declare const isVectorizeBinding: (value: unknown) => value is VectorizeBinding;
|
|
3015
|
+
declare const makeClient$1: (definition: VectorizeDefinition) => (index: VectorizeBinding) => VectorizeClient;
|
|
3016
|
+
declare const layer$1: <Self>(tag: Context.Service<Self, VectorizeClient>, definition: VectorizeDefinition) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
3017
|
+
declare const make$2: <Id extends string>(id: Id) => TagClass$2<VectorizeService<Id>, Id>;
|
|
3018
|
+
declare const Tag$3: <Self>() => <Id extends string>(id: Id) => TagClass$2<Self, Id>;
|
|
2815
3019
|
declare namespace WorkflowBinding_d_exports {
|
|
2816
|
-
export { WorkflowBindingClient, WorkflowBindingDefinition, WorkflowInstance, WorkflowInstanceCreateBatchOptions, WorkflowInstanceCreateOptions, WorkflowInstanceEvent, WorkflowInstanceRestartOptions, WorkflowInstanceStatus, WorkflowInstanceStatusName, WorkflowOperationError, WorkflowResultDecodeError, isWorkflow, layer
|
|
3020
|
+
export { WorkflowBindingClient, WorkflowBindingDefinition, WorkflowInstance, WorkflowInstanceCreateBatchOptions, WorkflowInstanceCreateOptions, WorkflowInstanceEvent, WorkflowInstanceRestartOptions, WorkflowInstanceStatus, WorkflowInstanceStatusName, WorkflowOperationError, WorkflowResultDecodeError, isWorkflow, layer, makeClient };
|
|
2817
3021
|
}
|
|
2818
3022
|
type WorkflowInstanceCreateOptions<Payload> = Omit<CloudflareWorkflowInstanceCreateOptions<Payload>, "params">;
|
|
2819
3023
|
type WorkflowInstanceCreateBatchOptions<Payload, EncodedPayload = unknown> = ReadonlyArray<{
|
|
@@ -2849,7 +3053,7 @@ interface WorkflowInstanceEvent {
|
|
|
2849
3053
|
readonly type: string;
|
|
2850
3054
|
readonly payload: unknown;
|
|
2851
3055
|
}
|
|
2852
|
-
interface WorkflowBindingDefinition<Payload extends ServiceFreeSchema$
|
|
3056
|
+
interface WorkflowBindingDefinition<Payload extends ServiceFreeSchema$2, Result extends ServiceFreeSchema$2> {
|
|
2853
3057
|
/** Binding name as configured in `wrangler.jsonc`. */
|
|
2854
3058
|
readonly binding: string;
|
|
2855
3059
|
/** Codec used to encode payloads passed to `Workflow.create`. */
|
|
@@ -2857,11 +3061,11 @@ interface WorkflowBindingDefinition<Payload extends ServiceFreeSchema$4, Result
|
|
|
2857
3061
|
/** Codec used to decode completed workflow status output. */
|
|
2858
3062
|
readonly result: Result;
|
|
2859
3063
|
}
|
|
2860
|
-
interface WorkflowBindingClient<Payload extends ServiceFreeSchema$
|
|
3064
|
+
interface WorkflowBindingClient<Payload extends ServiceFreeSchema$2, Result extends ServiceFreeSchema$2> {
|
|
2861
3065
|
readonly create: (payload: Schema.Schema.Type<Payload>, options?: WorkflowInstanceCreateOptions<Schema.Codec.Encoded<Payload>>) => Effect.Effect<WorkflowInstance<Schema.Schema.Type<Result>>, WorkflowOperationError | Schema.SchemaError>;
|
|
2862
3066
|
readonly createBatch: (batch: WorkflowInstanceCreateBatchOptions<Schema.Schema.Type<Payload>, Schema.Codec.Encoded<Payload>>) => Effect.Effect<ReadonlyArray<WorkflowInstance<Schema.Schema.Type<Result>>>, WorkflowOperationError | Schema.SchemaError>;
|
|
2863
3067
|
readonly get: (instanceId: string) => Effect.Effect<WorkflowInstance<Schema.Schema.Type<Result>>, WorkflowOperationError>;
|
|
2864
|
-
readonly
|
|
3068
|
+
readonly rawUnsafe: Effect.Effect<CloudflareWorkflow<Schema.Codec.Encoded<Payload>>>;
|
|
2865
3069
|
}
|
|
2866
3070
|
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
3071
|
readonly _tag: "WorkflowOperationError";
|
|
@@ -2870,7 +3074,9 @@ declare class WorkflowOperationError extends WorkflowOperationError_base<{
|
|
|
2870
3074
|
readonly binding: string;
|
|
2871
3075
|
readonly operation: string;
|
|
2872
3076
|
readonly cause: unknown;
|
|
2873
|
-
}> {
|
|
3077
|
+
}> {
|
|
3078
|
+
get message(): string;
|
|
3079
|
+
}
|
|
2874
3080
|
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
3081
|
readonly _tag: "WorkflowResultDecodeError";
|
|
2876
3082
|
} & Readonly<A>;
|
|
@@ -2878,51 +3084,53 @@ declare class WorkflowResultDecodeError extends WorkflowResultDecodeError_base<{
|
|
|
2878
3084
|
readonly binding: string;
|
|
2879
3085
|
readonly instanceId: string;
|
|
2880
3086
|
readonly cause: unknown;
|
|
2881
|
-
}> {
|
|
3087
|
+
}> {
|
|
3088
|
+
get message(): string;
|
|
3089
|
+
}
|
|
2882
3090
|
declare const isWorkflow: <Payload>(value: unknown) => value is CloudflareWorkflow<Payload>;
|
|
2883
|
-
declare const makeClient
|
|
2884
|
-
declare const layer
|
|
3091
|
+
declare const makeClient: <Payload extends ServiceFreeSchema$2, Result extends ServiceFreeSchema$2>(definition: WorkflowBindingDefinition<Payload, Result>) => ((workflow: CloudflareWorkflow<Schema.Codec.Encoded<Payload>>) => WorkflowBindingClient<Payload, Result>);
|
|
3092
|
+
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
3093
|
declare namespace WorkflowDefinition_d_exports {
|
|
2886
|
-
export { Definition$1 as Definition, Handler$1 as Handler, LayerOptions$
|
|
3094
|
+
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
3095
|
}
|
|
2888
|
-
interface Definition$1<Id extends string = string, Payload extends ServiceFreeSchema$
|
|
3096
|
+
interface Definition$1<Id extends string = string, Payload extends ServiceFreeSchema$2 = ServiceFreeSchema$2, Result extends ServiceFreeSchema$2 = ServiceFreeSchema$2> {
|
|
2889
3097
|
readonly id: Id;
|
|
2890
3098
|
readonly payload: Payload;
|
|
2891
3099
|
readonly result: Result;
|
|
2892
3100
|
}
|
|
2893
3101
|
declare namespace Definition$1 {
|
|
2894
|
-
type Any = Definition$1<string, ServiceFreeSchema$
|
|
3102
|
+
type Any = Definition$1<string, ServiceFreeSchema$2, ServiceFreeSchema$2>;
|
|
2895
3103
|
}
|
|
2896
3104
|
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
3105
|
interface Options$1<ROut, Self extends Definition$1.Any> {
|
|
2898
3106
|
readonly run: Handler$1<ROut, Self>;
|
|
2899
3107
|
}
|
|
2900
|
-
type LayerOptions$
|
|
3108
|
+
type LayerOptions$1 = {
|
|
2901
3109
|
readonly binding: string;
|
|
2902
3110
|
};
|
|
2903
|
-
interface TagClass$
|
|
3111
|
+
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
3112
|
readonly id: Id;
|
|
2905
3113
|
readonly payload: Payload;
|
|
2906
3114
|
readonly result: Result;
|
|
2907
3115
|
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$
|
|
3116
|
+
readonly layer: (options: LayerOptions$1) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
2909
3117
|
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
3118
|
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
3119
|
readonly get: (instanceId: string) => Effect.Effect<WorkflowInstance<Schema.Schema.Type<Result>>, WorkflowOperationError, Self>;
|
|
2912
|
-
readonly
|
|
3120
|
+
readonly rawUnsafe: Effect.Effect<globalThis.Workflow<Schema.Codec.Encoded<Payload>>, never, Self>;
|
|
2913
3121
|
}
|
|
2914
|
-
declare const make$
|
|
3122
|
+
declare const make$1: <Id extends string, Payload extends ServiceFreeSchema$2, Result extends ServiceFreeSchema$2>(id: Id, definition: {
|
|
2915
3123
|
readonly payload: Payload;
|
|
2916
3124
|
readonly result: Result;
|
|
2917
|
-
}) => TagClass$
|
|
2918
|
-
declare const Tag$
|
|
3125
|
+
}) => TagClass$1<Definition$1<Id, Payload, Result>, Id, Payload, Result>;
|
|
3126
|
+
declare const Tag$2: <Self>() => <Id extends string, Payload extends ServiceFreeSchema$2, Result extends ServiceFreeSchema$2>(id: Id, definition: {
|
|
2919
3127
|
readonly payload: Payload;
|
|
2920
3128
|
readonly result: Result;
|
|
2921
|
-
}) => TagClass$
|
|
2922
|
-
declare const Workflow: typeof Tag$
|
|
3129
|
+
}) => TagClass$1<Self, Id, Payload, Result>;
|
|
3130
|
+
declare const Workflow: typeof Tag$2;
|
|
2923
3131
|
declare const implement$1: <ROut, const Self extends Definition$1.Any>(_definition: Self, handler: Handler$1<ROut, Self>) => Handler$1<ROut, Self>;
|
|
2924
3132
|
declare namespace Workflow_d_exports {
|
|
2925
|
-
export { Definition, Handler, LayerOptions
|
|
3133
|
+
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
3134
|
}
|
|
2927
3135
|
interface WorkflowEventService<Payload = unknown> {
|
|
2928
3136
|
readonly raw: WorkflowEvent<unknown>;
|
|
@@ -2933,15 +3141,26 @@ interface WorkflowEventService<Payload = unknown> {
|
|
|
2933
3141
|
}
|
|
2934
3142
|
declare const WorkflowEvent_base: Context.ServiceClass<WorkflowEvent$1, "effect-cf/WorkflowEvent", WorkflowEventService<unknown>>;
|
|
2935
3143
|
declare class WorkflowEvent$1 extends WorkflowEvent_base {}
|
|
3144
|
+
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 & {
|
|
3145
|
+
readonly _tag: "WorkflowStepError";
|
|
3146
|
+
} & Readonly<A>;
|
|
3147
|
+
/** Failure raised when a Cloudflare Workflow step operation rejects. */
|
|
3148
|
+
declare class WorkflowStepError extends WorkflowStepError_base<{
|
|
3149
|
+
readonly step?: string;
|
|
3150
|
+
readonly operation: string;
|
|
3151
|
+
readonly cause: unknown;
|
|
3152
|
+
}> {
|
|
3153
|
+
get message(): string;
|
|
3154
|
+
}
|
|
2936
3155
|
interface WorkflowStepService {
|
|
2937
3156
|
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,
|
|
3157
|
+
do<A, E, R>(name: string, effect: Effect.Effect<A, E, R>, config?: WorkflowStepConfig): Effect.Effect<A, WorkflowStepError, Exclude<R, WorkflowStepContext$1>>;
|
|
3158
|
+
readonly sleep: (name: string, duration: WorkflowSleepDuration) => Effect.Effect<void, WorkflowStepError>;
|
|
3159
|
+
readonly sleepUntil: (name: string, timestamp: Date | number) => Effect.Effect<void, WorkflowStepError>;
|
|
2941
3160
|
readonly waitForEvent: <Payload>(name: string, options: {
|
|
2942
3161
|
readonly type: string;
|
|
2943
3162
|
readonly timeout?: WorkflowTimeoutDuration | number;
|
|
2944
|
-
}) => Effect.Effect<WorkflowStepEvent<Payload>,
|
|
3163
|
+
}) => Effect.Effect<WorkflowStepEvent<Payload>, WorkflowStepError>;
|
|
2945
3164
|
}
|
|
2946
3165
|
declare const WorkflowStep_base: Context.ServiceClass<WorkflowStep$1, "effect-cf/WorkflowStep", WorkflowStepService>;
|
|
2947
3166
|
declare class WorkflowStep$1 extends WorkflowStep_base {}
|
|
@@ -2956,86 +3175,26 @@ interface WorkflowOptions<ROut, Payload = unknown, Result = unknown> {
|
|
|
2956
3175
|
type WorkflowClass<Payload, Result, _ROut> = new (ctx: globalThis.ExecutionContext, env: WorkerEnv) => WorkflowEntrypoint<WorkerEnv, Payload> & {
|
|
2957
3176
|
run(event: Readonly<WorkflowEvent<Payload>>, step: WorkflowStep): Promise<Result>;
|
|
2958
3177
|
};
|
|
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,
|
|
3178
|
+
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>;
|
|
3179
|
+
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>>;
|
|
3180
|
+
declare const sleep: (name: string, duration: WorkflowSleepDuration) => Effect.Effect<void, WorkflowStepError, WorkflowStep$1>;
|
|
3181
|
+
declare const sleepUntil: (name: string, timestamp: Date | number) => Effect.Effect<void, WorkflowStepError, WorkflowStep$1>;
|
|
2963
3182
|
declare const waitForEvent: <Payload>(name: string, options: {
|
|
2964
3183
|
readonly type: string;
|
|
2965
3184
|
readonly timeout?: WorkflowTimeoutDuration | number;
|
|
2966
|
-
}) => Effect.Effect<WorkflowStepEvent<Payload>,
|
|
3185
|
+
}) => Effect.Effect<WorkflowStepEvent<Payload>, WorkflowStepError, WorkflowStep$1>;
|
|
2967
3186
|
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
3187
|
declare namespace Definition {
|
|
2969
3188
|
type Any = Definition$1.Any;
|
|
2970
3189
|
}
|
|
2971
|
-
type LayerOptions
|
|
2972
|
-
type TagClass
|
|
2973
|
-
declare const Tag$
|
|
3190
|
+
type LayerOptions = LayerOptions$1;
|
|
3191
|
+
type TagClass<Self, Id extends string, Payload extends Definition$1.Any["payload"], Result extends Definition$1.Any["result"]> = TagClass$1<Self, Id, Payload, Result>;
|
|
3192
|
+
declare const Tag$1: <Self>() => <Id extends string, Payload extends Definition$1.Any["payload"], Result extends Definition$1.Any["result"]>(id: Id, definition: {
|
|
2974
3193
|
readonly payload: Payload;
|
|
2975
3194
|
readonly result: Result;
|
|
2976
|
-
}) => TagClass
|
|
3195
|
+
}) => TagClass<Self, Id, Payload, Result>;
|
|
2977
3196
|
declare const implement: typeof implement$1;
|
|
2978
3197
|
type Handler<ROut, Self extends Definition$1.Any> = Handler$1<ROut, Self>;
|
|
2979
3198
|
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
3199
|
//#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 };
|
|
3200
|
+
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 };
|