effect-cf 0.40.0 → 0.40.2
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 +2 -0
- package/dist/AiGateway.d.mts +86 -0
- package/dist/AiGateway.mjs +178 -0
- package/dist/AnalyticsEngine.d.mts +170 -0
- package/dist/AnalyticsEngine.mjs +275 -0
- package/dist/{Artifacts-B3r3RuTB.d.mts → Artifacts.d.mts} +8 -5
- package/dist/{Artifacts-CBxWGeZB.mjs → Artifacts.mjs} +9 -5
- package/dist/Binding.d.mts +45 -0
- package/dist/{Binding-C82jRhdr.mjs → Binding.mjs} +8 -4
- package/dist/BrowserRendering.d.mts +85 -0
- package/dist/BrowserRendering.mjs +81 -0
- package/dist/Cache.d.mts +40 -0
- package/dist/Cache.mjs +51 -0
- package/dist/CloudflareOtlp.d.mts +95 -0
- package/dist/CloudflareOtlp.mjs +125 -0
- package/dist/CloudflareTracer.d.mts +20 -0
- package/dist/CloudflareTracer.mjs +69 -0
- package/dist/ComputerArtifacts.d.mts +2 -2
- package/dist/ComputerArtifacts.mjs +3 -2
- package/dist/ComputerWorkspace.d.mts +36 -31
- package/dist/ComputerWorkspace.mjs +8 -3
- package/dist/ComputerWorkspaceHost.d.mts +1 -1
- package/dist/ComputerWorkspaceHost.mjs +1 -1
- package/dist/{ContainerNamespace-DbLaeFhN.d.mts → ContainerNamespace.d.mts} +16 -12
- package/dist/ContainerNamespace.mjs +165 -0
- package/dist/D1.d.mts +33 -0
- package/dist/D1.mjs +32 -0
- package/dist/DurableObject.d.mts +103 -0
- package/dist/DurableObject.mjs +77 -0
- package/dist/DurableObjectAlarm.d.mts +187 -0
- package/dist/DurableObjectAlarm.mjs +344 -0
- package/dist/DurableObjectDefinition.d.mts +87 -0
- package/dist/DurableObjectDefinition.mjs +125 -0
- package/dist/DurableObjectNamespace.d.mts +154 -0
- package/dist/DurableObjectNamespace.mjs +144 -0
- package/dist/DurableObjectRpcWebSocket.d.mts +112 -0
- package/dist/DurableObjectRpcWebSocket.mjs +547 -0
- package/dist/DurableObjectSqlite.d.mts +11 -0
- package/dist/DurableObjectSqlite.mjs +16 -0
- package/dist/DurableObjectState.d.mts +65 -0
- package/dist/DurableObjectState.mjs +47 -0
- package/dist/DurableObjectStorage.d.mts +112 -0
- package/dist/{DurableObjectState-DLL0YgBd.mjs → DurableObjectStorage.mjs} +19 -157
- package/dist/DurableObjectWebSocket.d.mts +83 -0
- package/dist/DurableObjectWebSocket.mjs +120 -0
- package/dist/Email.d.mts +106 -0
- package/dist/Email.mjs +247 -0
- package/dist/Environment.d.mts +59 -0
- package/dist/{ErrorMessage-Byx2OgNd.mjs → Environment.mjs} +7 -18
- package/dist/{Hyperdrive-HrwFlZ6x.d.mts → Hyperdrive.d.mts} +8 -5
- package/dist/Hyperdrive.mjs +32 -0
- package/dist/HyperdrivePg.d.mts +4 -3
- package/dist/HyperdrivePg.mjs +3 -1
- package/dist/Images.d.mts +191 -0
- package/dist/Images.mjs +112 -0
- package/dist/Kv.d.mts +84 -0
- package/dist/Kv.mjs +132 -0
- package/dist/Mcp.d.mts +5 -3
- package/dist/Mcp.mjs +13 -4
- package/dist/Queue.d.mts +64 -0
- package/dist/Queue.mjs +52 -0
- package/dist/QueueBinding.d.mts +42 -0
- package/dist/QueueBinding.mjs +69 -0
- package/dist/QueueDefinition.d.mts +48 -0
- package/dist/QueueDefinition.mjs +63 -0
- package/dist/R2.d.mts +89 -0
- package/dist/R2.mjs +117 -0
- package/dist/Rpc.d.mts +29 -0
- package/dist/Rpc.mjs +28 -0
- package/dist/RpcDefinition.d.mts +116 -0
- package/dist/RpcDefinition.mjs +184 -0
- package/dist/RpcTracing.d.mts +52 -0
- package/dist/RpcTracing.mjs +77 -0
- package/dist/Sandbox.d.mts +10 -5
- package/dist/Sandbox.mjs +9 -3
- package/dist/ServiceBinding.d.mts +112 -0
- package/dist/ServiceBinding.mjs +145 -0
- package/dist/Vectorize.d.mts +68 -0
- package/dist/Vectorize.mjs +76 -0
- package/dist/Vitest.d.mts +6 -4
- package/dist/Vitest.mjs +8 -4
- package/dist/WebTransport.d.mts +66 -0
- package/dist/WebTransport.mjs +63 -0
- package/dist/Worker.d.mts +139 -0
- package/dist/Worker.mjs +141 -0
- package/dist/WorkerDefinition.d.mts +100 -0
- package/dist/WorkerDefinition.mjs +103 -0
- package/dist/WorkersAi.d.mts +84 -0
- package/dist/WorkersAi.mjs +84 -0
- package/dist/Workflow.d.mts +86 -0
- package/dist/Workflow.mjs +137 -0
- package/dist/{WorkflowBinding-DtVykUCz.d.mts → WorkflowBinding.d.mts} +14 -10
- package/dist/WorkflowBinding.mjs +100 -0
- package/dist/WorkflowDefinition.d.mts +51 -0
- package/dist/WorkflowDefinition.mjs +69 -0
- package/dist/{rolldown-runtime-D7D4PA-g.mjs → _virtual/_rolldown/runtime.mjs} +1 -1
- package/dist/index.d.mts +40 -1839
- package/dist/index.mjs +40 -3161
- package/dist/{ComputerWorkspaceHostRegistry-CY5Fv4Ng.mjs → internal/ComputerWorkspaceHostRegistry.mjs} +1 -1
- package/dist/internal/Entrypoint.mjs +37 -0
- package/dist/internal/ErrorMessage.mjs +17 -0
- package/dist/internal/NativeCallback.mjs +33 -0
- package/dist/internal/RpcInvocation.d.mts +13 -0
- package/dist/internal/RpcInvocation.mjs +34 -0
- package/dist/internal/Runtime.mjs +31 -0
- package/dist/internal/Telemetry.mjs +20 -0
- package/dist/{WorkerContext-Yobnfw-K.mjs → internal/WorkerContext.mjs} +4 -31
- package/package.json +1 -1
- package/src/AiGateway.ts +5 -1
- package/src/AnalyticsEngine.ts +14 -19
- package/src/Artifacts.ts +6 -1
- package/src/Binding.ts +5 -1
- package/src/BrowserRendering.ts +5 -1
- package/src/Cache.ts +5 -1
- package/src/CloudflareOtlp.ts +12 -10
- package/src/CloudflareTracer.ts +7 -1
- package/src/ComputerArtifacts.ts +2 -1
- package/src/ComputerWorkspace.ts +7 -1
- package/src/ContainerNamespace.ts +6 -1
- package/src/D1.ts +4 -1
- package/src/DurableObject.ts +4 -1
- package/src/DurableObjectAlarm.ts +10 -12
- package/src/DurableObjectDefinition.ts +3 -1
- package/src/DurableObjectNamespace.ts +4 -1
- package/src/DurableObjectRpcWebSocket.ts +7 -1
- package/src/DurableObjectSqlite.ts +2 -1
- package/src/DurableObjectState.ts +4 -1
- package/src/DurableObjectStorage.ts +11 -13
- package/src/DurableObjectWebSocket.ts +5 -1
- package/src/Email.ts +5 -1
- package/src/Environment.ts +6 -1
- package/src/Hyperdrive.ts +4 -1
- package/src/HyperdrivePg.ts +3 -1
- package/src/Images.ts +7 -1
- package/src/Kv.ts +7 -1
- package/src/Mcp.ts +13 -13
- package/src/Queue.ts +5 -11
- package/src/QueueBinding.ts +5 -1
- package/src/QueueDefinition.ts +4 -1
- package/src/R2.ts +7 -1
- package/src/Rpc.ts +4 -1
- package/src/RpcDefinition.ts +4 -1
- package/src/RpcTracing.ts +9 -1
- package/src/Sandbox.ts +7 -1
- package/src/ServiceBinding.ts +6 -1
- package/src/Vectorize.ts +7 -1
- package/src/Vitest.ts +5 -1
- package/src/WebTransport.ts +6 -1
- package/src/Worker.ts +10 -16
- package/src/WorkerDefinition.ts +3 -1
- package/src/WorkersAi.ts +7 -1
- package/src/Workflow.ts +10 -25
- package/src/WorkflowBinding.ts +6 -1
- package/src/WorkflowDefinition.ts +4 -1
- package/src/internal/Entrypoint.ts +3 -1
- package/src/internal/ErrorMessage.ts +1 -1
- package/src/internal/NativeCallback.ts +3 -1
- package/src/internal/RpcInvocation.ts +5 -1
- package/src/internal/Runtime.ts +5 -1
- package/src/internal/Telemetry.ts +4 -3
- package/src/internal/WorkerContext.ts +3 -1
- package/dist/Binding-DKcLrQCM.d.mts +0 -94
- package/dist/DurableObjectState-DJ0K-zyd.d.mts +0 -244
- package/dist/Worker-XsGJsCJX.mjs +0 -885
- package/dist/Worker-gV4mDqIs.d.mts +0 -641
|
@@ -1,244 +0,0 @@
|
|
|
1
|
-
import { i as WorkerContextWaitUntilOptions } from "./Worker-gV4mDqIs.mjs";
|
|
2
|
-
import { Cause, Context, Duration, Effect, Option, Schema } from "effect";
|
|
3
|
-
declare namespace DurableObjectStorage_d_exports {
|
|
4
|
-
export { DurableObjectStorage, DurableObjectTransaction, SchemaBackedSyncKvStorage, SqlCursor, SqlStorage, SqlStorageValue, StorageOperationError, SyncKvDefinition, SyncKvStorage, fromDurableObjectStorage };
|
|
5
|
-
}
|
|
6
|
-
type SqlStorageValue = globalThis.SqlStorageValue;
|
|
7
|
-
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]; }>) => Cause.YieldableError & {
|
|
8
|
-
readonly _tag: "StorageOperationError";
|
|
9
|
-
} & Readonly<A>;
|
|
10
|
-
declare class StorageOperationError extends StorageOperationError_base<{
|
|
11
|
-
readonly operation: string;
|
|
12
|
-
readonly cause: unknown;
|
|
13
|
-
}> {
|
|
14
|
-
get message(): string;
|
|
15
|
-
}
|
|
16
|
-
type StorageEffect<A> = Effect.Effect<A, StorageOperationError>;
|
|
17
|
-
interface SqlCursor<T extends Record<string, SqlStorageValue>> {
|
|
18
|
-
next(): StorageEffect<{
|
|
19
|
-
done?: false;
|
|
20
|
-
value: T;
|
|
21
|
-
} | {
|
|
22
|
-
done: true;
|
|
23
|
-
value?: never;
|
|
24
|
-
}>;
|
|
25
|
-
toArray(): StorageEffect<Array<T>>;
|
|
26
|
-
one(): StorageEffect<T>;
|
|
27
|
-
raw<U extends Array<SqlStorageValue>>(): StorageEffect<IterableIterator<U>>;
|
|
28
|
-
readonly columnNames: Array<string>;
|
|
29
|
-
readonly rowsRead: StorageEffect<number>;
|
|
30
|
-
readonly rowsWritten: StorageEffect<number>;
|
|
31
|
-
}
|
|
32
|
-
interface SqlStorage {
|
|
33
|
-
exec<T extends Record<string, SqlStorageValue>>(query: string, ...bindings: Array<SqlStorageValue>): StorageEffect<SqlCursor<T>>;
|
|
34
|
-
readonly databaseSize: number;
|
|
35
|
-
}
|
|
36
|
-
interface SyncKvDefinition<Key, Value, EncodedValue> {
|
|
37
|
-
readonly key: Schema.Codec<Key, string>;
|
|
38
|
-
readonly value: Schema.Codec<Value, EncodedValue>;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Sync KV wrapper that transparently encodes keys/values through Effect Schema.
|
|
42
|
-
*/
|
|
43
|
-
interface SchemaBackedSyncKvStorage<Key, Value> {
|
|
44
|
-
get(key: Key): Effect.Effect<Option.Option<Value>, unknown>;
|
|
45
|
-
put(key: Key, value: Value): Effect.Effect<void, unknown>;
|
|
46
|
-
delete(key: Key): Effect.Effect<boolean, unknown>;
|
|
47
|
-
list(options?: globalThis.SyncKvListOptions): Effect.Effect<Array<[Key, Value]>, unknown>;
|
|
48
|
-
}
|
|
49
|
-
interface SyncKvStorage {
|
|
50
|
-
get<T = unknown>(key: string): StorageEffect<T | undefined>;
|
|
51
|
-
put<T>(key: string, value: T): StorageEffect<void>;
|
|
52
|
-
delete(key: string): StorageEffect<boolean>;
|
|
53
|
-
list<T = unknown>(options?: globalThis.SyncKvListOptions): StorageEffect<Array<[string, T]>>;
|
|
54
|
-
schema<Key, Value, EncodedValue>(definition: SyncKvDefinition<Key, Value, EncodedValue>): SchemaBackedSyncKvStorage<Key, Value>;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Effect wrapper around Cloudflare transaction callbacks.
|
|
58
|
-
*/
|
|
59
|
-
interface DurableObjectTransaction {
|
|
60
|
-
get<T = unknown>(key: string, options?: globalThis.DurableObjectGetOptions): StorageEffect<T | undefined>;
|
|
61
|
-
get<T = unknown>(keys: Array<string>, options?: globalThis.DurableObjectGetOptions): StorageEffect<Map<string, T>>;
|
|
62
|
-
list<T = unknown>(options?: globalThis.DurableObjectListOptions): StorageEffect<Map<string, T>>;
|
|
63
|
-
put<T>(key: string, value: T, options?: globalThis.DurableObjectPutOptions): StorageEffect<void>;
|
|
64
|
-
put<T>(entries: Record<string, T>, options?: globalThis.DurableObjectPutOptions): StorageEffect<void>;
|
|
65
|
-
delete(key: string, options?: globalThis.DurableObjectPutOptions): StorageEffect<boolean>;
|
|
66
|
-
delete(keys: Array<string>, options?: globalThis.DurableObjectPutOptions): StorageEffect<number>;
|
|
67
|
-
rollback(): StorageEffect<void>;
|
|
68
|
-
getAlarm(options?: globalThis.DurableObjectGetAlarmOptions): StorageEffect<number | null>;
|
|
69
|
-
setAlarm(scheduledTime: number | Date, options?: globalThis.DurableObjectSetAlarmOptions): StorageEffect<void>;
|
|
70
|
-
setAlarmAfter(delay: Duration.Input, options?: globalThis.DurableObjectSetAlarmOptions): StorageEffect<void>;
|
|
71
|
-
deleteAlarm(options?: globalThis.DurableObjectSetAlarmOptions): StorageEffect<void>;
|
|
72
|
-
}
|
|
73
|
-
interface DurableObjectStorage {
|
|
74
|
-
get<T = unknown>(key: string, options?: globalThis.DurableObjectGetOptions): StorageEffect<T | undefined>;
|
|
75
|
-
put<T>(key: string, value: T, options?: globalThis.DurableObjectPutOptions): StorageEffect<void>;
|
|
76
|
-
delete(key: string, options?: globalThis.DurableObjectPutOptions): StorageEffect<boolean>;
|
|
77
|
-
/**
|
|
78
|
-
* Deletes all stored data. On compatibility dates before 2026-02-24, Cloudflare
|
|
79
|
-
* documents that active alarms must be deleted separately with `deleteAlarm()`.
|
|
80
|
-
*/
|
|
81
|
-
deleteAll(options?: globalThis.DurableObjectPutOptions): StorageEffect<void>;
|
|
82
|
-
getAlarm(options?: globalThis.DurableObjectGetAlarmOptions): StorageEffect<number | null>;
|
|
83
|
-
setAlarm(scheduledTime: number | Date, options?: globalThis.DurableObjectSetAlarmOptions): StorageEffect<void>;
|
|
84
|
-
setAlarmAfter(delay: Duration.Input, options?: globalThis.DurableObjectSetAlarmOptions): StorageEffect<void>;
|
|
85
|
-
deleteAlarm(options?: globalThis.DurableObjectSetAlarmOptions): StorageEffect<void>;
|
|
86
|
-
/**
|
|
87
|
-
* SQLite-backed Durable Object storage only.
|
|
88
|
-
*
|
|
89
|
-
* The callback Effect must complete synchronously. If it requires asynchronous
|
|
90
|
-
* work, use `transaction` instead so Cloudflare can run the async transaction
|
|
91
|
-
* callback under the platform's transaction contract.
|
|
92
|
-
*/
|
|
93
|
-
transactionSync<A, E, R>(closure: () => Effect.Effect<A, E, R>): Effect.Effect<A, E | StorageOperationError, R>;
|
|
94
|
-
/**
|
|
95
|
-
* Runs an async transaction and exposes a typed transaction wrapper.
|
|
96
|
-
*/
|
|
97
|
-
transaction<A, E, R>(closure: (txn: DurableObjectTransaction) => Effect.Effect<A, E, R>): Effect.Effect<A, E | StorageOperationError, R>;
|
|
98
|
-
/** Flushes pending writes to disk. */
|
|
99
|
-
sync(): StorageEffect<void>;
|
|
100
|
-
/** Requires SQLite-backed Durable Object storage. */
|
|
101
|
-
getCurrentBookmark(): StorageEffect<string>;
|
|
102
|
-
/** Requires SQLite-backed Durable Object storage. */
|
|
103
|
-
onNextSessionRestoreBookmark(bookmark: string): StorageEffect<string>;
|
|
104
|
-
readonly sql: SqlStorage;
|
|
105
|
-
readonly kv: SyncKvStorage;
|
|
106
|
-
}
|
|
107
|
-
declare const fromDurableObjectStorage: (storage: globalThis.DurableObjectStorage) => DurableObjectStorage;
|
|
108
|
-
declare namespace DurableObjectWebSocket_d_exports {
|
|
109
|
-
export { AcceptUpgradeOptions, AcceptedUpgrade, AttachmentInvalidPolicy, AttachmentRehydrateOptions, DurableWebSocket, DurableWebSocketAttachment, DurableWebSocketAttachmentError, DurableWebSocketCloseError, DurableWebSocketHandlers, DurableWebSocketSendData, DurableWebSocketSendError, RehydratedDurableWebSocket, acceptUpgrade, attachment, fromWebSocket, handlers };
|
|
110
|
-
}
|
|
111
|
-
type DurableWebSocketSendData = string | ArrayBuffer | ArrayBufferView;
|
|
112
|
-
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 & {
|
|
113
|
-
readonly _tag: "DurableWebSocketSendError";
|
|
114
|
-
} & Readonly<A>;
|
|
115
|
-
declare class DurableWebSocketSendError extends DurableWebSocketSendError_base<{
|
|
116
|
-
readonly cause: unknown;
|
|
117
|
-
}> {
|
|
118
|
-
get message(): string;
|
|
119
|
-
}
|
|
120
|
-
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 & {
|
|
121
|
-
readonly _tag: "DurableWebSocketCloseError";
|
|
122
|
-
} & Readonly<A>;
|
|
123
|
-
declare class DurableWebSocketCloseError extends DurableWebSocketCloseError_base<{
|
|
124
|
-
readonly cause: unknown;
|
|
125
|
-
}> {
|
|
126
|
-
get message(): string;
|
|
127
|
-
}
|
|
128
|
-
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 & {
|
|
129
|
-
readonly _tag: "DurableWebSocketAttachmentError";
|
|
130
|
-
} & Readonly<A>;
|
|
131
|
-
/** Error raised when serializing or deserializing a websocket attachment fails. */
|
|
132
|
-
declare class DurableWebSocketAttachmentError extends DurableWebSocketAttachmentError_base<{
|
|
133
|
-
readonly operation: "serialize" | "deserialize";
|
|
134
|
-
readonly cause: unknown;
|
|
135
|
-
}> {
|
|
136
|
-
get message(): string;
|
|
137
|
-
}
|
|
138
|
-
interface DurableWebSocket<Attachment = unknown> {
|
|
139
|
-
readonly raw: WebSocket;
|
|
140
|
-
send(data: DurableWebSocketSendData): Effect.Effect<void, DurableWebSocketSendError>;
|
|
141
|
-
close(code?: number, reason?: string): Effect.Effect<void, DurableWebSocketCloseError>;
|
|
142
|
-
/** Serializes hibernation attachment metadata onto the socket. */
|
|
143
|
-
serializeAttachment<A extends Attachment = Attachment>(value: A): Effect.Effect<void, DurableWebSocketAttachmentError>;
|
|
144
|
-
/** Deserializes hibernation attachment metadata from the socket. */
|
|
145
|
-
readonly deserializeAttachment: Effect.Effect<unknown, DurableWebSocketAttachmentError>;
|
|
146
|
-
}
|
|
147
|
-
declare const fromWebSocket: <Attachment = unknown>(raw: WebSocket) => DurableWebSocket<Attachment>;
|
|
148
|
-
interface AcceptUpgradeOptions<Attachment = unknown> {
|
|
149
|
-
readonly tags?: ReadonlyArray<string> | undefined;
|
|
150
|
-
/** Optional attachment serialized onto the server socket. */
|
|
151
|
-
readonly attachment?: Attachment | undefined;
|
|
152
|
-
}
|
|
153
|
-
interface AcceptedUpgrade<Attachment = unknown> {
|
|
154
|
-
readonly client: WebSocket;
|
|
155
|
-
readonly server: DurableWebSocket<Attachment>;
|
|
156
|
-
readonly response: Response;
|
|
157
|
-
}
|
|
158
|
-
declare const acceptUpgrade: <Attachment = unknown>(options?: AcceptUpgradeOptions<Attachment> | undefined) => Effect.Effect<AcceptedUpgrade<Attachment>, DurableWebSocketAttachmentError, DurableObjectState>;
|
|
159
|
-
type AttachmentInvalidPolicy = "ignore" | "ignore-and-close" | "fail";
|
|
160
|
-
interface AttachmentRehydrateOptions {
|
|
161
|
-
readonly tag?: string | undefined;
|
|
162
|
-
readonly onInvalid?: AttachmentInvalidPolicy | undefined;
|
|
163
|
-
}
|
|
164
|
-
interface RehydratedDurableWebSocket<Attachment> {
|
|
165
|
-
readonly socket: DurableWebSocket<Attachment>;
|
|
166
|
-
readonly attachment: Attachment;
|
|
167
|
-
}
|
|
168
|
-
interface DurableWebSocketAttachment<Attachment, Encoded> {
|
|
169
|
-
serialize(socket: DurableWebSocket<unknown>, value: Attachment): Effect.Effect<void, DurableWebSocketAttachmentError>;
|
|
170
|
-
deserialize(socket: DurableWebSocket<unknown>): Effect.Effect<Option.Option<Attachment>, DurableWebSocketAttachmentError>;
|
|
171
|
-
rehydrate(options?: AttachmentRehydrateOptions): Effect.Effect<Array<RehydratedDurableWebSocket<Attachment>>, DurableWebSocketAttachmentError, DurableObjectState>;
|
|
172
|
-
readonly schema: Schema.Codec<Attachment, Encoded, never, never>;
|
|
173
|
-
}
|
|
174
|
-
declare const attachment: <const AttachmentSchema extends Schema.Codec<any, any, never, never>>(schema: AttachmentSchema) => DurableWebSocketAttachment<Schema.Schema.Type<AttachmentSchema>, Schema.Codec.Encoded<AttachmentSchema>>;
|
|
175
|
-
interface DurableWebSocketHandlers<R = never, E = unknown> {
|
|
176
|
-
readonly message?: (socket: DurableWebSocket, message: string | ArrayBuffer) => Effect.Effect<void, E, R>;
|
|
177
|
-
readonly close?: (socket: DurableWebSocket, code: number, reason: string, wasClean: boolean) => Effect.Effect<void, E, R>;
|
|
178
|
-
readonly error?: (socket: DurableWebSocket, cause: unknown) => Effect.Effect<void, E, R>;
|
|
179
|
-
}
|
|
180
|
-
declare const handlers: <R = never, E = unknown>(options: DurableWebSocketHandlers<R, E>) => {
|
|
181
|
-
webSocketMessage: ((socket: DurableWebSocket, message: string | ArrayBuffer) => Effect.Effect<void, E, R>) | undefined;
|
|
182
|
-
webSocketClose: ((socket: DurableWebSocket, code: number, reason: string, wasClean: boolean) => Effect.Effect<void, E, R>) | undefined;
|
|
183
|
-
webSocketError: ((socket: DurableWebSocket, cause: unknown) => Effect.Effect<void, E, R>) | undefined;
|
|
184
|
-
};
|
|
185
|
-
declare namespace DurableObjectState_d_exports {
|
|
186
|
-
export { DurableObjectState, DurableObjectStateService, fromDurableObjectState };
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* Effect-friendly wrapper around Cloudflare `DurableObjectState`.
|
|
190
|
-
*/
|
|
191
|
-
interface DurableObjectStateService {
|
|
192
|
-
readonly raw: globalThis.DurableObjectState;
|
|
193
|
-
readonly id: globalThis.DurableObjectId;
|
|
194
|
-
readonly storage: DurableObjectStorage;
|
|
195
|
-
waitUntil(promise: Promise<unknown>): Effect.Effect<void>;
|
|
196
|
-
/**
|
|
197
|
-
* Runs a background Effect via Cloudflare's `waitUntil` with the caller's
|
|
198
|
-
* Effect context, mirroring `WorkerContext.waitUntil` failure modes:
|
|
199
|
-
* `"observe"` (default) logs or routes failures to `onFailure`, while
|
|
200
|
-
* `"propagate"` also rejects the native `waitUntil` promise.
|
|
201
|
-
*/
|
|
202
|
-
waitUntil<A, E, R, R2 = never>(effect: Effect.Effect<A, E, R>, options?: WorkerContextWaitUntilOptions<E, R2>): Effect.Effect<void, never, R | R2>;
|
|
203
|
-
/**
|
|
204
|
-
* Runs an Effect inside Cloudflare's `blockConcurrencyWhile` gate.
|
|
205
|
-
*
|
|
206
|
-
* Cloudflare resets a Durable Object if the callback throws/rejects, or if the
|
|
207
|
-
* callback exceeds the platform timeout (currently documented as 30 seconds).
|
|
208
|
-
* This safe default resolves the callback with the Effect `Exit` for typed
|
|
209
|
-
* Effect failures and resumes that `Exit` afterward, so typed failures remain
|
|
210
|
-
* ordinary Effect failures instead of resetting the Durable Object. Defects
|
|
211
|
-
* and interruptions still reject the callback.
|
|
212
|
-
*/
|
|
213
|
-
blockConcurrencyWhile<A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, E, R>;
|
|
214
|
-
/**
|
|
215
|
-
* Runs an Effect inside Cloudflare's `blockConcurrencyWhile` gate and lets
|
|
216
|
-
* Effect failures reject the callback.
|
|
217
|
-
*
|
|
218
|
-
* Use this only when Cloudflare's reset-on-throw behavior is intentional. The
|
|
219
|
-
* platform also resets the Durable Object if the callback exceeds the
|
|
220
|
-
* documented timeout (currently 30 seconds).
|
|
221
|
-
*/
|
|
222
|
-
blockConcurrencyWhileOrReset<A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, E, R>;
|
|
223
|
-
acceptWebSocket(ws: DurableWebSocket, tags?: Array<string>): Effect.Effect<void>;
|
|
224
|
-
getWebSockets(tag?: string): Effect.Effect<Array<DurableWebSocket>>;
|
|
225
|
-
setWebSocketAutoResponse(pair?: WebSocketRequestResponsePair): Effect.Effect<void>;
|
|
226
|
-
getWebSocketAutoResponse: Effect.Effect<WebSocketRequestResponsePair | null>;
|
|
227
|
-
getWebSocketAutoResponseTimestamp(ws: DurableWebSocket): Effect.Effect<Date | null>;
|
|
228
|
-
setHibernatableWebSocketEventTimeout(timeoutMs?: number): Effect.Effect<void>;
|
|
229
|
-
getHibernatableWebSocketEventTimeout: Effect.Effect<number | null>;
|
|
230
|
-
getTags(ws: DurableWebSocket): Effect.Effect<Array<string>>;
|
|
231
|
-
/**
|
|
232
|
-
* Forcibly resets the Durable Object. Cloudflare logs an uncaught Error using
|
|
233
|
-
* the optional reason, and the method is not available in `wrangler dev` local
|
|
234
|
-
* development according to the Durable Object State docs. Set
|
|
235
|
-
* `retryAlarm: false` to prevent the current alarm invocation from retrying;
|
|
236
|
-
* this option has no effect outside an alarm handler.
|
|
237
|
-
*/
|
|
238
|
-
abort(reason?: string, options?: globalThis.DurableObjectAbortOptions): Effect.Effect<void>;
|
|
239
|
-
}
|
|
240
|
-
declare const DurableObjectState_base: Context.ServiceClass<DurableObjectState, "effect-cf/DurableObjectState", DurableObjectStateService>;
|
|
241
|
-
declare class DurableObjectState extends DurableObjectState_base {}
|
|
242
|
-
declare const fromDurableObjectState: (state: globalThis.DurableObjectState) => DurableObjectStateService;
|
|
243
|
-
//#endregion
|
|
244
|
-
export { AcceptedUpgrade as a, DurableWebSocketAttachmentError as c, AcceptUpgradeOptions as i, DurableObjectStorage_d_exports as l, DurableObjectStateService as n, DurableObjectWebSocket_d_exports as o, DurableObjectState_d_exports as r, DurableWebSocket as s, DurableObjectState as t, StorageOperationError as u };
|