effect-cf 0.7.0 → 0.8.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 +8 -0
- package/README.md +91 -0
- package/dist/Hyperdrive-By6DrSS_.d.mts +140 -0
- package/dist/Hyperdrive-LuQaVhXU.mjs +86 -0
- package/dist/HyperdrivePg.d.mts +14 -0
- package/dist/HyperdrivePg.mjs +13 -0
- package/dist/index.d.mts +257 -200
- package/dist/index.mjs +251 -190
- package/package.json +13 -1
- package/src/D1.ts +3 -59
- package/src/Hyperdrive.ts +82 -0
- package/src/HyperdrivePg.ts +27 -0
- package/src/Images.ts +332 -0
- package/src/Kv.ts +0 -62
- package/src/R2.ts +230 -0
- package/src/index.ts +3 -0
package/dist/index.d.mts
CHANGED
|
@@ -1,129 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as BindingService, c as WorkerConfig, i as BindingNotFoundError, l as WorkerEnv, o as BindingValidationError, s as Binding_d_exports, t as Hyperdrive_d_exports, u as WorkerEnvironment } from "./Hyperdrive-By6DrSS_.mjs";
|
|
2
|
+
import { Cause, Context, Data, DateTime, Duration, Effect, Layer, Option, Schema, Scope } from "effect";
|
|
2
3
|
import { D1Client } from "@effect/sql-d1";
|
|
3
4
|
import { DurableObject, RpcStub, RpcTarget, WorkerEntrypoint, WorkflowEntrypoint, WorkflowEvent, WorkflowSleepDuration, WorkflowStep, WorkflowStepConfig, WorkflowStepContext, WorkflowStepEvent, WorkflowTimeoutDuration } from "cloudflare:workers";
|
|
4
5
|
import { HttpServerRequest, HttpServerResponse } from "effect/unstable/http";
|
|
5
6
|
import * as RpcSerialization from "effect/unstable/rpc/RpcSerialization";
|
|
6
7
|
import * as RpcServer from "effect/unstable/rpc/RpcServer";
|
|
8
|
+
import * as _$effect_unstable_sql_SqlClient0 from "effect/unstable/sql/SqlClient";
|
|
7
9
|
import * as _$effect_Types0 from "effect/Types";
|
|
8
10
|
import * as _$effect_Cause0 from "effect/Cause";
|
|
9
|
-
import * as _$effect_Redacted0 from "effect/Redacted";
|
|
10
11
|
import * as _$effect_Layer0 from "effect/Layer";
|
|
11
|
-
import * as _$effect_unstable_sql_SqlClient0 from "effect/unstable/sql/SqlClient";
|
|
12
|
-
import * as _$effect_Config0 from "effect/Config";
|
|
13
12
|
import * as _$effect_Scope0 from "effect/Scope";
|
|
13
|
+
import * as _$effect_Config0 from "effect/Config";
|
|
14
14
|
|
|
15
|
-
//#region src/
|
|
16
|
-
/** Cloudflare worker environment object (`env`). */
|
|
17
|
-
type WorkerEnv = Cloudflare.Env;
|
|
18
|
-
declare const WorkerEnvironment_base: Context.ServiceClass<WorkerEnvironment, "effect-cf/WorkerEnvironment", Cloudflare.Env>;
|
|
19
|
-
/**
|
|
20
|
-
* Context service for reading worker bindings from the current `env` object.
|
|
21
|
-
*/
|
|
22
|
-
declare class WorkerEnvironment extends WorkerEnvironment_base {}
|
|
23
|
-
type ScalarConfigValue = string | number | boolean;
|
|
24
|
-
type ScalarConfigKey = Extract<{ readonly [Key in keyof Cloudflare.Env]-?: NonNullable<Cloudflare.Env[Key]> extends ScalarConfigValue ? Key : never }[keyof Cloudflare.Env], string>;
|
|
25
|
-
/**
|
|
26
|
-
* Effect `Config` helpers for scalar Cloudflare vars and secrets declared on
|
|
27
|
-
* `Cloudflare.Env` / generated `worker-configuration.d.ts`.
|
|
28
|
-
*
|
|
29
|
-
* Users still author their app config explicitly with Effect `Config`:
|
|
30
|
-
*
|
|
31
|
-
* ```ts
|
|
32
|
-
* import { Config, Effect } from "effect";
|
|
33
|
-
* import { WorkerConfig } from "effect-cf";
|
|
34
|
-
*
|
|
35
|
-
* const AppConfig = Config.all({
|
|
36
|
-
* databaseUrl: WorkerConfig.redacted("DATABASE_URL"),
|
|
37
|
-
* port: WorkerConfig.integer("PORT").pipe(Config.withDefault(8787)),
|
|
38
|
-
* });
|
|
39
|
-
*
|
|
40
|
-
* const program = Effect.gen(function* () {
|
|
41
|
-
* const config = yield* AppConfig;
|
|
42
|
-
* // ...
|
|
43
|
-
* }).pipe(Effect.provide(WorkerConfig.layer));
|
|
44
|
-
* ```
|
|
45
|
-
*
|
|
46
|
-
* Keys are constrained to scalar `Cloudflare.Env` properties (`string`,
|
|
47
|
-
* `number`, or `boolean`, including optional scalar properties). Binding
|
|
48
|
-
* objects such as `KVNamespace`, `DurableObjectNamespace`, and service
|
|
49
|
-
* bindings are intentionally excluded; keep using the package binding helpers
|
|
50
|
-
* for those live resources.
|
|
51
|
-
*/
|
|
52
|
-
declare namespace WorkerConfig {
|
|
53
|
-
/** Scalar env value types supported by the typed config key helpers. */
|
|
54
|
-
type Scalar = ScalarConfigValue;
|
|
55
|
-
/** Scalar keys available on the current consumer's `Cloudflare.Env`. */
|
|
56
|
-
type Key = ScalarConfigKey;
|
|
57
|
-
/** Read a scalar Cloudflare var or secret as a string. */
|
|
58
|
-
const string: <const Name extends Key>(name: Name) => Config.Config<string>;
|
|
59
|
-
/** Read a scalar Cloudflare secret as a redacted string. */
|
|
60
|
-
const redacted: <const Name extends Key>(name: Name) => Config.Config<_$effect_Redacted0.Redacted<string>>;
|
|
61
|
-
/** Read a scalar Cloudflare var or secret as a number. */
|
|
62
|
-
const number: <const Name extends Key>(name: Name) => Config.Config<number>;
|
|
63
|
-
/** Read a scalar Cloudflare var or secret as an integer. */
|
|
64
|
-
const integer: <const Name extends Key>(name: Name) => Config.Config<number>;
|
|
65
|
-
/** Read a scalar Cloudflare var or secret as a boolean. */
|
|
66
|
-
const boolean: <const Name extends Key>(name: Name) => Config.Config<boolean>;
|
|
67
|
-
/** Build a `ConfigProvider` from a Cloudflare worker `env` object. */
|
|
68
|
-
const providerFromEnv: (env: WorkerEnv) => ConfigProvider.ConfigProvider;
|
|
69
|
-
/**
|
|
70
|
-
* Build a `ConfigProvider` from the current `WorkerEnvironment` with a custom
|
|
71
|
-
* conversion function.
|
|
72
|
-
*/
|
|
73
|
-
const providerWith: (makeProvider: (env: WorkerEnv) => ConfigProvider.ConfigProvider) => Effect.Effect<ConfigProvider.ConfigProvider, never, WorkerEnvironment>;
|
|
74
|
-
/** Build a `ConfigProvider` from the current `WorkerEnvironment`. */
|
|
75
|
-
const provider: Effect.Effect<ConfigProvider.ConfigProvider, never, WorkerEnvironment>;
|
|
76
|
-
/**
|
|
77
|
-
* Replace the active Effect `ConfigProvider` with one backed by the current
|
|
78
|
-
* Cloudflare worker `env` object.
|
|
79
|
-
*/
|
|
80
|
-
const providerLayer: _$effect_Layer0.Layer<never, never, WorkerEnvironment>;
|
|
81
|
-
/** Alias for `providerLayer` for concise use in worker layers. */
|
|
82
|
-
const layer: _$effect_Layer0.Layer<never, never, WorkerEnvironment>;
|
|
83
|
-
/** Build a `ConfigProvider` layer with a custom `env` conversion function. */
|
|
84
|
-
const layerWith: (makeProvider: (env: WorkerEnv) => ConfigProvider.ConfigProvider) => _$effect_Layer0.Layer<never, never, WorkerEnvironment>;
|
|
85
|
-
}
|
|
86
|
-
declare namespace Binding_d_exports {
|
|
87
|
-
export { BindingNotFoundError, BindingService, BindingValidationError, Service$2 as Service, TypeId$1 as TypeId, layer$6 as layer };
|
|
88
|
-
}
|
|
89
|
-
/** Internal type id marker used by binding helper services. */
|
|
90
|
-
declare const TypeId$1: "effect-cf/Binding";
|
|
91
|
-
declare const BindingNotFoundError_base: new <A extends Record<string, any> = {}>(args: _$effect_Types0.VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => _$effect_Cause0.YieldableError & {
|
|
92
|
-
readonly _tag: "BindingNotFoundError";
|
|
93
|
-
} & Readonly<A>;
|
|
94
|
-
/** Error raised when a configured binding does not exist on `env`. */
|
|
95
|
-
declare class BindingNotFoundError extends BindingNotFoundError_base<{
|
|
96
|
-
readonly binding: string;
|
|
97
|
-
}> {}
|
|
98
|
-
declare const BindingValidationError_base: new <A extends Record<string, any> = {}>(args: _$effect_Types0.VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => _$effect_Cause0.YieldableError & {
|
|
99
|
-
readonly _tag: "BindingValidationError";
|
|
100
|
-
} & Readonly<A>;
|
|
101
|
-
/** Error raised when a binding exists but does not match the expected shape. */
|
|
102
|
-
declare class BindingValidationError extends BindingValidationError_base<{
|
|
103
|
-
readonly binding: string;
|
|
104
|
-
}> {}
|
|
105
|
-
/**
|
|
106
|
-
* Creates a Context tag + layer for reading and validating a Cloudflare binding.
|
|
107
|
-
*/
|
|
108
|
-
interface BindingService<Self, Id extends string, Service> extends Context.ServiceClass<Self, Id, Service> {
|
|
109
|
-
readonly [TypeId$1]: typeof TypeId$1;
|
|
110
|
-
readonly binding: string;
|
|
111
|
-
readonly layer: Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
112
|
-
}
|
|
113
|
-
declare const layer$6: <Self, Resource, Service = Resource>(tag: Context.Service<Self, Service>, binding: string, isResource: (value: unknown) => value is Resource, wrap?: (resource: Resource) => Service) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
114
|
-
declare const Service$2: <Self>() => <Id extends string, Resource, Service = Resource>(id: Id, binding: string, isResource: (value: unknown) => value is Resource, wrap?: (resource: Resource) => Service) => BindingService<Self, Id, Service>;
|
|
15
|
+
//#region src/D1.d.ts
|
|
115
16
|
declare namespace D1_d_exports {
|
|
116
|
-
export { D1Definition,
|
|
17
|
+
export { D1Definition, D1Service, D1SqlLayerOptions, Service$1 as Service, make$10 as make };
|
|
117
18
|
}
|
|
118
|
-
declare const D1OperationError_base: new <A extends Record<string, any> = {}>(args: _$effect_Types0.VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => _$effect_Cause0.YieldableError & {
|
|
119
|
-
readonly _tag: "D1OperationError";
|
|
120
|
-
} & Readonly<A>;
|
|
121
|
-
/** Error raised when a D1 operation fails. */
|
|
122
|
-
declare class D1OperationError extends D1OperationError_base<{
|
|
123
|
-
readonly binding: string;
|
|
124
|
-
readonly operation: string;
|
|
125
|
-
readonly cause: unknown;
|
|
126
|
-
}> {}
|
|
127
19
|
/** Typed D1 binding definition. */
|
|
128
20
|
interface D1Definition {
|
|
129
21
|
/** Binding name as configured in `wrangler.jsonc`. */
|
|
@@ -141,21 +33,16 @@ interface D1Service<Id extends string> {
|
|
|
141
33
|
/**
|
|
142
34
|
* Creates a typed D1 service tag plus Effect helpers.
|
|
143
35
|
*/
|
|
144
|
-
declare const make$
|
|
36
|
+
declare const make$10: <Id extends string>(id: Id, definition: D1Definition) => BindingService<D1Service<Id>, Id, D1Database> & {
|
|
145
37
|
"effect-cf/D1": "effect-cf/D1";
|
|
146
38
|
definition: D1Definition;
|
|
147
39
|
sqlLayer: (options?: D1SqlLayerOptions) => Layer.Layer<D1Client.D1Client | _$effect_unstable_sql_SqlClient0.SqlClient, BindingNotFoundError | BindingValidationError | _$effect_Config0.ConfigError, WorkerEnvironment>;
|
|
148
|
-
prepare: (query: string) => Effect.Effect<D1PreparedStatement, D1OperationError, D1Service<Id>>;
|
|
149
|
-
batch: <T = unknown>(statements: readonly D1PreparedStatement[]) => Effect.Effect<D1Result<T>[], D1OperationError, D1Service<Id>>;
|
|
150
|
-
exec: (query: string) => Effect.Effect<D1ExecResult, D1OperationError, D1Service<Id>>;
|
|
151
|
-
unsafeRaw: () => Effect.Effect<D1Database, never, D1Service<Id>>;
|
|
152
40
|
};
|
|
153
41
|
/**
|
|
154
42
|
* Builds a D1 service around a Cloudflare D1 database binding.
|
|
155
43
|
*
|
|
156
|
-
* The returned service exposes the raw `D1Database` binding
|
|
157
|
-
*
|
|
158
|
-
* `@effect/sql-d1`.
|
|
44
|
+
* The returned service exposes the raw `D1Database` binding and `sqlLayer(...)`
|
|
45
|
+
* for providing `effect/unstable/sql` via `@effect/sql-d1`.
|
|
159
46
|
*
|
|
160
47
|
* @example
|
|
161
48
|
* ```ts
|
|
@@ -170,10 +57,6 @@ declare const Service$1: <Self>() => <Id extends string>(id: Id, definition: D1D
|
|
|
170
57
|
"effect-cf/D1": "effect-cf/D1";
|
|
171
58
|
definition: D1Definition;
|
|
172
59
|
sqlLayer: (options?: D1SqlLayerOptions) => Layer.Layer<D1Client.D1Client | _$effect_unstable_sql_SqlClient0.SqlClient, BindingNotFoundError | BindingValidationError | _$effect_Config0.ConfigError, WorkerEnvironment | Exclude<Exclude<Self, _$effect_Scope0.Scope>, Self>>;
|
|
173
|
-
prepare: (query: string) => Effect.Effect<D1PreparedStatement, D1OperationError, Self>;
|
|
174
|
-
batch: <T = unknown>(statements: readonly D1PreparedStatement[]) => Effect.Effect<D1Result<T>[], D1OperationError, Self>;
|
|
175
|
-
exec: (query: string) => Effect.Effect<D1ExecResult, D1OperationError, Self>;
|
|
176
|
-
unsafeRaw: () => Effect.Effect<D1Database, never, Self>;
|
|
177
60
|
};
|
|
178
61
|
declare namespace Rpc_d_exports {
|
|
179
62
|
export { DisposableValue, MethodArgs, MethodKey, MethodReturn, Provider, Result, RpcStub, RpcTarget, Serializable, Stub, Stubable, Stubify, dispose, isDisposable, resolve, scoped };
|
|
@@ -200,7 +83,7 @@ declare const dispose: (value: unknown) => Effect.Effect<void>;
|
|
|
200
83
|
declare const resolve: <A>(value: A) => Effect.Effect<Awaited<A>, unknown>;
|
|
201
84
|
declare const scoped: <A>(value: A) => Effect.Effect<Awaited<A>, unknown, Scope.Scope>;
|
|
202
85
|
declare namespace RpcDefinition_d_exports {
|
|
203
|
-
export { Definition$9 as Definition, Method$5 as Method, Methods$4 as Methods, NoReservedMethods$4 as NoReservedMethods, ReservedMethodName$6 as ReservedMethodName, ReservedMethodNameError, RpcArgumentCountError, RpcArgumentDecodeError, RpcArgumentEncodeError, RpcReservedMethodNameError, RpcSuccessDecodeError, RpcSuccessEncodeError, ServiceFreeSchema$4 as ServiceFreeSchema, assertNoReservedMethodNames, assertNoReservedMethods, decodeArgs, decodeSuccess, encodeArgs, encodeSuccess, make$
|
|
86
|
+
export { Definition$9 as Definition, Method$5 as Method, Methods$4 as Methods, NoReservedMethods$4 as NoReservedMethods, ReservedMethodName$6 as ReservedMethodName, ReservedMethodNameError, RpcArgumentCountError, RpcArgumentDecodeError, RpcArgumentEncodeError, RpcReservedMethodNameError, RpcSuccessDecodeError, RpcSuccessEncodeError, ServiceFreeSchema$4 as ServiceFreeSchema, assertNoReservedMethodNames, assertNoReservedMethods, decodeArgs, decodeSuccess, encodeArgs, encodeSuccess, make$9 as make, method$4 as method, reservedMethodNames };
|
|
204
87
|
}
|
|
205
88
|
declare const RpcReservedMethodNameError_base: new <A extends Record<string, any> = {}>(args: _$effect_Types0.VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => _$effect_Cause0.YieldableError & {
|
|
206
89
|
readonly _tag: "RpcReservedMethodNameError";
|
|
@@ -299,9 +182,9 @@ declare const decodeArgs: <const Self extends Definition$9.Any, MethodName exten
|
|
|
299
182
|
declare const encodeArgs: <const Self extends Definition$9.Any, MethodName extends Definition$9.MethodNames<Self>>(definition: Self, methodName: MethodName, args: Method$5.Args<Self["methods"][MethodName]>) => Effect.Effect<Method$5.EncodedArgs<Self["methods"][MethodName]>, RpcArgumentCountError | RpcArgumentEncodeError>;
|
|
300
183
|
declare const encodeSuccess: <const Self extends Definition$9.Any, MethodName extends Definition$9.MethodNames<Self>>(definition: Self, methodName: MethodName, value: Method$5.Success<Self["methods"][MethodName]>) => Effect.Effect<Method$5.EncodedSuccess<Self["methods"][MethodName]>, RpcSuccessEncodeError>;
|
|
301
184
|
declare const decodeSuccess: <const Self extends Definition$9.Any, MethodName extends Definition$9.MethodNames<Self>>(definition: Self, methodName: MethodName, value: unknown) => Effect.Effect<Method$5.Success<Self["methods"][MethodName]>, RpcSuccessDecodeError>;
|
|
302
|
-
declare const make$
|
|
185
|
+
declare const make$9: <Id extends string, const MethodsShape extends Methods$4>(id: Id, methods: MethodsShape) => Definition$9<Id, MethodsShape>;
|
|
303
186
|
declare namespace QueueBinding_d_exports {
|
|
304
|
-
export { MessageSendRequest, QueueBindingClient, QueueBindingDefinition, QueueMetrics, QueueOperationError, QueueSendBatchOptions, QueueSendBatchResponse, QueueSendOptions, QueueSendResponse, isQueue, layer$
|
|
187
|
+
export { MessageSendRequest, QueueBindingClient, QueueBindingDefinition, QueueMetrics, QueueOperationError, QueueSendBatchOptions, QueueSendBatchResponse, QueueSendOptions, QueueSendResponse, isQueue, layer$7 as layer, makeClient$6 as makeClient };
|
|
305
188
|
}
|
|
306
189
|
type QueueSendOptions = globalThis.QueueSendOptions;
|
|
307
190
|
type QueueSendResponse = globalThis.QueueSendResponse;
|
|
@@ -330,10 +213,10 @@ declare class QueueOperationError extends QueueOperationError_base<{
|
|
|
330
213
|
readonly cause: unknown;
|
|
331
214
|
}> {}
|
|
332
215
|
declare const isQueue: <Body>(value: unknown) => value is globalThis.Queue<Body>;
|
|
333
|
-
declare const makeClient$
|
|
334
|
-
declare const layer$
|
|
216
|
+
declare const makeClient$6: <Message extends ServiceFreeSchema$4>(definition: QueueBindingDefinition<Message>) => ((queue: globalThis.Queue<Schema.Codec.Encoded<Message>>) => QueueBindingClient<Message>);
|
|
217
|
+
declare const layer$7: <Self, Message extends ServiceFreeSchema$4>(tag: Context.Service<Self, QueueBindingClient<Message>>, definition: QueueBindingDefinition<Message>) => _$effect_Layer0.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
335
218
|
declare namespace QueueDefinition_d_exports {
|
|
336
|
-
export { Definition$8 as Definition, Handler$3 as Handler, LayerOptions$
|
|
219
|
+
export { Definition$8 as Definition, Handler$3 as Handler, LayerOptions$11 as LayerOptions, Options$7 as Options, Queue$1 as Queue, Tag$11 as Tag, TagClass$10 as TagClass, implement$7 as implement, make$8 as make };
|
|
337
220
|
}
|
|
338
221
|
interface Definition$8<Id extends string = string, Message extends ServiceFreeSchema$4 = ServiceFreeSchema$4> {
|
|
339
222
|
readonly id: Id;
|
|
@@ -347,31 +230,31 @@ interface Options$7<ROut, Self extends Definition$8.Any> extends Omit<WorkerOpti
|
|
|
347
230
|
readonly queue: Handler$3<ROut, Self>;
|
|
348
231
|
readonly rpc?: never;
|
|
349
232
|
}
|
|
350
|
-
type LayerOptions$
|
|
233
|
+
type LayerOptions$11 = {
|
|
351
234
|
readonly binding: string;
|
|
352
235
|
};
|
|
353
|
-
interface TagClass$
|
|
236
|
+
interface TagClass$10<Self, Id extends string, Message extends ServiceFreeSchema$4> extends Context.ServiceClass<Self, Id, QueueBindingClient<Message>> {
|
|
354
237
|
readonly id: Id;
|
|
355
238
|
readonly message: Message;
|
|
356
239
|
readonly make: <ROut, LayerError>(layer: Layer.Layer<ROut, LayerError, ExecutionContext | WorkerContext | WorkerEnvironment>, options: Options$7<ROut, Definition$8<Id, Message>>) => WorkerClass<Record<never, never>, ROut>;
|
|
357
|
-
readonly layer: (options: LayerOptions$
|
|
240
|
+
readonly layer: (options: LayerOptions$11) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
358
241
|
readonly send: (message: Schema.Schema.Type<Message>, options?: QueueSendOptions) => Effect.Effect<void, QueueOperationError | Schema.SchemaError, Self>;
|
|
359
242
|
readonly sendBatch: (messages: Iterable<MessageSendRequest<Schema.Schema.Type<Message>>>, options?: QueueSendBatchOptions) => Effect.Effect<void, QueueOperationError | Schema.SchemaError, Self>;
|
|
360
243
|
readonly metrics: () => Effect.Effect<QueueMetrics, QueueOperationError, Self>;
|
|
361
244
|
readonly unsafeRaw: () => Effect.Effect<globalThis.Queue<Schema.Codec.Encoded<Message>>, never, Self>;
|
|
362
245
|
}
|
|
363
|
-
declare const make$
|
|
246
|
+
declare const make$8: <Id extends string, Message extends ServiceFreeSchema$4>(id: Id, definition: {
|
|
364
247
|
readonly message: Message;
|
|
365
|
-
}) => TagClass$
|
|
366
|
-
declare const Tag$
|
|
248
|
+
}) => TagClass$10<Definition$8<Id, Message>, Id, Message>;
|
|
249
|
+
declare const Tag$11: <Self>() => <Id extends string, Message extends ServiceFreeSchema$4>(id: Id, definition: {
|
|
367
250
|
readonly message: Message;
|
|
368
|
-
}) => TagClass$
|
|
251
|
+
}) => TagClass$10<Self, Id, Message>;
|
|
369
252
|
declare const Queue$1: <Self>() => <Id extends string, Message extends ServiceFreeSchema$4>(id: Id, definition: {
|
|
370
253
|
readonly message: Message;
|
|
371
|
-
}) => TagClass$
|
|
254
|
+
}) => TagClass$10<Self, Id, Message>;
|
|
372
255
|
declare const implement$7: <ROut, const Self extends Definition$8.Any>(_definition: Self, handler: Handler$3<ROut, Self>) => Handler$3<ROut, Self>;
|
|
373
256
|
declare namespace Queue_d_exports {
|
|
374
|
-
export { Definition$7 as Definition, Handler$2 as Handler, LayerOptions$
|
|
257
|
+
export { Definition$7 as Definition, Handler$2 as Handler, LayerOptions$10 as LayerOptions, Options$6 as Options, QueueBatch, QueueHandler, QueueMessage, QueueMessageDecodeError, QueueOptions, Tag$10 as Tag, TagClass$9 as TagClass, decodeBatch, fromMessage, fromMessageBatch, implement$6 as implement };
|
|
375
258
|
}
|
|
376
259
|
interface QueueMessage<Body> {
|
|
377
260
|
readonly raw: globalThis.Message<unknown>;
|
|
@@ -420,16 +303,16 @@ type Definition$7<Id extends string = string, Message extends Definition$8.Any["
|
|
|
420
303
|
declare namespace Definition$7 {
|
|
421
304
|
type Any = Definition$8.Any;
|
|
422
305
|
}
|
|
423
|
-
type LayerOptions$
|
|
424
|
-
type TagClass$
|
|
425
|
-
declare const Tag$
|
|
306
|
+
type LayerOptions$10 = LayerOptions$11;
|
|
307
|
+
type TagClass$9<Self, Id extends string, Message extends Definition$8.Any["message"]> = TagClass$10<Self, Id, Message>;
|
|
308
|
+
declare const Tag$10: <Self>() => <Id extends string, Message extends Definition$8.Any["message"]>(id: Id, definition: {
|
|
426
309
|
readonly message: Message;
|
|
427
|
-
}) => TagClass$
|
|
310
|
+
}) => TagClass$9<Self, Id, Message>;
|
|
428
311
|
declare const implement$6: <ROut, const Self extends Definition$8.Any>(_definition: Self, handler: Handler$3<ROut, Self>) => Handler$3<ROut, Self>;
|
|
429
312
|
type Handler$2<ROut, Self extends Definition$8.Any> = Handler$3<ROut, Self>;
|
|
430
313
|
type Options$6<ROut, Self extends Definition$8.Any> = Options$7<ROut, Self>;
|
|
431
314
|
declare namespace WorkerDefinition_d_exports {
|
|
432
|
-
export { Api$3 as Api, Definition$6 as Definition, HandlerEffect$3 as HandlerEffect, Handlers$3 as Handlers, LayerOptions$
|
|
315
|
+
export { Api$3 as Api, Definition$6 as Definition, HandlerEffect$3 as HandlerEffect, Handlers$3 as Handlers, LayerOptions$9 as LayerOptions, Method$4 as Method, Methods$3 as Methods, NoReservedMethods$3 as NoReservedMethods, Options$5 as Options, ReservedMethodName$5 as ReservedMethodName, ServerApi$4 as ServerApi, ServiceFreeSchema$3 as ServiceFreeSchema, Tag$9 as Tag, TagClass$8 as TagClass, Worker, implement$5 as implement, make$7 as make, method$3 as method };
|
|
433
316
|
}
|
|
434
317
|
type ServiceFreeSchema$3 = Schema.Codec<any, any, never, never>;
|
|
435
318
|
interface Method$4<Args extends ReadonlyArray<ServiceFreeSchema$3> = ReadonlyArray<ServiceFreeSchema$3>, Success extends ServiceFreeSchema$3 = ServiceFreeSchema$3> {
|
|
@@ -477,14 +360,14 @@ type Handlers$3<ROut, Self extends Definition$6.Any> = { readonly [Key in keyof
|
|
|
477
360
|
interface Options$5<ROut, Self extends Definition$6.Any> extends Omit<WorkerOptions<ROut, Handlers$3<ROut, Self>>, "rpc"> {
|
|
478
361
|
readonly rpc: Handlers$3<ROut, Self>;
|
|
479
362
|
}
|
|
480
|
-
type LayerOptions$
|
|
363
|
+
type LayerOptions$9 = {
|
|
481
364
|
readonly binding: string;
|
|
482
365
|
};
|
|
483
|
-
type TagClass$
|
|
366
|
+
type TagClass$8<Self, Id extends string, MethodsShape extends Methods$3> = Context.ServiceClass<Self, Id, ServiceBindingEffectClient<Api$3<Definition$6<Id, MethodsShape>>, Definition$6<Id, MethodsShape>>> & ServiceBindingStaticClient<Self, Api$3<Definition$6<Id, MethodsShape>>, Definition$6<Id, MethodsShape>> & {
|
|
484
367
|
readonly id: Id;
|
|
485
368
|
readonly methods: MethodsShape;
|
|
486
369
|
readonly make: <ROut, LayerError>(layer: Layer.Layer<ROut, LayerError, ExecutionContext | WorkerContext | WorkerEnvironment>, options: Options$5<ROut, Definition$6<Id, MethodsShape>>) => WorkerClass<Handlers$3<ROut, Definition$6<Id, MethodsShape>>, ROut>;
|
|
487
|
-
readonly layer: (options: LayerOptions$
|
|
370
|
+
readonly layer: (options: LayerOptions$9) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
488
371
|
};
|
|
489
372
|
/**
|
|
490
373
|
* Defines a single RPC method schema in a worker definition.
|
|
@@ -498,9 +381,9 @@ declare const method$3: {
|
|
|
498
381
|
readonly success: Success;
|
|
499
382
|
}): Method$4<Args, Success>;
|
|
500
383
|
};
|
|
501
|
-
declare const make$
|
|
502
|
-
declare const Tag$
|
|
503
|
-
declare const Worker: <Self>() => <Id extends string, const MethodsShape extends Methods$3>(id: Id, methods: MethodsShape & NoReservedMethods$3<MethodsShape>) => TagClass$
|
|
384
|
+
declare const make$7: <Id extends string, const MethodsShape extends Methods$3>(id: Id, methods: MethodsShape & NoReservedMethods$3<MethodsShape>) => TagClass$8<Definition$6<Id, MethodsShape>, Id, MethodsShape>;
|
|
385
|
+
declare const Tag$9: <Self>() => <Id extends string, const MethodsShape extends Methods$3>(id: Id, methods: MethodsShape & NoReservedMethods$3<MethodsShape>) => TagClass$8<Self, Id, MethodsShape>;
|
|
386
|
+
declare const Worker: <Self>() => <Id extends string, const MethodsShape extends Methods$3>(id: Id, methods: MethodsShape & NoReservedMethods$3<MethodsShape>) => TagClass$8<Self, Id, MethodsShape>;
|
|
504
387
|
/**
|
|
505
388
|
* Helper for implementing handlers with the exact method shape of a definition.
|
|
506
389
|
*/
|
|
@@ -517,9 +400,9 @@ type AsyncMethodArgs<Api, Method extends keyof Api> = Api[Method] extends ((...a
|
|
|
517
400
|
type AsyncMethodSuccess<Api, Method extends keyof Api> = Api[Method] extends ((...args: AnyArgs) => Promise<infer A>) ? A : never;
|
|
518
401
|
type AsyncMethodCloudflareReturn<Api, Method extends keyof Api> = Result<AsyncMethodSuccess<Api, Method>>;
|
|
519
402
|
declare namespace ServiceBinding_d_exports {
|
|
520
|
-
export { Service, ServiceBindingClient, ServiceBindingDefinition, ServiceBindingEffectClient, ServiceBindingFetchError, ServiceBindingRpcError, ServiceBindingStaticClient, ServiceFetcher, isServiceBindingClient, layer$
|
|
403
|
+
export { Service, ServiceBindingClient, ServiceBindingDefinition, ServiceBindingEffectClient, ServiceBindingFetchError, ServiceBindingRpcError, ServiceBindingStaticClient, ServiceFetcher, isServiceBindingClient, layer$6 as layer, makeClient$5 as makeClient, makeDirectMethods$1 as makeDirectMethods };
|
|
521
404
|
}
|
|
522
|
-
declare const TypeId: "effect-cf/ServiceBinding";
|
|
405
|
+
declare const TypeId$1: "effect-cf/ServiceBinding";
|
|
523
406
|
/**
|
|
524
407
|
* Minimum shape for a Cloudflare service binding.
|
|
525
408
|
*/
|
|
@@ -663,8 +546,8 @@ type ServiceBindingStaticClient<R, Api extends object, Definition extends Defini
|
|
|
663
546
|
readonly scopedCall: <Method extends ServiceMethodKey<Api>>(method: Method, ...args: ServiceMethodArgs<Api, Method>) => Effect.Effect<Awaited<ServiceMethodSuccess<Api, Method>>, unknown, Scope.Scope | R>;
|
|
664
547
|
};
|
|
665
548
|
declare const isServiceBindingClient: <Api extends object>(value: unknown) => value is ServiceBindingClient<Api>;
|
|
666
|
-
declare const makeClient$
|
|
667
|
-
declare const layer$
|
|
549
|
+
declare const makeClient$5: <Api extends object, const Definition extends Definition$6.Any | undefined = undefined>(definition: ServiceBindingDefinition<Definition>) => ((service: ServiceBindingClient<Api>) => ServiceBindingEffectClient<Api, Definition>);
|
|
550
|
+
declare const layer$6: <Self, Api extends object, const Definition extends Definition$6.Any | undefined = undefined>(tag: Context.Service<Self, ServiceBindingEffectClient<Api, Definition>>, definition: ServiceBindingDefinition<Definition>) => _$effect_Layer0.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
668
551
|
/**
|
|
669
552
|
* Creates a typed Effect service for a Worker service binding.
|
|
670
553
|
*
|
|
@@ -695,7 +578,7 @@ declare const layer$4: <Self, Api extends object, const Definition extends Defin
|
|
|
695
578
|
* ```
|
|
696
579
|
*/
|
|
697
580
|
declare const Service: <Self, Api extends object = never>() => <Id extends string, const Definition extends Definition$6.Any | undefined = undefined>(id: Id, definition: ServiceBindingDefinition<Definition>) => BindingService<Self, Id, ServiceBindingEffectClient<ApiOrDefinition<Api, Definition>, Definition>> & DirectMethods$1<Self, Definition> & {
|
|
698
|
-
readonly [TypeId]: typeof TypeId;
|
|
581
|
+
readonly [TypeId$1]: typeof TypeId$1;
|
|
699
582
|
readonly definition: ServiceBindingDefinition<Definition>;
|
|
700
583
|
readonly fetch: (input: RequestInfo | URL, init?: RequestInit) => Effect.Effect<Response, ServiceBindingFetchError, Self>;
|
|
701
584
|
readonly rpc: <Method extends ServiceMethodKey<ApiOrDefinition<Api, Definition>>>(method: Method, ...args: ServiceMethodArgs<ApiOrDefinition<Api, Definition>, Method>) => Effect.Effect<Result<AsyncMethodSuccess<ApiOrDefinition<Api, Definition>, Method>>, ServiceBindingRpcError, Self>;
|
|
@@ -704,7 +587,7 @@ declare const Service: <Self, Api extends object = never>() => <Id extends strin
|
|
|
704
587
|
};
|
|
705
588
|
declare const makeDirectMethods$1: <R, Api, Definition extends Definition$6.Any | undefined>(rpcDefinition: Definition | undefined, call: ServiceCall<R, Api>) => DirectMethods$1<R, Definition>;
|
|
706
589
|
declare namespace Worker_d_exports {
|
|
707
|
-
export { Api$2 as Api, Definition$5 as Definition, ExecutionContext, FetchHandler, FetchWorkerOptions, HandlerEffect$2 as HandlerEffect, Handlers$2 as Handlers, LayerOptions$
|
|
590
|
+
export { Api$2 as Api, Definition$5 as Definition, ExecutionContext, FetchHandler, FetchWorkerOptions, HandlerEffect$2 as HandlerEffect, Handlers$2 as Handlers, LayerOptions$8 as LayerOptions, Method$3 as Method, Methods$2 as Methods, NativeRequest, NoReservedMethods$2 as NoReservedMethods, Options$4 as Options, ReservedMethodName$3 as ReservedMethodName, RpcHandlers$1 as RpcHandlers, ServerApi$3 as ServerApi, ServiceFreeSchema$2 as ServiceFreeSchema, Tag$8 as Tag, TagClass$7 as TagClass, TagFactory$1 as TagFactory, WorkerClass, WorkerContext, WorkerContextService, WorkerContextWaitUntilOptions, WorkerFetchSuccess, WorkerHandler, WorkerOptions, WorkerRpc, WorkerRpcHandler, WorkerRpcShape, implement$4 as implement, isWebSocketUpgrade, make$6 as make, makeFetchHandler, method$2 as method, renderHttpResponse };
|
|
708
591
|
}
|
|
709
592
|
declare const ExecutionContext_base: Context.ServiceClass<ExecutionContext, "effect-cf/ExecutionContext", globalThis.ExecutionContext<unknown>>;
|
|
710
593
|
declare class ExecutionContext extends ExecutionContext_base {}
|
|
@@ -749,8 +632,8 @@ interface FetchHandler<Env extends WorkerEnv = WorkerEnv> {
|
|
|
749
632
|
readonly fetch: (request: Request, env: Env, ctx: globalThis.ExecutionContext) => Promise<Response>;
|
|
750
633
|
}
|
|
751
634
|
declare const renderHttpResponse: <A extends HttpServerResponse.HttpServerResponse, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<Response, E, R>;
|
|
752
|
-
declare function make$
|
|
753
|
-
declare function make$
|
|
635
|
+
declare function make$6<ROut, LayerError>(layer: Layer.Layer<ROut, LayerError, ExecutionContext | WorkerContext | WorkerEnvironment>, fetch: WorkerHandler<ROut>): WorkerClass<Record<never, never>, ROut>;
|
|
636
|
+
declare function make$6<ROut, LayerError, const Rpc extends WorkerRpc<ROut> = Record<never, never>>(layer: Layer.Layer<ROut, LayerError, ExecutionContext | WorkerContext | WorkerEnvironment>, options: WorkerOptions<ROut, Rpc>): WorkerClass<Rpc, ROut>;
|
|
754
637
|
declare const makeFetchHandler: <ROut, LayerError, Env extends WorkerEnv = WorkerEnv>(layer: Layer.Layer<ROut, LayerError, ExecutionContext | WorkerContext | WorkerEnvironment>, options: FetchWorkerOptions<ROut>) => FetchHandler<Env>;
|
|
755
638
|
type ServiceFreeSchema$2 = Schema.Codec<any, any, never, never>;
|
|
756
639
|
interface Method$3<Args extends ReadonlyArray<ServiceFreeSchema$2> = ReadonlyArray<ServiceFreeSchema$2>, Success extends ServiceFreeSchema$2 = ServiceFreeSchema$2> {
|
|
@@ -779,15 +662,15 @@ type Handlers$2<ROut, Self extends Definition$5.Any> = { readonly [Key in keyof
|
|
|
779
662
|
interface Options$4<ROut, Self extends Definition$5.Any> extends Omit<WorkerOptions<ROut, Handlers$2<ROut, Self>>, "rpc"> {
|
|
780
663
|
readonly rpc: Handlers$2<ROut, Self>;
|
|
781
664
|
}
|
|
782
|
-
type LayerOptions$
|
|
783
|
-
type TagClass$
|
|
665
|
+
type LayerOptions$8 = LayerOptions$9;
|
|
666
|
+
type TagClass$7<Self, Id extends string, MethodsShape extends Methods$2> = Context.ServiceClass<Self, Id, ServiceBindingEffectClient<Api$2<Definition$5<Id, MethodsShape>>, Definition$5<Id, MethodsShape>>> & ServiceBindingStaticClient<Self, Api$2<Definition$5<Id, MethodsShape>>, Definition$5<Id, MethodsShape>> & {
|
|
784
667
|
readonly id: Id;
|
|
785
668
|
readonly methods: MethodsShape;
|
|
786
669
|
readonly make: <ROut, LayerError>(layer: Layer.Layer<ROut, LayerError, ExecutionContext | WorkerContext | WorkerEnvironment>, options: Options$4<ROut, Definition$5<Id, MethodsShape>>) => WorkerClass<Handlers$2<ROut, Definition$5<Id, MethodsShape>>, ROut>;
|
|
787
|
-
readonly layer: (options: LayerOptions$
|
|
670
|
+
readonly layer: (options: LayerOptions$8) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
788
671
|
};
|
|
789
|
-
type TagFactory$1 = <Self>() => <Id extends string, const MethodsShape extends Methods$2>(id: Id, methods: MethodsShape & NoReservedMethods$2<MethodsShape>) => TagClass$
|
|
790
|
-
declare const Tag$
|
|
672
|
+
type TagFactory$1 = <Self>() => <Id extends string, const MethodsShape extends Methods$2>(id: Id, methods: MethodsShape & NoReservedMethods$2<MethodsShape>) => TagClass$7<Self, Id, MethodsShape>;
|
|
673
|
+
declare const Tag$8: TagFactory$1;
|
|
791
674
|
declare const method$2: {
|
|
792
675
|
<Success extends ServiceFreeSchema$2>(definition: {
|
|
793
676
|
readonly success: Success;
|
|
@@ -1101,7 +984,7 @@ declare class DurableObjectState extends DurableObjectState_base {}
|
|
|
1101
984
|
*/
|
|
1102
985
|
declare const fromDurableObjectState: (state: globalThis.DurableObjectState) => DurableObjectStateService;
|
|
1103
986
|
declare namespace DurableObjectNamespace_d_exports {
|
|
1104
|
-
export { DurableObjectFetchError, DurableObjectNamespaceBindingDefinition, DurableObjectNamespaceClient, DurableObjectNamespaceDefinition, DurableObjectNamespaceEffectClient, DurableObjectNamespaceStaticClient, DurableObjectRpcError, DurableObjectStubClient, isDurableObjectNamespaceClient, layer$
|
|
987
|
+
export { DurableObjectFetchError, DurableObjectNamespaceBindingDefinition, DurableObjectNamespaceClient, DurableObjectNamespaceDefinition, DurableObjectNamespaceEffectClient, DurableObjectNamespaceStaticClient, DurableObjectRpcError, DurableObjectStubClient, isDurableObjectNamespaceClient, layer$5 as layer, makeClient$4 as makeClient, makeDirectMethods };
|
|
1105
988
|
}
|
|
1106
989
|
interface DurableObjectFetcher {
|
|
1107
990
|
fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
|
|
@@ -1299,8 +1182,8 @@ type DurableObjectNamespaceStaticClient<R, Api extends object, Definition extend
|
|
|
1299
1182
|
readonly unsafeRaw: () => Effect.Effect<DurableObjectNamespaceClient<Api>, never, R>;
|
|
1300
1183
|
};
|
|
1301
1184
|
declare const isDurableObjectNamespaceClient: <Api extends object>(value: unknown) => value is DurableObjectNamespaceClient<Api>;
|
|
1302
|
-
declare const makeClient$
|
|
1303
|
-
declare const layer$
|
|
1185
|
+
declare const makeClient$4: <Api extends object, const Definition extends Definition$4.Any | undefined = undefined>(definition: DurableObjectNamespaceBindingDefinition<Definition>) => ((namespace: DurableObjectNamespaceClient<Api>) => DurableObjectNamespaceEffectClient<Api, Definition>);
|
|
1186
|
+
declare const layer$5: <Self, Api extends object, const Definition extends Definition$4.Any | undefined = undefined>(tag: Context.Service<Self, DurableObjectNamespaceEffectClient<Api, Definition>>, definition: DurableObjectNamespaceBindingDefinition<Definition>) => _$effect_Layer0.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
1304
1187
|
declare const makeDirectMethods: <R, Api extends object, Definition extends Definition$4.Any | undefined>(rpcDefinition: Definition | undefined, helpers: {
|
|
1305
1188
|
readonly call: StubCall<R, Api>;
|
|
1306
1189
|
readonly fetch: (stub: DurableObjectStubClient<Api>, input: RequestInfo | URL, init?: RequestInit) => Effect.Effect<globalThis.Response, DurableObjectFetchError, R>;
|
|
@@ -1308,7 +1191,7 @@ declare const makeDirectMethods: <R, Api extends object, Definition extends Defi
|
|
|
1308
1191
|
readonly getByName: (name: string, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions) => Effect.Effect<DurableObjectStubClient<Api>, never, R>;
|
|
1309
1192
|
}) => DirectMethods<R, Api, Definition>;
|
|
1310
1193
|
declare namespace DurableObjectDefinition_d_exports {
|
|
1311
|
-
export { Api$1 as Api, Definition$4 as Definition, DurableObject$1 as DurableObject, HandlerEffect$1 as HandlerEffect, Handlers$1 as Handlers, LayerOptions$
|
|
1194
|
+
export { Api$1 as Api, Definition$4 as Definition, DurableObject$1 as DurableObject, HandlerEffect$1 as HandlerEffect, Handlers$1 as Handlers, LayerOptions$7 as LayerOptions, Method$2 as Method, Methods$1 as Methods, NoReservedMethods$1 as NoReservedMethods, Options$3 as Options, ReservedMethodName$1 as ReservedMethodName, ServerApi$2 as ServerApi, ServiceFreeSchema$1 as ServiceFreeSchema, Tag$7 as Tag, TagClass$6 as TagClass, implement$3 as implement, make$5 as make, method$1 as method };
|
|
1312
1195
|
}
|
|
1313
1196
|
type ServiceFreeSchema$1 = Schema.Codec<any, any, never, never>;
|
|
1314
1197
|
interface Method$2<Args extends ReadonlyArray<ServiceFreeSchema$1> = ReadonlyArray<ServiceFreeSchema$1>, Success extends ServiceFreeSchema$1 = ServiceFreeSchema$1> {
|
|
@@ -1353,14 +1236,14 @@ type Handlers$1<ROut, Self extends Definition$4.Any> = { readonly [Key in keyof
|
|
|
1353
1236
|
interface Options$3<ROut, Self extends Definition$4.Any> extends Omit<DurableObjectOptions<ROut, Handlers$1<ROut, Self>>, "rpc"> {
|
|
1354
1237
|
readonly rpc: Handlers$1<ROut, Self>;
|
|
1355
1238
|
}
|
|
1356
|
-
type LayerOptions$
|
|
1239
|
+
type LayerOptions$7 = {
|
|
1357
1240
|
readonly binding: string;
|
|
1358
1241
|
};
|
|
1359
|
-
type TagClass$
|
|
1242
|
+
type TagClass$6<Self, Id extends string, MethodsShape extends Methods$1> = Context.ServiceClass<Self, Id, DurableObjectNamespaceEffectClient<Api$1<Definition$4<Id, MethodsShape>>, Definition$4<Id, MethodsShape>>> & DurableObjectNamespaceStaticClient<Self, Api$1<Definition$4<Id, MethodsShape>>, Definition$4<Id, MethodsShape>> & {
|
|
1360
1243
|
readonly id: Id;
|
|
1361
1244
|
readonly methods: MethodsShape;
|
|
1362
1245
|
readonly make: <ROut, LayerError>(layer: Layer.Layer<ROut, LayerError, DurableObjectState | WorkerEnvironment>, options: Options$3<ROut, Definition$4<Id, MethodsShape>>) => DurableObjectClass<Handlers$1<ROut, Definition$4<Id, MethodsShape>>, ROut>;
|
|
1363
|
-
readonly layer: (options: LayerOptions$
|
|
1246
|
+
readonly layer: (options: LayerOptions$7) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
1364
1247
|
};
|
|
1365
1248
|
/**
|
|
1366
1249
|
* Defines a single RPC method schema in a Durable Object definition.
|
|
@@ -1374,9 +1257,9 @@ declare const method$1: {
|
|
|
1374
1257
|
readonly success: Success;
|
|
1375
1258
|
}): Method$2<Args, Success>;
|
|
1376
1259
|
};
|
|
1377
|
-
declare const make$
|
|
1378
|
-
declare const Tag$
|
|
1379
|
-
declare const DurableObject$1: <Self>() => <Id extends string, const MethodsShape extends Methods$1>(id: Id, methods: MethodsShape & NoReservedMethods$1<MethodsShape>) => TagClass$
|
|
1260
|
+
declare const make$5: <Id extends string, const MethodsShape extends Methods$1>(id: Id, methods: MethodsShape & NoReservedMethods$1<MethodsShape>) => TagClass$6<Definition$4<Id, MethodsShape>, Id, MethodsShape>;
|
|
1261
|
+
declare const Tag$7: <Self>() => <Id extends string, const MethodsShape extends Methods$1>(id: Id, methods: MethodsShape & NoReservedMethods$1<MethodsShape>) => TagClass$6<Self, Id, MethodsShape>;
|
|
1262
|
+
declare const DurableObject$1: <Self>() => <Id extends string, const MethodsShape extends Methods$1>(id: Id, methods: MethodsShape & NoReservedMethods$1<MethodsShape>) => TagClass$6<Self, Id, MethodsShape>;
|
|
1380
1263
|
/**
|
|
1381
1264
|
* Helper for implementing handlers with the exact method shape of a definition.
|
|
1382
1265
|
*/
|
|
@@ -1386,7 +1269,7 @@ declare const implement$3: <ROut, const Self extends Definition$4.Any>(_definiti
|
|
|
1386
1269
|
*/
|
|
1387
1270
|
type HandlerEffect$1<ROut, Self extends Definition$4.Any, Key extends keyof Self["methods"]> = DurableObjectHandler<ROut, Method$2.Success<Self["methods"][Key]>>;
|
|
1388
1271
|
declare namespace DurableObject_d_exports {
|
|
1389
|
-
export { Api, Definition$3 as Definition, DurableObjectClass, DurableObjectHandler, DurableObjectOptions, DurableObjectRpc, DurableObjectRpcShape, HandlerEffect, Handlers, LayerOptions$
|
|
1272
|
+
export { Api, Definition$3 as Definition, DurableObjectClass, DurableObjectHandler, DurableObjectOptions, DurableObjectRpc, DurableObjectRpcShape, HandlerEffect, Handlers, LayerOptions$6 as LayerOptions, Method$1 as Method, Methods, NoReservedMethods, Options$2 as Options, ReservedMethodName, RpcHandlers, ServerApi$1 as ServerApi, ServiceFreeSchema, Tag$6 as Tag, TagClass$5 as TagClass, TagFactory, implement$2 as implement, make$4 as make, method };
|
|
1390
1273
|
}
|
|
1391
1274
|
type RuntimeContext$1<ROut> = DurableObjectState | WorkerEnvironment | ROut;
|
|
1392
1275
|
type HandlerContext<ROut> = RuntimeContext$1<ROut> | Scope.Scope;
|
|
@@ -1429,7 +1312,7 @@ type DurableObjectClass<Rpc extends DurableObjectRpc<ROut>, ROut> = new (state:
|
|
|
1429
1312
|
/**
|
|
1430
1313
|
* Creates a Durable Object class backed by a single managed Effect runtime.
|
|
1431
1314
|
*/
|
|
1432
|
-
declare const make$
|
|
1315
|
+
declare const make$4: <ROut, LayerError, const Rpc extends DurableObjectRpc<ROut> = Record<never, never>>(layer: Layer.Layer<ROut, LayerError, DurableObjectState | WorkerEnvironment>, options?: DurableObjectOptions<ROut, Rpc>) => DurableObjectClass<Rpc, ROut>;
|
|
1433
1316
|
type ServiceFreeSchema = Schema.Codec<any, any, never, never>;
|
|
1434
1317
|
interface Method$1<Args extends ReadonlyArray<ServiceFreeSchema> = ReadonlyArray<ServiceFreeSchema>, Success extends ServiceFreeSchema = ServiceFreeSchema> {
|
|
1435
1318
|
readonly args: Args;
|
|
@@ -1452,21 +1335,21 @@ interface Definition$3<Id extends string = string, MethodsShape extends Methods
|
|
|
1452
1335
|
declare namespace Definition$3 {
|
|
1453
1336
|
type Any = Definition$3<string, Methods>;
|
|
1454
1337
|
}
|
|
1455
|
-
type LayerOptions$
|
|
1338
|
+
type LayerOptions$6 = LayerOptions$7;
|
|
1456
1339
|
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]>> };
|
|
1457
1340
|
type Api<Self extends Definition$3.Any> = Provider<ServerApi$1<Self>, ReservedMethodName>;
|
|
1458
1341
|
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]>> };
|
|
1459
1342
|
interface Options$2<ROut, Self extends Definition$3.Any> extends Omit<DurableObjectOptions<ROut, Handlers<ROut, Self>>, "rpc"> {
|
|
1460
1343
|
readonly rpc: Handlers<ROut, Self>;
|
|
1461
1344
|
}
|
|
1462
|
-
type TagClass$
|
|
1345
|
+
type TagClass$5<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>> & {
|
|
1463
1346
|
readonly id: Id;
|
|
1464
1347
|
readonly methods: MethodsShape;
|
|
1465
1348
|
readonly make: <ROut, LayerError>(layer: Layer.Layer<ROut, LayerError, DurableObjectState | WorkerEnvironment>, options: Options$2<ROut, Definition$3<Id, MethodsShape>>) => DurableObjectClass<Handlers<ROut, Definition$3<Id, MethodsShape>>, ROut>;
|
|
1466
|
-
readonly layer: (options: LayerOptions$
|
|
1349
|
+
readonly layer: (options: LayerOptions$6) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
1467
1350
|
};
|
|
1468
|
-
type TagFactory = <Self>() => <Id extends string, const MethodsShape extends Methods>(id: Id, methods: MethodsShape & NoReservedMethods<MethodsShape>) => TagClass$
|
|
1469
|
-
declare const Tag$
|
|
1351
|
+
type TagFactory = <Self>() => <Id extends string, const MethodsShape extends Methods>(id: Id, methods: MethodsShape & NoReservedMethods<MethodsShape>) => TagClass$5<Self, Id, MethodsShape>;
|
|
1352
|
+
declare const Tag$6: TagFactory;
|
|
1470
1353
|
declare const method: {
|
|
1471
1354
|
<Success extends ServiceFreeSchema>(definition: {
|
|
1472
1355
|
readonly success: Success;
|
|
@@ -1803,12 +1686,12 @@ declare class DurableObjectAlarm extends DurableObjectAlarm_base {
|
|
|
1803
1686
|
static readonly layer: Layer.Layer<DurableObjectAlarm, never, DurableObjectState>;
|
|
1804
1687
|
}
|
|
1805
1688
|
declare namespace DurableObjectRpcWebSocket_d_exports {
|
|
1806
|
-
export { DurableObjectRpcWebSocket, DurableObjectRpcWebSocketService, LayerOptions$
|
|
1689
|
+
export { DurableObjectRpcWebSocket, DurableObjectRpcWebSocketService, LayerOptions$5 as LayerOptions, NativeWebSocketMessage, layer$4 as layer };
|
|
1807
1690
|
}
|
|
1808
1691
|
/**
|
|
1809
1692
|
* Configuration for {@link layer}.
|
|
1810
1693
|
*/
|
|
1811
|
-
interface LayerOptions$
|
|
1694
|
+
interface LayerOptions$5 {
|
|
1812
1695
|
/** Tag used to select hibernated sockets. */
|
|
1813
1696
|
readonly tag?: string | undefined;
|
|
1814
1697
|
/** Socket attachment key used to persist client ids across hibernation. */
|
|
@@ -1833,9 +1716,117 @@ declare class DurableObjectRpcWebSocket extends DurableObjectRpcWebSocket_base {
|
|
|
1833
1716
|
/**
|
|
1834
1717
|
* Builds a layer that bridges Durable Object websocket events to `RpcServer.Protocol`.
|
|
1835
1718
|
*/
|
|
1836
|
-
declare const layer$
|
|
1719
|
+
declare const layer$4: (options?: LayerOptions$5) => Layer.Layer<DurableObjectRpcWebSocket | RpcServer.Protocol, never, DurableObjectState | RpcSerialization.RpcSerialization>;
|
|
1720
|
+
declare namespace Images_d_exports {
|
|
1721
|
+
export { DrawStepOptions, HostedImagesClient, ImageDrawOptions, ImageHandleClient, ImageInfoResponse, ImageInputOptions, ImageInputValue, ImageList, ImageListOptions, ImageMetadata, ImageOutputOptions, ImageTransform, ImageTransformationOutputOptions, ImageTransformationResult, ImageUpdateOptions, ImageUploadOptions, ImageUploadValue, ImagesClient, ImagesDefinition, ImagesOperationError, ImagesRuntimeBinding, ImagesService, ImagesTransformationResultClient, LayerOptions$4 as LayerOptions, ProcessOptions, Step, Steps, Tag$5 as Tag, TagClass$4 as TagClass, draw, empty, isImagesBinding, layer$3 as layer, make$3 as make, makeClient$3 as makeClient, transform };
|
|
1722
|
+
}
|
|
1723
|
+
declare const TypeId: "effect-cf/Images/Steps";
|
|
1724
|
+
declare const ImagesOperationError_base: new <A extends Record<string, any> = {}>(args: _$effect_Types0.VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => _$effect_Cause0.YieldableError & {
|
|
1725
|
+
readonly _tag: "ImagesOperationError";
|
|
1726
|
+
} & Readonly<A>;
|
|
1727
|
+
/** Error raised when a Cloudflare Images operation fails. */
|
|
1728
|
+
declare class ImagesOperationError extends ImagesOperationError_base<{
|
|
1729
|
+
readonly binding: string;
|
|
1730
|
+
readonly operation: string;
|
|
1731
|
+
readonly cause: unknown;
|
|
1732
|
+
}> {}
|
|
1733
|
+
/** Typed Cloudflare Images binding definition. */
|
|
1734
|
+
interface ImagesDefinition {
|
|
1735
|
+
/** Binding name as configured in `wrangler.jsonc`. */
|
|
1736
|
+
readonly binding: string;
|
|
1737
|
+
}
|
|
1738
|
+
type ImageInfoResponse = globalThis.ImageInfoResponse;
|
|
1739
|
+
type ImageTransform = globalThis.ImageTransform;
|
|
1740
|
+
type ImageDrawOptions = globalThis.ImageDrawOptions;
|
|
1741
|
+
type ImageInputOptions = globalThis.ImageInputOptions;
|
|
1742
|
+
type ImageOutputOptions = globalThis.ImageOutputOptions;
|
|
1743
|
+
type ImageTransformationOutputOptions = globalThis.ImageTransformationOutputOptions;
|
|
1744
|
+
type ImageTransformationResult = globalThis.ImageTransformationResult;
|
|
1745
|
+
type ImageUploadOptions = globalThis.ImageUploadOptions;
|
|
1746
|
+
type ImageUpdateOptions = globalThis.ImageUpdateOptions;
|
|
1747
|
+
type ImageListOptions = globalThis.ImageListOptions;
|
|
1748
|
+
type ImageList = globalThis.ImageList;
|
|
1749
|
+
type ImageMetadata = globalThis.ImageMetadata;
|
|
1750
|
+
type ImageInputValue = ReadableStream<Uint8Array> | ArrayBuffer;
|
|
1751
|
+
type ImageUploadValue = ReadableStream<Uint8Array> | ArrayBuffer;
|
|
1752
|
+
interface DrawStepOptions {
|
|
1753
|
+
readonly image: ReadableStream<Uint8Array> | globalThis.ImageTransformer;
|
|
1754
|
+
readonly options?: ImageDrawOptions;
|
|
1755
|
+
}
|
|
1756
|
+
type Step = Data.TaggedEnum<{
|
|
1757
|
+
readonly Transform: {
|
|
1758
|
+
readonly transform: ImageTransform;
|
|
1759
|
+
};
|
|
1760
|
+
readonly Draw: DrawStepOptions;
|
|
1761
|
+
}>;
|
|
1762
|
+
interface Steps {
|
|
1763
|
+
readonly [TypeId]: typeof TypeId;
|
|
1764
|
+
readonly steps: ReadonlyArray<Step>;
|
|
1765
|
+
}
|
|
1766
|
+
interface ProcessOptions {
|
|
1767
|
+
readonly stream: ImageInputValue;
|
|
1768
|
+
readonly inputOptions?: ImageInputOptions;
|
|
1769
|
+
readonly outputOptions: ImageOutputOptions;
|
|
1770
|
+
}
|
|
1771
|
+
interface ImagesTransformationResultClient {
|
|
1772
|
+
readonly raw: globalThis.ImageTransformationResult;
|
|
1773
|
+
readonly response: Effect.Effect<globalThis.Response, ImagesOperationError>;
|
|
1774
|
+
readonly contentType: Effect.Effect<string, ImagesOperationError>;
|
|
1775
|
+
readonly image: (options?: ImageTransformationOutputOptions) => Effect.Effect<ReadableStream<Uint8Array>, ImagesOperationError>;
|
|
1776
|
+
}
|
|
1777
|
+
interface ImageHandleClient {
|
|
1778
|
+
readonly raw: globalThis.ImageHandle;
|
|
1779
|
+
readonly details: Effect.Effect<Option.Option<ImageMetadata>, ImagesOperationError>;
|
|
1780
|
+
readonly bytes: Effect.Effect<Option.Option<ReadableStream<Uint8Array>>, ImagesOperationError>;
|
|
1781
|
+
readonly update: (options: ImageUpdateOptions) => Effect.Effect<ImageMetadata, ImagesOperationError>;
|
|
1782
|
+
readonly delete: Effect.Effect<boolean, ImagesOperationError>;
|
|
1783
|
+
}
|
|
1784
|
+
interface HostedImagesClient {
|
|
1785
|
+
readonly image: (imageId: string) => ImageHandleClient;
|
|
1786
|
+
readonly upload: (image: ImageUploadValue, options?: ImageUploadOptions) => Effect.Effect<ImageMetadata, ImagesOperationError>;
|
|
1787
|
+
readonly list: (options?: ImageListOptions) => Effect.Effect<ImageList, ImagesOperationError>;
|
|
1788
|
+
readonly unsafeRaw: Effect.Effect<globalThis.HostedImagesBinding>;
|
|
1789
|
+
}
|
|
1790
|
+
interface ImagesRuntimeBinding {
|
|
1791
|
+
readonly info: (image: ImageInputValue, options?: ImageInputOptions) => Promise<ImageInfoResponse>;
|
|
1792
|
+
readonly input: (image: ImageInputValue, options?: ImageInputOptions) => globalThis.ImageTransformer;
|
|
1793
|
+
readonly hosted?: globalThis.HostedImagesBinding;
|
|
1794
|
+
}
|
|
1795
|
+
interface ImagesClient {
|
|
1796
|
+
readonly info: (image: ImageInputValue, options?: ImageInputOptions) => Effect.Effect<ImageInfoResponse, ImagesOperationError>;
|
|
1797
|
+
readonly input: (image: ImageInputValue, options?: ImageInputOptions) => Effect.Effect<globalThis.ImageTransformer, ImagesOperationError>;
|
|
1798
|
+
readonly process: (steps: Steps, options: ProcessOptions) => Effect.Effect<ImagesTransformationResultClient, ImagesOperationError>;
|
|
1799
|
+
readonly hosted: Option.Option<HostedImagesClient>;
|
|
1800
|
+
readonly unsafeRaw: Effect.Effect<ImagesRuntimeBinding>;
|
|
1801
|
+
readonly definition: ImagesDefinition;
|
|
1802
|
+
}
|
|
1803
|
+
declare const ImagesServiceTypeId: unique symbol;
|
|
1804
|
+
/** Nominal service marker for Images services created with {@link make}. */
|
|
1805
|
+
interface ImagesService<Id extends string> {
|
|
1806
|
+
readonly [ImagesServiceTypeId]: {
|
|
1807
|
+
readonly id: Id;
|
|
1808
|
+
};
|
|
1809
|
+
}
|
|
1810
|
+
type LayerOptions$4 = {
|
|
1811
|
+
readonly binding: string;
|
|
1812
|
+
};
|
|
1813
|
+
interface TagClass$4<Self, Id extends string> extends Context.ServiceClass<Self, Id, ImagesClient> {
|
|
1814
|
+
readonly id: Id;
|
|
1815
|
+
readonly layer: (options: LayerOptions$4) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
1816
|
+
}
|
|
1817
|
+
/** Empty Images transformation pipeline. */
|
|
1818
|
+
declare const empty: Steps;
|
|
1819
|
+
declare function transform(transform: ImageTransform): (steps: Steps) => Steps;
|
|
1820
|
+
declare function transform(steps: Steps, transform: ImageTransform): Steps;
|
|
1821
|
+
declare function draw(draw: DrawStepOptions): (steps: Steps) => Steps;
|
|
1822
|
+
declare function draw(steps: Steps, draw: DrawStepOptions): Steps;
|
|
1823
|
+
declare const isImagesBinding: (value: unknown) => value is ImagesRuntimeBinding;
|
|
1824
|
+
declare const makeClient$3: (definition: ImagesDefinition) => (images: ImagesRuntimeBinding) => ImagesClient;
|
|
1825
|
+
declare const layer$3: <Self>(tag: Context.Service<Self, ImagesClient>, definition: ImagesDefinition) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
1826
|
+
declare const make$3: <Id extends string>(id: Id) => TagClass$4<ImagesService<Id>, Id>;
|
|
1827
|
+
declare const Tag$5: <Self>() => <Id extends string>(id: Id) => TagClass$4<Self, Id>;
|
|
1837
1828
|
declare namespace Kv_d_exports {
|
|
1838
|
-
export { Definition$2 as Definition, KvClient, KvDefinition, KvListKey, KvListOptions, KvListResult, KvOperationError, KvPutOptions, KvWithMetadata, LayerOptions$
|
|
1829
|
+
export { Definition$2 as Definition, KvClient, KvDefinition, KvListKey, KvListOptions, KvListResult, KvOperationError, KvPutOptions, KvWithMetadata, LayerOptions$3 as LayerOptions, Tag$4 as Tag, TagClass$3 as TagClass, isKvNamespace, layer$2 as layer, makeClient$2 as makeClient };
|
|
1839
1830
|
}
|
|
1840
1831
|
declare const KvOperationError_base: new <A extends Record<string, any> = {}>(args: _$effect_Types0.VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => _$effect_Cause0.YieldableError & {
|
|
1841
1832
|
readonly _tag: "KvOperationError";
|
|
@@ -1904,28 +1895,94 @@ interface KvClient<Key, Value, EncodedValue> {
|
|
|
1904
1895
|
readonly unsafeRaw: Effect.Effect<KVNamespace>;
|
|
1905
1896
|
readonly definition: KvDefinition<Key, Value, EncodedValue>;
|
|
1906
1897
|
}
|
|
1907
|
-
type LayerOptions$
|
|
1898
|
+
type LayerOptions$3 = {
|
|
1908
1899
|
readonly binding: string;
|
|
1909
1900
|
};
|
|
1910
|
-
interface TagClass$
|
|
1901
|
+
interface TagClass$3<Self, Id extends string, Key, Value, EncodedValue> extends Context.ServiceClass<Self, Id, KvClient<Key, Value, EncodedValue>> {
|
|
1911
1902
|
readonly id: Id;
|
|
1912
1903
|
readonly keySchema: Schema.Codec<Key, string>;
|
|
1913
1904
|
readonly valueSchema: Schema.Codec<Value, EncodedValue>;
|
|
1914
|
-
readonly layer: (options: LayerOptions$
|
|
1915
|
-
readonly put: (key: Key, value: Value, options?: KvPutOptions) => Effect.Effect<void, KvOperationError | Schema.SchemaError, Self>;
|
|
1916
|
-
readonly get: (key: Key) => Effect.Effect<Option.Option<Value>, KvOperationError | Schema.SchemaError, Self>;
|
|
1917
|
-
readonly getWithMetadata: <Metadata>(key: Key, metadataSchema: Schema.Codec<Metadata, unknown>) => Effect.Effect<Option.Option<KvWithMetadata<Value, Metadata>>, KvOperationError | Schema.SchemaError, Self>;
|
|
1918
|
-
readonly list: <Metadata = unknown>(options?: KvListOptions<Metadata>) => Effect.Effect<KvListResult<Key, Metadata>, KvOperationError | Schema.SchemaError, Self>;
|
|
1919
|
-
readonly remove: (key: Key) => Effect.Effect<void, KvOperationError | Schema.SchemaError, Self>;
|
|
1920
|
-
readonly unsafeRaw: () => Effect.Effect<KVNamespace, never, Self>;
|
|
1905
|
+
readonly layer: (options: LayerOptions$3) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
1921
1906
|
}
|
|
1922
1907
|
declare const isKvNamespace: (value: unknown) => value is KVNamespace;
|
|
1923
|
-
declare const makeClient$
|
|
1924
|
-
declare const layer$
|
|
1925
|
-
declare const Tag$
|
|
1908
|
+
declare const makeClient$2: <Key, Value, EncodedValue>(definition: KvDefinition<Key, Value, EncodedValue>) => ((kv: KVNamespace) => KvClient<Key, Value, EncodedValue>);
|
|
1909
|
+
declare const layer$2: <Self, Key, Value, EncodedValue>(tag: Context.Service<Self, KvClient<Key, Value, EncodedValue>>, definition: KvDefinition<Key, Value, EncodedValue>) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
1910
|
+
declare const Tag$4: <Self>() => <Id extends string, Key, Value, EncodedValue>(id: Id, definition: {
|
|
1926
1911
|
readonly key: Schema.Codec<Key, string>;
|
|
1927
1912
|
readonly value: Schema.Codec<Value, EncodedValue>;
|
|
1928
|
-
}) => TagClass$
|
|
1913
|
+
}) => TagClass$3<Self, Id, Key, Value, EncodedValue>;
|
|
1914
|
+
declare namespace R2_d_exports {
|
|
1915
|
+
export { LayerOptions$2 as LayerOptions, R2Client, R2Definition, R2GetOptions, R2ListOptions, R2MultipartOptions, R2MultipartUploadClient, R2OperationError, R2PutOptions, R2PutValue, R2Service, R2UploadPartOptions, R2UploadPartValue, Tag$3 as Tag, TagClass$2 as TagClass, isR2Bucket, layer$1 as layer, make$2 as make, makeClient$1 as makeClient };
|
|
1916
|
+
}
|
|
1917
|
+
declare const R2OperationError_base: new <A extends Record<string, any> = {}>(args: _$effect_Types0.VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => _$effect_Cause0.YieldableError & {
|
|
1918
|
+
readonly _tag: "R2OperationError";
|
|
1919
|
+
} & Readonly<A>;
|
|
1920
|
+
/** Error raised when an R2 operation fails. */
|
|
1921
|
+
declare class R2OperationError extends R2OperationError_base<{
|
|
1922
|
+
readonly binding: string;
|
|
1923
|
+
readonly operation: string;
|
|
1924
|
+
readonly cause: unknown;
|
|
1925
|
+
}> {}
|
|
1926
|
+
/** Typed R2 bucket binding definition. */
|
|
1927
|
+
interface R2Definition {
|
|
1928
|
+
/** Binding name as configured in `wrangler.jsonc`. */
|
|
1929
|
+
readonly binding: string;
|
|
1930
|
+
}
|
|
1931
|
+
type R2GetOptions = globalThis.R2GetOptions;
|
|
1932
|
+
type R2PutOptions = globalThis.R2PutOptions;
|
|
1933
|
+
type R2ListOptions = globalThis.R2ListOptions;
|
|
1934
|
+
type R2MultipartOptions = globalThis.R2MultipartOptions;
|
|
1935
|
+
type R2UploadPartOptions = globalThis.R2UploadPartOptions;
|
|
1936
|
+
type R2PutValue = ReadableStream | ArrayBuffer | ArrayBufferView | string | null | Blob;
|
|
1937
|
+
type R2UploadPartValue = ReadableStream | ArrayBuffer | ArrayBufferView | string | Blob;
|
|
1938
|
+
interface R2MultipartUploadClient {
|
|
1939
|
+
readonly raw: globalThis.R2MultipartUpload;
|
|
1940
|
+
readonly key: string;
|
|
1941
|
+
readonly uploadId: string;
|
|
1942
|
+
readonly uploadPart: (partNumber: number, value: R2UploadPartValue, options?: R2UploadPartOptions) => Effect.Effect<globalThis.R2UploadedPart, R2OperationError>;
|
|
1943
|
+
readonly abort: Effect.Effect<void, R2OperationError>;
|
|
1944
|
+
readonly complete: (uploadedParts: ReadonlyArray<globalThis.R2UploadedPart>) => Effect.Effect<globalThis.R2Object, R2OperationError>;
|
|
1945
|
+
}
|
|
1946
|
+
interface R2Client {
|
|
1947
|
+
readonly head: (key: string) => Effect.Effect<Option.Option<globalThis.R2Object>, R2OperationError>;
|
|
1948
|
+
readonly get: {
|
|
1949
|
+
(key: string, options: R2GetOptions & {
|
|
1950
|
+
readonly onlyIf: globalThis.R2Conditional | Headers;
|
|
1951
|
+
}): Effect.Effect<Option.Option<globalThis.R2ObjectBody | globalThis.R2Object>, R2OperationError>;
|
|
1952
|
+
(key: string, options?: R2GetOptions): Effect.Effect<Option.Option<globalThis.R2ObjectBody>, R2OperationError>;
|
|
1953
|
+
};
|
|
1954
|
+
readonly put: {
|
|
1955
|
+
(key: string, value: R2PutValue, options: R2PutOptions & {
|
|
1956
|
+
readonly onlyIf: globalThis.R2Conditional | Headers;
|
|
1957
|
+
}): Effect.Effect<Option.Option<globalThis.R2Object>, R2OperationError>;
|
|
1958
|
+
(key: string, value: R2PutValue, options?: R2PutOptions): Effect.Effect<globalThis.R2Object, R2OperationError>;
|
|
1959
|
+
};
|
|
1960
|
+
readonly createMultipartUpload: (key: string, options?: R2MultipartOptions) => Effect.Effect<R2MultipartUploadClient, R2OperationError>;
|
|
1961
|
+
readonly resumeMultipartUpload: (key: string, uploadId: string) => Effect.Effect<R2MultipartUploadClient, R2OperationError>;
|
|
1962
|
+
readonly delete: (keys: string | ReadonlyArray<string>) => Effect.Effect<void, R2OperationError>;
|
|
1963
|
+
readonly list: (options?: R2ListOptions) => Effect.Effect<globalThis.R2Objects, R2OperationError>;
|
|
1964
|
+
readonly unsafeRaw: Effect.Effect<globalThis.R2Bucket>;
|
|
1965
|
+
readonly definition: R2Definition;
|
|
1966
|
+
}
|
|
1967
|
+
declare const R2ServiceTypeId: unique symbol;
|
|
1968
|
+
/** Nominal service marker for R2 services created with {@link make}. */
|
|
1969
|
+
interface R2Service<Id extends string> {
|
|
1970
|
+
readonly [R2ServiceTypeId]: {
|
|
1971
|
+
readonly id: Id;
|
|
1972
|
+
};
|
|
1973
|
+
}
|
|
1974
|
+
type LayerOptions$2 = {
|
|
1975
|
+
readonly binding: string;
|
|
1976
|
+
};
|
|
1977
|
+
interface TagClass$2<Self, Id extends string> extends Context.ServiceClass<Self, Id, R2Client> {
|
|
1978
|
+
readonly id: Id;
|
|
1979
|
+
readonly layer: (options: LayerOptions$2) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
1980
|
+
}
|
|
1981
|
+
declare const isR2Bucket: (value: unknown) => value is globalThis.R2Bucket;
|
|
1982
|
+
declare const makeClient$1: (definition: R2Definition) => ((bucket: globalThis.R2Bucket) => R2Client);
|
|
1983
|
+
declare const layer$1: <Self>(tag: Context.Service<Self, R2Client>, definition: R2Definition) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
1984
|
+
declare const make$2: <Id extends string>(id: Id) => TagClass$2<R2Service<Id>, Id>;
|
|
1985
|
+
declare const Tag$3: <Self>() => <Id extends string>(id: Id) => TagClass$2<Self, Id>;
|
|
1929
1986
|
declare namespace WorkflowBinding_d_exports {
|
|
1930
1987
|
export { WorkflowBindingClient, WorkflowBindingDefinition, WorkflowInstance, WorkflowInstanceCreateBatchOptions, WorkflowInstanceCreateOptions, WorkflowInstanceEvent, WorkflowInstanceRestartOptions, WorkflowInstanceStatus, WorkflowInstanceStatusName, WorkflowOperationError, WorkflowResultDecodeError, isWorkflow, layer, makeClient };
|
|
1931
1988
|
}
|
|
@@ -2094,4 +2151,4 @@ declare const implement: <ROut, const Self extends Definition$1.Any>(_definition
|
|
|
2094
2151
|
type Handler<ROut, Self extends Definition$1.Any> = Handler$1<ROut, Self>;
|
|
2095
2152
|
type Options<ROut, Self extends Definition$1.Any> = Options$1<ROut, Self>;
|
|
2096
2153
|
//#endregion
|
|
2097
|
-
export { Binding_d_exports as Binding, D1_d_exports as D1, DurableObject_d_exports as DurableObject, DurableObjectAlarm_d_exports as DurableObjectAlarm, DurableObjectDefinition_d_exports as DurableObjectDefinition, DurableObjectNamespace_d_exports as DurableObjectNamespace, DurableObjectRpcWebSocket_d_exports as DurableObjectRpcWebSocket, DurableObjectState_d_exports as DurableObjectState, DurableObjectStorage_d_exports as DurableObjectStorage, DurableObjectWebSocket_d_exports as DurableObjectWebSocket, Kv_d_exports as Kv, Queue_d_exports as Queue, QueueBinding_d_exports as QueueBinding, QueueDefinition_d_exports as QueueDefinition, Rpc_d_exports as Rpc, RpcDefinition_d_exports as RpcDefinition, ServiceBinding_d_exports as ServiceBinding, Worker_d_exports as Worker, WorkerConfig, WorkerDefinition_d_exports as WorkerDefinition, type WorkerEnv, WorkerEnvironment, Workflow_d_exports as Workflow, WorkflowBinding_d_exports as WorkflowBinding, WorkflowDefinition_d_exports as WorkflowDefinition };
|
|
2154
|
+
export { Binding_d_exports as Binding, D1_d_exports as D1, DurableObject_d_exports as DurableObject, DurableObjectAlarm_d_exports as DurableObjectAlarm, DurableObjectDefinition_d_exports as DurableObjectDefinition, DurableObjectNamespace_d_exports as DurableObjectNamespace, DurableObjectRpcWebSocket_d_exports as DurableObjectRpcWebSocket, DurableObjectState_d_exports as DurableObjectState, DurableObjectStorage_d_exports as DurableObjectStorage, DurableObjectWebSocket_d_exports as DurableObjectWebSocket, Hyperdrive_d_exports as Hyperdrive, Images_d_exports as Images, Kv_d_exports as Kv, Queue_d_exports as Queue, QueueBinding_d_exports as QueueBinding, QueueDefinition_d_exports as QueueDefinition, R2_d_exports as R2, Rpc_d_exports as Rpc, RpcDefinition_d_exports as RpcDefinition, ServiceBinding_d_exports as ServiceBinding, Worker_d_exports as Worker, WorkerConfig, WorkerDefinition_d_exports as WorkerDefinition, type WorkerEnv, WorkerEnvironment, Workflow_d_exports as Workflow, WorkflowBinding_d_exports as WorkflowBinding, WorkflowDefinition_d_exports as WorkflowDefinition };
|