effect-cf 0.23.0 → 0.24.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 +14 -0
- package/README.md +151 -0
- package/dist/{Hyperdrive-COyg7R26.d.mts → Binding-Bq_FPzlt.d.mts} +4 -36
- package/dist/DurableObjectState-8sgBJB0s.mjs +384 -0
- package/dist/Hyperdrive-pEMnh3W6.d.mts +36 -0
- package/dist/HyperdrivePg.d.mts +2 -1
- package/dist/Vitest.d.mts +192 -0
- package/dist/Vitest.mjs +184 -0
- package/dist/WorkflowBinding-BECGNTzu.d.mts +1081 -0
- package/dist/index.d.mts +80 -1153
- package/dist/index.mjs +3 -383
- package/package.json +10 -1
- package/src/Vitest.ts +500 -0
- package/src/WorkflowBinding.ts +5 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { a as Environment_d_exports, c as WorkerEnvironment, i as Binding_d_exports, n as BindingService, o as WorkerConfig, r as BindingValidationError, s as WorkerEnv, t as BindingNotFoundError } from "./Binding-Bq_FPzlt.mjs";
|
|
2
|
+
import { t as Hyperdrive_d_exports } from "./Hyperdrive-pEMnh3W6.mjs";
|
|
3
|
+
import { A as Rpc_d_exports, C as QueueBinding_d_exports, D as RpcDefinition_d_exports, E as ReservedMethodName$2, M as DurableWebSocket, N as DurableObjectStorage_d_exports, O as ServiceFreeSchema$1, P as StorageOperationError, S as QueueDefinition_d_exports, T as Method$2, _ as AsyncMethodArgs, a as WorkflowInstanceCreateOptions, b as AsyncMethodSuccess, c as DurableObjectState, d as ExecutionContext, f as NativeRequest, g as ServiceBinding_d_exports, h as WorkerDefinition_d_exports, i as WorkflowInstanceCreateBatchOptions, j as DurableObjectWebSocket_d_exports, k as Provider, m as Worker_d_exports, n as WorkflowBinding_d_exports, p as WorkerContext, r as WorkflowInstance, s as WorkflowOperationError, t as WorkflowBindingClient, u as DurableObjectState_d_exports, v as AsyncMethodCloudflareReturn, w as Definition$4, x as Queue_d_exports, y as AsyncMethodKey } from "./WorkflowBinding-BECGNTzu.mjs";
|
|
4
|
+
import { Config, Context, Data, DateTime, Duration, Effect, Layer, Option, Redacted, Schema, Scope } from "effect";
|
|
5
|
+
import { Headers as Headers$1, HttpClient, HttpClientResponse } from "effect/unstable/http";
|
|
4
6
|
import { OtlpExporter } from "effect/unstable/observability";
|
|
5
7
|
import { D1Client } from "@effect/sql-d1";
|
|
6
|
-
import { DurableObject,
|
|
8
|
+
import { DurableObject, WorkflowEntrypoint, WorkflowEvent, WorkflowSleepDuration, WorkflowStep, WorkflowStepConfig, WorkflowStepContext, WorkflowStepEvent, WorkflowTimeoutDuration } from "cloudflare:workers";
|
|
7
9
|
import * as RpcSerialization from "effect/unstable/rpc/RpcSerialization";
|
|
8
10
|
import * as RpcServer from "effect/unstable/rpc/RpcServer";
|
|
9
11
|
import { SqliteClient } from "@effect/sql-sqlite-do";
|
|
10
12
|
import { SqlClient } from "effect/unstable/sql";
|
|
11
13
|
import * as Tracer from "effect/Tracer";
|
|
12
14
|
declare namespace WorkersAi_d_exports {
|
|
13
|
-
export { LayerOptions$
|
|
15
|
+
export { LayerOptions$14 as LayerOptions, Tag$13 as Tag, TagClass$12 as TagClass, WorkersAiAsyncBatchResponse, WorkersAiBinding, WorkersAiClient, WorkersAiDefinition, WorkersAiEmbeddingInput, WorkersAiEmbeddingResponse, WorkersAiModelsSearchObject, WorkersAiModelsSearchParams, WorkersAiOperationError, WorkersAiOptions, WorkersAiService, embeddingResponse, isWorkersAiBinding, layer$14 as layer, make$13 as make, makeClient$11 as makeClient };
|
|
14
16
|
}
|
|
15
17
|
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 & {
|
|
16
18
|
readonly _tag: "WorkersAiOperationError";
|
|
@@ -71,24 +73,24 @@ interface WorkersAiService<Id extends string> {
|
|
|
71
73
|
readonly id: Id;
|
|
72
74
|
};
|
|
73
75
|
}
|
|
74
|
-
type LayerOptions$
|
|
76
|
+
type LayerOptions$14 = {
|
|
75
77
|
readonly binding: string;
|
|
76
78
|
};
|
|
77
|
-
interface TagClass$
|
|
79
|
+
interface TagClass$12<Self, Id extends string, ModelList extends AiModelListType = AiModels> extends Context.ServiceClass<Self, Id, WorkersAiClient<ModelList>> {
|
|
78
80
|
readonly id: Id;
|
|
79
|
-
readonly layer: (options: LayerOptions$
|
|
81
|
+
readonly layer: (options: LayerOptions$14) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
80
82
|
}
|
|
81
83
|
declare const isWorkersAiBinding: (value: unknown) => value is WorkersAiBinding;
|
|
82
84
|
declare const embeddingResponse: (value: {
|
|
83
85
|
readonly data?: ReadonlyArray<ReadonlyArray<number>>;
|
|
84
86
|
readonly shape?: ReadonlyArray<number>;
|
|
85
87
|
}) => WorkersAiEmbeddingResponse;
|
|
86
|
-
declare const makeClient$
|
|
87
|
-
declare const layer$
|
|
88
|
-
declare const make$
|
|
89
|
-
declare const Tag$
|
|
88
|
+
declare const makeClient$11: <ModelList extends AiModelListType = AiModels>(definition: WorkersAiDefinition) => (ai: WorkersAiBinding<ModelList>) => WorkersAiClient<ModelList>;
|
|
89
|
+
declare const layer$14: <Self, ModelList extends AiModelListType = AiModels>(tag: Context.Service<Self, WorkersAiClient<ModelList>>, definition: WorkersAiDefinition) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
90
|
+
declare const make$13: <Id extends string>(id: Id) => TagClass$12<WorkersAiService<Id>, Id, AiModels>;
|
|
91
|
+
declare const Tag$13: <Self>() => <Id extends string, ModelList extends AiModelListType = AiModels>(id: Id) => TagClass$12<Self, Id, ModelList>;
|
|
90
92
|
declare namespace AiGateway_d_exports {
|
|
91
|
-
export { AiGatewayBinding, AiGatewayClient, AiGatewayDefinition, AiGatewayFetchOptions, AiGatewayHeaders, AiGatewayLog, AiGatewayOperationError, AiGatewayPatchLog, AiGatewayProvider, AiGatewayRunOptions, AiGatewayService, AiGatewayUniversalRequest, LayerOptions$
|
|
93
|
+
export { AiGatewayBinding, AiGatewayClient, AiGatewayDefinition, AiGatewayFetchOptions, AiGatewayHeaders, AiGatewayLog, AiGatewayOperationError, AiGatewayPatchLog, AiGatewayProvider, AiGatewayRunOptions, AiGatewayService, AiGatewayUniversalRequest, LayerOptions$13 as LayerOptions, Tag$12 as Tag, TagClass$11 as TagClass, isAiGatewayBinding, layer$13 as layer, make$12 as make, makeClient$10 as makeClient, makeClientFromAi, makeHttpClient };
|
|
92
94
|
}
|
|
93
95
|
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 & {
|
|
94
96
|
readonly _tag: "AiGatewayOperationError";
|
|
@@ -139,17 +141,17 @@ interface AiGatewayService<Id extends string> {
|
|
|
139
141
|
readonly id: Id;
|
|
140
142
|
};
|
|
141
143
|
}
|
|
142
|
-
type LayerOptions$
|
|
144
|
+
type LayerOptions$13 = {
|
|
143
145
|
readonly binding: string;
|
|
144
146
|
readonly gatewayId: string;
|
|
145
147
|
readonly accountId?: string;
|
|
146
148
|
};
|
|
147
|
-
interface TagClass$
|
|
149
|
+
interface TagClass$11<Self, Id extends string> extends Context.ServiceClass<Self, Id, AiGatewayClient> {
|
|
148
150
|
readonly id: Id;
|
|
149
|
-
readonly layer: (options: LayerOptions$
|
|
151
|
+
readonly layer: (options: LayerOptions$13) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError | AiGatewayOperationError, WorkerEnvironment>;
|
|
150
152
|
}
|
|
151
153
|
declare const isAiGatewayBinding: (value: unknown) => value is WorkersAiBinding;
|
|
152
|
-
declare const makeClient$
|
|
154
|
+
declare const makeClient$10: (definition: AiGatewayDefinition, gateway: AiGatewayBinding) => {
|
|
153
155
|
definition: AiGatewayDefinition;
|
|
154
156
|
run: (data: import("@cloudflare/workers-types").AIGatewayUniversalRequest | readonly import("@cloudflare/workers-types").AIGatewayUniversalRequest[], options?: {
|
|
155
157
|
gateway?: import("@cloudflare/workers-types").UniversalGatewayOptions;
|
|
@@ -167,11 +169,11 @@ declare const makeHttpClient: (definition: Omit<AiGatewayDefinition, "binding">
|
|
|
167
169
|
readonly accountId: string;
|
|
168
170
|
readonly binding?: string;
|
|
169
171
|
}, request?: typeof fetch) => AiGatewayClient;
|
|
170
|
-
declare const layer$
|
|
171
|
-
declare const make$
|
|
172
|
-
declare const Tag$
|
|
172
|
+
declare const layer$13: <Self>(tag: Context.Service<Self, AiGatewayClient>, definition: AiGatewayDefinition) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
173
|
+
declare const make$12: <Id extends string>(id: Id) => TagClass$11<AiGatewayService<Id>, Id>;
|
|
174
|
+
declare const Tag$12: <Self>() => <Id extends string>(id: Id) => TagClass$11<Self, Id>;
|
|
173
175
|
declare namespace AnalyticsEngine_d_exports {
|
|
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$
|
|
176
|
+
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$12 as LayerOptions, QueryConfigOptions, QueryTag, QueryTagClass, Tag$11 as Tag, TagClass$10 as TagClass, isAnalyticsEngineDataset, layer$12 as layer, layerFetch, layerFetchConfig, make$11 as make, makeClient$9 as makeClient, makeQuery, makeQueryClient, queryConfig, queryLayer, queryLayerConfig, writeLimits };
|
|
175
177
|
}
|
|
176
178
|
declare const writeLimits: {
|
|
177
179
|
readonly maxBlobs: 20;
|
|
@@ -308,7 +310,7 @@ interface AnalyticsEngineQueryService<Id extends string> {
|
|
|
308
310
|
readonly id: Id;
|
|
309
311
|
};
|
|
310
312
|
}
|
|
311
|
-
type LayerOptions$
|
|
313
|
+
type LayerOptions$12 = {
|
|
312
314
|
readonly binding: string;
|
|
313
315
|
readonly write?: AnalyticsEngineWritePolicy;
|
|
314
316
|
};
|
|
@@ -317,9 +319,9 @@ type QueryConfigOptions = {
|
|
|
317
319
|
readonly apiToken?: Config.Config<Redacted.Redacted<string>>;
|
|
318
320
|
readonly apiBaseUrl?: Config.Config<string>;
|
|
319
321
|
};
|
|
320
|
-
interface TagClass$
|
|
322
|
+
interface TagClass$10<Self, Id extends string> extends Context.ServiceClass<Self, Id, AnalyticsEngineClient> {
|
|
321
323
|
readonly id: Id;
|
|
322
|
-
readonly layer: (options: LayerOptions$
|
|
324
|
+
readonly layer: (options: LayerOptions$12) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
323
325
|
}
|
|
324
326
|
interface QueryTagClass<Self, Id extends string> extends Context.ServiceClass<Self, Id, AnalyticsEngineQueryClient> {
|
|
325
327
|
readonly id: Id;
|
|
@@ -330,7 +332,7 @@ interface QueryTagClass<Self, Id extends string> extends Context.ServiceClass<Se
|
|
|
330
332
|
}
|
|
331
333
|
declare const makeQueryClient: (definition: AnalyticsEngineQueryDefinition) => Effect.Effect<AnalyticsEngineQueryClient, never, HttpClient.HttpClient>;
|
|
332
334
|
declare const isAnalyticsEngineDataset: (value: unknown) => value is AnalyticsEngineBinding;
|
|
333
|
-
declare const makeClient$
|
|
335
|
+
declare const makeClient$9: (definition: AnalyticsEngineDefinition, defaults?: AnalyticsEngineWritePolicy) => (dataset: AnalyticsEngineBinding) => AnalyticsEngineClient;
|
|
334
336
|
declare const queryConfig: (options?: QueryConfigOptions) => Config.Config<{
|
|
335
337
|
accountId: string;
|
|
336
338
|
apiToken: Redacted.Redacted<string>;
|
|
@@ -340,13 +342,13 @@ declare const queryLayer: <Self>(tag: Context.Service<Self, AnalyticsEngineQuery
|
|
|
340
342
|
declare const layerFetch: <Self>(tag: Context.Service<Self, AnalyticsEngineQueryClient>, definition: AnalyticsEngineQueryDefinition) => Layer.Layer<Self, never, never>;
|
|
341
343
|
declare const queryLayerConfig: <Self>(tag: Context.Service<Self, AnalyticsEngineQueryClient>, config?: Config.Config<AnalyticsEngineQueryDefinition>) => Layer.Layer<Self, Config.ConfigError, HttpClient.HttpClient>;
|
|
342
344
|
declare const layerFetchConfig: <Self>(tag: Context.Service<Self, AnalyticsEngineQueryClient>, config?: Config.Config<AnalyticsEngineQueryDefinition>) => Layer.Layer<Self, Config.ConfigError, never>;
|
|
343
|
-
declare const layer$
|
|
344
|
-
declare const make$
|
|
345
|
+
declare const layer$12: <Self>(tag: Context.Service<Self, AnalyticsEngineClient>, definition: LayerOptions$12) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
346
|
+
declare const make$11: <Id extends string>(id: Id) => TagClass$10<AnalyticsEngineService<Id>, Id>;
|
|
345
347
|
declare const makeQuery: <Id extends string>(id: Id) => QueryTagClass<AnalyticsEngineQueryService<Id>, Id>;
|
|
346
|
-
declare const Tag$
|
|
348
|
+
declare const Tag$11: <Self>() => <Id extends string>(id: Id) => TagClass$10<Self, Id>;
|
|
347
349
|
declare const QueryTag: <Self>() => <Id extends string>(id: Id) => QueryTagClass<Self, Id>;
|
|
348
350
|
declare namespace BrowserRendering_d_exports {
|
|
349
|
-
export { BrowserRenderingBinding, BrowserRenderingBrowserClient, BrowserRenderingBrowserLike, BrowserRenderingClient, BrowserRenderingConnect, BrowserRenderingDefinition, BrowserRenderingLaunch, BrowserRenderingOperationError, BrowserRenderingPageClient, BrowserRenderingPageLike, BrowserRenderingService, LayerOptions$
|
|
351
|
+
export { BrowserRenderingBinding, BrowserRenderingBrowserClient, BrowserRenderingBrowserLike, BrowserRenderingClient, BrowserRenderingConnect, BrowserRenderingDefinition, BrowserRenderingLaunch, BrowserRenderingOperationError, BrowserRenderingPageClient, BrowserRenderingPageLike, BrowserRenderingService, LayerOptions$11 as LayerOptions, Tag$10 as Tag, TagClass$9 as TagClass, isBrowserRenderingBinding, layer$11 as layer, make$10 as make, makeClient$8 as makeClient };
|
|
350
352
|
}
|
|
351
353
|
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 & {
|
|
352
354
|
readonly _tag: "BrowserRenderingOperationError";
|
|
@@ -412,20 +414,20 @@ interface BrowserRenderingService<Id extends string> {
|
|
|
412
414
|
readonly id: Id;
|
|
413
415
|
};
|
|
414
416
|
}
|
|
415
|
-
type LayerOptions$
|
|
417
|
+
type LayerOptions$11 = {
|
|
416
418
|
readonly binding: string;
|
|
417
419
|
};
|
|
418
|
-
interface TagClass$
|
|
420
|
+
interface TagClass$9<Self, Id extends string> extends Context.ServiceClass<Self, Id, BrowserRenderingClient> {
|
|
419
421
|
readonly id: Id;
|
|
420
|
-
readonly layer: (options: LayerOptions$
|
|
422
|
+
readonly layer: (options: LayerOptions$11) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
421
423
|
}
|
|
422
424
|
declare const isBrowserRenderingBinding: (value: unknown) => value is BrowserRenderingBinding;
|
|
423
|
-
declare const makeClient$
|
|
424
|
-
declare const layer$
|
|
425
|
-
declare const make$
|
|
426
|
-
declare const Tag$
|
|
425
|
+
declare const makeClient$8: <RawBinding extends BrowserRenderingBinding = BrowserRenderingBinding>(definition: BrowserRenderingDefinition) => (binding: RawBinding) => BrowserRenderingClient<RawBinding>;
|
|
426
|
+
declare const layer$11: <Self>(tag: Context.Service<Self, BrowserRenderingClient>, definition: BrowserRenderingDefinition) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
427
|
+
declare const make$10: <Id extends string>(id: Id) => TagClass$9<BrowserRenderingService<Id>, Id>;
|
|
428
|
+
declare const Tag$10: <Self>() => <Id extends string>(id: Id) => TagClass$9<Self, Id>;
|
|
427
429
|
declare namespace Cache_d_exports {
|
|
428
|
-
export { CacheClient, CacheOperation, CacheOperationError, CacheQueryOptions, CacheRequest, CacheStorage, CacheStorageClient, layer$
|
|
430
|
+
export { CacheClient, CacheOperation, CacheOperationError, CacheQueryOptions, CacheRequest, CacheStorage, CacheStorageClient, layer$10 as layer, layerFrom, makeCacheClient, makeClient$7 as makeClient };
|
|
429
431
|
}
|
|
430
432
|
/** Request key accepted by Cloudflare's Cache API. */
|
|
431
433
|
type CacheRequest = CloudflareRequestInfo | URL;
|
|
@@ -472,1014 +474,13 @@ declare class CacheStorage extends CacheStorage_base {}
|
|
|
472
474
|
/** Wraps a native Cloudflare `Cache` instance. */
|
|
473
475
|
declare const makeCacheClient: (cache: CloudflareCache, name?: string) => CacheClient;
|
|
474
476
|
/** Wraps a native Cloudflare `CacheStorage` instance. */
|
|
475
|
-
declare const makeClient$
|
|
477
|
+
declare const makeClient$7: (storage: CloudflareCacheStorage) => CacheStorageClient;
|
|
476
478
|
/** Provides Cache API services from an explicit native `CacheStorage` instance. */
|
|
477
479
|
declare const layerFrom: (storage: CloudflareCacheStorage) => Layer.Layer<CacheStorage>;
|
|
478
480
|
/** Provides Cache API services from Cloudflare's global `caches` object. */
|
|
479
|
-
declare const layer$
|
|
480
|
-
declare namespace DurableObjectStorage_d_exports {
|
|
481
|
-
export { DurableObjectStorage, DurableObjectTransaction, SchemaBackedSyncKvStorage, SqlCursor, SqlStorage, SqlStorageValue, StorageOperationError, SyncKvDefinition, SyncKvStorage, fromDurableObjectStorage };
|
|
482
|
-
}
|
|
483
|
-
/** Supported primitive value types for Durable Object SQL APIs. */
|
|
484
|
-
type SqlStorageValue = globalThis.SqlStorageValue;
|
|
485
|
-
declare const StorageOperationError_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 & {
|
|
486
|
-
readonly _tag: "StorageOperationError";
|
|
487
|
-
} & Readonly<A>;
|
|
488
|
-
/** Error type used when a storage operation throws or rejects. */
|
|
489
|
-
declare class StorageOperationError extends StorageOperationError_base<{
|
|
490
|
-
readonly operation: string;
|
|
491
|
-
readonly cause: unknown;
|
|
492
|
-
}> {
|
|
493
|
-
get message(): string;
|
|
494
|
-
}
|
|
495
|
-
type StorageEffect<A> = Effect.Effect<A, StorageOperationError>;
|
|
496
|
-
/**
|
|
497
|
-
* Effect wrapper for Cloudflare SQL cursor operations.
|
|
498
|
-
*/
|
|
499
|
-
interface SqlCursor<T extends Record<string, SqlStorageValue>> {
|
|
500
|
-
next(): StorageEffect<{
|
|
501
|
-
done?: false;
|
|
502
|
-
value: T;
|
|
503
|
-
} | {
|
|
504
|
-
done: true;
|
|
505
|
-
value?: never;
|
|
506
|
-
}>;
|
|
507
|
-
toArray(): StorageEffect<Array<T>>;
|
|
508
|
-
one(): StorageEffect<T>;
|
|
509
|
-
raw<U extends Array<SqlStorageValue>>(): StorageEffect<IterableIterator<U>>;
|
|
510
|
-
readonly columnNames: Array<string>;
|
|
511
|
-
readonly rowsRead: StorageEffect<number>;
|
|
512
|
-
readonly rowsWritten: StorageEffect<number>;
|
|
513
|
-
}
|
|
514
|
-
/**
|
|
515
|
-
* Effect wrapper for Durable Object SQLite APIs.
|
|
516
|
-
*/
|
|
517
|
-
interface SqlStorage {
|
|
518
|
-
/** Executes a SQL statement and returns a typed cursor. */
|
|
519
|
-
exec<T extends Record<string, SqlStorageValue>>(query: string, ...bindings: Array<SqlStorageValue>): StorageEffect<SqlCursor<T>>;
|
|
520
|
-
readonly databaseSize: number;
|
|
521
|
-
}
|
|
522
|
-
/**
|
|
523
|
-
* Schema pair used by `SyncKvStorage.schema(...)`.
|
|
524
|
-
*/
|
|
525
|
-
interface SyncKvDefinition<Key, Value, EncodedValue> {
|
|
526
|
-
readonly key: Schema.Codec<Key, string>;
|
|
527
|
-
readonly value: Schema.Codec<Value, EncodedValue>;
|
|
528
|
-
}
|
|
529
|
-
/**
|
|
530
|
-
* Sync KV wrapper that transparently encodes keys/values through Effect Schema.
|
|
531
|
-
*/
|
|
532
|
-
interface SchemaBackedSyncKvStorage<Key, Value> {
|
|
533
|
-
get(key: Key): Effect.Effect<Option.Option<Value>, unknown>;
|
|
534
|
-
put(key: Key, value: Value): Effect.Effect<void, unknown>;
|
|
535
|
-
delete(key: Key): Effect.Effect<boolean, unknown>;
|
|
536
|
-
list(options?: globalThis.SyncKvListOptions): Effect.Effect<Array<[Key, Value]>, unknown>;
|
|
537
|
-
}
|
|
538
|
-
/**
|
|
539
|
-
* Effect wrapper for synchronous KV attached to Durable Object SQLite storage.
|
|
540
|
-
*/
|
|
541
|
-
interface SyncKvStorage {
|
|
542
|
-
get<T = unknown>(key: string): StorageEffect<T | undefined>;
|
|
543
|
-
put<T>(key: string, value: T): StorageEffect<void>;
|
|
544
|
-
delete(key: string): StorageEffect<boolean>;
|
|
545
|
-
list<T = unknown>(options?: globalThis.SyncKvListOptions): StorageEffect<Array<[string, T]>>;
|
|
546
|
-
schema<Key, Value, EncodedValue>(definition: SyncKvDefinition<Key, Value, EncodedValue>): SchemaBackedSyncKvStorage<Key, Value>;
|
|
547
|
-
}
|
|
548
|
-
/**
|
|
549
|
-
* Effect wrapper around Cloudflare transaction callbacks.
|
|
550
|
-
*/
|
|
551
|
-
interface DurableObjectTransaction {
|
|
552
|
-
get<T = unknown>(key: string, options?: globalThis.DurableObjectGetOptions): StorageEffect<T | undefined>;
|
|
553
|
-
get<T = unknown>(keys: Array<string>, options?: globalThis.DurableObjectGetOptions): StorageEffect<Map<string, T>>;
|
|
554
|
-
list<T = unknown>(options?: globalThis.DurableObjectListOptions): StorageEffect<Map<string, T>>;
|
|
555
|
-
put<T>(key: string, value: T, options?: globalThis.DurableObjectPutOptions): StorageEffect<void>;
|
|
556
|
-
put<T>(entries: Record<string, T>, options?: globalThis.DurableObjectPutOptions): StorageEffect<void>;
|
|
557
|
-
delete(key: string, options?: globalThis.DurableObjectPutOptions): StorageEffect<boolean>;
|
|
558
|
-
delete(keys: Array<string>, options?: globalThis.DurableObjectPutOptions): StorageEffect<number>;
|
|
559
|
-
rollback(): StorageEffect<void>;
|
|
560
|
-
getAlarm(options?: globalThis.DurableObjectGetAlarmOptions): StorageEffect<number | null>;
|
|
561
|
-
setAlarm(scheduledTime: number | Date, options?: globalThis.DurableObjectSetAlarmOptions): StorageEffect<void>;
|
|
562
|
-
deleteAlarm(options?: globalThis.DurableObjectSetAlarmOptions): StorageEffect<void>;
|
|
563
|
-
}
|
|
564
|
-
/**
|
|
565
|
-
* Effect wrapper around Cloudflare Durable Object storage.
|
|
566
|
-
*
|
|
567
|
-
* @example
|
|
568
|
-
* ```ts
|
|
569
|
-
* const program = Effect.gen(function* () {
|
|
570
|
-
* const state = yield* DurableObjectState;
|
|
571
|
-
* yield* state.storage.put("counter", 1);
|
|
572
|
-
* const value = yield* state.storage.get<number>("counter");
|
|
573
|
-
* return value;
|
|
574
|
-
* });
|
|
575
|
-
* ```
|
|
576
|
-
*/
|
|
577
|
-
interface DurableObjectStorage {
|
|
578
|
-
get<T = unknown>(key: string, options?: globalThis.DurableObjectGetOptions): StorageEffect<T | undefined>;
|
|
579
|
-
put<T>(key: string, value: T, options?: globalThis.DurableObjectPutOptions): StorageEffect<void>;
|
|
580
|
-
delete(key: string, options?: globalThis.DurableObjectPutOptions): StorageEffect<boolean>;
|
|
581
|
-
/**
|
|
582
|
-
* Deletes all stored data. On compatibility dates before 2026-02-24, Cloudflare
|
|
583
|
-
* documents that active alarms must be deleted separately with `deleteAlarm()`.
|
|
584
|
-
*/
|
|
585
|
-
deleteAll(options?: globalThis.DurableObjectPutOptions): StorageEffect<void>;
|
|
586
|
-
getAlarm(options?: globalThis.DurableObjectGetAlarmOptions): StorageEffect<number | null>;
|
|
587
|
-
setAlarm(scheduledTime: number | Date, options?: globalThis.DurableObjectSetAlarmOptions): StorageEffect<void>;
|
|
588
|
-
deleteAlarm(options?: globalThis.DurableObjectSetAlarmOptions): StorageEffect<void>;
|
|
589
|
-
/**
|
|
590
|
-
* SQLite-backed Durable Object storage only.
|
|
591
|
-
*
|
|
592
|
-
* The callback Effect must complete synchronously. If it requires asynchronous
|
|
593
|
-
* work, use `transaction` instead so Cloudflare can run the async transaction
|
|
594
|
-
* callback under the platform's transaction contract.
|
|
595
|
-
*/
|
|
596
|
-
transactionSync<A, E, R>(closure: () => Effect.Effect<A, E, R>): Effect.Effect<A, E | StorageOperationError, R>;
|
|
597
|
-
/**
|
|
598
|
-
* Runs an async transaction and exposes a typed transaction wrapper.
|
|
599
|
-
*/
|
|
600
|
-
transaction<A, E, R>(closure: (txn: DurableObjectTransaction) => Effect.Effect<A, E, R>): Effect.Effect<A, E | StorageOperationError, R>;
|
|
601
|
-
/** Flushes pending writes to disk. */
|
|
602
|
-
sync(): StorageEffect<void>;
|
|
603
|
-
/** SQLite-backed Durable Object storage point-in-time recovery API only. */
|
|
604
|
-
getCurrentBookmark(): StorageEffect<string>;
|
|
605
|
-
/** SQLite-backed Durable Object storage point-in-time recovery API only. */
|
|
606
|
-
onNextSessionRestoreBookmark(bookmark: string): StorageEffect<string>;
|
|
607
|
-
readonly sql: SqlStorage;
|
|
608
|
-
readonly kv: SyncKvStorage;
|
|
609
|
-
}
|
|
610
|
-
/**
|
|
611
|
-
* Wraps native Cloudflare storage APIs as Effect-returning helpers.
|
|
612
|
-
*/
|
|
613
|
-
declare const fromDurableObjectStorage: (storage: globalThis.DurableObjectStorage) => DurableObjectStorage;
|
|
614
|
-
declare namespace DurableObjectWebSocket_d_exports {
|
|
615
|
-
export { AcceptUpgradeOptions, AcceptedUpgrade, AttachmentInvalidPolicy, AttachmentRehydrateOptions, DurableWebSocket, DurableWebSocketAttachment, DurableWebSocketAttachmentError, DurableWebSocketCloseError, DurableWebSocketHandlers, DurableWebSocketSendData, DurableWebSocketSendError, RehydratedDurableWebSocket, acceptUpgrade, attachment, fromWebSocket, handlers };
|
|
616
|
-
}
|
|
617
|
-
/** Data supported by Cloudflare websocket `send`. */
|
|
618
|
-
type DurableWebSocketSendData = string | ArrayBuffer | ArrayBufferView;
|
|
619
|
-
declare const DurableWebSocketSendError_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 & {
|
|
620
|
-
readonly _tag: "DurableWebSocketSendError";
|
|
621
|
-
} & Readonly<A>;
|
|
622
|
-
/** Error raised when sending on a Durable Object websocket fails. */
|
|
623
|
-
declare class DurableWebSocketSendError extends DurableWebSocketSendError_base<{
|
|
624
|
-
readonly cause: unknown;
|
|
625
|
-
}> {
|
|
626
|
-
get message(): string;
|
|
627
|
-
}
|
|
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 & {
|
|
629
|
-
readonly _tag: "DurableWebSocketCloseError";
|
|
630
|
-
} & Readonly<A>;
|
|
631
|
-
/** Error raised when closing a Durable Object websocket fails. */
|
|
632
|
-
declare class DurableWebSocketCloseError extends DurableWebSocketCloseError_base<{
|
|
633
|
-
readonly cause: unknown;
|
|
634
|
-
}> {
|
|
635
|
-
get message(): string;
|
|
636
|
-
}
|
|
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 & {
|
|
638
|
-
readonly _tag: "DurableWebSocketAttachmentError";
|
|
639
|
-
} & Readonly<A>;
|
|
640
|
-
/** Error raised when serializing or deserializing a websocket attachment fails. */
|
|
641
|
-
declare class DurableWebSocketAttachmentError extends DurableWebSocketAttachmentError_base<{
|
|
642
|
-
readonly operation: "serialize" | "deserialize";
|
|
643
|
-
readonly cause: unknown;
|
|
644
|
-
}> {
|
|
645
|
-
get message(): string;
|
|
646
|
-
}
|
|
647
|
-
/** Effect-native wrapper around a hibernatable Durable Object websocket. */
|
|
648
|
-
interface DurableWebSocket<Attachment = unknown> {
|
|
649
|
-
/** Underlying Cloudflare websocket. */
|
|
650
|
-
readonly raw: WebSocket;
|
|
651
|
-
/** Sends a message through the socket. */
|
|
652
|
-
send(data: DurableWebSocketSendData): Effect.Effect<void, DurableWebSocketSendError>;
|
|
653
|
-
/** Closes the socket. */
|
|
654
|
-
close(code?: number, reason?: string): Effect.Effect<void, DurableWebSocketCloseError>;
|
|
655
|
-
/** Serializes hibernation attachment metadata onto the socket. */
|
|
656
|
-
serializeAttachment<A = Attachment>(value: A): Effect.Effect<void, DurableWebSocketAttachmentError>;
|
|
657
|
-
/** Deserializes hibernation attachment metadata from the socket. */
|
|
658
|
-
readonly deserializeAttachment: Effect.Effect<unknown, DurableWebSocketAttachmentError>;
|
|
659
|
-
}
|
|
660
|
-
/** Wraps a native Cloudflare websocket in the Effect-native Durable Object API. */
|
|
661
|
-
declare const fromWebSocket: <Attachment = unknown>(raw: WebSocket) => DurableWebSocket<Attachment>;
|
|
662
|
-
/**
|
|
663
|
-
* Options for accepting an incoming websocket request in a Durable Object.
|
|
664
|
-
*/
|
|
665
|
-
interface AcceptUpgradeOptions<Attachment = unknown> {
|
|
666
|
-
/** Optional websocket tags for Durable Object hibernation filtering. */
|
|
667
|
-
readonly tags?: ReadonlyArray<string> | undefined;
|
|
668
|
-
/** Optional attachment serialized onto the server socket. */
|
|
669
|
-
readonly attachment?: Attachment | undefined;
|
|
670
|
-
}
|
|
671
|
-
/**
|
|
672
|
-
* Result of a websocket upgrade accepted by {@link acceptUpgrade}.
|
|
673
|
-
*/
|
|
674
|
-
interface AcceptedUpgrade<Attachment = unknown> {
|
|
675
|
-
readonly client: WebSocket;
|
|
676
|
-
readonly server: DurableWebSocket<Attachment>;
|
|
677
|
-
readonly response: Response;
|
|
678
|
-
}
|
|
679
|
-
/**
|
|
680
|
-
* Accepts a websocket upgrade and registers the server socket on `DurableObjectState`.
|
|
681
|
-
*
|
|
682
|
-
* @example
|
|
683
|
-
* ```ts
|
|
684
|
-
* const response = yield* DurableObjectWebSocket.acceptUpgrade({
|
|
685
|
-
* tags: ["room:general"],
|
|
686
|
-
* });
|
|
687
|
-
*
|
|
688
|
-
* return response.response;
|
|
689
|
-
* ```
|
|
690
|
-
*/
|
|
691
|
-
declare const acceptUpgrade: <Attachment = unknown>(options?: AcceptUpgradeOptions<Attachment> | undefined) => Effect.Effect<AcceptedUpgrade<Attachment>, DurableWebSocketAttachmentError, DurableObjectState>;
|
|
692
|
-
type AttachmentInvalidPolicy = "ignore" | "ignore-and-close" | "fail";
|
|
693
|
-
interface AttachmentRehydrateOptions {
|
|
694
|
-
/** Optional Durable Object websocket tag filter. */
|
|
695
|
-
readonly tag?: string | undefined;
|
|
696
|
-
/** Invalid attachment behavior. Defaults to skipping invalid sockets. */
|
|
697
|
-
readonly onInvalid?: AttachmentInvalidPolicy | undefined;
|
|
698
|
-
}
|
|
699
|
-
interface RehydratedDurableWebSocket<Attachment> {
|
|
700
|
-
readonly socket: DurableWebSocket<Attachment>;
|
|
701
|
-
readonly attachment: Attachment;
|
|
702
|
-
}
|
|
703
|
-
interface DurableWebSocketAttachment<Attachment, Encoded> {
|
|
704
|
-
serialize(socket: DurableWebSocket<unknown>, value: Attachment): Effect.Effect<void, DurableWebSocketAttachmentError>;
|
|
705
|
-
deserialize(socket: DurableWebSocket<unknown>): Effect.Effect<Option.Option<Attachment>, DurableWebSocketAttachmentError>;
|
|
706
|
-
rehydrate(options?: AttachmentRehydrateOptions): Effect.Effect<Array<RehydratedDurableWebSocket<Attachment>>, DurableWebSocketAttachmentError, DurableObjectState>;
|
|
707
|
-
readonly schema: Schema.Codec<Attachment, Encoded, never, never>;
|
|
708
|
-
}
|
|
709
|
-
/** Creates typed attachment helpers for accepted and rehydrated sockets. */
|
|
710
|
-
declare const attachment: <const AttachmentSchema extends Schema.Codec<any, any, never, never>>(schema: AttachmentSchema) => DurableWebSocketAttachment<Schema.Schema.Type<AttachmentSchema>, Schema.Codec.Encoded<AttachmentSchema>>;
|
|
711
|
-
interface DurableWebSocketHandlers<R = never, E = unknown> {
|
|
712
|
-
readonly message?: (socket: DurableWebSocket, message: string | ArrayBuffer) => Effect.Effect<void, E, R>;
|
|
713
|
-
readonly close?: (socket: DurableWebSocket, code: number, reason: string, wasClean: boolean) => Effect.Effect<void, E, R>;
|
|
714
|
-
readonly error?: (socket: DurableWebSocket, error: unknown) => Effect.Effect<void, E, R>;
|
|
715
|
-
}
|
|
716
|
-
/** Maps compact websocket lifecycle handler names to `DurableObject.make` options. */
|
|
717
|
-
declare const handlers: <R = never, E = unknown>(options: DurableWebSocketHandlers<R, E>) => {
|
|
718
|
-
webSocketMessage: ((socket: DurableWebSocket, message: string | ArrayBuffer) => Effect.Effect<void, E, R>) | undefined;
|
|
719
|
-
webSocketClose: ((socket: DurableWebSocket, code: number, reason: string, wasClean: boolean) => Effect.Effect<void, E, R>) | undefined;
|
|
720
|
-
webSocketError: ((socket: DurableWebSocket, error: unknown) => Effect.Effect<void, E, R>) | undefined;
|
|
721
|
-
};
|
|
722
|
-
declare namespace Rpc_d_exports {
|
|
723
|
-
export { DisposableValue, MethodArgs, MethodKey, MethodReturn, Provider, Result$1 as Result, RpcStub, RpcTarget, Serializable, Stub, Stubable, Stubify, dispose, isDisposable, resolve, scoped };
|
|
724
|
-
}
|
|
725
|
-
type Stubable = Rpc.Stubable;
|
|
726
|
-
type Stub<T extends Stubable> = Rpc.Stub<T>;
|
|
727
|
-
type Provider<T extends object, Reserved extends string = never> = Rpc.Provider<T, Reserved>;
|
|
728
|
-
type BaseType = void | undefined | null | boolean | number | bigint | string | TypedArray | ArrayBuffer | DataView | Date | Error | RegExp | ReadableStream<Uint8Array> | WritableStream<Uint8Array> | Request | Response | Headers;
|
|
729
|
-
type Serializable<T> = BaseType | Map<T extends Map<infer Key, unknown> ? Serializable<Key> : never, T extends Map<unknown, infer Value> ? Serializable<Value> : never> | Set<T extends Set<infer Value> ? Serializable<Value> : never> | ReadonlyArray<T extends ReadonlyArray<infer Value> ? Serializable<Value> : never> | { [Key in keyof T]: Key extends number | string ? Serializable<T[Key]> : never; } | Stub<Stubable> | Stubable;
|
|
730
|
-
type Stubify<T> = T extends Stubable ? Stub<T> : T extends Map<infer Key, infer Value> ? Map<Stubify<Key>, Stubify<Value>> : T extends Set<infer Value> ? Set<Stubify<Value>> : T extends Array<infer Value> ? Array<Stubify<Value>> : T extends ReadonlyArray<infer Value> ? ReadonlyArray<Stubify<Value>> : T extends BaseType ? T : T extends {
|
|
731
|
-
[key: string | number]: unknown;
|
|
732
|
-
} ? { [Key in keyof T]: Stubify<T[Key]>; } : T;
|
|
733
|
-
type MaybeProvider<T> = T extends object ? Provider<T> : unknown;
|
|
734
|
-
type MaybeDisposable<T> = T extends object ? Disposable : unknown;
|
|
735
|
-
type Result$1<T> = T extends Stubable ? Promise<Stub<T>> & Provider<T> : T extends Serializable<T> ? Promise<Stubify<T> & MaybeDisposable<T>> & MaybeProvider<T> : never;
|
|
736
|
-
type MethodKey<Api> = { [Key in keyof Api]-?: Key extends string ? Api[Key] extends ((...args: Array<any>) => unknown) ? Key : never : never; }[keyof Api];
|
|
737
|
-
type MethodArgs<Api, Method extends keyof Api> = Api[Method] extends ((...args: infer Args) => unknown) ? Args : never;
|
|
738
|
-
type MethodReturn<Api, Method extends keyof Api> = Api[Method] extends ((...args: Array<any>) => infer Return) ? Return : never;
|
|
739
|
-
type DisposableValue = {
|
|
740
|
-
[Symbol.dispose](): void;
|
|
741
|
-
};
|
|
742
|
-
declare const isDisposable: (value: unknown) => value is DisposableValue;
|
|
743
|
-
declare const dispose: (value: unknown) => Effect.Effect<void>;
|
|
744
|
-
declare const resolve: <A>(value: A) => Effect.Effect<Awaited<A>, unknown>;
|
|
745
|
-
declare const scoped: <A>(value: A) => Effect.Effect<Awaited<A>, unknown, Scope.Scope>;
|
|
746
|
-
declare namespace RpcDefinition_d_exports {
|
|
747
|
-
export { Definition$7 as Definition, Method$3 as Method, Methods$2 as Methods, NoReservedMethods$2 as NoReservedMethods, ReservedMethodName$5 as ReservedMethodName, RpcArgumentCountError, RpcArgumentDecodeError, RpcArgumentEncodeError, RpcReservedMethodNameError, RpcSuccessDecodeError, RpcSuccessEncodeError, ServiceFreeSchema$2 as ServiceFreeSchema, WireError, assertNoReservedMethods, decodeArgs, decodeSuccess, decodeWireError, encodeArgs, encodeSuccess, encodeWireError, isWireError, make$13 as make, method$2 as method, reservedMethodNames };
|
|
748
|
-
}
|
|
749
|
-
declare const RpcReservedMethodNameError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
750
|
-
readonly _tag: "RpcReservedMethodNameError";
|
|
751
|
-
} & Readonly<A>;
|
|
752
|
-
declare class RpcReservedMethodNameError extends RpcReservedMethodNameError_base<{
|
|
753
|
-
readonly definition: string;
|
|
754
|
-
readonly method: string;
|
|
755
|
-
}> {
|
|
756
|
-
get message(): string;
|
|
757
|
-
}
|
|
758
|
-
declare const RpcArgumentCountError_base: Schema.Class<RpcArgumentCountError, Schema.TaggedStruct<"RpcArgumentCountError", {
|
|
759
|
-
readonly definition: Schema.String;
|
|
760
|
-
readonly method: Schema.String;
|
|
761
|
-
readonly expected: Schema.Number;
|
|
762
|
-
readonly actual: Schema.Number;
|
|
763
|
-
}>, import("effect/Cause").YieldableError>;
|
|
764
|
-
declare class RpcArgumentCountError extends RpcArgumentCountError_base {
|
|
765
|
-
get message(): string;
|
|
766
|
-
}
|
|
767
|
-
declare const RpcArgumentDecodeError_base: Schema.Class<RpcArgumentDecodeError, Schema.TaggedStruct<"RpcArgumentDecodeError", {
|
|
768
|
-
readonly definition: Schema.String;
|
|
769
|
-
readonly method: Schema.String;
|
|
770
|
-
readonly cause: Schema.Defect;
|
|
771
|
-
}>, import("effect/Cause").YieldableError>;
|
|
772
|
-
declare class RpcArgumentDecodeError extends RpcArgumentDecodeError_base {
|
|
773
|
-
get message(): string;
|
|
774
|
-
}
|
|
775
|
-
declare const RpcArgumentEncodeError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
776
|
-
readonly _tag: "RpcArgumentEncodeError";
|
|
777
|
-
} & Readonly<A>;
|
|
778
|
-
declare class RpcArgumentEncodeError extends RpcArgumentEncodeError_base<{
|
|
779
|
-
readonly definition: string;
|
|
780
|
-
readonly method: string;
|
|
781
|
-
readonly cause: unknown;
|
|
782
|
-
}> {
|
|
783
|
-
get message(): string;
|
|
784
|
-
}
|
|
785
|
-
declare const RpcSuccessDecodeError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
786
|
-
readonly _tag: "RpcSuccessDecodeError";
|
|
787
|
-
} & Readonly<A>;
|
|
788
|
-
declare class RpcSuccessDecodeError extends RpcSuccessDecodeError_base<{
|
|
789
|
-
readonly definition: string;
|
|
790
|
-
readonly method: string;
|
|
791
|
-
readonly cause: unknown;
|
|
792
|
-
}> {
|
|
793
|
-
get message(): string;
|
|
794
|
-
}
|
|
795
|
-
declare const RpcSuccessEncodeError_base: Schema.Class<RpcSuccessEncodeError, Schema.TaggedStruct<"RpcSuccessEncodeError", {
|
|
796
|
-
readonly definition: Schema.String;
|
|
797
|
-
readonly method: Schema.String;
|
|
798
|
-
readonly cause: Schema.Defect;
|
|
799
|
-
}>, import("effect/Cause").YieldableError>;
|
|
800
|
-
declare class RpcSuccessEncodeError extends RpcSuccessEncodeError_base {
|
|
801
|
-
get message(): string;
|
|
802
|
-
}
|
|
803
|
-
/** Errors raised server-side that must survive the Cloudflare RPC wire. */
|
|
804
|
-
type WireError = RpcArgumentCountError | RpcArgumentDecodeError | RpcSuccessEncodeError;
|
|
805
|
-
declare const isWireError: (error: unknown) => error is WireError;
|
|
806
|
-
/**
|
|
807
|
-
* Encodes package RPC errors into a plain `Error` envelope so their tags
|
|
808
|
-
* survive Cloudflare RPC serialization, which drops custom error properties.
|
|
809
|
-
*/
|
|
810
|
-
declare const encodeWireError: (error: unknown) => unknown;
|
|
811
|
-
/** Restores package RPC errors from the {@link encodeWireError} envelope. */
|
|
812
|
-
declare const decodeWireError: (cause: unknown) => unknown;
|
|
813
|
-
declare const reservedMethodNames: Set<string>;
|
|
814
|
-
type ReservedMethodName$5 = "constructor" | "fetch" | "connect" | "alarm" | "webSocketMessage" | "webSocketClose" | "webSocketError" | "then" | "dup" | "dispose" | "serialize" | "deserialize";
|
|
815
|
-
type ServiceFreeSchema$2 = Schema.Codec<any, any, never, never>;
|
|
816
|
-
interface Method$3<Args extends ReadonlyArray<ServiceFreeSchema$2> = ReadonlyArray<ServiceFreeSchema$2>, Success extends ServiceFreeSchema$2 = ServiceFreeSchema$2> {
|
|
817
|
-
readonly args: Args;
|
|
818
|
-
readonly success: Success;
|
|
819
|
-
}
|
|
820
|
-
declare namespace Method$3 {
|
|
821
|
-
export type Any = Method$3<ReadonlyArray<ServiceFreeSchema$2>, ServiceFreeSchema$2>;
|
|
822
|
-
type ArgsFromSchemas<Args extends ReadonlyArray<ServiceFreeSchema$2>> = Args extends readonly [] ? [] : Args extends readonly [infer Head extends ServiceFreeSchema$2, ...infer Tail extends ReadonlyArray<ServiceFreeSchema$2>] ? [Schema.Schema.Type<Head>, ...ArgsFromSchemas<Tail>] : Array<Schema.Schema.Type<Args[number]>>;
|
|
823
|
-
/** Method schemas cross the wire through their canonical JSON codec. */
|
|
824
|
-
type EncodedArgsFromSchemas<Args extends ReadonlyArray<ServiceFreeSchema$2>> = { [Index in keyof Args]: Schema.Json; };
|
|
825
|
-
export type Args<Self extends Any> = ArgsFromSchemas<Self["args"]>;
|
|
826
|
-
export type EncodedArgs<Self extends Any> = EncodedArgsFromSchemas<Self["args"]>;
|
|
827
|
-
export type Success<Self extends Any> = Schema.Schema.Type<Self["success"]>;
|
|
828
|
-
export type EncodedSuccess<Self extends Any> = Schema.Json;
|
|
829
|
-
export {};
|
|
830
|
-
}
|
|
831
|
-
type Methods$2 = Record<string, Method$3.Any>;
|
|
832
|
-
type NoReservedMethods$2<MethodsShape extends Methods$2, Reserved extends string = ReservedMethodName$5> = Extract<keyof MethodsShape, Reserved> extends never ? MethodsShape : never;
|
|
833
|
-
interface Definition$7<Id extends string = string, MethodsShape extends Methods$2 = Methods$2> {
|
|
834
|
-
readonly id: Id;
|
|
835
|
-
readonly methods: MethodsShape;
|
|
836
|
-
}
|
|
837
|
-
declare namespace Definition$7 {
|
|
838
|
-
type Any = Definition$7<string, Methods$2>;
|
|
839
|
-
type ServerApi<Self extends Any> = { readonly [Key in keyof Self["methods"]]: (...args: Method$3.Args<Self["methods"][Key]>) => Promise<Method$3.Success<Self["methods"][Key]>>; };
|
|
840
|
-
type Api<Self extends Any, Reserved extends string = never> = Provider<ServerApi<Self>, Reserved>;
|
|
841
|
-
type MethodNames<Self extends Any> = Extract<keyof Self["methods"], string>;
|
|
842
|
-
}
|
|
843
|
-
declare const assertNoReservedMethods: (target: string, methods: Record<string, unknown>, reserved: ReadonlySet<string>) => void;
|
|
844
|
-
declare function method$2<Success extends ServiceFreeSchema$2>(definition: {
|
|
845
|
-
readonly success: Success;
|
|
846
|
-
}): Method$3<readonly [], Success>;
|
|
847
|
-
declare function method$2<const Args extends ReadonlyArray<ServiceFreeSchema$2>, Success extends ServiceFreeSchema$2>(definition: {
|
|
848
|
-
readonly args: Args;
|
|
849
|
-
readonly success: Success;
|
|
850
|
-
}): Method$3<Args, Success>;
|
|
851
|
-
declare const decodeArgs: <const Self extends Definition$7.Any, MethodName extends Definition$7.MethodNames<Self>>(definition: Self, methodName: MethodName, args: readonly unknown[]) => Effect.Effect<Self["methods"][MethodName]["args"] extends (infer T) ? T extends Self["methods"][MethodName]["args"] ? T extends readonly [] ? [] : T extends readonly [infer Head extends ServiceFreeSchema$2, ...infer Tail extends readonly ServiceFreeSchema$2[]] ? [Schema.Schema.Type<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends ServiceFreeSchema$2, ...infer Tail extends readonly ServiceFreeSchema$2[]] ? [Schema.Schema.Type<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends ServiceFreeSchema$2, ...infer Tail extends readonly ServiceFreeSchema$2[]] ? [Schema.Schema.Type<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends ServiceFreeSchema$2, ...infer Tail extends readonly ServiceFreeSchema$2[]] ? [Schema.Schema.Type<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends ServiceFreeSchema$2, ...infer Tail extends readonly ServiceFreeSchema$2[]] ? [Schema.Schema.Type<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends ServiceFreeSchema$2, ...infer Tail extends readonly ServiceFreeSchema$2[]] ? [Schema.Schema.Type<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends ServiceFreeSchema$2, ...infer Tail extends readonly ServiceFreeSchema$2[]] ? [Schema.Schema.Type<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends ServiceFreeSchema$2, ...infer Tail extends readonly ServiceFreeSchema$2[]] ? [Schema.Schema.Type<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends ServiceFreeSchema$2, ...infer Tail extends readonly ServiceFreeSchema$2[]] ? [Schema.Schema.Type<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends ServiceFreeSchema$2, ...infer Tail extends readonly ServiceFreeSchema$2[]] ? [Schema.Schema.Type<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends ServiceFreeSchema$2, ...infer Tail extends readonly ServiceFreeSchema$2[]] ? [Schema.Schema.Type<Head>, ... /*elided*/ any] : Schema.Schema.Type<Tail[number]>[]] : Schema.Schema.Type<Tail[number]>[]] : Schema.Schema.Type<Tail[number]>[]] : Schema.Schema.Type<Tail[number]>[]] : Schema.Schema.Type<Tail[number]>[]] : Schema.Schema.Type<Tail[number]>[]] : Schema.Schema.Type<Tail[number]>[]] : Schema.Schema.Type<Tail[number]>[]] : Schema.Schema.Type<Tail[number]>[]] : Schema.Schema.Type<Tail[number]>[]] : Schema.Schema.Type<T[number]>[] : never : never, RpcArgumentCountError | RpcArgumentDecodeError, never>;
|
|
852
|
-
declare const encodeArgs: <const Self extends Definition$7.Any, MethodName extends Definition$7.MethodNames<Self>>(definition: Self, methodName: MethodName, args: Self["methods"][MethodName]["args"] extends (infer T) ? T extends Self["methods"][MethodName]["args"] ? T extends readonly [] ? [] : T extends readonly [infer Head extends ServiceFreeSchema$2, ...infer Tail extends readonly ServiceFreeSchema$2[]] ? [Schema.Schema.Type<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends ServiceFreeSchema$2, ...infer Tail extends readonly ServiceFreeSchema$2[]] ? [Schema.Schema.Type<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends ServiceFreeSchema$2, ...infer Tail extends readonly ServiceFreeSchema$2[]] ? [Schema.Schema.Type<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends ServiceFreeSchema$2, ...infer Tail extends readonly ServiceFreeSchema$2[]] ? [Schema.Schema.Type<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends ServiceFreeSchema$2, ...infer Tail extends readonly ServiceFreeSchema$2[]] ? [Schema.Schema.Type<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends ServiceFreeSchema$2, ...infer Tail extends readonly ServiceFreeSchema$2[]] ? [Schema.Schema.Type<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends ServiceFreeSchema$2, ...infer Tail extends readonly ServiceFreeSchema$2[]] ? [Schema.Schema.Type<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends ServiceFreeSchema$2, ...infer Tail extends readonly ServiceFreeSchema$2[]] ? [Schema.Schema.Type<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends ServiceFreeSchema$2, ...infer Tail extends readonly ServiceFreeSchema$2[]] ? [Schema.Schema.Type<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends ServiceFreeSchema$2, ...infer Tail extends readonly ServiceFreeSchema$2[]] ? [Schema.Schema.Type<Head>, ...Tail extends readonly [] ? [] : Tail extends readonly [infer Head extends ServiceFreeSchema$2, ...infer Tail extends readonly ServiceFreeSchema$2[]] ? [Schema.Schema.Type<Head>, ... /*elided*/ any] : Schema.Schema.Type<Tail[number]>[]] : Schema.Schema.Type<Tail[number]>[]] : Schema.Schema.Type<Tail[number]>[]] : Schema.Schema.Type<Tail[number]>[]] : Schema.Schema.Type<Tail[number]>[]] : Schema.Schema.Type<Tail[number]>[]] : Schema.Schema.Type<Tail[number]>[]] : Schema.Schema.Type<Tail[number]>[]] : Schema.Schema.Type<Tail[number]>[]] : Schema.Schema.Type<Tail[number]>[]] : Schema.Schema.Type<T[number]>[] : never : never) => Effect.Effect<Self["methods"][MethodName]["args"] extends (infer T_1 extends readonly ServiceFreeSchema$2[]) ? { [Index in keyof T_1]: Schema.Json; } : never, RpcArgumentCountError | RpcArgumentEncodeError, never>;
|
|
853
|
-
declare const encodeSuccess: <const Self extends Definition$7.Any, MethodName extends Definition$7.MethodNames<Self>>(definition: Self, methodName: MethodName, value: Method$3.Success<Self["methods"][MethodName]>) => Effect.Effect<Method$3.EncodedSuccess<Self["methods"][MethodName]>, RpcSuccessEncodeError>;
|
|
854
|
-
declare const decodeSuccess: <const Self extends Definition$7.Any, MethodName extends Definition$7.MethodNames<Self>>(definition: Self, methodName: MethodName, value: unknown) => Effect.Effect<Method$3.Success<Self["methods"][MethodName]>, RpcSuccessDecodeError>;
|
|
855
|
-
declare const make$13: <Id extends string, const MethodsShape extends Methods$2>(id: Id, methods: MethodsShape) => Definition$7<Id, MethodsShape>;
|
|
856
|
-
declare namespace QueueBinding_d_exports {
|
|
857
|
-
export { MessageSendRequest, QueueBindingClient, QueueBindingDefinition, QueueMetrics, QueueOperationError, QueueProducer, QueueSendBatchOptions, QueueSendBatchResponse, QueueSendOptions, QueueSendResponse, isQueue, layer$12 as layer, makeClient$9 as makeClient };
|
|
858
|
-
}
|
|
859
|
-
type QueueSendOptions = CloudflareQueueSendOptions;
|
|
860
|
-
type QueueSendResponse = CloudflareQueueSendResponse;
|
|
861
|
-
type QueueSendBatchOptions = CloudflareQueueSendBatchOptions;
|
|
862
|
-
type QueueSendBatchResponse = CloudflareQueueSendBatchResponse;
|
|
863
|
-
type QueueMetrics = CloudflareQueueMetrics;
|
|
864
|
-
type MessageSendRequest<Body> = CloudflareMessageSendRequest<Body>;
|
|
865
|
-
type QueueProducer<Body> = Pick<CloudflareQueue<Body>, "send"> & Partial<Pick<CloudflareQueue<Body>, "sendBatch" | "metrics">>;
|
|
866
|
-
interface QueueBindingDefinition<Message extends ServiceFreeSchema$2> {
|
|
867
|
-
/** Binding name as configured in `wrangler.jsonc`. */
|
|
868
|
-
readonly binding: string;
|
|
869
|
-
/** Codec used to encode messages before sending them to Cloudflare Queues. */
|
|
870
|
-
readonly message: Message;
|
|
871
|
-
}
|
|
872
|
-
interface QueueBindingClient<Message extends ServiceFreeSchema$2> {
|
|
873
|
-
readonly send: (message: Schema.Schema.Type<Message>, options?: QueueSendOptions) => Effect.Effect<void, QueueOperationError | Schema.SchemaError>;
|
|
874
|
-
readonly sendBatch: (messages: Iterable<MessageSendRequest<Schema.Schema.Type<Message>>>, options?: QueueSendBatchOptions) => Effect.Effect<void, QueueOperationError | Schema.SchemaError>;
|
|
875
|
-
readonly metrics: () => Effect.Effect<QueueMetrics, QueueOperationError>;
|
|
876
|
-
readonly rawUnsafe: Effect.Effect<CloudflareQueue<Schema.Codec.Encoded<Message>>>;
|
|
877
|
-
}
|
|
878
|
-
declare const QueueOperationError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
879
|
-
readonly _tag: "QueueOperationError";
|
|
880
|
-
} & Readonly<A>;
|
|
881
|
-
declare class QueueOperationError extends QueueOperationError_base<{
|
|
882
|
-
readonly binding: string;
|
|
883
|
-
readonly operation: string;
|
|
884
|
-
readonly cause: unknown;
|
|
885
|
-
readonly message: string;
|
|
886
|
-
}> {}
|
|
887
|
-
declare const isQueue: <Body>(value: unknown) => value is QueueProducer<Body>;
|
|
888
|
-
declare const makeClient$9: <Message extends ServiceFreeSchema$2>(definition: QueueBindingDefinition<Message>) => ((queue: QueueProducer<Schema.Codec.Encoded<Message>>) => QueueBindingClient<Message>);
|
|
889
|
-
declare const layer$12: <Self, Message extends ServiceFreeSchema$2>(tag: Context.Service<Self, QueueBindingClient<Message>>, definition: QueueBindingDefinition<Message>) => import("effect/Layer").Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
890
|
-
declare namespace QueueDefinition_d_exports {
|
|
891
|
-
export { Definition$6 as Definition, Handler$3 as Handler, LayerOptions$13 as LayerOptions, Options$5 as Options, Queue$1 as Queue, Tag$12 as Tag, TagClass$11 as TagClass, implement$5 as implement, make$12 as make };
|
|
892
|
-
}
|
|
893
|
-
interface Definition$6<Id extends string = string, Message extends ServiceFreeSchema$2 = ServiceFreeSchema$2> {
|
|
894
|
-
readonly id: Id;
|
|
895
|
-
readonly message: Message;
|
|
896
|
-
}
|
|
897
|
-
declare namespace Definition$6 {
|
|
898
|
-
type Any = Definition$6<string, ServiceFreeSchema$2>;
|
|
899
|
-
}
|
|
900
|
-
type Handler$3<ROut, Self extends Definition$6.Any> = (batch: QueueBatch<Schema.Schema.Type<Self["message"]>>) => Effect.Effect<void, unknown, ExecutionContext | WorkerContext | WorkerEnvironment | Scope.Scope | ROut>;
|
|
901
|
-
interface Options$5<ROut, Self extends Definition$6.Any> extends Omit<WorkerOptions<ROut, Record<never, never>>, "queue" | "rpc"> {
|
|
902
|
-
readonly queue: Handler$3<ROut, Self>;
|
|
903
|
-
readonly rpc?: never;
|
|
904
|
-
}
|
|
905
|
-
type LayerOptions$13 = {
|
|
906
|
-
readonly binding: string;
|
|
907
|
-
};
|
|
908
|
-
interface TagClass$11<Self, Id extends string, Message extends ServiceFreeSchema$2> extends Context.ServiceClass<Self, `effect-cf/Queue/${Id}`, QueueBindingClient<Message>> {
|
|
909
|
-
readonly id: Id;
|
|
910
|
-
readonly message: Message;
|
|
911
|
-
readonly make: <ROut, LayerError>(layer: Layer.Layer<ROut, LayerError, ExecutionContext | WorkerContext | WorkerEnvironment>, options: Options$5<ROut, Definition$6<Id, Message>>) => WorkerClass<Record<never, never>, ROut>;
|
|
912
|
-
readonly layer: (options: LayerOptions$13) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
913
|
-
readonly send: (message: Schema.Schema.Type<Message>, options?: QueueSendOptions) => Effect.Effect<void, QueueOperationError | Schema.SchemaError, Self>;
|
|
914
|
-
readonly sendBatch: (messages: Iterable<MessageSendRequest<Schema.Schema.Type<Message>>>, options?: QueueSendBatchOptions) => Effect.Effect<void, QueueOperationError | Schema.SchemaError, Self>;
|
|
915
|
-
readonly metrics: () => Effect.Effect<QueueMetrics, QueueOperationError, Self>;
|
|
916
|
-
readonly rawUnsafe: Effect.Effect<globalThis.Queue<Schema.Codec.Encoded<Message>>, never, Self>;
|
|
917
|
-
}
|
|
918
|
-
declare const make$12: <Id extends string, Message extends ServiceFreeSchema$2>(id: Id, definition: {
|
|
919
|
-
readonly message: Message;
|
|
920
|
-
}) => TagClass$11<Definition$6<Id, Message>, Id, Message>;
|
|
921
|
-
declare const Tag$12: <Self>() => <Id extends string, Message extends ServiceFreeSchema$2>(id: Id, definition: {
|
|
922
|
-
readonly message: Message;
|
|
923
|
-
}) => TagClass$11<Self, Id, Message>;
|
|
924
|
-
declare const Queue$1: typeof Tag$12;
|
|
925
|
-
declare const implement$5: <ROut, const Self extends Definition$6.Any>(_definition: Self, handler: Handler$3<ROut, Self>) => Handler$3<ROut, Self>;
|
|
926
|
-
declare namespace Queue_d_exports {
|
|
927
|
-
export { Definition$5 as Definition, Handler$2 as Handler, LayerOptions$12 as LayerOptions, Options$4 as Options, QueueBatch, QueueHandler, QueueMessage, QueueMessageDecodeError, QueueOptions, Tag$11 as Tag, TagClass$10 as TagClass, decodeBatch, fromMessage, fromMessageBatch, implement$4 as implement };
|
|
928
|
-
}
|
|
929
|
-
interface QueueMessage<Body> {
|
|
930
|
-
readonly raw: globalThis.Message<unknown>;
|
|
931
|
-
readonly id: string;
|
|
932
|
-
readonly timestamp: Date;
|
|
933
|
-
readonly body: Body;
|
|
934
|
-
readonly attempts: number;
|
|
935
|
-
readonly ack: Effect.Effect<void>;
|
|
936
|
-
readonly retry: (options?: globalThis.QueueRetryOptions) => Effect.Effect<void>;
|
|
937
|
-
}
|
|
938
|
-
interface QueueBatch<Body> {
|
|
939
|
-
readonly raw: globalThis.MessageBatch<unknown>;
|
|
940
|
-
readonly messages: ReadonlyArray<QueueMessage<Body>>;
|
|
941
|
-
readonly queue: string;
|
|
942
|
-
readonly metadata: globalThis.MessageBatchMetadata;
|
|
943
|
-
readonly ackAll: Effect.Effect<void>;
|
|
944
|
-
readonly retryAll: (options?: globalThis.QueueRetryOptions) => Effect.Effect<void>;
|
|
945
|
-
}
|
|
946
|
-
declare const QueueMessageDecodeError_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 & {
|
|
947
|
-
readonly _tag: "QueueMessageDecodeError";
|
|
948
|
-
} & Readonly<A>;
|
|
949
|
-
declare class QueueMessageDecodeError extends QueueMessageDecodeError_base<{
|
|
950
|
-
readonly queue: string;
|
|
951
|
-
readonly messageId: string;
|
|
952
|
-
readonly index: number;
|
|
953
|
-
readonly cause: unknown;
|
|
954
|
-
}> {
|
|
955
|
-
get message(): string;
|
|
956
|
-
}
|
|
957
|
-
type RuntimeContext$2<ROut> = ExecutionContext | WorkerContext | WorkerEnvironment | ROut;
|
|
958
|
-
type QueueHandlerContext<ROut> = RuntimeContext$2<ROut> | Scope.Scope;
|
|
959
|
-
type QueueHandler<ROut, Body = unknown> = (batch: QueueBatch<Body>) => Effect.Effect<void, unknown, QueueHandlerContext<ROut>>;
|
|
960
|
-
interface QueueOptions<ROut, Body = unknown> {
|
|
961
|
-
readonly queue: QueueHandler<ROut, Body>;
|
|
962
|
-
}
|
|
963
|
-
declare const fromMessage: <Body>(message: globalThis.Message<unknown>, body: Body) => {
|
|
964
|
-
raw: Message<unknown>;
|
|
965
|
-
id: string;
|
|
966
|
-
timestamp: Date;
|
|
967
|
-
body: Body;
|
|
968
|
-
attempts: number;
|
|
969
|
-
ack: Effect.Effect<void, never, never>;
|
|
970
|
-
retry: (options?: globalThis.QueueRetryOptions) => Effect.Effect<void, never, never>;
|
|
971
|
-
};
|
|
972
|
-
declare const fromMessageBatch: <Body>(batch: globalThis.MessageBatch<unknown>, messages: ReadonlyArray<QueueMessage<Body>>) => QueueBatch<Body>;
|
|
973
|
-
declare const decodeBatch: <Body>(batch: globalThis.MessageBatch<unknown>, decodeBody: (body: unknown) => Effect.Effect<Body, unknown>) => Effect.Effect<QueueBatch<Body>, QueueMessageDecodeError>;
|
|
974
|
-
type Definition$5<Id extends string = string, Message extends Definition$6.Any["message"] = Definition$6.Any["message"]> = Definition$6<Id, Message>;
|
|
975
|
-
declare namespace Definition$5 {
|
|
976
|
-
type Any = Definition$6.Any;
|
|
977
|
-
}
|
|
978
|
-
type LayerOptions$12 = LayerOptions$13;
|
|
979
|
-
type TagClass$10<Self, Id extends string, Message extends Definition$6.Any["message"]> = TagClass$11<Self, Id, Message>;
|
|
980
|
-
declare const Tag$11: <Self>() => <Id extends string, Message extends Definition$6.Any["message"]>(id: Id, definition: {
|
|
981
|
-
readonly message: Message;
|
|
982
|
-
}) => TagClass$10<Self, Id, Message>;
|
|
983
|
-
declare const implement$4: typeof implement$5;
|
|
984
|
-
type Handler$2<ROut, Self extends Definition$6.Any> = Handler$3<ROut, Self>;
|
|
985
|
-
type Options$4<ROut, Self extends Definition$6.Any> = Options$5<ROut, Self>;
|
|
986
|
-
//#endregion
|
|
987
|
-
//#region src/internal/RpcInvocation.d.ts
|
|
988
|
-
type AnyArgs = Array<any>;
|
|
989
|
-
type AsyncMethodKey<Api> = { [Key in keyof Api]-?: Key extends string ? Api[Key] extends ((...args: AnyArgs) => Promise<unknown>) ? Key : never : never; }[keyof Api];
|
|
990
|
-
type AsyncMethodArgs<Api, Method extends keyof Api> = Api[Method] extends ((...args: infer Args) => Promise<unknown>) ? Args : never;
|
|
991
|
-
type AsyncMethodSuccess<Api, Method extends keyof Api> = Api[Method] extends ((...args: AnyArgs) => Promise<infer A>) ? A : never;
|
|
992
|
-
type AsyncMethodCloudflareReturn<Api, Method extends keyof Api> = Result$1<AsyncMethodSuccess<Api, Method>>;
|
|
993
|
-
declare namespace ServiceBinding_d_exports {
|
|
994
|
-
export { Service$1 as Service, ServiceBindingClient, ServiceBindingDefinition, ServiceBindingEffectClient, ServiceBindingFetchError, ServiceBindingRpcError, ServiceBindingStaticClient, ServiceFetcher, isServiceBindingClient, layer$11 as layer, makeClient$8 as makeClient, makeDirectMethods$1 as makeDirectMethods };
|
|
995
|
-
}
|
|
996
|
-
declare const TypeId$2: "effect-cf/ServiceBinding";
|
|
997
|
-
/**
|
|
998
|
-
* Minimum shape for a Cloudflare service binding.
|
|
999
|
-
*/
|
|
1000
|
-
interface ServiceFetcher {
|
|
1001
|
-
fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
|
|
1002
|
-
}
|
|
1003
|
-
type RpcClient$1<Api> = { readonly [Key in keyof Api as Key extends string ? Api[Key] extends ((...args: Array<any>) => unknown) ? Key : never : never]: Api[Key]; };
|
|
1004
|
-
type ReservedMethodName$4 = ReservedMethodName$3 | "fetch";
|
|
1005
|
-
/**
|
|
1006
|
-
* Native Cloudflare service object including optional RPC methods.
|
|
1007
|
-
*/
|
|
1008
|
-
type ServiceBindingClient<Api extends object> = ServiceFetcher & RpcClient$1<Provider<Api, ReservedMethodName$4>>;
|
|
1009
|
-
type ApiFromDefinition<Definition> = Definition extends Definition$4.Any ? ServerApi$2<Definition> : never;
|
|
1010
|
-
type ApiOrDefinition<Api extends object, Definition> = [Api] extends [never] ? ApiFromDefinition<Definition> : Api;
|
|
1011
|
-
/**
|
|
1012
|
-
* Binding metadata used to create an Effect service from a Worker binding.
|
|
1013
|
-
*/
|
|
1014
|
-
interface ServiceBindingDefinition<Definition extends Definition$4.Any | undefined = undefined> {
|
|
1015
|
-
/** Binding name as configured in `wrangler.jsonc`. */
|
|
1016
|
-
readonly binding: string;
|
|
1017
|
-
/** Optional RPC schema used for argument/result encoding. */
|
|
1018
|
-
readonly definition?: Definition;
|
|
1019
|
-
}
|
|
1020
|
-
declare const ServiceBindingFetchError_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 & {
|
|
1021
|
-
readonly _tag: "ServiceBindingFetchError";
|
|
1022
|
-
} & Readonly<A>;
|
|
1023
|
-
/**
|
|
1024
|
-
* Failure raised when calling `fetch` on a service binding.
|
|
1025
|
-
*/
|
|
1026
|
-
declare class ServiceBindingFetchError extends ServiceBindingFetchError_base<{
|
|
1027
|
-
readonly binding: string;
|
|
1028
|
-
readonly cause: unknown;
|
|
1029
|
-
}> {
|
|
1030
|
-
get message(): string;
|
|
1031
|
-
}
|
|
1032
|
-
declare const ServiceBindingRpcError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
1033
|
-
readonly _tag: "ServiceBindingRpcError";
|
|
1034
|
-
} & Readonly<A>;
|
|
1035
|
-
/**
|
|
1036
|
-
* Failure raised when invoking an RPC method on a service binding.
|
|
1037
|
-
*/
|
|
1038
|
-
declare class ServiceBindingRpcError extends ServiceBindingRpcError_base<{
|
|
1039
|
-
readonly binding: string;
|
|
1040
|
-
readonly method: string;
|
|
1041
|
-
readonly cause: unknown;
|
|
1042
|
-
}> {
|
|
1043
|
-
get message(): string;
|
|
1044
|
-
}
|
|
1045
|
-
type ServiceMethodKey<Api> = AsyncMethodKey<Api>;
|
|
1046
|
-
type ServiceMethodArgs<Api, Method extends keyof Api> = AsyncMethodArgs<Api, Method>;
|
|
1047
|
-
type ServiceMethodSuccess<Api, Method extends keyof Api> = AsyncMethodSuccess<Api, Method>;
|
|
1048
|
-
type ServiceMethodCloudflareReturn<Api, Method extends keyof Api> = AsyncMethodCloudflareReturn<Api, Method>;
|
|
1049
|
-
type ServiceCall<R, Api> = <Method extends ServiceMethodKey<Api>>(method: Method, ...args: ServiceMethodArgs<Api, Method>) => Effect.Effect<ServiceMethodSuccess<Api, Method>, ServiceBindingRpcError, R>;
|
|
1050
|
-
type DefinitionDirectMethods<R, Definition extends Definition$4.Any> = { readonly [Method in Definition$7.MethodNames<Definition>]: (...args: Method$3.Args<Definition["methods"][Method]>) => Effect.Effect<Method$3.Success<Definition["methods"][Method]>, ServiceBindingRpcError, R>; };
|
|
1051
|
-
type DirectMethods$1<R, Definition> = Definition extends Definition$4.Any ? DefinitionDirectMethods<R, Definition> : {};
|
|
1052
|
-
type ServiceBindingEffectClient<Api extends object, Definition extends Definition$4.Any | undefined = undefined> = DirectMethods$1<never, Definition> & {
|
|
1053
|
-
/**
|
|
1054
|
-
* Forwards an HTTP request to the bound Worker service.
|
|
1055
|
-
*
|
|
1056
|
-
* Use this when the service binding is acting as an HTTP origin rather than a
|
|
1057
|
-
* Cloudflare RPC target.
|
|
1058
|
-
*
|
|
1059
|
-
* @example
|
|
1060
|
-
* ```ts
|
|
1061
|
-
* import { Effect } from "effect";
|
|
1062
|
-
*
|
|
1063
|
-
* const program = Effect.gen(function* () {
|
|
1064
|
-
* const api = yield* ApiWorker;
|
|
1065
|
-
* return yield* api.fetch(new Request("https://internal.example/users"));
|
|
1066
|
-
* });
|
|
1067
|
-
* ```
|
|
1068
|
-
*/
|
|
1069
|
-
readonly fetch: (input: RequestInfo | URL, init?: RequestInit) => Effect.Effect<globalThis.Response, ServiceBindingFetchError>;
|
|
1070
|
-
/**
|
|
1071
|
-
* Invokes a Worker RPC method and returns Cloudflare's raw RPC result.
|
|
1072
|
-
*
|
|
1073
|
-
* This preserves Cloudflare RPC behavior such as promise-like pipelining and
|
|
1074
|
-
* transferable / disposable result objects. It does not resolve the returned
|
|
1075
|
-
* promise-like value and it does not decode definition-backed success schemas.
|
|
1076
|
-
*
|
|
1077
|
-
* Most application code should use {@link call} instead.
|
|
1078
|
-
*
|
|
1079
|
-
* @example
|
|
1080
|
-
* ```ts
|
|
1081
|
-
* import { Effect } from "effect";
|
|
1082
|
-
*
|
|
1083
|
-
* const program = Effect.gen(function* () {
|
|
1084
|
-
* const counter = yield* CounterService;
|
|
1085
|
-
*
|
|
1086
|
-
* const result = yield* counter.rpc("increment", 41);
|
|
1087
|
-
* const value = yield* Effect.promise(() => result);
|
|
1088
|
-
*
|
|
1089
|
-
* return value;
|
|
1090
|
-
* });
|
|
1091
|
-
* ```
|
|
1092
|
-
*/
|
|
1093
|
-
readonly rpc: <Method extends ServiceMethodKey<Api>>(method: Method, ...args: ServiceMethodArgs<Api, Method>) => Effect.Effect<ServiceMethodCloudflareReturn<Api, Method>, ServiceBindingRpcError>;
|
|
1094
|
-
/**
|
|
1095
|
-
* Invokes a Worker RPC method, resolves Cloudflare's RPC result, and decodes
|
|
1096
|
-
* the success value when the binding was created from a definition.
|
|
1097
|
-
*
|
|
1098
|
-
* This is the normal choice when application code wants the final typed value.
|
|
1099
|
-
*
|
|
1100
|
-
* @example
|
|
1101
|
-
* ```ts
|
|
1102
|
-
* import { Effect } from "effect";
|
|
1103
|
-
*
|
|
1104
|
-
* const program = Effect.gen(function* () {
|
|
1105
|
-
* const counter = yield* CounterService;
|
|
1106
|
-
* const value = yield* counter.call("increment", 41);
|
|
1107
|
-
*
|
|
1108
|
-
* return value;
|
|
1109
|
-
* });
|
|
1110
|
-
* ```
|
|
1111
|
-
*/
|
|
1112
|
-
readonly call: <Method extends ServiceMethodKey<Api>>(method: Method, ...args: ServiceMethodArgs<Api, Method>) => Effect.Effect<ServiceMethodSuccess<Api, Method>, ServiceBindingRpcError>;
|
|
1113
|
-
/**
|
|
1114
|
-
* Invokes a Worker RPC method in the current `Scope`, resolves Cloudflare's RPC
|
|
1115
|
-
* result, decodes definition-backed success values, and disposes the resolved
|
|
1116
|
-
* result when the scope closes if it implements `Symbol.dispose`.
|
|
1117
|
-
*
|
|
1118
|
-
* Use this for RPC methods that return Cloudflare RPC resources or other
|
|
1119
|
-
* disposable objects whose lifetime should be tied to an Effect scope.
|
|
1120
|
-
*
|
|
1121
|
-
* @example
|
|
1122
|
-
* ```ts
|
|
1123
|
-
* import { Effect } from "effect";
|
|
1124
|
-
*
|
|
1125
|
-
* const program = Effect.scoped(
|
|
1126
|
-
* Effect.gen(function* () {
|
|
1127
|
-
* const files = yield* FileService;
|
|
1128
|
-
* const handle = yield* files.scopedCall("open", "report.csv");
|
|
1129
|
-
*
|
|
1130
|
-
* return yield* handle.read();
|
|
1131
|
-
* }),
|
|
1132
|
-
* );
|
|
1133
|
-
* ```
|
|
1134
|
-
*/
|
|
1135
|
-
readonly scopedCall: <Method extends ServiceMethodKey<Api>>(method: Method, ...args: ServiceMethodArgs<Api, Method>) => Effect.Effect<Awaited<ServiceMethodSuccess<Api, Method>>, unknown, Scope.Scope>;
|
|
1136
|
-
};
|
|
1137
|
-
type ServiceBindingStaticClient<R, Api extends object, Definition extends Definition$4.Any | undefined = undefined> = DirectMethods$1<R, Definition> & {
|
|
1138
|
-
readonly fetch: (input: RequestInfo | URL, init?: RequestInit) => Effect.Effect<globalThis.Response, ServiceBindingFetchError, R>;
|
|
1139
|
-
readonly rpc: <Method extends ServiceMethodKey<Api>>(method: Method, ...args: ServiceMethodArgs<Api, Method>) => Effect.Effect<ServiceMethodCloudflareReturn<Api, Method>, ServiceBindingRpcError, R>;
|
|
1140
|
-
readonly call: <Method extends ServiceMethodKey<Api>>(method: Method, ...args: ServiceMethodArgs<Api, Method>) => Effect.Effect<ServiceMethodSuccess<Api, Method>, ServiceBindingRpcError, R>;
|
|
1141
|
-
readonly scopedCall: <Method extends ServiceMethodKey<Api>>(method: Method, ...args: ServiceMethodArgs<Api, Method>) => Effect.Effect<Awaited<ServiceMethodSuccess<Api, Method>>, unknown, Scope.Scope | R>;
|
|
1142
|
-
};
|
|
1143
|
-
declare const isServiceBindingClient: <Api extends object>(value: unknown) => value is ServiceBindingClient<Api>;
|
|
1144
|
-
declare const makeClient$8: <Api extends object, const Definition extends Definition$4.Any | undefined = undefined>(definition: ServiceBindingDefinition<Definition>) => ((service: ServiceBindingClient<Api>) => ServiceBindingEffectClient<Api, Definition>);
|
|
1145
|
-
declare const layer$11: <Self, Api extends object, const Definition extends Definition$4.Any | undefined = undefined>(tag: Context.Service<Self, ServiceBindingEffectClient<Api, Definition>>, definition: ServiceBindingDefinition<Definition>) => import("effect/Layer").Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
1146
|
-
/**
|
|
1147
|
-
* Creates a typed Effect service for a Worker service binding.
|
|
1148
|
-
*
|
|
1149
|
-
* Returned value includes:
|
|
1150
|
-
* - a Context tag for dependency injection
|
|
1151
|
-
* - `fetch(...)` for raw HTTP forwarding
|
|
1152
|
-
* - `rpc(...)` for raw Cloudflare RPC results
|
|
1153
|
-
* - `call(...)` for resolved and decoded RPC results
|
|
1154
|
-
* - `scopedCall(...)` for scoped and decoded disposable RPC results
|
|
1155
|
-
* - direct RPC methods when `definition` is provided
|
|
1156
|
-
*
|
|
1157
|
-
* @example
|
|
1158
|
-
* ```ts
|
|
1159
|
-
* const Counter = WorkerDefinition.make("Counter", {
|
|
1160
|
-
* increment: WorkerDefinition.method({
|
|
1161
|
-
* args: [Schema.Number],
|
|
1162
|
-
* success: Schema.Number,
|
|
1163
|
-
* }),
|
|
1164
|
-
* });
|
|
1165
|
-
*
|
|
1166
|
-
* const CounterLive = Counter.layer({ binding: "COUNTER" });
|
|
1167
|
-
*
|
|
1168
|
-
* const program = Effect.gen(function* () {
|
|
1169
|
-
* const counter = yield* Counter;
|
|
1170
|
-
* const next = yield* counter.increment(1);
|
|
1171
|
-
* return next;
|
|
1172
|
-
* });
|
|
1173
|
-
* ```
|
|
1174
|
-
*/
|
|
1175
|
-
declare const Service$1: <Self, Api extends object = never>() => <Id extends string, const Definition extends Definition$4.Any | undefined = undefined>(id: Id, definition: ServiceBindingDefinition<Definition>) => BindingService<Self, Id, ServiceBindingEffectClient<ApiOrDefinition<Api, Definition>, Definition>> & DirectMethods$1<Self, Definition> & {
|
|
1176
|
-
readonly [TypeId$2]: typeof TypeId$2;
|
|
1177
|
-
readonly definition: ServiceBindingDefinition<Definition>;
|
|
1178
|
-
readonly fetch: (input: URL | RequestInfo<unknown, CfProperties<unknown>>, init?: RequestInit<CfProperties<unknown>> | undefined) => Effect.Effect<Response, ServiceBindingFetchError, Self>;
|
|
1179
|
-
readonly rpc: <Method extends ServiceMethodKey<ApiOrDefinition<Api, Definition>>>(method: Method, ...args: AsyncMethodArgs<ApiOrDefinition<Api, Definition>, Method>) => Effect.Effect<Result$1<AsyncMethodSuccess<ApiOrDefinition<Api, Definition>, Method>>, ServiceBindingRpcError, Self>;
|
|
1180
|
-
readonly call: <Method extends ServiceMethodKey<ApiOrDefinition<Api, Definition>>>(method: Method, ...args: AsyncMethodArgs<ApiOrDefinition<Api, Definition>, Method>) => Effect.Effect<AsyncMethodSuccess<ApiOrDefinition<Api, Definition>, Method>, ServiceBindingRpcError, Self>;
|
|
1181
|
-
readonly scopedCall: <Method extends ServiceMethodKey<ApiOrDefinition<Api, Definition>>>(method: Method, ...args: AsyncMethodArgs<ApiOrDefinition<Api, Definition>, Method>) => Effect.Effect<Awaited<AsyncMethodSuccess<ApiOrDefinition<Api, Definition>, Method>>, unknown, Self | Scope.Scope>;
|
|
1182
|
-
};
|
|
1183
|
-
declare const makeDirectMethods$1: <R, Api, Definition extends Definition$4.Any | undefined>(rpcDefinition: Definition | undefined, call: ServiceCall<R, Api>) => DirectMethods$1<R, Definition>;
|
|
1184
|
-
declare namespace WorkerDefinition_d_exports {
|
|
1185
|
-
export { Api$1 as Api, Definition$4 as Definition, HandlerEffect$1 as HandlerEffect, Handlers$1 as Handlers, LayerOptions$11 as LayerOptions, Method$2 as Method, Methods$1 as Methods, NoReservedMethods$1 as NoReservedMethods, Options$3 as Options, ReservedMethodName$3 as ReservedMethodName, ServerApi$2 as ServerApi, ServiceFreeSchema$1 as ServiceFreeSchema, Tag$10 as Tag, TagClass$9 as TagClass, Worker, implement$3 as implement, make$11 as make, method$1 as method };
|
|
1186
|
-
}
|
|
1187
|
-
type ServiceFreeSchema$1 = Schema.Codec<any, any, never, never>;
|
|
1188
|
-
interface Method$2<Args extends ReadonlyArray<ServiceFreeSchema$1> = ReadonlyArray<ServiceFreeSchema$1>, Success extends ServiceFreeSchema$1 = ServiceFreeSchema$1> {
|
|
1189
|
-
readonly args: Args;
|
|
1190
|
-
readonly success: Success;
|
|
1191
|
-
}
|
|
1192
|
-
declare namespace Method$2 {
|
|
1193
|
-
export type Any = Method$2<ReadonlyArray<ServiceFreeSchema$1>, ServiceFreeSchema$1>;
|
|
1194
|
-
type ArgsFromSchemas<Args extends ReadonlyArray<ServiceFreeSchema$1>> = Args extends readonly [] ? [] : Args extends readonly [infer Head extends ServiceFreeSchema$1, ...infer Tail extends ReadonlyArray<ServiceFreeSchema$1>] ? [Schema.Schema.Type<Head>, ...ArgsFromSchemas<Tail>] : Array<Schema.Schema.Type<Args[number]>>;
|
|
1195
|
-
/** Method schemas cross the wire through their canonical JSON codec. */
|
|
1196
|
-
type EncodedArgsFromSchemas<Args extends ReadonlyArray<ServiceFreeSchema$1>> = { [Index in keyof Args]: Schema.Json; };
|
|
1197
|
-
export type Args<Self extends Any> = ArgsFromSchemas<Self["args"]>;
|
|
1198
|
-
export type EncodedArgs<Self extends Any> = EncodedArgsFromSchemas<Self["args"]>;
|
|
1199
|
-
export type Success<Self extends Any> = Schema.Schema.Type<Self["success"]>;
|
|
1200
|
-
export type EncodedSuccess<Self extends Any> = Schema.Json;
|
|
1201
|
-
export {};
|
|
1202
|
-
}
|
|
1203
|
-
type Methods$1 = Record<string, Method$2.Any>;
|
|
1204
|
-
/**
|
|
1205
|
-
* RPC contract for a Worker service.
|
|
1206
|
-
*
|
|
1207
|
-
* Create with {@link make} and reuse to type both worker implementations and
|
|
1208
|
-
* service bindings in other workers.
|
|
1209
|
-
*/
|
|
1210
|
-
interface Definition$4<Id extends string = string, MethodsShape extends Methods$1 = Methods$1> {
|
|
1211
|
-
readonly id: Id;
|
|
1212
|
-
readonly methods: MethodsShape;
|
|
1213
|
-
}
|
|
1214
|
-
declare namespace Definition$4 {
|
|
1215
|
-
type Any = Definition$4<string, Methods$1>;
|
|
1216
|
-
}
|
|
1217
|
-
type ReservedMethodName$3 = ReservedMethodName$2;
|
|
1218
|
-
type NoReservedMethods$1<MethodsShape extends Methods$1> = Extract<keyof MethodsShape, ReservedMethodName$3> extends never ? MethodsShape : never;
|
|
1219
|
-
/**
|
|
1220
|
-
* Promise-based client API derived from a {@link Definition}.
|
|
1221
|
-
*/
|
|
1222
|
-
type ServerApi$2<Self extends Definition$4.Any> = { readonly [Key in keyof Self["methods"]]: (...args: Method$2.Args<Self["methods"][Key]>) => Promise<Method$2.Success<Self["methods"][Key]>>; };
|
|
1223
|
-
type Api$1<Self extends Definition$4.Any> = Provider<ServerApi$2<Self>, ReservedMethodName$3>;
|
|
1224
|
-
/**
|
|
1225
|
-
* Effect handlers for each RPC method in a worker definition.
|
|
1226
|
-
*/
|
|
1227
|
-
type Handlers$1<ROut, Self extends Definition$4.Any> = { readonly [Key in keyof Self["methods"]]: (...args: Method$2.Args<Self["methods"][Key]>) => WorkerRpcHandler<ROut, Method$2.Success<Self["methods"][Key]>>; };
|
|
1228
|
-
/**
|
|
1229
|
-
* Worker constructor options for a specific RPC definition.
|
|
1230
|
-
*/
|
|
1231
|
-
interface Options$3<ROut, Self extends Definition$4.Any, REvent = never, EventLayerError = never> extends Omit<WorkerOptions<ROut, REvent, EventLayerError, Handlers$1<ROut | REvent, Self>>, "rpc"> {
|
|
1232
|
-
readonly rpc: Handlers$1<ROut | REvent, Self>;
|
|
1233
|
-
}
|
|
1234
|
-
type LayerOptions$11 = {
|
|
1235
|
-
readonly binding: string;
|
|
1236
|
-
};
|
|
1237
|
-
type TagClass$9<Self, Id extends string, MethodsShape extends Methods$1> = Context.ServiceClass<Self, Id, ServiceBindingEffectClient<Api$1<Definition$4<Id, MethodsShape>>, Definition$4<Id, MethodsShape>>> & ServiceBindingStaticClient<Self, Api$1<Definition$4<Id, MethodsShape>>, Definition$4<Id, MethodsShape>> & {
|
|
1238
|
-
readonly id: Id;
|
|
1239
|
-
readonly methods: MethodsShape;
|
|
1240
|
-
readonly make: <ROut, LayerError, REvent = never, EventLayerError = never>(layer: Layer.Layer<ROut, LayerError, ExecutionContext | WorkerContext | WorkerEnvironment>, options: Options$3<ROut, Definition$4<Id, MethodsShape>, REvent, EventLayerError>) => WorkerClass<Handlers$1<ROut | REvent, Definition$4<Id, MethodsShape>>, ROut | REvent>;
|
|
1241
|
-
readonly layer: (options: LayerOptions$11) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
1242
|
-
};
|
|
1243
|
-
/**
|
|
1244
|
-
* Defines a single RPC method schema in a worker definition.
|
|
1245
|
-
*/
|
|
1246
|
-
declare const method$1: {
|
|
1247
|
-
<Success extends ServiceFreeSchema$1>(definition: {
|
|
1248
|
-
readonly success: Success;
|
|
1249
|
-
}): Method$2<readonly [], Success>;
|
|
1250
|
-
<const Args extends ReadonlyArray<ServiceFreeSchema$1>, Success extends ServiceFreeSchema$1>(definition: {
|
|
1251
|
-
readonly args: Args;
|
|
1252
|
-
readonly success: Success;
|
|
1253
|
-
}): Method$2<Args, Success>;
|
|
1254
|
-
};
|
|
1255
|
-
declare const make$11: <Id extends string, const MethodsShape extends Methods$1>(id: Id, methods: MethodsShape & NoReservedMethods$1<MethodsShape>) => TagClass$9<Definition$4<Id, MethodsShape>, Id, MethodsShape>;
|
|
1256
|
-
declare const Tag$10: <Self>() => <Id extends string, const MethodsShape extends Methods$1>(id: Id, methods: MethodsShape & NoReservedMethods$1<MethodsShape>) => TagClass$9<Self, Id, MethodsShape>;
|
|
1257
|
-
declare const Worker: typeof Tag$10;
|
|
1258
|
-
/**
|
|
1259
|
-
* Helper for implementing handlers with the exact method shape of a definition.
|
|
1260
|
-
*/
|
|
1261
|
-
declare const implement$3: <ROut, const Self extends Definition$4.Any>(_definition: Self, handlers: Handlers$1<ROut, Self>) => Handlers$1<ROut, Self>;
|
|
1262
|
-
/**
|
|
1263
|
-
* Convenience alias for a single worker RPC handler Effect.
|
|
1264
|
-
*/
|
|
1265
|
-
type HandlerEffect$1<ROut, Self extends Definition$4.Any, Key extends keyof Self["methods"]> = WorkerRpcHandler<ROut, Method$2.Success<Self["methods"][Key]>>;
|
|
1266
|
-
declare namespace Worker_d_exports {
|
|
1267
|
-
export { Api$1 as Api, Definition$4 as Definition, ExecutionContext, FetchHandler, FetchWorkerOptions, HandlerEffect$1 as HandlerEffect, Handlers$1 as Handlers, LayerOptions$11 as LayerOptions, Method$2 as Method, Methods$1 as Methods, NativeRequest, NoReservedMethods$1 as NoReservedMethods, Options$3 as Options, ReservedMethodName$2 as ReservedMethodName, RpcHandlers$1 as RpcHandlers, ServerApi$2 as ServerApi, ServiceFreeSchema$1 as ServiceFreeSchema, Tag$10 as Tag, TagClass$9 as TagClass, WorkerClass, WorkerContext, WorkerContextService, WorkerContextWaitUntilOptions, WorkerFetchSuccess, WorkerHandler, WorkerOptions, WorkerRpc, WorkerRpcHandler, WorkerRpcShape, implement$3 as implement, isWebSocketUpgrade, make$10 as make, makeFetchHandler, method$1 as method };
|
|
1268
|
-
}
|
|
1269
|
-
declare const ExecutionContext_base: Context.ServiceClass<ExecutionContext, "effect-cf/ExecutionContext", globalThis.ExecutionContext<unknown>>;
|
|
1270
|
-
/**
|
|
1271
|
-
* Access to Cloudflare's native `ExecutionContext`.
|
|
1272
|
-
*/
|
|
1273
|
-
declare class ExecutionContext extends ExecutionContext_base {}
|
|
1274
|
-
/**
|
|
1275
|
-
* Options for {@link WorkerContextService.waitUntil}.
|
|
1276
|
-
*/
|
|
1277
|
-
interface WorkerContextWaitUntilOptions<E, R> {
|
|
1278
|
-
/**
|
|
1279
|
-
* Failure mode for the background effect: `"observe"` (default) logs or
|
|
1280
|
-
* routes the failure to `onFailure`, while `"propagate"` also rejects the
|
|
1281
|
-
* native `waitUntil` promise.
|
|
1282
|
-
*/
|
|
1283
|
-
readonly mode?: "observe" | "propagate";
|
|
1284
|
-
/** Custom failure handler for the background effect. */
|
|
1285
|
-
readonly onFailure?: (cause: Cause.Cause<E>) => Effect.Effect<void, never, R>;
|
|
1286
|
-
}
|
|
1287
|
-
/**
|
|
1288
|
-
* Effect wrapper around `ExecutionContext` background APIs.
|
|
1289
|
-
*/
|
|
1290
|
-
interface WorkerContextService {
|
|
1291
|
-
readonly raw: globalThis.ExecutionContext;
|
|
1292
|
-
waitUntil<A, E, R, R2 = never>(effect: Effect.Effect<A, E, R>, options?: WorkerContextWaitUntilOptions<E, R2>): Effect.Effect<void, never, R | R2>;
|
|
1293
|
-
waitUntilPropagating<A, E, R, R2 = never>(effect: Effect.Effect<A, E, R>, options?: Omit<WorkerContextWaitUntilOptions<E, R2>, "mode">): Effect.Effect<void, never, R | R2>;
|
|
1294
|
-
readonly passThroughOnException: Effect.Effect<void>;
|
|
1295
|
-
}
|
|
1296
|
-
declare const WorkerContext_base: Context.ServiceClass<WorkerContext, "effect-cf/WorkerContext", WorkerContextService>;
|
|
1297
|
-
/**
|
|
1298
|
-
* Service used inside handlers to schedule background work via `waitUntil`.
|
|
1299
|
-
*
|
|
1300
|
-
* @example
|
|
1301
|
-
* ```ts
|
|
1302
|
-
* const handler = Effect.gen(function* () {
|
|
1303
|
-
* const ctx = yield* Worker.WorkerContext;
|
|
1304
|
-
* yield* ctx.waitUntil(Effect.log("flush analytics"));
|
|
1305
|
-
* return new Response("ok");
|
|
1306
|
-
* });
|
|
1307
|
-
* ```
|
|
1308
|
-
*/
|
|
1309
|
-
declare class WorkerContext extends WorkerContext_base {}
|
|
1310
|
-
declare const NativeRequest_base: Context.ServiceClass<NativeRequest, "effect-cf/NativeRequest", Request<unknown, CfProperties<unknown>>>;
|
|
1311
|
-
/**
|
|
1312
|
-
* Access to the incoming `Request` currently handled by a worker or Durable Object fetch.
|
|
1313
|
-
*/
|
|
1314
|
-
declare class NativeRequest extends NativeRequest_base {}
|
|
1315
|
-
/**
|
|
1316
|
-
* Returns `true` when the request is a websocket upgrade request.
|
|
1317
|
-
*/
|
|
1318
|
-
declare const isWebSocketUpgrade: (request: Request) => boolean;
|
|
1319
|
-
type ReservedMethodName$2 = ReservedMethodName$5 | "fetch" | "connect" | "queue" | "scheduled" | "tail" | "tailStream" | "test" | "trace" | "alarm" | "webSocketMessage" | "webSocketClose" | "webSocketError";
|
|
1320
|
-
type WorkerBaseContext<ROut> = ExecutionContext | WorkerContext | WorkerEnvironment | ROut;
|
|
1321
|
-
type WorkerFetchContext<ROut> = WorkerBaseContext<ROut> | NativeRequest | HttpServerRequest.HttpServerRequest | Scope.Scope;
|
|
1322
|
-
type WorkerRpcContext<ROut> = WorkerBaseContext<ROut> | Scope.Scope;
|
|
1323
|
-
/**
|
|
1324
|
-
* Successful result of a worker fetch handler: either a native `Response`
|
|
1325
|
-
* (returned to Cloudflare untouched) or an Effect `HttpServerResponse`
|
|
1326
|
-
* (rendered through the Effect HTTP pipeline).
|
|
1327
|
-
*/
|
|
1328
|
-
type WorkerFetchSuccess = Response | HttpServerResponse.HttpServerResponse;
|
|
1329
|
-
/**
|
|
1330
|
-
* Effect type for `fetch` handlers executed by {@link make}.
|
|
1331
|
-
*/
|
|
1332
|
-
type WorkerHandler<ROut, A = WorkerFetchSuccess> = Effect.Effect<A, unknown, WorkerFetchContext<ROut>>;
|
|
1333
|
-
/**
|
|
1334
|
-
* Effect type for worker RPC handlers.
|
|
1335
|
-
*/
|
|
1336
|
-
type WorkerRpcHandler<ROut, A = unknown> = Effect.Effect<A, unknown, WorkerRpcContext<ROut>>;
|
|
1337
|
-
/**
|
|
1338
|
-
* Shape of worker RPC handlers passed to {@link make}.
|
|
1339
|
-
*/
|
|
1340
|
-
type WorkerRpc<ROut> = Record<string, (...args: Array<any>) => WorkerRpcHandler<ROut>>;
|
|
1341
|
-
type WorkerRpcShape<Rpc extends WorkerRpc<ROut>, ROut> = { readonly [Key in keyof Rpc]: Rpc[Key] extends ((...args: infer Args) => Effect.Effect<infer A, unknown, WorkerRpcContext<ROut>>) ? (...args: Args) => Promise<A> : never; };
|
|
1342
|
-
type RpcHandlers$1<ROut, Api> = { readonly [Key in keyof Api as Key extends keyof WorkerEntrypoint ? never : Key extends string ? Key extends ReservedMethodName$2 ? never : [Api[Key]] extends [never] ? never : Api[Key] extends ((...args: Array<any>) => Promise<unknown>) ? Key : never : never]: Api[Key] extends ((...args: infer Args) => Promise<infer A>) ? (...args: Args) => WorkerRpcHandler<ROut, A> : never; };
|
|
1343
|
-
/**
|
|
1344
|
-
* Options for creating a worker class with Effect handlers.
|
|
1345
|
-
*/
|
|
1346
|
-
interface WorkerOptions<RRuntime, REvent = never, EventLayerError = never, Rpc extends WorkerRpc<RRuntime | REvent> = Record<never, never>> {
|
|
1347
|
-
/**
|
|
1348
|
-
* Layer provided around each Cloudflare event handled by this Worker.
|
|
1349
|
-
*
|
|
1350
|
-
* The layer is built inside the event's Effect scope and finalized when the
|
|
1351
|
-
* event effect completes. Use this for event-scoped resources such as OTLP
|
|
1352
|
-
* trace/log exporters that should flush at event completion.
|
|
1353
|
-
*/
|
|
1354
|
-
readonly eventLayer?: Layer.Layer<REvent, EventLayerError, WorkerBaseContext<RRuntime>>;
|
|
1355
|
-
/** Main request handler. */
|
|
1356
|
-
readonly fetch?: Effect.Effect<WorkerFetchSuccess, unknown, WorkerFetchContext<RRuntime | REvent>>;
|
|
1357
|
-
/** Queue consumer handler invoked per message batch. */
|
|
1358
|
-
readonly queue?: QueueHandler<RRuntime | REvent>;
|
|
1359
|
-
/** Optional RPC methods exposed as class instance methods. */
|
|
1360
|
-
readonly rpc?: Rpc;
|
|
1361
|
-
}
|
|
1362
|
-
type FetchWorkerOptions<RRuntime, REvent = never, EventLayerError = never> = Omit<WorkerOptions<RRuntime, REvent, EventLayerError, Record<never, never>>, "rpc"> & {
|
|
1363
|
-
readonly rpc?: never;
|
|
1364
|
-
};
|
|
1365
|
-
/**
|
|
1366
|
-
* Cloudflare `WorkerEntrypoint` constructor produced by {@link make}.
|
|
1367
|
-
*/
|
|
1368
|
-
type WorkerClass<Rpc extends WorkerRpc<ROut>, ROut> = new (ctx: globalThis.ExecutionContext, env: WorkerEnv) => WorkerEntrypoint<WorkerEnv> & {
|
|
1369
|
-
fetch(request: Request): Promise<Response>;
|
|
1370
|
-
queue(batch: globalThis.MessageBatch): Promise<void>;
|
|
1371
|
-
} & WorkerRpcShape<Rpc, ROut>;
|
|
1372
|
-
/**
|
|
1373
|
-
* `ExportedHandler`-compatible fetch object produced by {@link makeFetchHandler}.
|
|
1374
|
-
*/
|
|
1375
|
-
interface FetchHandler<Env extends WorkerEnv = WorkerEnv> {
|
|
1376
|
-
readonly fetch: (request: Request, env: Env, ctx: globalThis.ExecutionContext) => Promise<Response>;
|
|
1377
|
-
}
|
|
1378
|
-
/**
|
|
1379
|
-
* Creates a Cloudflare worker class backed by a single managed Effect runtime.
|
|
1380
|
-
*
|
|
1381
|
-
* The runtime layer is built when Cloudflare constructs the class and reused
|
|
1382
|
-
* for every event the instance handles. Layer finalizers do not run when the
|
|
1383
|
-
* isolate is evicted; Cloudflare provides no shutdown hook. Use `eventLayer`
|
|
1384
|
-
* for resources that must be finalized per event.
|
|
1385
|
-
*
|
|
1386
|
-
* @example
|
|
1387
|
-
* ```ts
|
|
1388
|
-
* export default Worker.make(Layer.empty, {
|
|
1389
|
-
* fetch: Effect.succeed(new Response("ok")),
|
|
1390
|
-
* });
|
|
1391
|
-
* ```
|
|
1392
|
-
*/
|
|
1393
|
-
declare function make$10<ROut, LayerError>(layer: Layer.Layer<ROut, LayerError, ExecutionContext | WorkerContext | WorkerEnvironment>, fetch: WorkerHandler<ROut>): WorkerClass<Record<never, never>, ROut>;
|
|
1394
|
-
declare function make$10<ROut, LayerError, REvent = never, EventLayerError = never, const Rpc extends WorkerRpc<ROut | REvent> = Record<never, never>>(layer: Layer.Layer<ROut, LayerError, ExecutionContext | WorkerContext | WorkerEnvironment>, options: WorkerOptions<ROut, REvent, EventLayerError, Rpc>): WorkerClass<Rpc, ROut | REvent>;
|
|
1395
|
-
/**
|
|
1396
|
-
* Creates an `ExportedHandler`-compatible `{ fetch }` object backed by
|
|
1397
|
-
* {@link make}.
|
|
1398
|
-
*
|
|
1399
|
-
* The Effect runtime is cached per `env` identity, so the user layer builds
|
|
1400
|
-
* once per isolate instead of once per request. `ExecutionContext`-backed
|
|
1401
|
-
* services (`Worker.ExecutionContext`, `Worker.WorkerContext`) are still
|
|
1402
|
-
* provided fresh for every request. Layer finalizers do not run when the
|
|
1403
|
-
* isolate is evicted; Cloudflare provides no shutdown hook. Use `eventLayer`
|
|
1404
|
-
* for resources that must be finalized per event.
|
|
1405
|
-
*/
|
|
1406
|
-
declare const makeFetchHandler: <ROut, LayerError, REvent = never, EventLayerError = never, Env extends WorkerEnv = WorkerEnv>(layer: Layer.Layer<ROut, LayerError, ExecutionContext | WorkerContext | WorkerEnvironment>, options: FetchWorkerOptions<ROut, REvent, EventLayerError>) => FetchHandler<Env>;
|
|
1407
|
-
declare namespace DurableObjectState_d_exports {
|
|
1408
|
-
export { DurableObjectState, DurableObjectStateService, fromDurableObjectState };
|
|
1409
|
-
}
|
|
1410
|
-
/**
|
|
1411
|
-
* Effect-friendly wrapper around Cloudflare `DurableObjectState`.
|
|
1412
|
-
*/
|
|
1413
|
-
interface DurableObjectStateService {
|
|
1414
|
-
/** Underlying Cloudflare state instance. */
|
|
1415
|
-
readonly raw: globalThis.DurableObjectState;
|
|
1416
|
-
/** Durable Object id for the current instance. */
|
|
1417
|
-
readonly id: globalThis.DurableObjectId;
|
|
1418
|
-
/** Wrapped storage API. */
|
|
1419
|
-
readonly storage: DurableObjectStorage;
|
|
1420
|
-
/** Registers background work with Cloudflare's lifecycle. */
|
|
1421
|
-
waitUntil(promise: Promise<unknown>): Effect.Effect<void>;
|
|
1422
|
-
/**
|
|
1423
|
-
* Runs a background Effect via Cloudflare's `waitUntil` with the caller's
|
|
1424
|
-
* Effect context, mirroring `WorkerContext.waitUntil` failure modes:
|
|
1425
|
-
* `"observe"` (default) logs or routes failures to `onFailure`, while
|
|
1426
|
-
* `"propagate"` also rejects the native `waitUntil` promise.
|
|
1427
|
-
*/
|
|
1428
|
-
waitUntil<A, E, R, R2 = never>(effect: Effect.Effect<A, E, R>, options?: WorkerContextWaitUntilOptions<E, R2>): Effect.Effect<void, never, R | R2>;
|
|
1429
|
-
/**
|
|
1430
|
-
* Runs an Effect inside Cloudflare's `blockConcurrencyWhile` gate.
|
|
1431
|
-
*
|
|
1432
|
-
* Cloudflare resets a Durable Object if the callback throws/rejects, or if the
|
|
1433
|
-
* callback exceeds the platform timeout (currently documented as 30 seconds).
|
|
1434
|
-
* This safe default resolves the callback with the Effect `Exit` for typed
|
|
1435
|
-
* Effect failures and resumes that `Exit` afterward, so typed failures remain
|
|
1436
|
-
* ordinary Effect failures instead of resetting the Durable Object. Defects
|
|
1437
|
-
* and interruptions still reject the callback.
|
|
1438
|
-
*/
|
|
1439
|
-
blockConcurrencyWhile<A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, E, R>;
|
|
1440
|
-
/**
|
|
1441
|
-
* Runs an Effect inside Cloudflare's `blockConcurrencyWhile` gate and lets
|
|
1442
|
-
* Effect failures reject the callback.
|
|
1443
|
-
*
|
|
1444
|
-
* Use this only when Cloudflare's reset-on-throw behavior is intentional. The
|
|
1445
|
-
* platform also resets the Durable Object if the callback exceeds the
|
|
1446
|
-
* documented timeout (currently 30 seconds).
|
|
1447
|
-
*/
|
|
1448
|
-
blockConcurrencyWhileOrReset<A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, E, R>;
|
|
1449
|
-
/** Accepts a websocket connection for hibernation-capable Durable Objects. */
|
|
1450
|
-
acceptWebSocket(ws: DurableWebSocket, tags?: Array<string>): Effect.Effect<void>;
|
|
1451
|
-
/** Lists active sockets, optionally filtered by tag. */
|
|
1452
|
-
getWebSockets(tag?: string): Effect.Effect<Array<DurableWebSocket>>;
|
|
1453
|
-
/** Configures automatic request/response handling for sockets. */
|
|
1454
|
-
setWebSocketAutoResponse(pair?: WebSocketRequestResponsePair): Effect.Effect<void>;
|
|
1455
|
-
/** Gets the configured websocket auto-response pair. */
|
|
1456
|
-
getWebSocketAutoResponse: Effect.Effect<WebSocketRequestResponsePair | null>;
|
|
1457
|
-
/** Timestamp of the last automatic websocket response for a socket. */
|
|
1458
|
-
getWebSocketAutoResponseTimestamp(ws: DurableWebSocket): Effect.Effect<Date | null>;
|
|
1459
|
-
/** Sets the timeout for hibernatable websocket events. */
|
|
1460
|
-
setHibernatableWebSocketEventTimeout(timeoutMs?: number): Effect.Effect<void>;
|
|
1461
|
-
/** Gets the timeout for hibernatable websocket events. */
|
|
1462
|
-
getHibernatableWebSocketEventTimeout: Effect.Effect<number | null>;
|
|
1463
|
-
/** Reads tags attached to a websocket. */
|
|
1464
|
-
getTags(ws: DurableWebSocket): Effect.Effect<Array<string>>;
|
|
1465
|
-
/**
|
|
1466
|
-
* Forcibly resets the Durable Object. Cloudflare logs an uncaught Error using
|
|
1467
|
-
* the optional reason, and the method is not available in `wrangler dev` local
|
|
1468
|
-
* development according to the Durable Object State docs.
|
|
1469
|
-
*/
|
|
1470
|
-
abort(reason?: string): Effect.Effect<void>;
|
|
1471
|
-
}
|
|
1472
|
-
declare const DurableObjectState_base: Context.ServiceClass<DurableObjectState, "effect-cf/DurableObjectState", DurableObjectStateService>;
|
|
1473
|
-
/**
|
|
1474
|
-
* Context tag for accessing the current Durable Object state service.
|
|
1475
|
-
*/
|
|
1476
|
-
declare class DurableObjectState extends DurableObjectState_base {}
|
|
1477
|
-
/**
|
|
1478
|
-
* Wraps a native Cloudflare `DurableObjectState` as a {@link DurableObjectStateService}.
|
|
1479
|
-
*/
|
|
1480
|
-
declare const fromDurableObjectState: (state: globalThis.DurableObjectState) => DurableObjectStateService;
|
|
481
|
+
declare const layer$10: Layer.Layer<CacheStorage>;
|
|
1481
482
|
declare namespace CloudflareOtlp_d_exports {
|
|
1482
|
-
export { DurableObjectLayerOptions, LayerOptions$10 as LayerOptions, ResourceOptions, Serialization, Signal, WorkerLayerOptions, layer$
|
|
483
|
+
export { DurableObjectLayerOptions, LayerOptions$10 as LayerOptions, ResourceOptions, Serialization, Signal, WorkerLayerOptions, layer$9 as layer, layerDurableObject, layerJson, layerProtobuf, layerWorker };
|
|
1483
484
|
}
|
|
1484
485
|
/** Telemetry signal groups supported by the Cloudflare OTLP layers. */
|
|
1485
486
|
type Signal = "logs" | "traces" | "metrics";
|
|
@@ -1556,7 +557,7 @@ interface DurableObjectLayerOptions extends LayerOptions$10 {
|
|
|
1556
557
|
* The layer provides {@link OtlpExporter.Flusher} for draining buffered
|
|
1557
558
|
* telemetry before the isolate freezes.
|
|
1558
559
|
*/
|
|
1559
|
-
declare const layer$
|
|
560
|
+
declare const layer$9: (options?: LayerOptions$10) => Layer.Layer<OtlpExporter.Flusher>;
|
|
1560
561
|
/** Base OTLP telemetry layer forced to JSON serialization. */
|
|
1561
562
|
declare const layerJson: (options?: Omit<LayerOptions$10, "serialization">) => Layer.Layer<OtlpExporter.Flusher>;
|
|
1562
563
|
/** Base OTLP telemetry layer forced to protobuf serialization. */
|
|
@@ -1577,7 +578,7 @@ declare const layerWorker: (options?: WorkerLayerOptions) => Layer.Layer<OtlpExp
|
|
|
1577
578
|
*/
|
|
1578
579
|
declare const layerDurableObject: (options?: DurableObjectLayerOptions) => Layer.Layer<OtlpExporter.Flusher, never, DurableObjectState>;
|
|
1579
580
|
declare namespace ContainerNamespace_d_exports {
|
|
1580
|
-
export { ContainerInstanceClient, ContainerNamespace, ContainerNamespaceClient, ContainerNamespaceDefinition, ContainerNamespaceResource, ContainerNamespaceService, ContainerNamespaceStaticClient, ContainerOperationError, ContainerReadinessOptions, ContainerSignal, ContainerStartAndWaitForPortsOptions, ContainerStartOptions, ContainerState, ContainerStopSignal, ContainerStub, ContainerStubOf, ContainerWaitOptions, LayerOptions$9 as LayerOptions, Tag$9 as Tag, TagClass$8 as TagClass, isContainerNamespaceResource, layer$
|
|
581
|
+
export { ContainerInstanceClient, ContainerNamespace, ContainerNamespaceClient, ContainerNamespaceDefinition, ContainerNamespaceResource, ContainerNamespaceService, ContainerNamespaceStaticClient, ContainerOperationError, ContainerReadinessOptions, ContainerSignal, ContainerStartAndWaitForPortsOptions, ContainerStartOptions, ContainerState, ContainerStopSignal, ContainerStub, ContainerStubOf, ContainerWaitOptions, LayerOptions$9 as LayerOptions, Tag$9 as Tag, TagClass$8 as TagClass, isContainerNamespaceResource, layer$8 as layer, make$9 as make, makeClient$6 as makeClient };
|
|
1581
582
|
}
|
|
1582
583
|
/** Named signal accepted by Cloudflare Container instances. */
|
|
1583
584
|
type ContainerSignal = "SIGKILL" | "SIGINT" | "SIGTERM";
|
|
@@ -1714,8 +715,8 @@ interface TagClass$8<Self, Id extends string, Namespace extends ContainerNamespa
|
|
|
1714
715
|
readonly layer: (options: LayerOptions$9) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
1715
716
|
}
|
|
1716
717
|
declare const isContainerNamespaceResource: (value: unknown) => value is ContainerNamespaceResource;
|
|
1717
|
-
declare const makeClient$
|
|
1718
|
-
declare const layer$
|
|
718
|
+
declare const makeClient$6: (definition: ContainerNamespaceDefinition) => <Namespace extends ContainerNamespaceResource>(namespace: Namespace) => ContainerNamespaceClient<Namespace>;
|
|
719
|
+
declare const layer$8: <Self, Namespace extends ContainerNamespaceResource>(tag: Context.Service<Self, ContainerNamespaceClient<Namespace>>, definition: ContainerNamespaceDefinition) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
1719
720
|
declare const make$9: <Id extends string>(id: Id) => TagClass$8<ContainerNamespaceService<Id>, Id, ContainerNamespaceResource>;
|
|
1720
721
|
declare const ContainerNamespaceServiceTypeId: unique symbol;
|
|
1721
722
|
/** Nominal service marker for Container namespaces created with {@link make}. */
|
|
@@ -1775,7 +776,7 @@ declare const Service: <Self>() => <Id extends string>(id: Id, definition: D1Def
|
|
|
1775
776
|
sqlLayer: (options?: D1SqlLayerOptions) => Layer.Layer<D1Client.D1Client | SqlClient.SqlClient, Config.ConfigError | BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
1776
777
|
};
|
|
1777
778
|
declare namespace DurableObjectNamespace_d_exports {
|
|
1778
|
-
export { DurableObjectFetchError, DurableObjectNamespaceBindingDefinition, DurableObjectNamespaceClient, DurableObjectNamespaceDefinition, DurableObjectNamespaceEffectClient, DurableObjectNamespaceStaticClient, DurableObjectRpcError, DurableObjectStubClient, isDurableObjectNamespaceClient, layer$
|
|
779
|
+
export { DurableObjectFetchError, DurableObjectNamespaceBindingDefinition, DurableObjectNamespaceClient, DurableObjectNamespaceDefinition, DurableObjectNamespaceEffectClient, DurableObjectNamespaceStaticClient, DurableObjectRpcError, DurableObjectStubClient, isDurableObjectNamespaceClient, layer$7 as layer, makeClient$5 as makeClient, makeDirectMethods };
|
|
1779
780
|
}
|
|
1780
781
|
interface DurableObjectFetcher {
|
|
1781
782
|
fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
|
|
@@ -1851,10 +852,10 @@ type StubMethodArgs<Api, Method extends keyof Api> = AsyncMethodArgs<Api, Method
|
|
|
1851
852
|
type StubMethodSuccess<Api, Method extends keyof Api> = AsyncMethodSuccess<Api, Method>;
|
|
1852
853
|
type StubMethodCloudflareReturn<Api, Method extends keyof Api> = AsyncMethodCloudflareReturn<Api, Method>;
|
|
1853
854
|
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>;
|
|
1854
|
-
type DefinitionNamespaceDirectMethods<R, Api extends object, Definition extends Definition$3.Any> = { readonly [Method in Definition$
|
|
855
|
+
type DefinitionNamespaceDirectMethods<R, Api extends object, Definition extends Definition$3.Any> = { readonly [Method in Definition$4.MethodNames<Definition>]: (stub: DurableObjectStubClient<Api>, ...args: Method$2.Args<Definition["methods"][Method]>) => Effect.Effect<Method$2.Success<Definition["methods"][Method]>, DurableObjectRpcError, R>; };
|
|
1855
856
|
type DefinitionDurableObjectDirectClient<R, Definition extends Definition$3.Any> = {
|
|
1856
857
|
readonly fetch: (input: RequestInfo | URL, init?: RequestInit) => Effect.Effect<globalThis.Response, DurableObjectFetchError, R>;
|
|
1857
|
-
} & { readonly [Method in Definition$
|
|
858
|
+
} & { readonly [Method in Definition$4.MethodNames<Definition>]: (...args: Method$2.Args<Definition["methods"][Method]>) => Effect.Effect<Method$2.Success<Definition["methods"][Method]>, DurableObjectRpcError, R>; };
|
|
1858
859
|
type DefinitionNamespaceDirectClientMethods<R, Definition extends Definition$3.Any> = {
|
|
1859
860
|
readonly byName: (name: string, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions) => DefinitionDurableObjectDirectClient<R, Definition>;
|
|
1860
861
|
readonly byId: (id: globalThis.DurableObjectId, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions) => DefinitionDurableObjectDirectClient<R, Definition>;
|
|
@@ -1983,8 +984,8 @@ type DurableObjectNamespaceStaticClient<R, Api extends object, Definition extend
|
|
|
1983
984
|
readonly rawUnsafe: () => Effect.Effect<DurableObjectNamespaceClient<Api>, never, R>;
|
|
1984
985
|
};
|
|
1985
986
|
declare const isDurableObjectNamespaceClient: <Api extends object>(value: unknown) => value is DurableObjectNamespaceClient<Api>;
|
|
1986
|
-
declare const makeClient$
|
|
1987
|
-
declare const layer$
|
|
987
|
+
declare const makeClient$5: <Api extends object, const Definition extends Definition$3.Any | undefined = undefined>(definition: DurableObjectNamespaceBindingDefinition<Definition>) => ((namespace: DurableObjectNamespaceClient<Api>) => DurableObjectNamespaceEffectClient<Api, Definition>);
|
|
988
|
+
declare const layer$7: <Self, Api extends object, const Definition extends Definition$3.Any | undefined = undefined>(tag: Context.Service<Self, DurableObjectNamespaceEffectClient<Api, Definition>>, definition: DurableObjectNamespaceBindingDefinition<Definition>) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
1988
989
|
declare const makeDirectMethods: <R, Api extends object, Definition extends Definition$3.Any | undefined>(rpcDefinition: Definition | undefined, helpers: {
|
|
1989
990
|
readonly call: StubCall<R, Api>;
|
|
1990
991
|
readonly fetch: (stub: DurableObjectStubClient<Api>, input: RequestInfo | URL, init?: RequestInit) => Effect.Effect<globalThis.Response, DurableObjectFetchError, R>;
|
|
@@ -1992,7 +993,7 @@ declare const makeDirectMethods: <R, Api extends object, Definition extends Defi
|
|
|
1992
993
|
readonly getByName: (name: string, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions) => Effect.Effect<DurableObjectStubClient<Api>, never, R>;
|
|
1993
994
|
}) => DirectMethods<R, Api, Definition>;
|
|
1994
995
|
declare namespace DurableObjectDefinition_d_exports {
|
|
1995
|
-
export { Api, Definition$3 as Definition, DurableObject$1 as DurableObject, HandlerEffect, Handlers, LayerOptions$8 as LayerOptions, Method$1 as Method, Methods, NoReservedMethods, Options$2 as Options, ReservedMethodName, ServerApi
|
|
996
|
+
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, ServiceFreeSchema, Tag$8 as Tag, TagClass$7 as TagClass, implement$2 as implement, make$7 as make, method };
|
|
1996
997
|
}
|
|
1997
998
|
type ServiceFreeSchema = Schema.Codec<any, any, never, never>;
|
|
1998
999
|
interface Method$1<Args extends ReadonlyArray<ServiceFreeSchema> = ReadonlyArray<ServiceFreeSchema>, Success extends ServiceFreeSchema = ServiceFreeSchema> {
|
|
@@ -2021,13 +1022,13 @@ interface Definition$3<Id extends string = string, MethodsShape extends Methods
|
|
|
2021
1022
|
declare namespace Definition$3 {
|
|
2022
1023
|
type Any = Definition$3<string, Methods>;
|
|
2023
1024
|
}
|
|
2024
|
-
type ReservedMethodName = ReservedMethodName$
|
|
1025
|
+
type ReservedMethodName = ReservedMethodName$2 | "fetch" | "alarm" | "webSocketMessage" | "webSocketClose" | "webSocketError";
|
|
2025
1026
|
type NoReservedMethods<MethodsShape extends Methods> = Extract<keyof MethodsShape, ReservedMethodName> extends never ? MethodsShape : never;
|
|
2026
1027
|
/**
|
|
2027
1028
|
* Promise-based client API derived from a Durable Object definition.
|
|
2028
1029
|
*/
|
|
2029
|
-
type ServerApi
|
|
2030
|
-
type Api<Self extends Definition$3.Any> = Provider<ServerApi
|
|
1030
|
+
type ServerApi<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]>>; };
|
|
1031
|
+
type Api<Self extends Definition$3.Any> = Provider<ServerApi<Self>, ReservedMethodName>;
|
|
2031
1032
|
/**
|
|
2032
1033
|
* Effect handlers for each RPC method in a Durable Object definition.
|
|
2033
1034
|
*/
|
|
@@ -2071,7 +1072,7 @@ declare const implement$2: <ROut, const Self extends Definition$3.Any>(_definiti
|
|
|
2071
1072
|
*/
|
|
2072
1073
|
type HandlerEffect<ROut, Self extends Definition$3.Any, Key extends keyof Self["methods"]> = DurableObjectHandler<ROut, Method$1.Success<Self["methods"][Key]>>;
|
|
2073
1074
|
declare namespace DurableObject_d_exports {
|
|
2074
|
-
export { Api, Definition$3 as Definition, DurableObjectClass, DurableObjectHandler, DurableObjectOptions, DurableObjectRpc, DurableObjectRpcShape, HandlerEffect, Handlers, LayerOptions$8 as LayerOptions, Method$1 as Method, Methods, NoReservedMethods, Options$2 as Options, ReservedMethodName, RpcHandlers, ServerApi
|
|
1075
|
+
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, ServiceFreeSchema, Tag$8 as Tag, TagClass$7 as TagClass, implement$2 as implement, make$6 as make, method };
|
|
2075
1076
|
}
|
|
2076
1077
|
type RuntimeContext$1<ROut> = DurableObjectState | WorkerEnvironment | ROut;
|
|
2077
1078
|
type HandlerContext<ROut> = RuntimeContext$1<ROut> | Scope.Scope;
|
|
@@ -2467,7 +1468,7 @@ declare class DurableObjectAlarm extends DurableObjectAlarm_base {
|
|
|
2467
1468
|
static readonly layer: Layer.Layer<DurableObjectAlarm, never, DurableObjectState>;
|
|
2468
1469
|
}
|
|
2469
1470
|
declare namespace DurableObjectRpcWebSocket_d_exports {
|
|
2470
|
-
export { DurableObjectRpcWebSocket, DurableObjectRpcWebSocketService, LayerOptions$7 as LayerOptions, NativeWebSocketMessage, layer$
|
|
1471
|
+
export { DurableObjectRpcWebSocket, DurableObjectRpcWebSocketService, LayerOptions$7 as LayerOptions, NativeWebSocketMessage, layer$6 as layer };
|
|
2471
1472
|
}
|
|
2472
1473
|
/**
|
|
2473
1474
|
* Configuration for {@link layer}.
|
|
@@ -2497,9 +1498,9 @@ declare class DurableObjectRpcWebSocket extends DurableObjectRpcWebSocket_base {
|
|
|
2497
1498
|
/**
|
|
2498
1499
|
* Builds a layer that bridges Durable Object websocket events to `RpcServer.Protocol`.
|
|
2499
1500
|
*/
|
|
2500
|
-
declare const layer$
|
|
1501
|
+
declare const layer$6: (options?: LayerOptions$7) => Layer.Layer<RpcServer.Protocol | DurableObjectRpcWebSocket, never, DurableObjectState | RpcSerialization.RpcSerialization>;
|
|
2501
1502
|
declare namespace DurableObjectSqlite_d_exports {
|
|
2502
|
-
export { SqliteLayerOptions, layer$
|
|
1503
|
+
export { SqliteLayerOptions, layer$5 as layer };
|
|
2503
1504
|
}
|
|
2504
1505
|
/** Options forwarded to `@effect/sql-sqlite-do` when building a SQL client layer. */
|
|
2505
1506
|
type SqliteLayerOptions = Omit<SqliteClient.SqliteClientConfig, "db" | "storage">;
|
|
@@ -2514,9 +1515,9 @@ type SqliteLayerOptions = Omit<SqliteClient.SqliteClientConfig, "db" | "storage"
|
|
|
2514
1515
|
* );
|
|
2515
1516
|
* ```
|
|
2516
1517
|
*/
|
|
2517
|
-
declare const layer$
|
|
1518
|
+
declare const layer$5: (options?: SqliteLayerOptions) => Layer.Layer<SqliteClient.SqliteClient | SqlClient.SqlClient, never, DurableObjectState>;
|
|
2518
1519
|
declare namespace Email_d_exports {
|
|
2519
|
-
export { EmailAddress, EmailAttachment, EmailBinding, EmailClient, EmailDefinition, EmailErrorCode, EmailMessage, EmailMessageBuilder, EmailOperationError, EmailRecipients, EmailSendError, EmailSendInput, EmailSendOptions, EmailSendResult, EmailService, EmailValidationError, EmailViolation, LayerOptions$6 as LayerOptions, Tag$7 as Tag, TagClass$6 as TagClass, emailErrorCodes, isEmailBinding, isEmailMessageBuilder, layer$
|
|
1520
|
+
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$4 as layer, make$5 as make, makeClient$4 as makeClient, sendLimits, validateMessage };
|
|
2520
1521
|
}
|
|
2521
1522
|
/** Documented Cloudflare Email Sending limits. */
|
|
2522
1523
|
declare const sendLimits: {
|
|
@@ -2632,12 +1633,12 @@ declare const isEmailMessageBuilder: (message: EmailSendInput) => message is Ema
|
|
|
2632
1633
|
*/
|
|
2633
1634
|
declare const validateMessage: (message: EmailMessageBuilder) => ReadonlyArray<EmailViolation>;
|
|
2634
1635
|
declare const isEmailBinding: (value: unknown) => value is EmailBinding;
|
|
2635
|
-
declare const makeClient$
|
|
2636
|
-
declare const layer$
|
|
1636
|
+
declare const makeClient$4: (definition: EmailDefinition, options?: EmailSendOptions) => (email: EmailBinding) => EmailClient;
|
|
1637
|
+
declare const layer$4: <Self>(tag: Context.Service<Self, EmailClient>, definition: LayerOptions$6) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
2637
1638
|
declare const make$5: <Id extends string>(id: Id) => TagClass$6<EmailService<Id>, Id>;
|
|
2638
1639
|
declare const Tag$7: <Self>() => <Id extends string>(id: Id) => TagClass$6<Self, Id>;
|
|
2639
1640
|
declare namespace Images_d_exports {
|
|
2640
|
-
export { DrawStepOptions, HostedImagesClient, ImageDrawOptions, ImageHandleClient, ImageInfoResponse, ImageInputOptions, ImageInputValue, ImageList, ImageListOptions, ImageMetadata, ImageOutputOptions, ImageTransform, ImageTransformationOutputOptions, ImageTransformationResult, ImageUpdateOptions, ImageUploadOptions, ImageUploadValue, ImagesClient, ImagesDefinition, ImagesOperationError, ImagesRuntimeBinding, ImagesService, ImagesTransformationResultClient, LayerOptions$5 as LayerOptions, ProcessOptions, Step, Steps, Tag$6 as Tag, TagClass$5 as TagClass, TypeId, draw, empty, isImagesBinding, layer$
|
|
1641
|
+
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$3 as layer, make$4 as make, makeClient$3 as makeClient, transform };
|
|
2641
1642
|
}
|
|
2642
1643
|
declare const TypeId: "~effect-cf/Images/Steps";
|
|
2643
1644
|
type TypeId = typeof TypeId;
|
|
@@ -2806,12 +1807,12 @@ declare const draw: {
|
|
|
2806
1807
|
(steps: Steps, draw: DrawStepOptions): Steps;
|
|
2807
1808
|
};
|
|
2808
1809
|
declare const isImagesBinding: (value: unknown) => value is ImagesRuntimeBinding;
|
|
2809
|
-
declare const makeClient$
|
|
2810
|
-
declare const layer$
|
|
1810
|
+
declare const makeClient$3: (definition: ImagesDefinition) => (images: ImagesRuntimeBinding) => ImagesClient;
|
|
1811
|
+
declare const layer$3: <Self>(tag: Context.Service<Self, ImagesClient>, definition: ImagesDefinition) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
2811
1812
|
declare const make$4: <Id extends string>(id: Id) => TagClass$5<ImagesService<Id>, Id>;
|
|
2812
1813
|
declare const Tag$6: <Self>() => <Id extends string>(id: Id) => TagClass$5<Self, Id>;
|
|
2813
1814
|
declare namespace Kv_d_exports {
|
|
2814
|
-
export { Definition$2 as Definition, KvClient, KvDefinition, KvListKey, KvListOptions, KvListResult, KvOperation, KvOperationError, KvPutOptions, KvWithMetadata, LayerOptions$4 as LayerOptions, Tag$5 as Tag, TagClass$4 as TagClass, isKvNamespace, layer$
|
|
1815
|
+
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$2 as layer, makeClient$2 as makeClient };
|
|
2815
1816
|
}
|
|
2816
1817
|
/** KV operation represented by {@link KvOperationError}. */
|
|
2817
1818
|
type KvOperation = "put" | "get" | "getWithMetadata" | "list" | "delete";
|
|
@@ -2894,14 +1895,14 @@ interface TagClass$4<Self, Id extends string, Key, Value, EncodedValue> extends
|
|
|
2894
1895
|
readonly layer: (options: LayerOptions$4) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
2895
1896
|
}
|
|
2896
1897
|
declare const isKvNamespace: (value: unknown) => value is KVNamespace;
|
|
2897
|
-
declare const makeClient$
|
|
2898
|
-
declare const layer$
|
|
1898
|
+
declare const makeClient$2: <Key, Value, EncodedValue>(definition: KvDefinition<Key, Value, EncodedValue>) => ((kv: KVNamespace) => KvClient<Key, Value, EncodedValue>);
|
|
1899
|
+
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>;
|
|
2899
1900
|
declare const Tag$5: <Self>() => <Id extends string, Key, Value, EncodedValue>(id: Id, definition: {
|
|
2900
1901
|
readonly key: Schema.Codec<Key, string>;
|
|
2901
1902
|
readonly value: Schema.Codec<Value, EncodedValue>;
|
|
2902
1903
|
}) => TagClass$4<Self, Id, Key, Value, EncodedValue>;
|
|
2903
1904
|
declare namespace R2_d_exports {
|
|
2904
|
-
export { LayerOptions$3 as LayerOptions, R2Client, R2Definition, R2GetOptions, R2ListOptions, R2MultipartOptions, R2MultipartUploadClient, R2ObjectBodyClient, R2Operation, R2OperationError, R2PutOptions, R2PutValue, R2Service, R2UploadPartOptions, R2UploadPartValue, Tag$4 as Tag, TagClass$3 as TagClass, isR2Bucket, layer$
|
|
1905
|
+
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$1 as layer, make$3 as make, makeClient$1 as makeClient };
|
|
2905
1906
|
}
|
|
2906
1907
|
/** R2 operation represented by {@link R2OperationError}. */
|
|
2907
1908
|
type R2Operation = "head" | "get" | "put" | "delete" | "list" | "createMultipartUpload" | "resumeMultipartUpload" | "uploadPart" | "abortMultipartUpload" | "completeMultipartUpload" | "arrayBuffer" | "bytes" | "text" | "json" | "blob";
|
|
@@ -2980,12 +1981,12 @@ interface TagClass$3<Self, Id extends string> extends Context.ServiceClass<Self,
|
|
|
2980
1981
|
readonly layer: (options: LayerOptions$3) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
2981
1982
|
}
|
|
2982
1983
|
declare const isR2Bucket: (value: unknown) => value is CloudflareR2Bucket;
|
|
2983
|
-
declare const makeClient$
|
|
2984
|
-
declare const layer$
|
|
1984
|
+
declare const makeClient$1: (definition: R2Definition) => ((bucket: CloudflareR2Bucket) => R2Client);
|
|
1985
|
+
declare const layer$1: <Self>(tag: Context.Service<Self, R2Client>, definition: R2Definition) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
2985
1986
|
declare const make$3: <Id extends string>(id: Id) => TagClass$3<R2Service<Id>, Id>;
|
|
2986
1987
|
declare const Tag$4: <Self>() => <Id extends string>(id: Id) => TagClass$3<Self, Id>;
|
|
2987
1988
|
declare namespace Vectorize_d_exports {
|
|
2988
|
-
export { LayerOptions$2 as LayerOptions, Tag$3 as Tag, TagClass$2 as TagClass, VectorizeBinding, VectorizeClient, VectorizeDefinition, VectorizeIndexDetails, VectorizeIndexInfo, VectorizeMatch, VectorizeMatches, VectorizeMutation, VectorizeOperation, VectorizeOperationError, VectorizeQueryOptions, VectorizeService, VectorizeValues, VectorizeVector, VectorizeVectorMetadata, VectorizeVectorMetadataFilter, VectorizeVectorMetadataValue, isVectorizeBinding, layer
|
|
1989
|
+
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, make$2 as make, makeClient };
|
|
2989
1990
|
}
|
|
2990
1991
|
/** Vectorize operation represented by {@link VectorizeOperationError}. */
|
|
2991
1992
|
type VectorizeOperation = "describe" | "query" | "queryById" | "insert" | "upsert" | "deleteByIds" | "getByIds";
|
|
@@ -3044,94 +2045,20 @@ interface TagClass$2<Self, Id extends string> extends Context.ServiceClass<Self,
|
|
|
3044
2045
|
readonly layer: (options: LayerOptions$2) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
3045
2046
|
}
|
|
3046
2047
|
declare const isVectorizeBinding: (value: unknown) => value is VectorizeBinding;
|
|
3047
|
-
declare const makeClient
|
|
3048
|
-
declare const layer
|
|
2048
|
+
declare const makeClient: (definition: VectorizeDefinition) => (index: VectorizeBinding) => VectorizeClient;
|
|
2049
|
+
declare const layer: <Self>(tag: Context.Service<Self, VectorizeClient>, definition: VectorizeDefinition) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
3049
2050
|
declare const make$2: <Id extends string>(id: Id) => TagClass$2<VectorizeService<Id>, Id>;
|
|
3050
2051
|
declare const Tag$3: <Self>() => <Id extends string>(id: Id) => TagClass$2<Self, Id>;
|
|
3051
|
-
declare namespace WorkflowBinding_d_exports {
|
|
3052
|
-
export { WorkflowBindingClient, WorkflowBindingDefinition, WorkflowInstance, WorkflowInstanceCreateBatchOptions, WorkflowInstanceCreateOptions, WorkflowInstanceEvent, WorkflowInstanceRestartOptions, WorkflowInstanceStatus, WorkflowInstanceStatusName, WorkflowOperationError, WorkflowResultDecodeError, isWorkflow, layer, makeClient };
|
|
3053
|
-
}
|
|
3054
|
-
type WorkflowInstanceCreateOptions<Payload> = Omit<CloudflareWorkflowInstanceCreateOptions<Payload>, "params">;
|
|
3055
|
-
type WorkflowInstanceCreateBatchOptions<Payload, EncodedPayload = unknown> = ReadonlyArray<{
|
|
3056
|
-
readonly payload: Payload;
|
|
3057
|
-
} & WorkflowInstanceCreateOptions<EncodedPayload>>;
|
|
3058
|
-
interface WorkflowInstanceRestartOptions {
|
|
3059
|
-
readonly from?: {
|
|
3060
|
-
readonly name?: string;
|
|
3061
|
-
readonly count?: number;
|
|
3062
|
-
readonly type?: string;
|
|
3063
|
-
};
|
|
3064
|
-
}
|
|
3065
|
-
type WorkflowInstanceStatusName = CloudflareInstanceStatus["status"];
|
|
3066
|
-
interface WorkflowInstanceStatus<Result> {
|
|
3067
|
-
readonly status: WorkflowInstanceStatusName;
|
|
3068
|
-
readonly output: Option.Option<Result>;
|
|
3069
|
-
readonly error: Option.Option<{
|
|
3070
|
-
readonly name: string;
|
|
3071
|
-
readonly message: string;
|
|
3072
|
-
}>;
|
|
3073
|
-
}
|
|
3074
|
-
interface WorkflowInstance<Result> {
|
|
3075
|
-
readonly raw: CloudflareWorkflowInstance;
|
|
3076
|
-
readonly id: string;
|
|
3077
|
-
readonly pause: Effect.Effect<void, WorkflowOperationError>;
|
|
3078
|
-
readonly resume: Effect.Effect<void, WorkflowOperationError>;
|
|
3079
|
-
readonly terminate: Effect.Effect<void, WorkflowOperationError>;
|
|
3080
|
-
readonly restart: (options?: WorkflowInstanceRestartOptions) => Effect.Effect<void, WorkflowOperationError>;
|
|
3081
|
-
readonly status: Effect.Effect<WorkflowInstanceStatus<Result>, WorkflowOperationError | WorkflowResultDecodeError>;
|
|
3082
|
-
readonly sendEvent: (event: WorkflowInstanceEvent) => Effect.Effect<void, WorkflowOperationError>;
|
|
3083
|
-
}
|
|
3084
|
-
interface WorkflowInstanceEvent {
|
|
3085
|
-
readonly type: string;
|
|
3086
|
-
readonly payload: unknown;
|
|
3087
|
-
}
|
|
3088
|
-
interface WorkflowBindingDefinition<Payload extends ServiceFreeSchema$2, Result extends ServiceFreeSchema$2> {
|
|
3089
|
-
/** Binding name as configured in `wrangler.jsonc`. */
|
|
3090
|
-
readonly binding: string;
|
|
3091
|
-
/** Codec used to encode payloads passed to `Workflow.create`. */
|
|
3092
|
-
readonly payload: Payload;
|
|
3093
|
-
/** Codec used to decode completed workflow status output. */
|
|
3094
|
-
readonly result: Result;
|
|
3095
|
-
}
|
|
3096
|
-
interface WorkflowBindingClient<Payload extends ServiceFreeSchema$2, Result extends ServiceFreeSchema$2> {
|
|
3097
|
-
readonly create: (payload: Schema.Schema.Type<Payload>, options?: WorkflowInstanceCreateOptions<Schema.Codec.Encoded<Payload>>) => Effect.Effect<WorkflowInstance<Schema.Schema.Type<Result>>, WorkflowOperationError | Schema.SchemaError>;
|
|
3098
|
-
readonly createBatch: (batch: WorkflowInstanceCreateBatchOptions<Schema.Schema.Type<Payload>, Schema.Codec.Encoded<Payload>>) => Effect.Effect<ReadonlyArray<WorkflowInstance<Schema.Schema.Type<Result>>>, WorkflowOperationError | Schema.SchemaError>;
|
|
3099
|
-
readonly get: (instanceId: string) => Effect.Effect<WorkflowInstance<Schema.Schema.Type<Result>>, WorkflowOperationError>;
|
|
3100
|
-
readonly rawUnsafe: Effect.Effect<CloudflareWorkflow<Schema.Codec.Encoded<Payload>>>;
|
|
3101
|
-
}
|
|
3102
|
-
declare const WorkflowOperationError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
3103
|
-
readonly _tag: "WorkflowOperationError";
|
|
3104
|
-
} & Readonly<A>;
|
|
3105
|
-
declare class WorkflowOperationError extends WorkflowOperationError_base<{
|
|
3106
|
-
readonly binding: string;
|
|
3107
|
-
readonly operation: string;
|
|
3108
|
-
readonly cause: unknown;
|
|
3109
|
-
}> {
|
|
3110
|
-
get message(): string;
|
|
3111
|
-
}
|
|
3112
|
-
declare const WorkflowResultDecodeError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
3113
|
-
readonly _tag: "WorkflowResultDecodeError";
|
|
3114
|
-
} & Readonly<A>;
|
|
3115
|
-
declare class WorkflowResultDecodeError extends WorkflowResultDecodeError_base<{
|
|
3116
|
-
readonly binding: string;
|
|
3117
|
-
readonly instanceId: string;
|
|
3118
|
-
readonly cause: unknown;
|
|
3119
|
-
}> {
|
|
3120
|
-
get message(): string;
|
|
3121
|
-
}
|
|
3122
|
-
declare const isWorkflow: <Payload>(value: unknown) => value is CloudflareWorkflow<Payload>;
|
|
3123
|
-
declare const makeClient: <Payload extends ServiceFreeSchema$2, Result extends ServiceFreeSchema$2>(definition: WorkflowBindingDefinition<Payload, Result>) => ((workflow: CloudflareWorkflow<Schema.Codec.Encoded<Payload>>) => WorkflowBindingClient<Payload, Result>);
|
|
3124
|
-
declare const layer: <Self, Payload extends ServiceFreeSchema$2, Result extends ServiceFreeSchema$2>(tag: Context.Service<Self, WorkflowBindingClient<Payload, Result>>, definition: WorkflowBindingDefinition<Payload, Result>) => import("effect/Layer").Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
3125
2052
|
declare namespace WorkflowDefinition_d_exports {
|
|
3126
2053
|
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 };
|
|
3127
2054
|
}
|
|
3128
|
-
interface Definition$1<Id extends string = string, Payload extends ServiceFreeSchema$
|
|
2055
|
+
interface Definition$1<Id extends string = string, Payload extends ServiceFreeSchema$1 = ServiceFreeSchema$1, Result extends ServiceFreeSchema$1 = ServiceFreeSchema$1> {
|
|
3129
2056
|
readonly id: Id;
|
|
3130
2057
|
readonly payload: Payload;
|
|
3131
2058
|
readonly result: Result;
|
|
3132
2059
|
}
|
|
3133
2060
|
declare namespace Definition$1 {
|
|
3134
|
-
type Any = Definition$1<string, ServiceFreeSchema$
|
|
2061
|
+
type Any = Definition$1<string, ServiceFreeSchema$1, ServiceFreeSchema$1>;
|
|
3135
2062
|
}
|
|
3136
2063
|
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>>;
|
|
3137
2064
|
interface Options$1<ROut, Self extends Definition$1.Any> {
|
|
@@ -3140,7 +2067,7 @@ interface Options$1<ROut, Self extends Definition$1.Any> {
|
|
|
3140
2067
|
type LayerOptions$1 = {
|
|
3141
2068
|
readonly binding: string;
|
|
3142
2069
|
};
|
|
3143
|
-
interface TagClass$1<Self, Id extends string, Payload extends ServiceFreeSchema$
|
|
2070
|
+
interface TagClass$1<Self, Id extends string, Payload extends ServiceFreeSchema$1, Result extends ServiceFreeSchema$1> extends Context.ServiceClass<Self, `effect-cf/Workflow/${Id}`, WorkflowBindingClient<Payload, Result>> {
|
|
3144
2071
|
readonly id: Id;
|
|
3145
2072
|
readonly payload: Payload;
|
|
3146
2073
|
readonly result: Result;
|
|
@@ -3151,11 +2078,11 @@ interface TagClass$1<Self, Id extends string, Payload extends ServiceFreeSchema$
|
|
|
3151
2078
|
readonly get: (instanceId: string) => Effect.Effect<WorkflowInstance<Schema.Schema.Type<Result>>, WorkflowOperationError, Self>;
|
|
3152
2079
|
readonly rawUnsafe: Effect.Effect<globalThis.Workflow<Schema.Codec.Encoded<Payload>>, never, Self>;
|
|
3153
2080
|
}
|
|
3154
|
-
declare const make$1: <Id extends string, Payload extends ServiceFreeSchema$
|
|
2081
|
+
declare const make$1: <Id extends string, Payload extends ServiceFreeSchema$1, Result extends ServiceFreeSchema$1>(id: Id, definition: {
|
|
3155
2082
|
readonly payload: Payload;
|
|
3156
2083
|
readonly result: Result;
|
|
3157
2084
|
}) => TagClass$1<Definition$1<Id, Payload, Result>, Id, Payload, Result>;
|
|
3158
|
-
declare const Tag$2: <Self>() => <Id extends string, Payload extends ServiceFreeSchema$
|
|
2085
|
+
declare const Tag$2: <Self>() => <Id extends string, Payload extends ServiceFreeSchema$1, Result extends ServiceFreeSchema$1>(id: Id, definition: {
|
|
3159
2086
|
readonly payload: Payload;
|
|
3160
2087
|
readonly result: Result;
|
|
3161
2088
|
}) => TagClass$1<Self, Id, Payload, Result>;
|