@orpc/experimental-durable-iterator 0.0.0-next.012cf1e

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.
@@ -0,0 +1,290 @@
1
+ import { RPCHandlerOptions } from '@orpc/server/websocket';
2
+ import { DurableObject } from 'cloudflare:workers';
3
+ import { b as DurableIteratorTokenPayload, a as DurableIteratorObjectDef, D as DurableIteratorObject$1 } from '../shared/experimental-durable-iterator.DQjHfIr1.mjs';
4
+ import { StandardRPCJsonSerializerOptions } from '@orpc/client/standard';
5
+ import { Interceptor } from '@orpc/shared';
6
+ export { withEventMeta } from '@orpc/server';
7
+ import '@orpc/client';
8
+ import 'valibot';
9
+
10
+ interface DurableIteratorWebsocketInternal {
11
+ /**
12
+ * Access the original websocket instance
13
+ *
14
+ * @warning Be careful when using original because you can accidentally modifying internal state.
15
+ */
16
+ original: WebSocket;
17
+ /**
18
+ * Serialize the websocket id
19
+ *
20
+ * @warning this method should be called when client established connection
21
+ */
22
+ serializeId(id: string): void;
23
+ /**
24
+ * Deserialize the websocket id
25
+ *
26
+ * @warning this method assumes that the id is already set when client established connection
27
+ */
28
+ deserializeId(): string;
29
+ /**
30
+ * Serialize the token payload usually when client connected
31
+ *
32
+ * @warning this method should be called when client established connection or when token payload is updated
33
+ */
34
+ serializeTokenPayload(payload: DurableIteratorTokenPayload): void;
35
+ /**
36
+ * Deserialize the payload attached when client connected
37
+ *
38
+ * @warning this method assumes that the token payload is already set when client established connection
39
+ */
40
+ deserializeTokenPayload(): DurableIteratorTokenPayload;
41
+ /**
42
+ * Serialize the hibernation id used for publishing events to the client
43
+ */
44
+ serializeHibernationId(id: string): void;
45
+ /**
46
+ * Deserialize the hibernation id used for publishing events to the client
47
+ */
48
+ deserializeHibernationId(): string | undefined;
49
+ /**
50
+ * Close the websocket connection if expired
51
+ *
52
+ * @warning this method assumes that the token payload is already set when client established connection
53
+ */
54
+ closeIfExpired(): void;
55
+ }
56
+ interface DurableIteratorWebsocket extends WebSocket {
57
+ /**
58
+ * Durable Event internal apis
59
+ */
60
+ ['~orpc']: DurableIteratorWebsocketInternal;
61
+ }
62
+ /**
63
+ * Create a Durable Iterator WebSocket from a regular WebSocket
64
+ *
65
+ * @info The websocket automatically closes if expired before sending data
66
+ */
67
+ declare function toDurableIteratorWebsocket(original: WebSocket): DurableIteratorWebsocket;
68
+
69
+ interface DurableIteratorObjectStateInternal {
70
+ /**
71
+ * The original DurableObjectState
72
+ *
73
+ * @warning Be careful when using original because you can accidentally modifying internal state.
74
+ */
75
+ original: DurableObjectState;
76
+ }
77
+ interface DurableIteratorObjectState<TProps> extends DurableObjectState<TProps> {
78
+ /**
79
+ * DurableIteratorObjectState internal apis
80
+ */
81
+ '~orpc': DurableIteratorObjectStateInternal;
82
+ /**
83
+ * Get all WebSockets connected to this Durable Object
84
+ * And convert them to DurableIteratorWebsocket to avoid accidentally modifying internal state
85
+ */
86
+ 'getWebSockets'(...args: Parameters<DurableObjectState['getWebSockets']>): DurableIteratorWebsocket[];
87
+ }
88
+ declare function toDurableIteratorObjectState<TProps>(original: DurableObjectState<TProps>): DurableIteratorObjectState<TProps>;
89
+
90
+ interface EventResumeStorageOptions extends StandardRPCJsonSerializerOptions {
91
+ /**
92
+ * How long (in seconds) to retain events for reconnection replay.
93
+ *
94
+ * When a client reconnects, stored events within this window can be replayed
95
+ * to ensure no data is lost. Outside this window, missed events are dropped.
96
+ *
97
+ * @remarks
98
+ * - Use infinite values to disable
99
+ * - Note that for performance, expired event cleanup is deferred. This means
100
+ * expired events may remain in storage for a short period beyond their
101
+ * retention time.
102
+ *
103
+ * @default NaN (disabled)
104
+ */
105
+ resumeRetentionSeconds?: number;
106
+ /**
107
+ * Prefix for the resume storage table schema.
108
+ * This is used to avoid naming conflicts with other tables in the same Durable Object.
109
+ *
110
+ * @default 'orpc:durable-iterator:resume:'
111
+ */
112
+ resumeSchemaPrefix?: string;
113
+ }
114
+ interface ResumeEventFilter {
115
+ /** Only websockets with these tags will receive the event */
116
+ tags?: readonly string[];
117
+ /** Only websockets that are in this list will receive the event */
118
+ targets?: readonly DurableIteratorWebsocket[];
119
+ /** Websockets that are in this list will not receive the event */
120
+ exclude?: readonly DurableIteratorWebsocket[];
121
+ }
122
+ declare class EventResumeStorage<T extends object> {
123
+ private readonly durableState;
124
+ private readonly serializer;
125
+ private readonly retentionSeconds;
126
+ private readonly schemaPrefix;
127
+ get isEnabled(): boolean;
128
+ constructor(durableState: DurableObjectState, options?: EventResumeStorageOptions);
129
+ /**
130
+ * Store an payload for resume capability.
131
+ *
132
+ * @returns The updated meta of the stored payload
133
+ */
134
+ store(payload: T, resumeFilter: ResumeEventFilter): T;
135
+ /**
136
+ * Get events after lastEventId for a specific websocket
137
+ */
138
+ get(websocket: DurableIteratorWebsocket, lastEventId: string): T[];
139
+ private initSchema;
140
+ private resetSchema;
141
+ private lastCleanupTime;
142
+ private cleanupExpiredEvents;
143
+ private serializeEventPayload;
144
+ private deserializeEventPayload;
145
+ private withEventId;
146
+ }
147
+
148
+ type DurableIteratorObjectRouterContext = {
149
+ object: DurableObject<any, any>;
150
+ resumeStorage: EventResumeStorage<any>;
151
+ websocket: DurableIteratorWebsocket;
152
+ options: DurableIteratorObjectHandlerOptions;
153
+ };
154
+ interface PublishEventOptions {
155
+ /**
156
+ * Deliver the event only to websockets that have the specified tags.
157
+ */
158
+ tags?: readonly string[];
159
+ /**
160
+ * Restrict the event to a specific set of websockets.
161
+ *
162
+ * Accept a list of websockets or a filter function.
163
+ *
164
+ * Use this when security is important — only the listed websockets
165
+ * will ever receive the event. Newly connected websockets are not
166
+ * included unless explicitly added here.
167
+ */
168
+ targets?: readonly WebSocket[] | ((ws: DurableIteratorWebsocket) => boolean);
169
+ /**
170
+ * Exclude certain websockets from receiving the event.
171
+ *
172
+ * Accept a list of websockets or a filter function.
173
+ *
174
+ * Use this when broadcasting widely but skipping a few clients
175
+ * (e.g., the sender). Newly connected websockets may still receive
176
+ * the event if not listed here, so this is less strict than `targets`.
177
+ */
178
+ exclude?: readonly WebSocket[] | ((ws: DurableIteratorWebsocket) => boolean);
179
+ }
180
+ interface DurableIteratorObjectHandlerOptions extends RPCHandlerOptions<DurableIteratorObjectRouterContext>, EventResumeStorageOptions {
181
+ /**
182
+ * The signing key to use verify the token.
183
+ */
184
+ signingKey: string;
185
+ /**
186
+ * Called after a client successfully subscribes to the main iterator.
187
+ * You can start sending events to the client here.
188
+ *
189
+ * @param websocket Corresponding WebSocket connection.
190
+ * @param lastEventId Can be `undefined` if this is the first connection (not a resumed session).
191
+ */
192
+ onSubscribed?: (websocket: DurableIteratorWebsocket, lastEventId: string | undefined) => void;
193
+ }
194
+ declare class DurableIteratorObjectHandler<T extends object, TProps> implements DurableIteratorObjectDef<T> {
195
+ private readonly object;
196
+ private readonly options;
197
+ '~eventPayloadType'?: {
198
+ type: T;
199
+ };
200
+ private readonly handler;
201
+ private readonly resumeStorage;
202
+ /**
203
+ * Proxied, ensure you don't accidentally change internal state, and auto close if expired websockets before .send is called
204
+ */
205
+ ctx: DurableIteratorObjectState<TProps>;
206
+ constructor(ctx: DurableObjectState<TProps>, object: DurableObject<any, TProps>, options: DurableIteratorObjectHandlerOptions);
207
+ /**
208
+ * Publish an event to a set of clients.
209
+ */
210
+ publishEvent(payload: T, options?: PublishEventOptions): void;
211
+ /**
212
+ * This method is called when a HTTP request is received for upgrading to a WebSocket connection.
213
+ * Should mapping with corresponding `fetch` inside durable object
214
+ */
215
+ fetch(request: Request): Promise<Response>;
216
+ /**
217
+ * This method is called when a WebSocket message is received.
218
+ * Should mapping with corresponding `webSocketMessage` inside durable object
219
+ */
220
+ webSocketMessage(websocket_: WebSocket, message: string | ArrayBuffer): Promise<void>;
221
+ /**
222
+ * This method is called when a WebSocket connection is closed.
223
+ * Should mapping with corresponding `webSocketClose` inside durable object
224
+ */
225
+ webSocketClose(ws_: WebSocket, _code: number, _reason: string, _wasClean: boolean): void | Promise<void>;
226
+ }
227
+
228
+ declare class DurableIteratorObject<T extends object, TEnv = Cloudflare.Env, TProps = {}> extends DurableObject<TEnv, TProps> implements DurableIteratorObject$1<T> {
229
+ '~orpc': DurableIteratorObjectHandler<T, TProps>;
230
+ /**
231
+ * Proxied, ensure you don't accidentally change internal state, and auto close if expired websockets before .send is called
232
+ */
233
+ protected ctx: DurableIteratorObjectState<TProps>;
234
+ constructor(ctx: DurableObjectState<TProps>, env: TEnv, options: DurableIteratorObjectHandlerOptions);
235
+ /**
236
+ * Publish an event to clients
237
+ */
238
+ publishEvent(payload: T, options?: PublishEventOptions): void;
239
+ /**
240
+ * Upgrades websocket connection
241
+ *
242
+ * @info You can safety intercept non-upgrade requests
243
+ * @warning No verification is done here, you should verify the token payload before calling this method.
244
+ */
245
+ fetch(request: Request): Promise<Response>;
246
+ /**
247
+ * Handle WebSocket messages
248
+ *
249
+ * @warning Use `toDurableIteratorWebsocket` to proxy the WebSocket when interacting
250
+ * to avoid accidentally modifying internal state, and auto close if expired before .send is called
251
+ */
252
+ webSocketMessage(websocket: WebSocket, message: string | ArrayBuffer): Promise<void>;
253
+ /**
254
+ * Handle WebSocket close event
255
+ *
256
+ * @warning Use `toDurableIteratorWebsocket` to proxy the WebSocket when interacting
257
+ * to avoid accidentally modifying internal state, and auto close if expired before .send is called
258
+ */
259
+ webSocketClose(websocket: WebSocket, code: number, reason: string, wasClean: boolean): void | Promise<void>;
260
+ }
261
+
262
+ interface UpgradeDurableIteratorRequestOptions {
263
+ /**
264
+ * The signing key used to verify the token
265
+ */
266
+ signingKey: string;
267
+ /**
268
+ * The durable object namespace
269
+ */
270
+ namespace: DurableObjectNamespace<any>;
271
+ /**
272
+ * The options to use when getting the durable object stub
273
+ */
274
+ namespaceGetOptions?: DurableObjectNamespaceGetDurableObjectOptions;
275
+ /**
276
+ * intercept upgrade process
277
+ */
278
+ interceptors?: Interceptor<{
279
+ payload: DurableIteratorTokenPayload;
280
+ }, Promise<Response>>[];
281
+ }
282
+ /**
283
+ * Verifies and upgrades a durable iterator request.
284
+ *
285
+ * @info Verify token before forwarding to durable object to prevent DDoS attacks
286
+ */
287
+ declare function upgradeDurableIteratorRequest(request: Request, options: UpgradeDurableIteratorRequestOptions): Promise<Response>;
288
+
289
+ export { DurableIteratorObject, DurableIteratorObjectHandler, EventResumeStorage, toDurableIteratorObjectState, toDurableIteratorWebsocket, upgradeDurableIteratorRequest };
290
+ export type { DurableIteratorObjectHandlerOptions, DurableIteratorObjectState, DurableIteratorObjectStateInternal, DurableIteratorWebsocket, DurableIteratorWebsocketInternal, EventResumeStorageOptions, PublishEventOptions, ResumeEventFilter, UpgradeDurableIteratorRequestOptions };
@@ -0,0 +1,290 @@
1
+ import { RPCHandlerOptions } from '@orpc/server/websocket';
2
+ import { DurableObject } from 'cloudflare:workers';
3
+ import { b as DurableIteratorTokenPayload, a as DurableIteratorObjectDef, D as DurableIteratorObject$1 } from '../shared/experimental-durable-iterator.DQjHfIr1.js';
4
+ import { StandardRPCJsonSerializerOptions } from '@orpc/client/standard';
5
+ import { Interceptor } from '@orpc/shared';
6
+ export { withEventMeta } from '@orpc/server';
7
+ import '@orpc/client';
8
+ import 'valibot';
9
+
10
+ interface DurableIteratorWebsocketInternal {
11
+ /**
12
+ * Access the original websocket instance
13
+ *
14
+ * @warning Be careful when using original because you can accidentally modifying internal state.
15
+ */
16
+ original: WebSocket;
17
+ /**
18
+ * Serialize the websocket id
19
+ *
20
+ * @warning this method should be called when client established connection
21
+ */
22
+ serializeId(id: string): void;
23
+ /**
24
+ * Deserialize the websocket id
25
+ *
26
+ * @warning this method assumes that the id is already set when client established connection
27
+ */
28
+ deserializeId(): string;
29
+ /**
30
+ * Serialize the token payload usually when client connected
31
+ *
32
+ * @warning this method should be called when client established connection or when token payload is updated
33
+ */
34
+ serializeTokenPayload(payload: DurableIteratorTokenPayload): void;
35
+ /**
36
+ * Deserialize the payload attached when client connected
37
+ *
38
+ * @warning this method assumes that the token payload is already set when client established connection
39
+ */
40
+ deserializeTokenPayload(): DurableIteratorTokenPayload;
41
+ /**
42
+ * Serialize the hibernation id used for publishing events to the client
43
+ */
44
+ serializeHibernationId(id: string): void;
45
+ /**
46
+ * Deserialize the hibernation id used for publishing events to the client
47
+ */
48
+ deserializeHibernationId(): string | undefined;
49
+ /**
50
+ * Close the websocket connection if expired
51
+ *
52
+ * @warning this method assumes that the token payload is already set when client established connection
53
+ */
54
+ closeIfExpired(): void;
55
+ }
56
+ interface DurableIteratorWebsocket extends WebSocket {
57
+ /**
58
+ * Durable Event internal apis
59
+ */
60
+ ['~orpc']: DurableIteratorWebsocketInternal;
61
+ }
62
+ /**
63
+ * Create a Durable Iterator WebSocket from a regular WebSocket
64
+ *
65
+ * @info The websocket automatically closes if expired before sending data
66
+ */
67
+ declare function toDurableIteratorWebsocket(original: WebSocket): DurableIteratorWebsocket;
68
+
69
+ interface DurableIteratorObjectStateInternal {
70
+ /**
71
+ * The original DurableObjectState
72
+ *
73
+ * @warning Be careful when using original because you can accidentally modifying internal state.
74
+ */
75
+ original: DurableObjectState;
76
+ }
77
+ interface DurableIteratorObjectState<TProps> extends DurableObjectState<TProps> {
78
+ /**
79
+ * DurableIteratorObjectState internal apis
80
+ */
81
+ '~orpc': DurableIteratorObjectStateInternal;
82
+ /**
83
+ * Get all WebSockets connected to this Durable Object
84
+ * And convert them to DurableIteratorWebsocket to avoid accidentally modifying internal state
85
+ */
86
+ 'getWebSockets'(...args: Parameters<DurableObjectState['getWebSockets']>): DurableIteratorWebsocket[];
87
+ }
88
+ declare function toDurableIteratorObjectState<TProps>(original: DurableObjectState<TProps>): DurableIteratorObjectState<TProps>;
89
+
90
+ interface EventResumeStorageOptions extends StandardRPCJsonSerializerOptions {
91
+ /**
92
+ * How long (in seconds) to retain events for reconnection replay.
93
+ *
94
+ * When a client reconnects, stored events within this window can be replayed
95
+ * to ensure no data is lost. Outside this window, missed events are dropped.
96
+ *
97
+ * @remarks
98
+ * - Use infinite values to disable
99
+ * - Note that for performance, expired event cleanup is deferred. This means
100
+ * expired events may remain in storage for a short period beyond their
101
+ * retention time.
102
+ *
103
+ * @default NaN (disabled)
104
+ */
105
+ resumeRetentionSeconds?: number;
106
+ /**
107
+ * Prefix for the resume storage table schema.
108
+ * This is used to avoid naming conflicts with other tables in the same Durable Object.
109
+ *
110
+ * @default 'orpc:durable-iterator:resume:'
111
+ */
112
+ resumeSchemaPrefix?: string;
113
+ }
114
+ interface ResumeEventFilter {
115
+ /** Only websockets with these tags will receive the event */
116
+ tags?: readonly string[];
117
+ /** Only websockets that are in this list will receive the event */
118
+ targets?: readonly DurableIteratorWebsocket[];
119
+ /** Websockets that are in this list will not receive the event */
120
+ exclude?: readonly DurableIteratorWebsocket[];
121
+ }
122
+ declare class EventResumeStorage<T extends object> {
123
+ private readonly durableState;
124
+ private readonly serializer;
125
+ private readonly retentionSeconds;
126
+ private readonly schemaPrefix;
127
+ get isEnabled(): boolean;
128
+ constructor(durableState: DurableObjectState, options?: EventResumeStorageOptions);
129
+ /**
130
+ * Store an payload for resume capability.
131
+ *
132
+ * @returns The updated meta of the stored payload
133
+ */
134
+ store(payload: T, resumeFilter: ResumeEventFilter): T;
135
+ /**
136
+ * Get events after lastEventId for a specific websocket
137
+ */
138
+ get(websocket: DurableIteratorWebsocket, lastEventId: string): T[];
139
+ private initSchema;
140
+ private resetSchema;
141
+ private lastCleanupTime;
142
+ private cleanupExpiredEvents;
143
+ private serializeEventPayload;
144
+ private deserializeEventPayload;
145
+ private withEventId;
146
+ }
147
+
148
+ type DurableIteratorObjectRouterContext = {
149
+ object: DurableObject<any, any>;
150
+ resumeStorage: EventResumeStorage<any>;
151
+ websocket: DurableIteratorWebsocket;
152
+ options: DurableIteratorObjectHandlerOptions;
153
+ };
154
+ interface PublishEventOptions {
155
+ /**
156
+ * Deliver the event only to websockets that have the specified tags.
157
+ */
158
+ tags?: readonly string[];
159
+ /**
160
+ * Restrict the event to a specific set of websockets.
161
+ *
162
+ * Accept a list of websockets or a filter function.
163
+ *
164
+ * Use this when security is important — only the listed websockets
165
+ * will ever receive the event. Newly connected websockets are not
166
+ * included unless explicitly added here.
167
+ */
168
+ targets?: readonly WebSocket[] | ((ws: DurableIteratorWebsocket) => boolean);
169
+ /**
170
+ * Exclude certain websockets from receiving the event.
171
+ *
172
+ * Accept a list of websockets or a filter function.
173
+ *
174
+ * Use this when broadcasting widely but skipping a few clients
175
+ * (e.g., the sender). Newly connected websockets may still receive
176
+ * the event if not listed here, so this is less strict than `targets`.
177
+ */
178
+ exclude?: readonly WebSocket[] | ((ws: DurableIteratorWebsocket) => boolean);
179
+ }
180
+ interface DurableIteratorObjectHandlerOptions extends RPCHandlerOptions<DurableIteratorObjectRouterContext>, EventResumeStorageOptions {
181
+ /**
182
+ * The signing key to use verify the token.
183
+ */
184
+ signingKey: string;
185
+ /**
186
+ * Called after a client successfully subscribes to the main iterator.
187
+ * You can start sending events to the client here.
188
+ *
189
+ * @param websocket Corresponding WebSocket connection.
190
+ * @param lastEventId Can be `undefined` if this is the first connection (not a resumed session).
191
+ */
192
+ onSubscribed?: (websocket: DurableIteratorWebsocket, lastEventId: string | undefined) => void;
193
+ }
194
+ declare class DurableIteratorObjectHandler<T extends object, TProps> implements DurableIteratorObjectDef<T> {
195
+ private readonly object;
196
+ private readonly options;
197
+ '~eventPayloadType'?: {
198
+ type: T;
199
+ };
200
+ private readonly handler;
201
+ private readonly resumeStorage;
202
+ /**
203
+ * Proxied, ensure you don't accidentally change internal state, and auto close if expired websockets before .send is called
204
+ */
205
+ ctx: DurableIteratorObjectState<TProps>;
206
+ constructor(ctx: DurableObjectState<TProps>, object: DurableObject<any, TProps>, options: DurableIteratorObjectHandlerOptions);
207
+ /**
208
+ * Publish an event to a set of clients.
209
+ */
210
+ publishEvent(payload: T, options?: PublishEventOptions): void;
211
+ /**
212
+ * This method is called when a HTTP request is received for upgrading to a WebSocket connection.
213
+ * Should mapping with corresponding `fetch` inside durable object
214
+ */
215
+ fetch(request: Request): Promise<Response>;
216
+ /**
217
+ * This method is called when a WebSocket message is received.
218
+ * Should mapping with corresponding `webSocketMessage` inside durable object
219
+ */
220
+ webSocketMessage(websocket_: WebSocket, message: string | ArrayBuffer): Promise<void>;
221
+ /**
222
+ * This method is called when a WebSocket connection is closed.
223
+ * Should mapping with corresponding `webSocketClose` inside durable object
224
+ */
225
+ webSocketClose(ws_: WebSocket, _code: number, _reason: string, _wasClean: boolean): void | Promise<void>;
226
+ }
227
+
228
+ declare class DurableIteratorObject<T extends object, TEnv = Cloudflare.Env, TProps = {}> extends DurableObject<TEnv, TProps> implements DurableIteratorObject$1<T> {
229
+ '~orpc': DurableIteratorObjectHandler<T, TProps>;
230
+ /**
231
+ * Proxied, ensure you don't accidentally change internal state, and auto close if expired websockets before .send is called
232
+ */
233
+ protected ctx: DurableIteratorObjectState<TProps>;
234
+ constructor(ctx: DurableObjectState<TProps>, env: TEnv, options: DurableIteratorObjectHandlerOptions);
235
+ /**
236
+ * Publish an event to clients
237
+ */
238
+ publishEvent(payload: T, options?: PublishEventOptions): void;
239
+ /**
240
+ * Upgrades websocket connection
241
+ *
242
+ * @info You can safety intercept non-upgrade requests
243
+ * @warning No verification is done here, you should verify the token payload before calling this method.
244
+ */
245
+ fetch(request: Request): Promise<Response>;
246
+ /**
247
+ * Handle WebSocket messages
248
+ *
249
+ * @warning Use `toDurableIteratorWebsocket` to proxy the WebSocket when interacting
250
+ * to avoid accidentally modifying internal state, and auto close if expired before .send is called
251
+ */
252
+ webSocketMessage(websocket: WebSocket, message: string | ArrayBuffer): Promise<void>;
253
+ /**
254
+ * Handle WebSocket close event
255
+ *
256
+ * @warning Use `toDurableIteratorWebsocket` to proxy the WebSocket when interacting
257
+ * to avoid accidentally modifying internal state, and auto close if expired before .send is called
258
+ */
259
+ webSocketClose(websocket: WebSocket, code: number, reason: string, wasClean: boolean): void | Promise<void>;
260
+ }
261
+
262
+ interface UpgradeDurableIteratorRequestOptions {
263
+ /**
264
+ * The signing key used to verify the token
265
+ */
266
+ signingKey: string;
267
+ /**
268
+ * The durable object namespace
269
+ */
270
+ namespace: DurableObjectNamespace<any>;
271
+ /**
272
+ * The options to use when getting the durable object stub
273
+ */
274
+ namespaceGetOptions?: DurableObjectNamespaceGetDurableObjectOptions;
275
+ /**
276
+ * intercept upgrade process
277
+ */
278
+ interceptors?: Interceptor<{
279
+ payload: DurableIteratorTokenPayload;
280
+ }, Promise<Response>>[];
281
+ }
282
+ /**
283
+ * Verifies and upgrades a durable iterator request.
284
+ *
285
+ * @info Verify token before forwarding to durable object to prevent DDoS attacks
286
+ */
287
+ declare function upgradeDurableIteratorRequest(request: Request, options: UpgradeDurableIteratorRequestOptions): Promise<Response>;
288
+
289
+ export { DurableIteratorObject, DurableIteratorObjectHandler, EventResumeStorage, toDurableIteratorObjectState, toDurableIteratorWebsocket, upgradeDurableIteratorRequest };
290
+ export type { DurableIteratorObjectHandlerOptions, DurableIteratorObjectState, DurableIteratorObjectStateInternal, DurableIteratorWebsocket, DurableIteratorWebsocketInternal, EventResumeStorageOptions, PublishEventOptions, ResumeEventFilter, UpgradeDurableIteratorRequestOptions };