@cloudflare/workers-types 0.20230518.0 → 0.20240405.1
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/2021-11-03/index.d.ts +1708 -191
- package/2021-11-03/index.ts +1659 -191
- package/2022-01-31/index.d.ts +1723 -166
- package/2022-01-31/index.ts +1674 -166
- package/2022-03-21/index.d.ts +1743 -166
- package/2022-03-21/index.ts +1694 -166
- package/2022-08-04/index.d.ts +1743 -166
- package/2022-08-04/index.ts +1694 -166
- package/2022-10-31/index.d.ts +1747 -168
- package/2022-10-31/index.ts +1698 -168
- package/2022-11-30/index.d.ts +1739 -167
- package/2022-11-30/index.ts +1690 -167
- package/2023-03-01/index.d.ts +4640 -0
- package/2023-03-01/index.ts +4579 -0
- package/2023-07-01/index.d.ts +4640 -0
- package/2023-07-01/index.ts +4579 -0
- package/README.md +9 -4
- package/experimental/index.d.ts +1787 -182
- package/experimental/index.ts +1738 -182
- package/index.d.ts +1708 -191
- package/index.ts +1659 -191
- package/oldest/index.d.ts +1708 -191
- package/oldest/index.ts +1659 -191
- package/package.json +1 -1
package/2021-11-03/index.d.ts
CHANGED
|
@@ -16,8 +16,15 @@ and limitations under the License.
|
|
|
16
16
|
// noinspection JSUnusedGlobalSymbols
|
|
17
17
|
declare class DOMException extends Error {
|
|
18
18
|
constructor(message?: string, name?: string);
|
|
19
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message) */
|
|
19
20
|
readonly message: string;
|
|
21
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name) */
|
|
20
22
|
readonly name: string;
|
|
23
|
+
/**
|
|
24
|
+
* @deprecated
|
|
25
|
+
*
|
|
26
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code)
|
|
27
|
+
*/
|
|
21
28
|
readonly code: number;
|
|
22
29
|
readonly stack: any;
|
|
23
30
|
static readonly INDEX_SIZE_ERR: number;
|
|
@@ -56,30 +63,61 @@ declare type WorkerGlobalScopeEventMap = {
|
|
|
56
63
|
declare abstract class WorkerGlobalScope extends EventTarget<WorkerGlobalScopeEventMap> {
|
|
57
64
|
EventTarget: typeof EventTarget;
|
|
58
65
|
}
|
|
66
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console) */
|
|
59
67
|
declare interface Console {
|
|
60
68
|
"assert"(condition?: boolean, ...data: any[]): void;
|
|
69
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/clear_static) */
|
|
61
70
|
clear(): void;
|
|
71
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/count_static) */
|
|
62
72
|
count(label?: string): void;
|
|
73
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/countReset_static) */
|
|
63
74
|
countReset(label?: string): void;
|
|
75
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/debug_static) */
|
|
64
76
|
debug(...data: any[]): void;
|
|
77
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dir_static) */
|
|
65
78
|
dir(item?: any, options?: any): void;
|
|
79
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dirxml_static) */
|
|
66
80
|
dirxml(...data: any[]): void;
|
|
81
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/error_static) */
|
|
67
82
|
error(...data: any[]): void;
|
|
83
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/group_static) */
|
|
68
84
|
group(...data: any[]): void;
|
|
85
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupCollapsed_static) */
|
|
69
86
|
groupCollapsed(...data: any[]): void;
|
|
87
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupEnd_static) */
|
|
70
88
|
groupEnd(): void;
|
|
89
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/info_static) */
|
|
71
90
|
info(...data: any[]): void;
|
|
91
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/log_static) */
|
|
72
92
|
log(...data: any[]): void;
|
|
93
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/table_static) */
|
|
73
94
|
table(tabularData?: any, properties?: string[]): void;
|
|
95
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/time_static) */
|
|
74
96
|
time(label?: string): void;
|
|
97
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeEnd_static) */
|
|
75
98
|
timeEnd(label?: string): void;
|
|
99
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeLog_static) */
|
|
76
100
|
timeLog(label?: string, ...data: any[]): void;
|
|
77
101
|
timeStamp(label?: string): void;
|
|
102
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/trace_static) */
|
|
78
103
|
trace(...data: any[]): void;
|
|
104
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/warn_static) */
|
|
79
105
|
warn(...data: any[]): void;
|
|
80
106
|
}
|
|
81
107
|
declare const console: Console;
|
|
82
108
|
declare type BufferSource = ArrayBufferView | ArrayBuffer;
|
|
109
|
+
declare type TypedArray =
|
|
110
|
+
| Int8Array
|
|
111
|
+
| Uint8Array
|
|
112
|
+
| Uint8ClampedArray
|
|
113
|
+
| Int16Array
|
|
114
|
+
| Uint16Array
|
|
115
|
+
| Int32Array
|
|
116
|
+
| Uint32Array
|
|
117
|
+
| Float32Array
|
|
118
|
+
| Float64Array
|
|
119
|
+
| BigInt64Array
|
|
120
|
+
| BigUint64Array;
|
|
83
121
|
declare namespace WebAssembly {
|
|
84
122
|
class CompileError extends Error {
|
|
85
123
|
constructor(message?: string);
|
|
@@ -154,7 +192,11 @@ declare namespace WebAssembly {
|
|
|
154
192
|
function instantiate(module: Module, imports?: Imports): Promise<Instance>;
|
|
155
193
|
function validate(bytes: BufferSource): boolean;
|
|
156
194
|
}
|
|
157
|
-
/**
|
|
195
|
+
/**
|
|
196
|
+
* This ServiceWorker API interface represents the global execution context of a service worker.
|
|
197
|
+
*
|
|
198
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorkerGlobalScope)
|
|
199
|
+
*/
|
|
158
200
|
declare interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
159
201
|
DOMException: typeof DOMException;
|
|
160
202
|
WorkerGlobalScope: typeof WorkerGlobalScope;
|
|
@@ -178,7 +220,7 @@ declare interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
|
178
220
|
structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;
|
|
179
221
|
fetch(
|
|
180
222
|
input: RequestInfo,
|
|
181
|
-
init?: RequestInit<RequestInitCfProperties
|
|
223
|
+
init?: RequestInit<RequestInitCfProperties>,
|
|
182
224
|
): Promise<Response>;
|
|
183
225
|
self: ServiceWorkerGlobalScope;
|
|
184
226
|
crypto: Crypto;
|
|
@@ -188,6 +230,7 @@ declare interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
|
188
230
|
readonly origin: string;
|
|
189
231
|
Event: typeof Event;
|
|
190
232
|
ExtendableEvent: typeof ExtendableEvent;
|
|
233
|
+
CustomEvent: typeof CustomEvent;
|
|
191
234
|
PromiseRejectionEvent: typeof PromiseRejectionEvent;
|
|
192
235
|
FetchEvent: typeof FetchEvent;
|
|
193
236
|
TailEvent: typeof TailEvent;
|
|
@@ -213,6 +256,7 @@ declare interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
|
213
256
|
Response: typeof Response;
|
|
214
257
|
WebSocket: typeof WebSocket;
|
|
215
258
|
WebSocketPair: typeof WebSocketPair;
|
|
259
|
+
WebSocketRequestResponsePair: typeof WebSocketRequestResponsePair;
|
|
216
260
|
AbortController: typeof AbortController;
|
|
217
261
|
AbortSignal: typeof AbortSignal;
|
|
218
262
|
TextDecoder: typeof TextDecoder;
|
|
@@ -231,53 +275,78 @@ declare interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
|
231
275
|
FixedLengthStream: typeof FixedLengthStream;
|
|
232
276
|
IdentityTransformStream: typeof IdentityTransformStream;
|
|
233
277
|
HTMLRewriter: typeof HTMLRewriter;
|
|
278
|
+
GPUAdapter: typeof gpuGPUAdapter;
|
|
279
|
+
GPUOutOfMemoryError: typeof gpuGPUOutOfMemoryError;
|
|
280
|
+
GPUValidationError: typeof gpuGPUValidationError;
|
|
281
|
+
GPUInternalError: typeof gpuGPUInternalError;
|
|
282
|
+
GPUDeviceLostInfo: typeof gpuGPUDeviceLostInfo;
|
|
283
|
+
GPUBufferUsage: typeof gpuGPUBufferUsage;
|
|
284
|
+
GPUShaderStage: typeof gpuGPUShaderStage;
|
|
285
|
+
GPUMapMode: typeof gpuGPUMapMode;
|
|
286
|
+
GPUTextureUsage: typeof gpuGPUTextureUsage;
|
|
287
|
+
GPUColorWrite: typeof gpuGPUColorWrite;
|
|
234
288
|
}
|
|
235
289
|
declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(
|
|
236
290
|
type: Type,
|
|
237
291
|
handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>,
|
|
238
|
-
options?: EventTargetAddEventListenerOptions | boolean
|
|
292
|
+
options?: EventTargetAddEventListenerOptions | boolean,
|
|
239
293
|
): void;
|
|
240
294
|
declare function removeEventListener<
|
|
241
|
-
Type extends keyof WorkerGlobalScopeEventMap
|
|
295
|
+
Type extends keyof WorkerGlobalScopeEventMap,
|
|
242
296
|
>(
|
|
243
297
|
type: Type,
|
|
244
298
|
handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>,
|
|
245
|
-
options?: EventTargetEventListenerOptions | boolean
|
|
299
|
+
options?: EventTargetEventListenerOptions | boolean,
|
|
246
300
|
): void;
|
|
247
|
-
/**
|
|
301
|
+
/**
|
|
302
|
+
* Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.
|
|
303
|
+
*
|
|
304
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
|
|
305
|
+
*/
|
|
248
306
|
declare function dispatchEvent(
|
|
249
|
-
event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap]
|
|
307
|
+
event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap],
|
|
250
308
|
): boolean;
|
|
309
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/btoa) */
|
|
251
310
|
declare function btoa(data: string): string;
|
|
311
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/atob) */
|
|
252
312
|
declare function atob(data: string): string;
|
|
313
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/setTimeout) */
|
|
253
314
|
declare function setTimeout(
|
|
254
315
|
callback: (...args: any[]) => void,
|
|
255
|
-
msDelay?: number
|
|
316
|
+
msDelay?: number,
|
|
256
317
|
): number;
|
|
318
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/setTimeout) */
|
|
257
319
|
declare function setTimeout<Args extends any[]>(
|
|
258
320
|
callback: (...args: Args) => void,
|
|
259
321
|
msDelay?: number,
|
|
260
322
|
...args: Args
|
|
261
323
|
): number;
|
|
324
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/clearTimeout) */
|
|
262
325
|
declare function clearTimeout(timeoutId: number | null): void;
|
|
326
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/setInterval) */
|
|
263
327
|
declare function setInterval(
|
|
264
328
|
callback: (...args: any[]) => void,
|
|
265
|
-
msDelay?: number
|
|
329
|
+
msDelay?: number,
|
|
266
330
|
): number;
|
|
331
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/setInterval) */
|
|
267
332
|
declare function setInterval<Args extends any[]>(
|
|
268
333
|
callback: (...args: Args) => void,
|
|
269
334
|
msDelay?: number,
|
|
270
335
|
...args: Args
|
|
271
336
|
): number;
|
|
337
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/clearInterval) */
|
|
272
338
|
declare function clearInterval(timeoutId: number | null): void;
|
|
339
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/queueMicrotask) */
|
|
273
340
|
declare function queueMicrotask(task: Function): void;
|
|
341
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/structuredClone) */
|
|
274
342
|
declare function structuredClone<T>(
|
|
275
343
|
value: T,
|
|
276
|
-
options?: StructuredSerializeOptions
|
|
344
|
+
options?: StructuredSerializeOptions,
|
|
277
345
|
): T;
|
|
346
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/fetch) */
|
|
278
347
|
declare function fetch(
|
|
279
348
|
input: RequestInfo,
|
|
280
|
-
init?: RequestInit<RequestInitCfProperties
|
|
349
|
+
init?: RequestInit<RequestInitCfProperties>,
|
|
281
350
|
): Promise<Response>;
|
|
282
351
|
declare const self: ServiceWorkerGlobalScope;
|
|
283
352
|
declare const crypto: Crypto;
|
|
@@ -292,85 +361,118 @@ declare interface ExecutionContext {
|
|
|
292
361
|
}
|
|
293
362
|
declare type ExportedHandlerFetchHandler<
|
|
294
363
|
Env = unknown,
|
|
295
|
-
CfHostMetadata = unknown
|
|
364
|
+
CfHostMetadata = unknown,
|
|
296
365
|
> = (
|
|
297
366
|
request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>,
|
|
298
367
|
env: Env,
|
|
299
|
-
ctx: ExecutionContext
|
|
368
|
+
ctx: ExecutionContext,
|
|
300
369
|
) => Response | Promise<Response>;
|
|
301
370
|
declare type ExportedHandlerTailHandler<Env = unknown> = (
|
|
302
371
|
events: TraceItem[],
|
|
303
372
|
env: Env,
|
|
304
|
-
ctx: ExecutionContext
|
|
373
|
+
ctx: ExecutionContext,
|
|
305
374
|
) => void | Promise<void>;
|
|
306
375
|
declare type ExportedHandlerTraceHandler<Env = unknown> = (
|
|
307
376
|
traces: TraceItem[],
|
|
308
377
|
env: Env,
|
|
309
|
-
ctx: ExecutionContext
|
|
378
|
+
ctx: ExecutionContext,
|
|
310
379
|
) => void | Promise<void>;
|
|
311
380
|
declare type ExportedHandlerScheduledHandler<Env = unknown> = (
|
|
312
381
|
controller: ScheduledController,
|
|
313
382
|
env: Env,
|
|
314
|
-
ctx: ExecutionContext
|
|
383
|
+
ctx: ExecutionContext,
|
|
315
384
|
) => void | Promise<void>;
|
|
316
385
|
declare type ExportedHandlerQueueHandler<Env = unknown, Message = unknown> = (
|
|
317
386
|
batch: MessageBatch<Message>,
|
|
318
387
|
env: Env,
|
|
319
|
-
ctx: ExecutionContext
|
|
388
|
+
ctx: ExecutionContext,
|
|
320
389
|
) => void | Promise<void>;
|
|
321
390
|
declare type ExportedHandlerTestHandler<Env = unknown> = (
|
|
322
391
|
controller: TestController,
|
|
323
392
|
env: Env,
|
|
324
|
-
ctx: ExecutionContext
|
|
393
|
+
ctx: ExecutionContext,
|
|
325
394
|
) => void | Promise<void>;
|
|
326
395
|
declare interface ExportedHandler<
|
|
327
396
|
Env = unknown,
|
|
328
|
-
|
|
329
|
-
CfHostMetadata = unknown
|
|
397
|
+
QueueHandlerMessage = unknown,
|
|
398
|
+
CfHostMetadata = unknown,
|
|
330
399
|
> {
|
|
331
400
|
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
|
|
332
401
|
tail?: ExportedHandlerTailHandler<Env>;
|
|
333
402
|
trace?: ExportedHandlerTraceHandler<Env>;
|
|
334
403
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
335
404
|
test?: ExportedHandlerTestHandler<Env>;
|
|
336
|
-
|
|
405
|
+
email?: EmailExportedHandler<Env>;
|
|
406
|
+
queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage>;
|
|
337
407
|
}
|
|
338
408
|
declare interface StructuredSerializeOptions {
|
|
339
409
|
transfer?: any[];
|
|
340
410
|
}
|
|
341
411
|
declare abstract class PromiseRejectionEvent extends Event {
|
|
412
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/promise) */
|
|
342
413
|
readonly promise: Promise<any>;
|
|
414
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/reason) */
|
|
343
415
|
readonly reason: any;
|
|
344
416
|
}
|
|
345
|
-
/**
|
|
417
|
+
/**
|
|
418
|
+
* Provides access to performance-related information for the current page. It's part of the High Resolution Time API, but is enhanced by the Performance Timeline API, the Navigation Timing API, the User Timing API, and the Resource Timing API.
|
|
419
|
+
*
|
|
420
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance)
|
|
421
|
+
*/
|
|
346
422
|
declare interface Performance {
|
|
423
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/timeOrigin) */
|
|
347
424
|
readonly timeOrigin: number;
|
|
425
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/now) */
|
|
348
426
|
now(): number;
|
|
349
427
|
}
|
|
428
|
+
declare interface AlarmInvocationInfo {
|
|
429
|
+
readonly isRetry: boolean;
|
|
430
|
+
readonly retryCount: number;
|
|
431
|
+
}
|
|
350
432
|
declare interface DurableObject {
|
|
351
433
|
fetch(request: Request): Response | Promise<Response>;
|
|
352
434
|
alarm?(): void | Promise<void>;
|
|
353
|
-
|
|
354
|
-
|
|
435
|
+
webSocketMessage?(
|
|
436
|
+
ws: WebSocket,
|
|
437
|
+
message: string | ArrayBuffer,
|
|
438
|
+
): void | Promise<void>;
|
|
439
|
+
webSocketClose?(
|
|
440
|
+
ws: WebSocket,
|
|
441
|
+
code: number,
|
|
442
|
+
reason: string,
|
|
443
|
+
wasClean: boolean,
|
|
444
|
+
): void | Promise<void>;
|
|
445
|
+
webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;
|
|
446
|
+
}
|
|
447
|
+
declare type DurableObjectStub<
|
|
448
|
+
T extends Rpc.DurableObjectBranded | undefined = undefined,
|
|
449
|
+
> = Fetcher<
|
|
450
|
+
T,
|
|
451
|
+
"alarm" | "webSocketMessage" | "webSocketClose" | "webSocketError"
|
|
452
|
+
> & {
|
|
355
453
|
readonly id: DurableObjectId;
|
|
356
454
|
readonly name?: string;
|
|
357
|
-
}
|
|
455
|
+
};
|
|
358
456
|
declare interface DurableObjectId {
|
|
359
457
|
toString(): string;
|
|
360
458
|
equals(other: DurableObjectId): boolean;
|
|
361
459
|
readonly name?: string;
|
|
362
460
|
}
|
|
363
|
-
declare interface DurableObjectNamespace
|
|
461
|
+
declare interface DurableObjectNamespace<
|
|
462
|
+
T extends Rpc.DurableObjectBranded | undefined = undefined,
|
|
463
|
+
> {
|
|
364
464
|
newUniqueId(
|
|
365
|
-
options?: DurableObjectNamespaceNewUniqueIdOptions
|
|
465
|
+
options?: DurableObjectNamespaceNewUniqueIdOptions,
|
|
366
466
|
): DurableObjectId;
|
|
367
467
|
idFromName(name: string): DurableObjectId;
|
|
368
468
|
idFromString(id: string): DurableObjectId;
|
|
369
469
|
get(
|
|
370
470
|
id: DurableObjectId,
|
|
371
|
-
options?: DurableObjectNamespaceGetDurableObjectOptions
|
|
372
|
-
): DurableObjectStub
|
|
373
|
-
jurisdiction(
|
|
471
|
+
options?: DurableObjectNamespaceGetDurableObjectOptions,
|
|
472
|
+
): DurableObjectStub<T>;
|
|
473
|
+
jurisdiction(
|
|
474
|
+
jurisdiction: DurableObjectJurisdiction,
|
|
475
|
+
): DurableObjectNamespace<T>;
|
|
374
476
|
}
|
|
375
477
|
declare type DurableObjectJurisdiction = "eu" | "fedramp";
|
|
376
478
|
declare interface DurableObjectNamespaceNewUniqueIdOptions {
|
|
@@ -396,27 +498,33 @@ declare interface DurableObjectState {
|
|
|
396
498
|
blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
|
|
397
499
|
acceptWebSocket(ws: WebSocket, tags?: string[]): void;
|
|
398
500
|
getWebSockets(tag?: string): WebSocket[];
|
|
501
|
+
setWebSocketAutoResponse(maybeReqResp?: WebSocketRequestResponsePair): void;
|
|
502
|
+
getWebSocketAutoResponse(): WebSocketRequestResponsePair | null;
|
|
503
|
+
getWebSocketAutoResponseTimestamp(ws: WebSocket): Date | null;
|
|
504
|
+
setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;
|
|
505
|
+
getHibernatableWebSocketEventTimeout(): number | null;
|
|
506
|
+
getTags(ws: WebSocket): string[];
|
|
399
507
|
}
|
|
400
508
|
declare interface DurableObjectTransaction {
|
|
401
509
|
get<T = unknown>(
|
|
402
510
|
key: string,
|
|
403
|
-
options?: DurableObjectGetOptions
|
|
511
|
+
options?: DurableObjectGetOptions,
|
|
404
512
|
): Promise<T | undefined>;
|
|
405
513
|
get<T = unknown>(
|
|
406
514
|
keys: string[],
|
|
407
|
-
options?: DurableObjectGetOptions
|
|
515
|
+
options?: DurableObjectGetOptions,
|
|
408
516
|
): Promise<Map<string, T>>;
|
|
409
517
|
list<T = unknown>(
|
|
410
|
-
options?: DurableObjectListOptions
|
|
518
|
+
options?: DurableObjectListOptions,
|
|
411
519
|
): Promise<Map<string, T>>;
|
|
412
520
|
put<T>(
|
|
413
521
|
key: string,
|
|
414
522
|
value: T,
|
|
415
|
-
options?: DurableObjectPutOptions
|
|
523
|
+
options?: DurableObjectPutOptions,
|
|
416
524
|
): Promise<void>;
|
|
417
525
|
put<T>(
|
|
418
526
|
entries: Record<string, T>,
|
|
419
|
-
options?: DurableObjectPutOptions
|
|
527
|
+
options?: DurableObjectPutOptions,
|
|
420
528
|
): Promise<void>;
|
|
421
529
|
delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;
|
|
422
530
|
delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;
|
|
@@ -424,41 +532,41 @@ declare interface DurableObjectTransaction {
|
|
|
424
532
|
getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;
|
|
425
533
|
setAlarm(
|
|
426
534
|
scheduledTime: number | Date,
|
|
427
|
-
options?: DurableObjectSetAlarmOptions
|
|
535
|
+
options?: DurableObjectSetAlarmOptions,
|
|
428
536
|
): Promise<void>;
|
|
429
537
|
deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
|
|
430
538
|
}
|
|
431
539
|
declare interface DurableObjectStorage {
|
|
432
540
|
get<T = unknown>(
|
|
433
541
|
key: string,
|
|
434
|
-
options?: DurableObjectGetOptions
|
|
542
|
+
options?: DurableObjectGetOptions,
|
|
435
543
|
): Promise<T | undefined>;
|
|
436
544
|
get<T = unknown>(
|
|
437
545
|
keys: string[],
|
|
438
|
-
options?: DurableObjectGetOptions
|
|
546
|
+
options?: DurableObjectGetOptions,
|
|
439
547
|
): Promise<Map<string, T>>;
|
|
440
548
|
list<T = unknown>(
|
|
441
|
-
options?: DurableObjectListOptions
|
|
549
|
+
options?: DurableObjectListOptions,
|
|
442
550
|
): Promise<Map<string, T>>;
|
|
443
551
|
put<T>(
|
|
444
552
|
key: string,
|
|
445
553
|
value: T,
|
|
446
|
-
options?: DurableObjectPutOptions
|
|
554
|
+
options?: DurableObjectPutOptions,
|
|
447
555
|
): Promise<void>;
|
|
448
556
|
put<T>(
|
|
449
557
|
entries: Record<string, T>,
|
|
450
|
-
options?: DurableObjectPutOptions
|
|
558
|
+
options?: DurableObjectPutOptions,
|
|
451
559
|
): Promise<void>;
|
|
452
560
|
delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;
|
|
453
561
|
delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;
|
|
454
562
|
deleteAll(options?: DurableObjectPutOptions): Promise<void>;
|
|
455
563
|
transaction<T>(
|
|
456
|
-
closure: (txn: DurableObjectTransaction) => Promise<T
|
|
564
|
+
closure: (txn: DurableObjectTransaction) => Promise<T>,
|
|
457
565
|
): Promise<T>;
|
|
458
566
|
getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;
|
|
459
567
|
setAlarm(
|
|
460
568
|
scheduledTime: number | Date,
|
|
461
|
-
options?: DurableObjectSetAlarmOptions
|
|
569
|
+
options?: DurableObjectSetAlarmOptions,
|
|
462
570
|
): Promise<void>;
|
|
463
571
|
deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
|
|
464
572
|
sync(): Promise<void>;
|
|
@@ -490,6 +598,11 @@ declare interface DurableObjectSetAlarmOptions {
|
|
|
490
598
|
allowConcurrency?: boolean;
|
|
491
599
|
allowUnconfirmed?: boolean;
|
|
492
600
|
}
|
|
601
|
+
declare class WebSocketRequestResponsePair {
|
|
602
|
+
constructor(request: string, response: string);
|
|
603
|
+
get request(): string;
|
|
604
|
+
get response(): string;
|
|
605
|
+
}
|
|
493
606
|
declare interface AnalyticsEngineDataset {
|
|
494
607
|
writeDataPoint(event?: AnalyticsEngineDataPoint): void;
|
|
495
608
|
}
|
|
@@ -500,32 +613,101 @@ declare interface AnalyticsEngineDataPoint {
|
|
|
500
613
|
}
|
|
501
614
|
declare class Event {
|
|
502
615
|
constructor(type: string, init?: EventInit);
|
|
503
|
-
/**
|
|
616
|
+
/**
|
|
617
|
+
* Returns the type of event, e.g. "click", "hashchange", or "submit".
|
|
618
|
+
*
|
|
619
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/type)
|
|
620
|
+
*/
|
|
504
621
|
readonly type: string;
|
|
505
|
-
/**
|
|
622
|
+
/**
|
|
623
|
+
* Returns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE.
|
|
624
|
+
*
|
|
625
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/eventPhase)
|
|
626
|
+
*/
|
|
506
627
|
readonly eventPhase: number;
|
|
507
|
-
/**
|
|
628
|
+
/**
|
|
629
|
+
* Returns true or false depending on how event was initialized. True if event invokes listeners past a ShadowRoot node that is the root of its target, and false otherwise.
|
|
630
|
+
*
|
|
631
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composed)
|
|
632
|
+
*/
|
|
508
633
|
readonly composed: boolean;
|
|
509
|
-
/**
|
|
634
|
+
/**
|
|
635
|
+
* Returns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise.
|
|
636
|
+
*
|
|
637
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/bubbles)
|
|
638
|
+
*/
|
|
510
639
|
readonly bubbles: boolean;
|
|
511
|
-
/**
|
|
640
|
+
/**
|
|
641
|
+
* Returns true or false depending on how event was initialized. Its return value does not always carry meaning, but true can indicate that part of the operation during which event was dispatched, can be canceled by invoking the preventDefault() method.
|
|
642
|
+
*
|
|
643
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelable)
|
|
644
|
+
*/
|
|
512
645
|
readonly cancelable: boolean;
|
|
513
|
-
/**
|
|
646
|
+
/**
|
|
647
|
+
* Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise.
|
|
648
|
+
*
|
|
649
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/defaultPrevented)
|
|
650
|
+
*/
|
|
514
651
|
readonly defaultPrevented: boolean;
|
|
515
|
-
/**
|
|
652
|
+
/**
|
|
653
|
+
* @deprecated
|
|
654
|
+
*
|
|
655
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/returnValue)
|
|
656
|
+
*/
|
|
516
657
|
readonly returnValue: boolean;
|
|
517
|
-
/**
|
|
658
|
+
/**
|
|
659
|
+
* Returns the object whose event listener's callback is currently being invoked.
|
|
660
|
+
*
|
|
661
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/currentTarget)
|
|
662
|
+
*/
|
|
518
663
|
readonly currentTarget?: EventTarget;
|
|
519
|
-
/**
|
|
664
|
+
/**
|
|
665
|
+
* @deprecated
|
|
666
|
+
*
|
|
667
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/srcElement)
|
|
668
|
+
*/
|
|
520
669
|
readonly srcElement?: EventTarget;
|
|
521
|
-
/**
|
|
670
|
+
/**
|
|
671
|
+
* Returns the event's timestamp as the number of milliseconds measured relative to the time origin.
|
|
672
|
+
*
|
|
673
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/timeStamp)
|
|
674
|
+
*/
|
|
522
675
|
readonly timeStamp: number;
|
|
523
|
-
/**
|
|
676
|
+
/**
|
|
677
|
+
* Returns true if event was dispatched by the user agent, and false otherwise.
|
|
678
|
+
*
|
|
679
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/isTrusted)
|
|
680
|
+
*/
|
|
524
681
|
readonly isTrusted: boolean;
|
|
682
|
+
/**
|
|
683
|
+
* @deprecated
|
|
684
|
+
*
|
|
685
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)
|
|
686
|
+
*/
|
|
525
687
|
cancelBubble: boolean;
|
|
688
|
+
/**
|
|
689
|
+
* Invoking this method prevents event from reaching any registered event listeners after the current one finishes running and, when dispatched in a tree, also prevents event from reaching any other objects.
|
|
690
|
+
*
|
|
691
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopImmediatePropagation)
|
|
692
|
+
*/
|
|
526
693
|
stopImmediatePropagation(): void;
|
|
694
|
+
/**
|
|
695
|
+
* If invoked when the cancelable attribute value is true, and while executing a listener for the event with passive set to false, signals to the operation that caused event to be dispatched that it needs to be canceled.
|
|
696
|
+
*
|
|
697
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/preventDefault)
|
|
698
|
+
*/
|
|
527
699
|
preventDefault(): void;
|
|
700
|
+
/**
|
|
701
|
+
* When dispatched in a tree, invoking this method prevents event from reaching any objects other than the current object.
|
|
702
|
+
*
|
|
703
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopPropagation)
|
|
704
|
+
*/
|
|
528
705
|
stopPropagation(): void;
|
|
706
|
+
/**
|
|
707
|
+
* Returns the invocation target objects of event's path (objects on which listeners will be invoked), except for any nodes in shadow trees of which the shadow root's mode is "closed" that are not reachable from event's currentTarget.
|
|
708
|
+
*
|
|
709
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composedPath)
|
|
710
|
+
*/
|
|
529
711
|
composedPath(): EventTarget[];
|
|
530
712
|
static readonly NONE: number;
|
|
531
713
|
static readonly CAPTURING_PHASE: number;
|
|
@@ -538,28 +720,55 @@ declare interface EventInit {
|
|
|
538
720
|
composed?: boolean;
|
|
539
721
|
}
|
|
540
722
|
declare type EventListener<EventType extends Event = Event> = (
|
|
541
|
-
event: EventType
|
|
723
|
+
event: EventType,
|
|
542
724
|
) => void;
|
|
543
725
|
declare interface EventListenerObject<EventType extends Event = Event> {
|
|
544
726
|
handleEvent(event: EventType): void;
|
|
545
727
|
}
|
|
546
728
|
declare type EventListenerOrEventListenerObject<
|
|
547
|
-
EventType extends Event = Event
|
|
729
|
+
EventType extends Event = Event,
|
|
548
730
|
> = EventListener<EventType> | EventListenerObject<EventType>;
|
|
549
731
|
declare class EventTarget<
|
|
550
|
-
EventMap extends Record<string, Event> = Record<string, Event
|
|
732
|
+
EventMap extends Record<string, Event> = Record<string, Event>,
|
|
551
733
|
> {
|
|
552
734
|
constructor();
|
|
735
|
+
/**
|
|
736
|
+
* Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
|
|
737
|
+
*
|
|
738
|
+
* The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
|
|
739
|
+
*
|
|
740
|
+
* When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
|
|
741
|
+
*
|
|
742
|
+
* When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
|
|
743
|
+
*
|
|
744
|
+
* When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
|
|
745
|
+
*
|
|
746
|
+
* If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
|
|
747
|
+
*
|
|
748
|
+
* The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
|
|
749
|
+
*
|
|
750
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
|
|
751
|
+
*/
|
|
553
752
|
addEventListener<Type extends keyof EventMap>(
|
|
554
753
|
type: Type,
|
|
555
754
|
handler: EventListenerOrEventListenerObject<EventMap[Type]>,
|
|
556
|
-
options?: EventTargetAddEventListenerOptions | boolean
|
|
755
|
+
options?: EventTargetAddEventListenerOptions | boolean,
|
|
557
756
|
): void;
|
|
757
|
+
/**
|
|
758
|
+
* Removes the event listener in target's event listener list with the same type, callback, and options.
|
|
759
|
+
*
|
|
760
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
|
|
761
|
+
*/
|
|
558
762
|
removeEventListener<Type extends keyof EventMap>(
|
|
559
763
|
type: Type,
|
|
560
764
|
handler: EventListenerOrEventListenerObject<EventMap[Type]>,
|
|
561
|
-
options?: EventTargetEventListenerOptions | boolean
|
|
765
|
+
options?: EventTargetEventListenerOptions | boolean,
|
|
562
766
|
): void;
|
|
767
|
+
/**
|
|
768
|
+
* Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.
|
|
769
|
+
*
|
|
770
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
|
|
771
|
+
*/
|
|
563
772
|
dispatchEvent(event: EventMap[keyof EventMap]): boolean;
|
|
564
773
|
}
|
|
565
774
|
declare interface EventTargetEventListenerOptions {
|
|
@@ -576,17 +785,38 @@ declare interface EventTargetHandlerObject {
|
|
|
576
785
|
}
|
|
577
786
|
declare class AbortController {
|
|
578
787
|
constructor();
|
|
579
|
-
/**
|
|
788
|
+
/**
|
|
789
|
+
* Returns the AbortSignal object associated with this object.
|
|
790
|
+
*
|
|
791
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/signal)
|
|
792
|
+
*/
|
|
580
793
|
readonly signal: AbortSignal;
|
|
794
|
+
/**
|
|
795
|
+
* Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted.
|
|
796
|
+
*
|
|
797
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/abort)
|
|
798
|
+
*/
|
|
581
799
|
abort(reason?: any): void;
|
|
582
800
|
}
|
|
583
801
|
declare abstract class AbortSignal extends EventTarget {
|
|
802
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_static) */
|
|
584
803
|
static abort(reason?: any): AbortSignal;
|
|
804
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/timeout_static) */
|
|
585
805
|
static timeout(delay: number): AbortSignal;
|
|
586
806
|
static any(signals: AbortSignal[]): AbortSignal;
|
|
587
|
-
/**
|
|
807
|
+
/**
|
|
808
|
+
* Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise.
|
|
809
|
+
*
|
|
810
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/aborted)
|
|
811
|
+
*/
|
|
588
812
|
readonly aborted: boolean;
|
|
813
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/reason) */
|
|
589
814
|
readonly reason: any;
|
|
815
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */
|
|
816
|
+
get onabort(): any | null;
|
|
817
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */
|
|
818
|
+
set onabort(value: any | null);
|
|
819
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/throwIfAborted) */
|
|
590
820
|
throwIfAborted(): void;
|
|
591
821
|
}
|
|
592
822
|
declare interface Scheduler {
|
|
@@ -596,18 +826,40 @@ declare interface SchedulerWaitOptions {
|
|
|
596
826
|
signal?: AbortSignal;
|
|
597
827
|
}
|
|
598
828
|
declare abstract class ExtendableEvent extends Event {
|
|
829
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent/waitUntil) */
|
|
599
830
|
waitUntil(promise: Promise<any>): void;
|
|
600
831
|
}
|
|
832
|
+
declare class CustomEvent<T = any> extends Event {
|
|
833
|
+
constructor(type: string, init?: CustomEventCustomEventInit);
|
|
834
|
+
/**
|
|
835
|
+
* Returns any custom data event was created with. Typically used for synthetic events.
|
|
836
|
+
*
|
|
837
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent/detail)
|
|
838
|
+
*/
|
|
839
|
+
get detail(): T;
|
|
840
|
+
}
|
|
841
|
+
declare interface CustomEventCustomEventInit {
|
|
842
|
+
bubbles?: boolean;
|
|
843
|
+
cancelable?: boolean;
|
|
844
|
+
composed?: boolean;
|
|
845
|
+
detail?: any;
|
|
846
|
+
}
|
|
601
847
|
declare class Blob {
|
|
602
848
|
constructor(
|
|
603
849
|
bits?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[],
|
|
604
|
-
options?: BlobOptions
|
|
850
|
+
options?: BlobOptions,
|
|
605
851
|
);
|
|
852
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size) */
|
|
606
853
|
readonly size: number;
|
|
854
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type) */
|
|
607
855
|
readonly type: string;
|
|
856
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice) */
|
|
608
857
|
slice(start?: number, end?: number, type?: string): Blob;
|
|
858
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/arrayBuffer) */
|
|
609
859
|
arrayBuffer(): Promise<ArrayBuffer>;
|
|
860
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text) */
|
|
610
861
|
text(): Promise<string>;
|
|
862
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/stream) */
|
|
611
863
|
stream(): ReadableStream;
|
|
612
864
|
}
|
|
613
865
|
declare interface BlobOptions {
|
|
@@ -617,9 +869,11 @@ declare class File extends Blob {
|
|
|
617
869
|
constructor(
|
|
618
870
|
bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined,
|
|
619
871
|
name: string,
|
|
620
|
-
options?: FileOptions
|
|
872
|
+
options?: FileOptions,
|
|
621
873
|
);
|
|
874
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name) */
|
|
622
875
|
readonly name: string;
|
|
876
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified) */
|
|
623
877
|
readonly lastModified: number;
|
|
624
878
|
}
|
|
625
879
|
declare interface FileOptions {
|
|
@@ -627,6 +881,7 @@ declare interface FileOptions {
|
|
|
627
881
|
lastModified?: number;
|
|
628
882
|
}
|
|
629
883
|
declare abstract class CacheStorage {
|
|
884
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/open) */
|
|
630
885
|
open(cacheName: string): Promise<Cache>;
|
|
631
886
|
readonly default: Cache;
|
|
632
887
|
}
|
|
@@ -634,7 +889,7 @@ declare abstract class Cache {
|
|
|
634
889
|
delete(request: RequestInfo, options?: CacheQueryOptions): Promise<boolean>;
|
|
635
890
|
match(
|
|
636
891
|
request: RequestInfo,
|
|
637
|
-
options?: CacheQueryOptions
|
|
892
|
+
options?: CacheQueryOptions,
|
|
638
893
|
): Promise<Response | undefined>;
|
|
639
894
|
put(request: RequestInfo, response: Response): Promise<void>;
|
|
640
895
|
}
|
|
@@ -642,8 +897,13 @@ declare interface CacheQueryOptions {
|
|
|
642
897
|
ignoreMethod?: boolean;
|
|
643
898
|
}
|
|
644
899
|
declare abstract class Crypto {
|
|
645
|
-
/**
|
|
900
|
+
/**
|
|
901
|
+
* Available only in secure contexts.
|
|
902
|
+
*
|
|
903
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/subtle)
|
|
904
|
+
*/
|
|
646
905
|
readonly subtle: SubtleCrypto;
|
|
906
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues) */
|
|
647
907
|
getRandomValues<
|
|
648
908
|
T extends
|
|
649
909
|
| Int8Array
|
|
@@ -653,8 +913,13 @@ declare abstract class Crypto {
|
|
|
653
913
|
| Int32Array
|
|
654
914
|
| Uint32Array
|
|
655
915
|
| BigInt64Array
|
|
656
|
-
| BigUint64Array
|
|
916
|
+
| BigUint64Array,
|
|
657
917
|
>(buffer: T): T;
|
|
918
|
+
/**
|
|
919
|
+
* Available only in secure contexts.
|
|
920
|
+
*
|
|
921
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/randomUUID)
|
|
922
|
+
*/
|
|
658
923
|
randomUUID(): string;
|
|
659
924
|
DigestStream: typeof DigestStream;
|
|
660
925
|
}
|
|
@@ -662,59 +927,63 @@ declare abstract class SubtleCrypto {
|
|
|
662
927
|
encrypt(
|
|
663
928
|
algorithm: string | SubtleCryptoEncryptAlgorithm,
|
|
664
929
|
key: CryptoKey,
|
|
665
|
-
plainText: ArrayBuffer | ArrayBufferView
|
|
930
|
+
plainText: ArrayBuffer | ArrayBufferView,
|
|
666
931
|
): Promise<ArrayBuffer>;
|
|
667
932
|
decrypt(
|
|
668
933
|
algorithm: string | SubtleCryptoEncryptAlgorithm,
|
|
669
934
|
key: CryptoKey,
|
|
670
|
-
cipherText: ArrayBuffer | ArrayBufferView
|
|
935
|
+
cipherText: ArrayBuffer | ArrayBufferView,
|
|
671
936
|
): Promise<ArrayBuffer>;
|
|
672
937
|
sign(
|
|
673
938
|
algorithm: string | SubtleCryptoSignAlgorithm,
|
|
674
939
|
key: CryptoKey,
|
|
675
|
-
data: ArrayBuffer | ArrayBufferView
|
|
940
|
+
data: ArrayBuffer | ArrayBufferView,
|
|
676
941
|
): Promise<ArrayBuffer>;
|
|
677
942
|
verify(
|
|
678
943
|
algorithm: string | SubtleCryptoSignAlgorithm,
|
|
679
944
|
key: CryptoKey,
|
|
680
945
|
signature: ArrayBuffer | ArrayBufferView,
|
|
681
|
-
data: ArrayBuffer | ArrayBufferView
|
|
946
|
+
data: ArrayBuffer | ArrayBufferView,
|
|
682
947
|
): Promise<boolean>;
|
|
683
948
|
digest(
|
|
684
949
|
algorithm: string | SubtleCryptoHashAlgorithm,
|
|
685
|
-
data: ArrayBuffer | ArrayBufferView
|
|
950
|
+
data: ArrayBuffer | ArrayBufferView,
|
|
686
951
|
): Promise<ArrayBuffer>;
|
|
952
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/generateKey) */
|
|
687
953
|
generateKey(
|
|
688
954
|
algorithm: string | SubtleCryptoGenerateKeyAlgorithm,
|
|
689
955
|
extractable: boolean,
|
|
690
|
-
keyUsages: string[]
|
|
956
|
+
keyUsages: string[],
|
|
691
957
|
): Promise<CryptoKey | CryptoKeyPair>;
|
|
958
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveKey) */
|
|
692
959
|
deriveKey(
|
|
693
960
|
algorithm: string | SubtleCryptoDeriveKeyAlgorithm,
|
|
694
961
|
baseKey: CryptoKey,
|
|
695
962
|
derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm,
|
|
696
963
|
extractable: boolean,
|
|
697
|
-
keyUsages: string[]
|
|
964
|
+
keyUsages: string[],
|
|
698
965
|
): Promise<CryptoKey>;
|
|
699
966
|
deriveBits(
|
|
700
967
|
algorithm: string | SubtleCryptoDeriveKeyAlgorithm,
|
|
701
968
|
baseKey: CryptoKey,
|
|
702
|
-
length: number | null
|
|
969
|
+
length: number | null,
|
|
703
970
|
): Promise<ArrayBuffer>;
|
|
971
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/importKey) */
|
|
704
972
|
importKey(
|
|
705
973
|
format: string,
|
|
706
974
|
keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey,
|
|
707
975
|
algorithm: string | SubtleCryptoImportKeyAlgorithm,
|
|
708
976
|
extractable: boolean,
|
|
709
|
-
keyUsages: string[]
|
|
977
|
+
keyUsages: string[],
|
|
710
978
|
): Promise<CryptoKey>;
|
|
711
979
|
exportKey(format: string, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;
|
|
712
980
|
wrapKey(
|
|
713
981
|
format: string,
|
|
714
982
|
key: CryptoKey,
|
|
715
983
|
wrappingKey: CryptoKey,
|
|
716
|
-
wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm
|
|
984
|
+
wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm,
|
|
717
985
|
): Promise<ArrayBuffer>;
|
|
986
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/unwrapKey) */
|
|
718
987
|
unwrapKey(
|
|
719
988
|
format: string,
|
|
720
989
|
wrappedKey: ArrayBuffer | ArrayBufferView,
|
|
@@ -722,16 +991,19 @@ declare abstract class SubtleCrypto {
|
|
|
722
991
|
unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm,
|
|
723
992
|
unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm,
|
|
724
993
|
extractable: boolean,
|
|
725
|
-
keyUsages: string[]
|
|
994
|
+
keyUsages: string[],
|
|
726
995
|
): Promise<CryptoKey>;
|
|
727
996
|
timingSafeEqual(
|
|
728
997
|
a: ArrayBuffer | ArrayBufferView,
|
|
729
|
-
b: ArrayBuffer | ArrayBufferView
|
|
998
|
+
b: ArrayBuffer | ArrayBufferView,
|
|
730
999
|
): boolean;
|
|
731
1000
|
}
|
|
732
1001
|
declare abstract class CryptoKey {
|
|
1002
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/type) */
|
|
733
1003
|
readonly type: string;
|
|
1004
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/extractable) */
|
|
734
1005
|
readonly extractable: boolean;
|
|
1006
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/algorithm) */
|
|
735
1007
|
readonly algorithm:
|
|
736
1008
|
| CryptoKeyKeyAlgorithm
|
|
737
1009
|
| CryptoKeyAesKeyAlgorithm
|
|
@@ -739,6 +1011,7 @@ declare abstract class CryptoKey {
|
|
|
739
1011
|
| CryptoKeyRsaKeyAlgorithm
|
|
740
1012
|
| CryptoKeyEllipticKeyAlgorithm
|
|
741
1013
|
| CryptoKeyArbitraryKeyAlgorithm;
|
|
1014
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/usages) */
|
|
742
1015
|
readonly usages: string[];
|
|
743
1016
|
}
|
|
744
1017
|
declare interface CryptoKeyPair {
|
|
@@ -826,7 +1099,7 @@ declare interface CryptoKeyHmacKeyAlgorithm {
|
|
|
826
1099
|
declare interface CryptoKeyRsaKeyAlgorithm {
|
|
827
1100
|
name: string;
|
|
828
1101
|
modulusLength: number;
|
|
829
|
-
publicExponent: ArrayBuffer;
|
|
1102
|
+
publicExponent: ArrayBuffer | (ArrayBuffer | ArrayBufferView);
|
|
830
1103
|
hash?: CryptoKeyKeyAlgorithm;
|
|
831
1104
|
}
|
|
832
1105
|
declare interface CryptoKeyEllipticKeyAlgorithm {
|
|
@@ -847,9 +1120,24 @@ declare class DigestStream extends WritableStream<
|
|
|
847
1120
|
}
|
|
848
1121
|
declare class TextDecoder {
|
|
849
1122
|
constructor(decoder?: string, options?: TextDecoderConstructorOptions);
|
|
1123
|
+
/**
|
|
1124
|
+
* Returns the result of running encoding's decoder. The method can be invoked zero or more times with options's stream set to true, and then once without options's stream (or set to false), to process a fragmented input. If the invocation without options's stream (or set to false) has no input, it's clearest to omit both arguments.
|
|
1125
|
+
*
|
|
1126
|
+
* ```
|
|
1127
|
+
* var string = "", decoder = new TextDecoder(encoding), buffer;
|
|
1128
|
+
* while(buffer = next_chunk()) {
|
|
1129
|
+
* string += decoder.decode(buffer, {stream:true});
|
|
1130
|
+
* }
|
|
1131
|
+
* string += decoder.decode(); // end-of-queue
|
|
1132
|
+
* ```
|
|
1133
|
+
*
|
|
1134
|
+
* If the error mode is "fatal" and encoding's decoder returns error, throws a TypeError.
|
|
1135
|
+
*
|
|
1136
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder/decode)
|
|
1137
|
+
*/
|
|
850
1138
|
decode(
|
|
851
1139
|
input?: ArrayBuffer | ArrayBufferView,
|
|
852
|
-
options?: TextDecoderDecodeOptions
|
|
1140
|
+
options?: TextDecoderDecodeOptions,
|
|
853
1141
|
): string;
|
|
854
1142
|
readonly encoding: string;
|
|
855
1143
|
readonly fatal: boolean;
|
|
@@ -857,8 +1145,21 @@ declare class TextDecoder {
|
|
|
857
1145
|
}
|
|
858
1146
|
declare class TextEncoder {
|
|
859
1147
|
constructor();
|
|
1148
|
+
/**
|
|
1149
|
+
* Returns the result of running UTF-8's encoder.
|
|
1150
|
+
*
|
|
1151
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encode)
|
|
1152
|
+
*/
|
|
860
1153
|
encode(input?: string): Uint8Array;
|
|
861
|
-
|
|
1154
|
+
/**
|
|
1155
|
+
* Runs the UTF-8 encoder on source, stores the result of that operation into destination, and returns the progress made as an object wherein read is the number of converted code units of source and written is the number of bytes modified in destination.
|
|
1156
|
+
*
|
|
1157
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encodeInto)
|
|
1158
|
+
*/
|
|
1159
|
+
encodeInto(
|
|
1160
|
+
input: string,
|
|
1161
|
+
buffer: ArrayBuffer | ArrayBufferView,
|
|
1162
|
+
): TextEncoderEncodeIntoResult;
|
|
862
1163
|
readonly encoding: string;
|
|
863
1164
|
}
|
|
864
1165
|
declare interface TextDecoderConstructorOptions {
|
|
@@ -882,17 +1183,20 @@ declare class FormData {
|
|
|
882
1183
|
has(name: string): boolean;
|
|
883
1184
|
set(name: string, value: string): void;
|
|
884
1185
|
set(name: string, value: Blob, filename?: string): void;
|
|
1186
|
+
/** Returns an array of key, value pairs for every entry in the list. */
|
|
885
1187
|
entries(): IterableIterator<[key: string, value: File | string]>;
|
|
1188
|
+
/** Returns a list of keys in the list. */
|
|
886
1189
|
keys(): IterableIterator<string>;
|
|
1190
|
+
/** Returns a list of values in the list. */
|
|
887
1191
|
values(): IterableIterator<File | string>;
|
|
888
1192
|
forEach<This = unknown>(
|
|
889
1193
|
callback: (
|
|
890
1194
|
this: This,
|
|
891
1195
|
value: File | string,
|
|
892
1196
|
key: string,
|
|
893
|
-
parent: FormData
|
|
1197
|
+
parent: FormData,
|
|
894
1198
|
) => void,
|
|
895
|
-
thisArg?: This
|
|
1199
|
+
thisArg?: This,
|
|
896
1200
|
): void;
|
|
897
1201
|
[Symbol.iterator](): IterableIterator<[key: string, value: File | string]>;
|
|
898
1202
|
}
|
|
@@ -903,7 +1207,7 @@ declare class HTMLRewriter {
|
|
|
903
1207
|
constructor();
|
|
904
1208
|
on(
|
|
905
1209
|
selector: string,
|
|
906
|
-
handlers: HTMLRewriterElementContentHandlers
|
|
1210
|
+
handlers: HTMLRewriterElementContentHandlers,
|
|
907
1211
|
): HTMLRewriter;
|
|
908
1212
|
onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter;
|
|
909
1213
|
transform(response: Response): Response;
|
|
@@ -970,7 +1274,9 @@ declare interface DocumentEnd {
|
|
|
970
1274
|
append(content: string, options?: ContentOptions): DocumentEnd;
|
|
971
1275
|
}
|
|
972
1276
|
declare abstract class FetchEvent extends ExtendableEvent {
|
|
1277
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/request) */
|
|
973
1278
|
readonly request: Request;
|
|
1279
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/respondWith) */
|
|
974
1280
|
respondWith(promise: Response | Promise<Response>): void;
|
|
975
1281
|
passThroughOnException(): void;
|
|
976
1282
|
}
|
|
@@ -988,10 +1294,13 @@ declare class Headers {
|
|
|
988
1294
|
delete(name: string): void;
|
|
989
1295
|
forEach<This = unknown>(
|
|
990
1296
|
callback: (this: This, value: string, key: string, parent: Headers) => void,
|
|
991
|
-
thisArg?: This
|
|
1297
|
+
thisArg?: This,
|
|
992
1298
|
): void;
|
|
1299
|
+
/** Returns an iterator allowing to go through all key/value pairs contained in this object. */
|
|
993
1300
|
entries(): IterableIterator<[key: string, value: string]>;
|
|
1301
|
+
/** Returns an iterator allowing to go through all keys of the key/value pairs contained in this object. */
|
|
994
1302
|
keys(): IterableIterator<string>;
|
|
1303
|
+
/** Returns an iterator allowing to go through all values of the key/value pairs contained in this object. */
|
|
995
1304
|
values(): IterableIterator<string>;
|
|
996
1305
|
[Symbol.iterator](): IterableIterator<[key: string, value: string]>;
|
|
997
1306
|
}
|
|
@@ -1014,14 +1323,23 @@ declare abstract class Body {
|
|
|
1014
1323
|
}
|
|
1015
1324
|
declare class Response extends Body {
|
|
1016
1325
|
constructor(body?: BodyInit | null, init?: ResponseInit);
|
|
1326
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirect_static) */
|
|
1017
1327
|
static redirect(url: string, status?: number): Response;
|
|
1328
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/json_static) */
|
|
1018
1329
|
static json(any: any, maybeInit?: ResponseInit | Response): Response;
|
|
1330
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/clone) */
|
|
1019
1331
|
clone(): Response;
|
|
1332
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/status) */
|
|
1020
1333
|
readonly status: number;
|
|
1334
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/statusText) */
|
|
1021
1335
|
readonly statusText: string;
|
|
1336
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/headers) */
|
|
1022
1337
|
readonly headers: Headers;
|
|
1338
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/ok) */
|
|
1023
1339
|
readonly ok: boolean;
|
|
1340
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirected) */
|
|
1024
1341
|
readonly redirected: boolean;
|
|
1342
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/url) */
|
|
1025
1343
|
readonly url: string;
|
|
1026
1344
|
readonly webSocket: WebSocket | null;
|
|
1027
1345
|
readonly cf?: any;
|
|
@@ -1036,29 +1354,58 @@ declare interface ResponseInit {
|
|
|
1036
1354
|
}
|
|
1037
1355
|
declare type RequestInfo<
|
|
1038
1356
|
CfHostMetadata = unknown,
|
|
1039
|
-
Cf = CfProperties<CfHostMetadata
|
|
1357
|
+
Cf = CfProperties<CfHostMetadata>,
|
|
1040
1358
|
> = Request<CfHostMetadata, Cf> | string | URL;
|
|
1041
1359
|
declare class Request<
|
|
1042
1360
|
CfHostMetadata = unknown,
|
|
1043
|
-
Cf = CfProperties<CfHostMetadata
|
|
1361
|
+
Cf = CfProperties<CfHostMetadata>,
|
|
1044
1362
|
> extends Body {
|
|
1045
1363
|
constructor(input: RequestInfo<CfProperties>, init?: RequestInit<Cf>);
|
|
1364
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/clone) */
|
|
1046
1365
|
clone(): Request<CfHostMetadata, Cf>;
|
|
1047
|
-
/**
|
|
1366
|
+
/**
|
|
1367
|
+
* Returns request's HTTP method, which is "GET" by default.
|
|
1368
|
+
*
|
|
1369
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/method)
|
|
1370
|
+
*/
|
|
1048
1371
|
readonly method: string;
|
|
1049
|
-
/**
|
|
1372
|
+
/**
|
|
1373
|
+
* Returns the URL of request as a string.
|
|
1374
|
+
*
|
|
1375
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/url)
|
|
1376
|
+
*/
|
|
1050
1377
|
readonly url: string;
|
|
1051
|
-
/**
|
|
1378
|
+
/**
|
|
1379
|
+
* Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the "Host" header.
|
|
1380
|
+
*
|
|
1381
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/headers)
|
|
1382
|
+
*/
|
|
1052
1383
|
readonly headers: Headers;
|
|
1053
|
-
/**
|
|
1384
|
+
/**
|
|
1385
|
+
* Returns the redirect mode associated with request, which is a string indicating how redirects for the request will be handled during fetching. A request will follow redirects by default.
|
|
1386
|
+
*
|
|
1387
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/redirect)
|
|
1388
|
+
*/
|
|
1054
1389
|
readonly redirect: string;
|
|
1055
1390
|
readonly fetcher: Fetcher | null;
|
|
1056
|
-
/**
|
|
1391
|
+
/**
|
|
1392
|
+
* Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler.
|
|
1393
|
+
*
|
|
1394
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/signal)
|
|
1395
|
+
*/
|
|
1057
1396
|
readonly signal: AbortSignal;
|
|
1058
1397
|
readonly cf?: Cf;
|
|
1059
|
-
/**
|
|
1398
|
+
/**
|
|
1399
|
+
* Returns request's subresource integrity metadata, which is a cryptographic hash of the resource being fetched. Its value consists of multiple hashes separated by whitespace. [SRI]
|
|
1400
|
+
*
|
|
1401
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/integrity)
|
|
1402
|
+
*/
|
|
1060
1403
|
readonly integrity: string;
|
|
1061
|
-
/**
|
|
1404
|
+
/**
|
|
1405
|
+
* Returns a boolean indicating whether or not request can outlive the global in which it was created.
|
|
1406
|
+
*
|
|
1407
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/keepalive)
|
|
1408
|
+
*/
|
|
1062
1409
|
readonly keepalive: boolean;
|
|
1063
1410
|
}
|
|
1064
1411
|
declare interface RequestInit<Cf = CfProperties> {
|
|
@@ -1077,10 +1424,18 @@ declare interface RequestInit<Cf = CfProperties> {
|
|
|
1077
1424
|
/** An AbortSignal to set request's signal. */
|
|
1078
1425
|
signal?: AbortSignal | null;
|
|
1079
1426
|
}
|
|
1080
|
-
declare
|
|
1427
|
+
declare type Service<
|
|
1428
|
+
T extends Rpc.WorkerEntrypointBranded | undefined = undefined,
|
|
1429
|
+
> = Fetcher<T>;
|
|
1430
|
+
declare type Fetcher<
|
|
1431
|
+
T extends Rpc.EntrypointBranded | undefined = undefined,
|
|
1432
|
+
Reserved extends string = never,
|
|
1433
|
+
> = (T extends Rpc.EntrypointBranded
|
|
1434
|
+
? Rpc.Provider<T, Reserved | "fetch" | "connect">
|
|
1435
|
+
: unknown) & {
|
|
1081
1436
|
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
1082
1437
|
connect(address: SocketAddress | string, options?: SocketOptions): Socket;
|
|
1083
|
-
}
|
|
1438
|
+
};
|
|
1084
1439
|
declare interface FetcherPutOptions {
|
|
1085
1440
|
expiration?: number;
|
|
1086
1441
|
expirationTtl?: number;
|
|
@@ -1095,82 +1450,84 @@ declare type KVNamespaceListResult<Metadata, Key extends string = string> =
|
|
|
1095
1450
|
list_complete: false;
|
|
1096
1451
|
keys: KVNamespaceListKey<Metadata, Key>[];
|
|
1097
1452
|
cursor: string;
|
|
1453
|
+
cacheStatus: string | null;
|
|
1098
1454
|
}
|
|
1099
1455
|
| {
|
|
1100
1456
|
list_complete: true;
|
|
1101
1457
|
keys: KVNamespaceListKey<Metadata, Key>[];
|
|
1458
|
+
cacheStatus: string | null;
|
|
1102
1459
|
};
|
|
1103
1460
|
declare interface KVNamespace<Key extends string = string> {
|
|
1104
1461
|
get(
|
|
1105
1462
|
key: Key,
|
|
1106
|
-
options?: Partial<KVNamespaceGetOptions<undefined
|
|
1463
|
+
options?: Partial<KVNamespaceGetOptions<undefined>>,
|
|
1107
1464
|
): Promise<string | null>;
|
|
1108
1465
|
get(key: Key, type: "text"): Promise<string | null>;
|
|
1109
1466
|
get<ExpectedValue = unknown>(
|
|
1110
1467
|
key: Key,
|
|
1111
|
-
type: "json"
|
|
1468
|
+
type: "json",
|
|
1112
1469
|
): Promise<ExpectedValue | null>;
|
|
1113
1470
|
get(key: Key, type: "arrayBuffer"): Promise<ArrayBuffer | null>;
|
|
1114
1471
|
get(key: Key, type: "stream"): Promise<ReadableStream | null>;
|
|
1115
1472
|
get(
|
|
1116
1473
|
key: Key,
|
|
1117
|
-
options?: KVNamespaceGetOptions<"text"
|
|
1474
|
+
options?: KVNamespaceGetOptions<"text">,
|
|
1118
1475
|
): Promise<string | null>;
|
|
1119
1476
|
get<ExpectedValue = unknown>(
|
|
1120
1477
|
key: Key,
|
|
1121
|
-
options?: KVNamespaceGetOptions<"json"
|
|
1478
|
+
options?: KVNamespaceGetOptions<"json">,
|
|
1122
1479
|
): Promise<ExpectedValue | null>;
|
|
1123
1480
|
get(
|
|
1124
1481
|
key: Key,
|
|
1125
|
-
options?: KVNamespaceGetOptions<"arrayBuffer"
|
|
1482
|
+
options?: KVNamespaceGetOptions<"arrayBuffer">,
|
|
1126
1483
|
): Promise<ArrayBuffer | null>;
|
|
1127
1484
|
get(
|
|
1128
1485
|
key: Key,
|
|
1129
|
-
options?: KVNamespaceGetOptions<"stream"
|
|
1486
|
+
options?: KVNamespaceGetOptions<"stream">,
|
|
1130
1487
|
): Promise<ReadableStream | null>;
|
|
1131
1488
|
list<Metadata = unknown>(
|
|
1132
|
-
options?: KVNamespaceListOptions
|
|
1489
|
+
options?: KVNamespaceListOptions,
|
|
1133
1490
|
): Promise<KVNamespaceListResult<Metadata, Key>>;
|
|
1134
1491
|
put(
|
|
1135
1492
|
key: Key,
|
|
1136
1493
|
value: string | ArrayBuffer | ArrayBufferView | ReadableStream,
|
|
1137
|
-
options?: KVNamespacePutOptions
|
|
1494
|
+
options?: KVNamespacePutOptions,
|
|
1138
1495
|
): Promise<void>;
|
|
1139
1496
|
getWithMetadata<Metadata = unknown>(
|
|
1140
1497
|
key: Key,
|
|
1141
|
-
options?: Partial<KVNamespaceGetOptions<undefined
|
|
1498
|
+
options?: Partial<KVNamespaceGetOptions<undefined>>,
|
|
1142
1499
|
): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
|
|
1143
1500
|
getWithMetadata<Metadata = unknown>(
|
|
1144
1501
|
key: Key,
|
|
1145
|
-
type: "text"
|
|
1502
|
+
type: "text",
|
|
1146
1503
|
): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
|
|
1147
1504
|
getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(
|
|
1148
1505
|
key: Key,
|
|
1149
|
-
type: "json"
|
|
1506
|
+
type: "json",
|
|
1150
1507
|
): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;
|
|
1151
1508
|
getWithMetadata<Metadata = unknown>(
|
|
1152
1509
|
key: Key,
|
|
1153
|
-
type: "arrayBuffer"
|
|
1510
|
+
type: "arrayBuffer",
|
|
1154
1511
|
): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;
|
|
1155
1512
|
getWithMetadata<Metadata = unknown>(
|
|
1156
1513
|
key: Key,
|
|
1157
|
-
type: "stream"
|
|
1514
|
+
type: "stream",
|
|
1158
1515
|
): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;
|
|
1159
1516
|
getWithMetadata<Metadata = unknown>(
|
|
1160
1517
|
key: Key,
|
|
1161
|
-
options: KVNamespaceGetOptions<"text"
|
|
1518
|
+
options: KVNamespaceGetOptions<"text">,
|
|
1162
1519
|
): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
|
|
1163
1520
|
getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(
|
|
1164
1521
|
key: Key,
|
|
1165
|
-
options: KVNamespaceGetOptions<"json"
|
|
1522
|
+
options: KVNamespaceGetOptions<"json">,
|
|
1166
1523
|
): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;
|
|
1167
1524
|
getWithMetadata<Metadata = unknown>(
|
|
1168
1525
|
key: Key,
|
|
1169
|
-
options: KVNamespaceGetOptions<"arrayBuffer"
|
|
1526
|
+
options: KVNamespaceGetOptions<"arrayBuffer">,
|
|
1170
1527
|
): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;
|
|
1171
1528
|
getWithMetadata<Metadata = unknown>(
|
|
1172
1529
|
key: Key,
|
|
1173
|
-
options: KVNamespaceGetOptions<"stream"
|
|
1530
|
+
options: KVNamespaceGetOptions<"stream">,
|
|
1174
1531
|
): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;
|
|
1175
1532
|
delete(key: Key): Promise<void>;
|
|
1176
1533
|
}
|
|
@@ -1191,32 +1548,49 @@ declare interface KVNamespacePutOptions {
|
|
|
1191
1548
|
declare interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
|
|
1192
1549
|
value: Value | null;
|
|
1193
1550
|
metadata: Metadata | null;
|
|
1551
|
+
cacheStatus: string | null;
|
|
1552
|
+
}
|
|
1553
|
+
declare type QueueContentType = "text" | "bytes" | "json" | "v8";
|
|
1554
|
+
declare interface Queue<Body = unknown> {
|
|
1555
|
+
send(message: Body, options?: QueueSendOptions): Promise<void>;
|
|
1556
|
+
sendBatch(
|
|
1557
|
+
messages: Iterable<MessageSendRequest<Body>>,
|
|
1558
|
+
options?: QueueSendBatchOptions,
|
|
1559
|
+
): Promise<void>;
|
|
1194
1560
|
}
|
|
1195
|
-
declare interface
|
|
1196
|
-
|
|
1197
|
-
|
|
1561
|
+
declare interface QueueSendOptions {
|
|
1562
|
+
contentType?: QueueContentType;
|
|
1563
|
+
delaySeconds?: number;
|
|
1564
|
+
}
|
|
1565
|
+
declare interface QueueSendBatchOptions {
|
|
1566
|
+
delaySeconds?: number;
|
|
1198
1567
|
}
|
|
1199
|
-
declare interface QueueSendOptions {}
|
|
1200
1568
|
declare interface MessageSendRequest<Body = unknown> {
|
|
1201
1569
|
body: Body;
|
|
1570
|
+
contentType?: QueueContentType;
|
|
1571
|
+
delaySeconds?: number;
|
|
1572
|
+
}
|
|
1573
|
+
declare interface QueueRetryOptions {
|
|
1574
|
+
delaySeconds?: number;
|
|
1202
1575
|
}
|
|
1203
1576
|
declare interface Message<Body = unknown> {
|
|
1204
1577
|
readonly id: string;
|
|
1205
1578
|
readonly timestamp: Date;
|
|
1206
1579
|
readonly body: Body;
|
|
1207
|
-
|
|
1580
|
+
readonly attempts: number;
|
|
1581
|
+
retry(options?: QueueRetryOptions): void;
|
|
1208
1582
|
ack(): void;
|
|
1209
1583
|
}
|
|
1210
1584
|
declare interface QueueEvent<Body = unknown> extends ExtendableEvent {
|
|
1211
1585
|
readonly messages: readonly Message<Body>[];
|
|
1212
1586
|
readonly queue: string;
|
|
1213
|
-
retryAll(): void;
|
|
1587
|
+
retryAll(options?: QueueRetryOptions): void;
|
|
1214
1588
|
ackAll(): void;
|
|
1215
1589
|
}
|
|
1216
1590
|
declare interface MessageBatch<Body = unknown> {
|
|
1217
1591
|
readonly messages: readonly Message<Body>[];
|
|
1218
1592
|
readonly queue: string;
|
|
1219
|
-
retryAll(): void;
|
|
1593
|
+
retryAll(options?: QueueRetryOptions): void;
|
|
1220
1594
|
ackAll(): void;
|
|
1221
1595
|
}
|
|
1222
1596
|
declare interface R2Error extends Error {
|
|
@@ -1239,7 +1613,7 @@ declare abstract class R2Bucket {
|
|
|
1239
1613
|
key: string,
|
|
1240
1614
|
options: R2GetOptions & {
|
|
1241
1615
|
onlyIf: R2Conditional | Headers;
|
|
1242
|
-
}
|
|
1616
|
+
},
|
|
1243
1617
|
): Promise<R2ObjectBody | R2Object | null>;
|
|
1244
1618
|
get(key: string, options?: R2GetOptions): Promise<R2ObjectBody | null>;
|
|
1245
1619
|
put(
|
|
@@ -1251,8 +1625,10 @@ declare abstract class R2Bucket {
|
|
|
1251
1625
|
| string
|
|
1252
1626
|
| null
|
|
1253
1627
|
| Blob,
|
|
1254
|
-
options?: R2PutOptions
|
|
1255
|
-
|
|
1628
|
+
options?: R2PutOptions & {
|
|
1629
|
+
onlyIf: R2Conditional | Headers;
|
|
1630
|
+
},
|
|
1631
|
+
): Promise<R2Object | null>;
|
|
1256
1632
|
put(
|
|
1257
1633
|
key: string,
|
|
1258
1634
|
value:
|
|
@@ -1262,13 +1638,11 @@ declare abstract class R2Bucket {
|
|
|
1262
1638
|
| string
|
|
1263
1639
|
| null
|
|
1264
1640
|
| Blob,
|
|
1265
|
-
options?: R2PutOptions
|
|
1266
|
-
|
|
1267
|
-
}
|
|
1268
|
-
): Promise<R2Object | null>;
|
|
1641
|
+
options?: R2PutOptions,
|
|
1642
|
+
): Promise<R2Object>;
|
|
1269
1643
|
createMultipartUpload(
|
|
1270
1644
|
key: string,
|
|
1271
|
-
options?: R2MultipartOptions
|
|
1645
|
+
options?: R2MultipartOptions,
|
|
1272
1646
|
): Promise<R2MultipartUpload>;
|
|
1273
1647
|
resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload;
|
|
1274
1648
|
delete(keys: string | string[]): Promise<void>;
|
|
@@ -1279,7 +1653,7 @@ declare interface R2MultipartUpload {
|
|
|
1279
1653
|
readonly uploadId: string;
|
|
1280
1654
|
uploadPart(
|
|
1281
1655
|
partNumber: number,
|
|
1282
|
-
value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob
|
|
1656
|
+
value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob,
|
|
1283
1657
|
): Promise<R2UploadedPart>;
|
|
1284
1658
|
abort(): Promise<void>;
|
|
1285
1659
|
complete(uploadedParts: R2UploadedPart[]): Promise<R2Object>;
|
|
@@ -1299,6 +1673,7 @@ declare abstract class R2Object {
|
|
|
1299
1673
|
readonly httpMetadata?: R2HTTPMetadata;
|
|
1300
1674
|
readonly customMetadata?: Record<string, string>;
|
|
1301
1675
|
readonly range?: R2Range;
|
|
1676
|
+
readonly storageClass: string;
|
|
1302
1677
|
writeHttpMetadata(headers: Headers): void;
|
|
1303
1678
|
}
|
|
1304
1679
|
declare interface R2ObjectBody extends R2Object {
|
|
@@ -1341,10 +1716,12 @@ declare interface R2PutOptions {
|
|
|
1341
1716
|
sha256?: ArrayBuffer | string;
|
|
1342
1717
|
sha384?: ArrayBuffer | string;
|
|
1343
1718
|
sha512?: ArrayBuffer | string;
|
|
1719
|
+
storageClass?: string;
|
|
1344
1720
|
}
|
|
1345
1721
|
declare interface R2MultipartOptions {
|
|
1346
1722
|
httpMetadata?: R2HTTPMetadata | Headers;
|
|
1347
1723
|
customMetadata?: Record<string, string>;
|
|
1724
|
+
storageClass?: string;
|
|
1348
1725
|
}
|
|
1349
1726
|
declare interface R2Checksums {
|
|
1350
1727
|
readonly md5?: ArrayBuffer;
|
|
@@ -1400,7 +1777,7 @@ declare interface UnderlyingSink<W = any> {
|
|
|
1400
1777
|
start?: (controller: WritableStreamDefaultController) => void | Promise<void>;
|
|
1401
1778
|
write?: (
|
|
1402
1779
|
chunk: W,
|
|
1403
|
-
controller: WritableStreamDefaultController
|
|
1780
|
+
controller: WritableStreamDefaultController,
|
|
1404
1781
|
) => void | Promise<void>;
|
|
1405
1782
|
abort?: (reason: any) => void | Promise<void>;
|
|
1406
1783
|
close?: () => void | Promise<void>;
|
|
@@ -1415,26 +1792,29 @@ declare interface UnderlyingByteSource {
|
|
|
1415
1792
|
declare interface UnderlyingSource<R = any> {
|
|
1416
1793
|
type?: "" | undefined;
|
|
1417
1794
|
start?: (
|
|
1418
|
-
controller: ReadableStreamDefaultController<R
|
|
1795
|
+
controller: ReadableStreamDefaultController<R>,
|
|
1419
1796
|
) => void | Promise<void>;
|
|
1420
1797
|
pull?: (
|
|
1421
|
-
controller: ReadableStreamDefaultController<R
|
|
1798
|
+
controller: ReadableStreamDefaultController<R>,
|
|
1422
1799
|
) => void | Promise<void>;
|
|
1423
1800
|
cancel?: (reason: any) => void | Promise<void>;
|
|
1801
|
+
expectedLength?: number | bigint;
|
|
1424
1802
|
}
|
|
1425
1803
|
declare interface Transformer<I = any, O = any> {
|
|
1426
1804
|
readableType?: string;
|
|
1427
1805
|
writableType?: string;
|
|
1428
1806
|
start?: (
|
|
1429
|
-
controller: TransformStreamDefaultController<O
|
|
1807
|
+
controller: TransformStreamDefaultController<O>,
|
|
1430
1808
|
) => void | Promise<void>;
|
|
1431
1809
|
transform?: (
|
|
1432
1810
|
chunk: I,
|
|
1433
|
-
controller: TransformStreamDefaultController<O
|
|
1811
|
+
controller: TransformStreamDefaultController<O>,
|
|
1434
1812
|
) => void | Promise<void>;
|
|
1435
1813
|
flush?: (
|
|
1436
|
-
controller: TransformStreamDefaultController<O
|
|
1814
|
+
controller: TransformStreamDefaultController<O>,
|
|
1437
1815
|
) => void | Promise<void>;
|
|
1816
|
+
cancel?: (reason: any) => void | Promise<void>;
|
|
1817
|
+
expectedLength?: number;
|
|
1438
1818
|
}
|
|
1439
1819
|
declare interface StreamPipeOptions {
|
|
1440
1820
|
/**
|
|
@@ -1468,88 +1848,137 @@ declare type ReadableStreamReadResult<R = any> =
|
|
|
1468
1848
|
done: true;
|
|
1469
1849
|
value?: undefined;
|
|
1470
1850
|
};
|
|
1471
|
-
/**
|
|
1851
|
+
/**
|
|
1852
|
+
* This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object.
|
|
1853
|
+
*
|
|
1854
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream)
|
|
1855
|
+
*/
|
|
1472
1856
|
declare interface ReadableStream<R = any> {
|
|
1857
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/locked) */
|
|
1473
1858
|
readonly locked: boolean;
|
|
1859
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/cancel) */
|
|
1474
1860
|
cancel(reason?: any): Promise<void>;
|
|
1861
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader) */
|
|
1475
1862
|
getReader(): ReadableStreamDefaultReader<R>;
|
|
1863
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader) */
|
|
1476
1864
|
getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader;
|
|
1865
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeThrough) */
|
|
1477
1866
|
pipeThrough<T>(
|
|
1478
1867
|
transform: ReadableWritablePair<T, R>,
|
|
1479
|
-
options?: StreamPipeOptions
|
|
1868
|
+
options?: StreamPipeOptions,
|
|
1480
1869
|
): ReadableStream<T>;
|
|
1870
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeTo) */
|
|
1481
1871
|
pipeTo(
|
|
1482
1872
|
destination: WritableStream<R>,
|
|
1483
|
-
options?: StreamPipeOptions
|
|
1873
|
+
options?: StreamPipeOptions,
|
|
1484
1874
|
): Promise<void>;
|
|
1875
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/tee) */
|
|
1485
1876
|
tee(): [ReadableStream<R>, ReadableStream<R>];
|
|
1486
1877
|
values(options?: ReadableStreamValuesOptions): AsyncIterableIterator<R>;
|
|
1487
1878
|
[Symbol.asyncIterator](
|
|
1488
|
-
options?: ReadableStreamValuesOptions
|
|
1879
|
+
options?: ReadableStreamValuesOptions,
|
|
1489
1880
|
): AsyncIterableIterator<R>;
|
|
1490
1881
|
}
|
|
1491
1882
|
declare const ReadableStream: {
|
|
1492
1883
|
prototype: ReadableStream;
|
|
1493
1884
|
new (
|
|
1494
1885
|
underlyingSource: UnderlyingByteSource,
|
|
1495
|
-
strategy?: QueuingStrategy<Uint8Array
|
|
1886
|
+
strategy?: QueuingStrategy<Uint8Array>,
|
|
1496
1887
|
): ReadableStream<Uint8Array>;
|
|
1497
1888
|
new <R = any>(
|
|
1498
1889
|
underlyingSource?: UnderlyingSource<R>,
|
|
1499
|
-
strategy?: QueuingStrategy<R
|
|
1890
|
+
strategy?: QueuingStrategy<R>,
|
|
1500
1891
|
): ReadableStream<R>;
|
|
1501
1892
|
};
|
|
1502
1893
|
declare class ReadableStreamDefaultReader<R = any> {
|
|
1503
1894
|
constructor(stream: ReadableStream);
|
|
1504
1895
|
readonly closed: Promise<void>;
|
|
1505
1896
|
cancel(reason?: any): Promise<void>;
|
|
1897
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/read) */
|
|
1506
1898
|
read(): Promise<ReadableStreamReadResult<R>>;
|
|
1899
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/releaseLock) */
|
|
1507
1900
|
releaseLock(): void;
|
|
1508
1901
|
}
|
|
1509
1902
|
declare class ReadableStreamBYOBReader {
|
|
1510
1903
|
constructor(stream: ReadableStream);
|
|
1511
1904
|
readonly closed: Promise<void>;
|
|
1512
1905
|
cancel(reason?: any): Promise<void>;
|
|
1906
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/read) */
|
|
1513
1907
|
read<T extends ArrayBufferView>(
|
|
1514
|
-
view: T
|
|
1908
|
+
view: T,
|
|
1515
1909
|
): Promise<ReadableStreamReadResult<T>>;
|
|
1910
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/releaseLock) */
|
|
1516
1911
|
releaseLock(): void;
|
|
1517
1912
|
readAtLeast<T extends ArrayBufferView>(
|
|
1518
1913
|
minElements: number,
|
|
1519
|
-
view: T
|
|
1914
|
+
view: T,
|
|
1520
1915
|
): Promise<ReadableStreamReadResult<T>>;
|
|
1521
1916
|
}
|
|
1917
|
+
declare interface ReadableStreamBYOBReaderReadableStreamBYOBReaderReadOptions {
|
|
1918
|
+
min?: number;
|
|
1919
|
+
}
|
|
1522
1920
|
declare interface ReadableStreamGetReaderOptions {
|
|
1921
|
+
/**
|
|
1922
|
+
* Creates a ReadableStreamBYOBReader and locks the stream to the new reader.
|
|
1923
|
+
*
|
|
1924
|
+
* This call behaves the same way as the no-argument variant, except that it only works on readable byte streams, i.e. streams which were constructed specifically with the ability to handle "bring your own buffer" reading. The returned BYOB reader provides the ability to directly read individual chunks from the stream via its read() method, into developer-supplied buffers, allowing more precise control over allocation.
|
|
1925
|
+
*/
|
|
1523
1926
|
mode: "byob";
|
|
1524
1927
|
}
|
|
1928
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest) */
|
|
1525
1929
|
declare interface ReadableStreamBYOBRequest {
|
|
1526
|
-
|
|
1930
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/view) */
|
|
1931
|
+
get view(): Uint8Array | null;
|
|
1932
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respond) */
|
|
1527
1933
|
respond(bytesWritten: number): void;
|
|
1934
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respondWithNewView) */
|
|
1528
1935
|
respondWithNewView(view: ArrayBuffer | ArrayBufferView): void;
|
|
1529
|
-
|
|
1936
|
+
get atLeast(): number | null;
|
|
1530
1937
|
}
|
|
1938
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController) */
|
|
1531
1939
|
declare interface ReadableStreamDefaultController<R = any> {
|
|
1532
|
-
|
|
1940
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/desiredSize) */
|
|
1941
|
+
get desiredSize(): number | null;
|
|
1942
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/close) */
|
|
1533
1943
|
close(): void;
|
|
1944
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/enqueue) */
|
|
1534
1945
|
enqueue(chunk?: R): void;
|
|
1946
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/error) */
|
|
1535
1947
|
error(reason: any): void;
|
|
1536
1948
|
}
|
|
1949
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController) */
|
|
1537
1950
|
declare interface ReadableByteStreamController {
|
|
1538
|
-
|
|
1539
|
-
|
|
1951
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/byobRequest) */
|
|
1952
|
+
get byobRequest(): ReadableStreamBYOBRequest | null;
|
|
1953
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/desiredSize) */
|
|
1954
|
+
get desiredSize(): number | null;
|
|
1955
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/close) */
|
|
1540
1956
|
close(): void;
|
|
1957
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/enqueue) */
|
|
1541
1958
|
enqueue(chunk: ArrayBuffer | ArrayBufferView): void;
|
|
1959
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/error) */
|
|
1542
1960
|
error(reason: any): void;
|
|
1543
1961
|
}
|
|
1544
|
-
/**
|
|
1962
|
+
/**
|
|
1963
|
+
* This Streams API interface represents a controller allowing control of a WritableStream's state. When constructing a WritableStream, the underlying sink is given a corresponding WritableStreamDefaultController instance to manipulate.
|
|
1964
|
+
*
|
|
1965
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController)
|
|
1966
|
+
*/
|
|
1545
1967
|
declare interface WritableStreamDefaultController {
|
|
1546
|
-
|
|
1968
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/signal) */
|
|
1969
|
+
get signal(): AbortSignal;
|
|
1970
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/error) */
|
|
1547
1971
|
error(reason?: any): void;
|
|
1548
1972
|
}
|
|
1973
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController) */
|
|
1549
1974
|
declare interface TransformStreamDefaultController<O = any> {
|
|
1975
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/desiredSize) */
|
|
1550
1976
|
get desiredSize(): number | null;
|
|
1977
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/enqueue) */
|
|
1551
1978
|
enqueue(chunk?: O): void;
|
|
1979
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/error) */
|
|
1552
1980
|
error(reason: any): void;
|
|
1981
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/terminate) */
|
|
1553
1982
|
terminate(): void;
|
|
1554
1983
|
}
|
|
1555
1984
|
declare interface ReadableWritablePair<R = any, W = any> {
|
|
@@ -1564,36 +1993,49 @@ declare interface ReadableWritablePair<R = any, W = any> {
|
|
|
1564
1993
|
declare class WritableStream<W = any> {
|
|
1565
1994
|
constructor(
|
|
1566
1995
|
underlyingSink?: UnderlyingSink,
|
|
1567
|
-
queuingStrategy?: QueuingStrategy
|
|
1996
|
+
queuingStrategy?: QueuingStrategy,
|
|
1568
1997
|
);
|
|
1998
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/locked) */
|
|
1569
1999
|
readonly locked: boolean;
|
|
2000
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/abort) */
|
|
1570
2001
|
abort(reason?: any): Promise<void>;
|
|
2002
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/close) */
|
|
1571
2003
|
close(): Promise<void>;
|
|
2004
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/getWriter) */
|
|
1572
2005
|
getWriter(): WritableStreamDefaultWriter<W>;
|
|
1573
2006
|
}
|
|
1574
2007
|
declare class WritableStreamDefaultWriter<W = any> {
|
|
1575
2008
|
constructor(stream: WritableStream);
|
|
2009
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/closed) */
|
|
1576
2010
|
readonly closed: Promise<void>;
|
|
2011
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/ready) */
|
|
1577
2012
|
readonly ready: Promise<void>;
|
|
2013
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/desiredSize) */
|
|
1578
2014
|
readonly desiredSize: number | null;
|
|
2015
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/abort) */
|
|
1579
2016
|
abort(reason?: any): Promise<void>;
|
|
2017
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/close) */
|
|
1580
2018
|
close(): Promise<void>;
|
|
2019
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/write) */
|
|
1581
2020
|
write(chunk?: W): Promise<void>;
|
|
2021
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/releaseLock) */
|
|
1582
2022
|
releaseLock(): void;
|
|
1583
2023
|
}
|
|
1584
2024
|
declare class TransformStream<I = any, O = any> {
|
|
1585
2025
|
constructor(
|
|
1586
2026
|
transformer?: Transformer<I, O>,
|
|
1587
2027
|
writableStrategy?: QueuingStrategy<I>,
|
|
1588
|
-
readableStrategy?: QueuingStrategy<O
|
|
2028
|
+
readableStrategy?: QueuingStrategy<O>,
|
|
1589
2029
|
);
|
|
2030
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/readable) */
|
|
1590
2031
|
readonly readable: ReadableStream<O>;
|
|
2032
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/writable) */
|
|
1591
2033
|
readonly writable: WritableStream<I>;
|
|
1592
2034
|
}
|
|
1593
2035
|
declare class FixedLengthStream extends IdentityTransformStream {
|
|
1594
2036
|
constructor(
|
|
1595
2037
|
expectedLength: number | bigint,
|
|
1596
|
-
queuingStrategy?: IdentityTransformStreamQueuingStrategy
|
|
2038
|
+
queuingStrategy?: IdentityTransformStreamQueuingStrategy,
|
|
1597
2039
|
);
|
|
1598
2040
|
}
|
|
1599
2041
|
declare class IdentityTransformStream extends TransformStream<
|
|
@@ -1622,26 +2064,35 @@ declare class DecompressionStream extends TransformStream<
|
|
|
1622
2064
|
}
|
|
1623
2065
|
declare class TextEncoderStream extends TransformStream<string, Uint8Array> {
|
|
1624
2066
|
constructor();
|
|
2067
|
+
get encoding(): string;
|
|
1625
2068
|
}
|
|
1626
2069
|
declare class TextDecoderStream extends TransformStream<
|
|
1627
2070
|
ArrayBuffer | ArrayBufferView,
|
|
1628
2071
|
string
|
|
1629
2072
|
> {
|
|
1630
2073
|
constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit);
|
|
2074
|
+
get encoding(): string;
|
|
2075
|
+
get fatal(): boolean;
|
|
2076
|
+
get ignoreBOM(): boolean;
|
|
1631
2077
|
}
|
|
1632
2078
|
declare interface TextDecoderStreamTextDecoderStreamInit {
|
|
1633
2079
|
fatal?: boolean;
|
|
2080
|
+
ignoreBOM?: boolean;
|
|
1634
2081
|
}
|
|
1635
2082
|
declare class ByteLengthQueuingStrategy
|
|
1636
2083
|
implements QueuingStrategy<ArrayBufferView>
|
|
1637
2084
|
{
|
|
1638
2085
|
constructor(init: QueuingStrategyInit);
|
|
2086
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/highWaterMark) */
|
|
1639
2087
|
get highWaterMark(): number;
|
|
2088
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/size) */
|
|
1640
2089
|
get size(): (chunk?: any) => number;
|
|
1641
2090
|
}
|
|
1642
2091
|
declare class CountQueuingStrategy implements QueuingStrategy {
|
|
1643
2092
|
constructor(init: QueuingStrategyInit);
|
|
2093
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/highWaterMark) */
|
|
1644
2094
|
get highWaterMark(): number;
|
|
2095
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/size) */
|
|
1645
2096
|
get size(): (chunk?: any) => number;
|
|
1646
2097
|
}
|
|
1647
2098
|
declare interface QueuingStrategyInit {
|
|
@@ -1652,6 +2103,11 @@ declare interface QueuingStrategyInit {
|
|
|
1652
2103
|
*/
|
|
1653
2104
|
highWaterMark: number;
|
|
1654
2105
|
}
|
|
2106
|
+
declare interface ScriptVersion {
|
|
2107
|
+
id?: string;
|
|
2108
|
+
tag?: string;
|
|
2109
|
+
message?: string;
|
|
2110
|
+
}
|
|
1655
2111
|
declare abstract class TailEvent extends ExtendableEvent {
|
|
1656
2112
|
readonly events: TraceItem[];
|
|
1657
2113
|
readonly traces: TraceItem[];
|
|
@@ -1660,17 +2116,23 @@ declare interface TraceItem {
|
|
|
1660
2116
|
readonly event:
|
|
1661
2117
|
| (
|
|
1662
2118
|
| TraceItemFetchEventInfo
|
|
2119
|
+
| TraceItemJsRpcEventInfo
|
|
1663
2120
|
| TraceItemScheduledEventInfo
|
|
1664
2121
|
| TraceItemAlarmEventInfo
|
|
1665
2122
|
| TraceItemQueueEventInfo
|
|
1666
2123
|
| TraceItemEmailEventInfo
|
|
2124
|
+
| TraceItemTailEventInfo
|
|
1667
2125
|
| TraceItemCustomEventInfo
|
|
2126
|
+
| TraceItemHibernatableWebSocketEventInfo
|
|
1668
2127
|
)
|
|
1669
2128
|
| null;
|
|
1670
2129
|
readonly eventTimestamp: number | null;
|
|
1671
2130
|
readonly logs: TraceLog[];
|
|
1672
2131
|
readonly exceptions: TraceException[];
|
|
2132
|
+
readonly diagnosticsChannelEvents: TraceDiagnosticChannelEvent[];
|
|
1673
2133
|
readonly scriptName: string | null;
|
|
2134
|
+
readonly entrypoint?: string;
|
|
2135
|
+
readonly scriptVersion?: ScriptVersion;
|
|
1674
2136
|
readonly dispatchNamespace?: string;
|
|
1675
2137
|
readonly scriptTags?: string[];
|
|
1676
2138
|
readonly outcome: string;
|
|
@@ -1692,6 +2154,12 @@ declare interface TraceItemEmailEventInfo {
|
|
|
1692
2154
|
readonly rcptTo: string;
|
|
1693
2155
|
readonly rawSize: number;
|
|
1694
2156
|
}
|
|
2157
|
+
declare interface TraceItemTailEventInfo {
|
|
2158
|
+
readonly consumedEvents: TraceItemTailEventInfoTailItem[];
|
|
2159
|
+
}
|
|
2160
|
+
declare interface TraceItemTailEventInfoTailItem {
|
|
2161
|
+
readonly scriptName: string | null;
|
|
2162
|
+
}
|
|
1695
2163
|
declare interface TraceItemFetchEventInfo {
|
|
1696
2164
|
readonly response?: TraceItemFetchEventInfoResponse;
|
|
1697
2165
|
readonly request: TraceItemFetchEventInfoRequest;
|
|
@@ -1706,6 +2174,26 @@ declare interface TraceItemFetchEventInfoRequest {
|
|
|
1706
2174
|
declare interface TraceItemFetchEventInfoResponse {
|
|
1707
2175
|
readonly status: number;
|
|
1708
2176
|
}
|
|
2177
|
+
declare interface TraceItemJsRpcEventInfo {
|
|
2178
|
+
readonly rpcMethod: string;
|
|
2179
|
+
}
|
|
2180
|
+
declare interface TraceItemHibernatableWebSocketEventInfo {
|
|
2181
|
+
readonly getWebSocketEvent:
|
|
2182
|
+
| TraceItemHibernatableWebSocketEventInfoMessage
|
|
2183
|
+
| TraceItemHibernatableWebSocketEventInfoClose
|
|
2184
|
+
| TraceItemHibernatableWebSocketEventInfoError;
|
|
2185
|
+
}
|
|
2186
|
+
declare interface TraceItemHibernatableWebSocketEventInfoMessage {
|
|
2187
|
+
readonly webSocketEventType: string;
|
|
2188
|
+
}
|
|
2189
|
+
declare interface TraceItemHibernatableWebSocketEventInfoClose {
|
|
2190
|
+
readonly webSocketEventType: string;
|
|
2191
|
+
readonly code: number;
|
|
2192
|
+
readonly wasClean: boolean;
|
|
2193
|
+
}
|
|
2194
|
+
declare interface TraceItemHibernatableWebSocketEventInfoError {
|
|
2195
|
+
readonly webSocketEventType: string;
|
|
2196
|
+
}
|
|
1709
2197
|
declare interface TraceLog {
|
|
1710
2198
|
readonly timestamp: number;
|
|
1711
2199
|
readonly level: string;
|
|
@@ -1715,6 +2203,12 @@ declare interface TraceException {
|
|
|
1715
2203
|
readonly timestamp: number;
|
|
1716
2204
|
readonly message: string;
|
|
1717
2205
|
readonly name: string;
|
|
2206
|
+
readonly stack?: string;
|
|
2207
|
+
}
|
|
2208
|
+
declare interface TraceDiagnosticChannelEvent {
|
|
2209
|
+
readonly timestamp: number;
|
|
2210
|
+
readonly channel: string;
|
|
2211
|
+
readonly message: any;
|
|
1718
2212
|
}
|
|
1719
2213
|
declare interface TraceMetrics {
|
|
1720
2214
|
readonly cpuTime: number;
|
|
@@ -1725,19 +2219,32 @@ declare interface UnsafeTraceMetrics {
|
|
|
1725
2219
|
}
|
|
1726
2220
|
declare class URL {
|
|
1727
2221
|
constructor(url: string | URL, base?: string | URL);
|
|
2222
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href) */
|
|
1728
2223
|
href: string;
|
|
2224
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/origin) */
|
|
1729
2225
|
readonly origin: string;
|
|
2226
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol) */
|
|
1730
2227
|
protocol: string;
|
|
2228
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username) */
|
|
1731
2229
|
username: string;
|
|
2230
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password) */
|
|
1732
2231
|
password: string;
|
|
2232
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host) */
|
|
1733
2233
|
host: string;
|
|
2234
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname) */
|
|
1734
2235
|
hostname: string;
|
|
2236
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port) */
|
|
1735
2237
|
port: string;
|
|
2238
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname) */
|
|
1736
2239
|
pathname: string;
|
|
2240
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search) */
|
|
1737
2241
|
search: string;
|
|
2242
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/searchParams) */
|
|
1738
2243
|
readonly searchParams: URLSearchParams;
|
|
2244
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash) */
|
|
1739
2245
|
hash: string;
|
|
1740
2246
|
toString(): string;
|
|
2247
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/toJSON) */
|
|
1741
2248
|
toJSON(): string;
|
|
1742
2249
|
}
|
|
1743
2250
|
declare class URLSearchParams {
|
|
@@ -1746,7 +2253,7 @@ declare class URLSearchParams {
|
|
|
1746
2253
|
| URLSearchParams
|
|
1747
2254
|
| string
|
|
1748
2255
|
| Record<string, string>
|
|
1749
|
-
| [key: string, value: string][]
|
|
2256
|
+
| [key: string, value: string][],
|
|
1750
2257
|
);
|
|
1751
2258
|
get size(): number;
|
|
1752
2259
|
append(name: string, value: string): void;
|
|
@@ -1756,23 +2263,30 @@ declare class URLSearchParams {
|
|
|
1756
2263
|
has(name: string): boolean;
|
|
1757
2264
|
set(name: string, value: string): void;
|
|
1758
2265
|
sort(): void;
|
|
2266
|
+
/** Returns an array of key, value pairs for every entry in the search params. */
|
|
1759
2267
|
entries(): IterableIterator<[key: string, value: string]>;
|
|
2268
|
+
/** Returns a list of keys in the search params. */
|
|
1760
2269
|
keys(): IterableIterator<string>;
|
|
2270
|
+
/** Returns a list of values in the search params. */
|
|
1761
2271
|
values(): IterableIterator<string>;
|
|
1762
2272
|
forEach<This = unknown>(
|
|
1763
2273
|
callback: (
|
|
1764
2274
|
this: This,
|
|
1765
2275
|
value: string,
|
|
1766
2276
|
key: string,
|
|
1767
|
-
parent: URLSearchParams
|
|
2277
|
+
parent: URLSearchParams,
|
|
1768
2278
|
) => void,
|
|
1769
|
-
thisArg?: This
|
|
2279
|
+
thisArg?: This,
|
|
1770
2280
|
): void;
|
|
1771
2281
|
toString(): string;
|
|
1772
2282
|
[Symbol.iterator](): IterableIterator<[key: string, value: string]>;
|
|
1773
2283
|
}
|
|
1774
2284
|
declare class URLPattern {
|
|
1775
|
-
constructor(
|
|
2285
|
+
constructor(
|
|
2286
|
+
input?: string | URLPatternURLPatternInit,
|
|
2287
|
+
baseURL?: string,
|
|
2288
|
+
patternOptions?: URLPatternURLPatternOptions,
|
|
2289
|
+
);
|
|
1776
2290
|
get protocol(): string;
|
|
1777
2291
|
get username(): string;
|
|
1778
2292
|
get password(): string;
|
|
@@ -1784,7 +2298,7 @@ declare class URLPattern {
|
|
|
1784
2298
|
test(input?: string | URLPatternURLPatternInit, baseURL?: string): boolean;
|
|
1785
2299
|
exec(
|
|
1786
2300
|
input?: string | URLPatternURLPatternInit,
|
|
1787
|
-
baseURL?: string
|
|
2301
|
+
baseURL?: string,
|
|
1788
2302
|
): URLPatternURLPatternResult | null;
|
|
1789
2303
|
}
|
|
1790
2304
|
declare interface URLPatternURLPatternInit {
|
|
@@ -1813,13 +2327,28 @@ declare interface URLPatternURLPatternResult {
|
|
|
1813
2327
|
search: URLPatternURLPatternComponentResult;
|
|
1814
2328
|
hash: URLPatternURLPatternComponentResult;
|
|
1815
2329
|
}
|
|
2330
|
+
declare interface URLPatternURLPatternOptions {
|
|
2331
|
+
ignoreCase?: boolean;
|
|
2332
|
+
}
|
|
1816
2333
|
declare class CloseEvent extends Event {
|
|
1817
|
-
constructor(type: string, initializer
|
|
1818
|
-
/**
|
|
2334
|
+
constructor(type: string, initializer?: CloseEventInit);
|
|
2335
|
+
/**
|
|
2336
|
+
* Returns the WebSocket connection close code provided by the server.
|
|
2337
|
+
*
|
|
2338
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/code)
|
|
2339
|
+
*/
|
|
1819
2340
|
readonly code: number;
|
|
1820
|
-
/**
|
|
2341
|
+
/**
|
|
2342
|
+
* Returns the WebSocket connection close reason provided by the server.
|
|
2343
|
+
*
|
|
2344
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/reason)
|
|
2345
|
+
*/
|
|
1821
2346
|
readonly reason: string;
|
|
1822
|
-
/**
|
|
2347
|
+
/**
|
|
2348
|
+
* Returns true if the connection closed cleanly; false otherwise.
|
|
2349
|
+
*
|
|
2350
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/wasClean)
|
|
2351
|
+
*/
|
|
1823
2352
|
readonly wasClean: boolean;
|
|
1824
2353
|
}
|
|
1825
2354
|
declare interface CloseEventInit {
|
|
@@ -1834,12 +2363,21 @@ declare class MessageEvent extends Event {
|
|
|
1834
2363
|
declare interface MessageEventInit {
|
|
1835
2364
|
data: ArrayBuffer | string;
|
|
1836
2365
|
}
|
|
1837
|
-
/**
|
|
2366
|
+
/**
|
|
2367
|
+
* Events providing information related to errors in scripts or in files.
|
|
2368
|
+
*
|
|
2369
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent)
|
|
2370
|
+
*/
|
|
1838
2371
|
declare interface ErrorEvent extends Event {
|
|
2372
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/filename) */
|
|
1839
2373
|
readonly filename: string;
|
|
2374
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/message) */
|
|
1840
2375
|
readonly message: string;
|
|
2376
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/lineno) */
|
|
1841
2377
|
readonly lineno: number;
|
|
2378
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/colno) */
|
|
1842
2379
|
readonly colno: number;
|
|
2380
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/error) */
|
|
1843
2381
|
readonly error: any;
|
|
1844
2382
|
}
|
|
1845
2383
|
declare type WebSocketEventMap = {
|
|
@@ -1851,21 +2389,51 @@ declare type WebSocketEventMap = {
|
|
|
1851
2389
|
declare class WebSocket extends EventTarget<WebSocketEventMap> {
|
|
1852
2390
|
constructor(url: string, protocols?: string[] | string);
|
|
1853
2391
|
accept(): void;
|
|
2392
|
+
/**
|
|
2393
|
+
* Transmits data using the WebSocket connection. data can be a string, a Blob, an ArrayBuffer, or an ArrayBufferView.
|
|
2394
|
+
*
|
|
2395
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/send)
|
|
2396
|
+
*/
|
|
1854
2397
|
send(message: (ArrayBuffer | ArrayBufferView) | string): void;
|
|
2398
|
+
/**
|
|
2399
|
+
* Closes the WebSocket connection, optionally using code as the the WebSocket connection close code and reason as the the WebSocket connection close reason.
|
|
2400
|
+
*
|
|
2401
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/close)
|
|
2402
|
+
*/
|
|
1855
2403
|
close(code?: number, reason?: string): void;
|
|
1856
2404
|
serializeAttachment(attachment: any): void;
|
|
1857
2405
|
deserializeAttachment(): any | null;
|
|
1858
2406
|
static readonly READY_STATE_CONNECTING: number;
|
|
2407
|
+
static readonly CONNECTING: number;
|
|
1859
2408
|
static readonly READY_STATE_OPEN: number;
|
|
2409
|
+
static readonly OPEN: number;
|
|
1860
2410
|
static readonly READY_STATE_CLOSING: number;
|
|
2411
|
+
static readonly CLOSING: number;
|
|
1861
2412
|
static readonly READY_STATE_CLOSED: number;
|
|
1862
|
-
|
|
2413
|
+
static readonly CLOSED: number;
|
|
2414
|
+
/**
|
|
2415
|
+
* Returns the state of the WebSocket object's connection. It can have the values described below.
|
|
2416
|
+
*
|
|
2417
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/readyState)
|
|
2418
|
+
*/
|
|
1863
2419
|
readonly readyState: number;
|
|
1864
|
-
/**
|
|
2420
|
+
/**
|
|
2421
|
+
* Returns the URL that was used to establish the WebSocket connection.
|
|
2422
|
+
*
|
|
2423
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/url)
|
|
2424
|
+
*/
|
|
1865
2425
|
readonly url: string | null;
|
|
1866
|
-
/**
|
|
2426
|
+
/**
|
|
2427
|
+
* Returns the subprotocol selected by the server, if any. It can be used in conjunction with the array form of the constructor's second argument to perform subprotocol negotiation.
|
|
2428
|
+
*
|
|
2429
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/protocol)
|
|
2430
|
+
*/
|
|
1867
2431
|
readonly protocol: string | null;
|
|
1868
|
-
/**
|
|
2432
|
+
/**
|
|
2433
|
+
* Returns the extensions selected by the server, if any.
|
|
2434
|
+
*
|
|
2435
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/extensions)
|
|
2436
|
+
*/
|
|
1869
2437
|
readonly extensions: string | null;
|
|
1870
2438
|
}
|
|
1871
2439
|
declare const WebSocketPair: {
|
|
@@ -1878,6 +2446,7 @@ declare interface Socket {
|
|
|
1878
2446
|
get readable(): ReadableStream;
|
|
1879
2447
|
get writable(): WritableStream;
|
|
1880
2448
|
get closed(): Promise<void>;
|
|
2449
|
+
get opened(): Promise<SocketInfo>;
|
|
1881
2450
|
close(): Promise<void>;
|
|
1882
2451
|
startTls(options?: TlsOptions): Socket;
|
|
1883
2452
|
}
|
|
@@ -1892,6 +2461,519 @@ declare interface SocketAddress {
|
|
|
1892
2461
|
declare interface TlsOptions {
|
|
1893
2462
|
expectedServerHostname?: string;
|
|
1894
2463
|
}
|
|
2464
|
+
declare interface SocketInfo {
|
|
2465
|
+
remoteAddress?: string;
|
|
2466
|
+
localAddress?: string;
|
|
2467
|
+
}
|
|
2468
|
+
declare abstract class gpuGPUAdapter {
|
|
2469
|
+
requestDevice(param1?: gpuGPUDeviceDescriptor): Promise<gpuGPUDevice>;
|
|
2470
|
+
requestAdapterInfo(unmaskHints?: string[]): Promise<gpuGPUAdapterInfo>;
|
|
2471
|
+
get features(): gpuGPUSupportedFeatures;
|
|
2472
|
+
get limits(): gpuGPUSupportedLimits;
|
|
2473
|
+
}
|
|
2474
|
+
declare interface gpuGPUDevice extends EventTarget {
|
|
2475
|
+
createBuffer(param1: gpuGPUBufferDescriptor): gpuGPUBuffer;
|
|
2476
|
+
createBindGroupLayout(
|
|
2477
|
+
descriptor: gpuGPUBindGroupLayoutDescriptor,
|
|
2478
|
+
): gpuGPUBindGroupLayout;
|
|
2479
|
+
createBindGroup(descriptor: gpuGPUBindGroupDescriptor): gpuGPUBindGroup;
|
|
2480
|
+
createSampler(descriptor: gpuGPUSamplerDescriptor): gpuGPUSampler;
|
|
2481
|
+
createShaderModule(
|
|
2482
|
+
descriptor: gpuGPUShaderModuleDescriptor,
|
|
2483
|
+
): gpuGPUShaderModule;
|
|
2484
|
+
createPipelineLayout(
|
|
2485
|
+
descriptor: gpuGPUPipelineLayoutDescriptor,
|
|
2486
|
+
): gpuGPUPipelineLayout;
|
|
2487
|
+
createComputePipeline(
|
|
2488
|
+
descriptor: gpuGPUComputePipelineDescriptor,
|
|
2489
|
+
): gpuGPUComputePipeline;
|
|
2490
|
+
createRenderPipeline(
|
|
2491
|
+
descriptor: gpuGPURenderPipelineDescriptor,
|
|
2492
|
+
): gpuGPURenderPipeline;
|
|
2493
|
+
createCommandEncoder(
|
|
2494
|
+
descriptor?: gpuGPUCommandEncoderDescriptor,
|
|
2495
|
+
): gpuGPUCommandEncoder;
|
|
2496
|
+
createTexture(param1: gpuGPUTextureDescriptor): gpuGPUTexture;
|
|
2497
|
+
destroy(): void;
|
|
2498
|
+
createQuerySet(descriptor: gpuGPUQuerySetDescriptor): gpuGPUQuerySet;
|
|
2499
|
+
pushErrorScope(filter: string): void;
|
|
2500
|
+
popErrorScope(): Promise<gpuGPUError | null>;
|
|
2501
|
+
get queue(): gpuGPUQueue;
|
|
2502
|
+
get lost(): Promise<gpuGPUDeviceLostInfo>;
|
|
2503
|
+
get features(): gpuGPUSupportedFeatures;
|
|
2504
|
+
get limits(): gpuGPUSupportedLimits;
|
|
2505
|
+
}
|
|
2506
|
+
declare interface gpuGPUDeviceDescriptor {
|
|
2507
|
+
label?: string;
|
|
2508
|
+
requiredFeatures?: string[];
|
|
2509
|
+
requiredLimits?: Record<string, number | bigint>;
|
|
2510
|
+
defaultQueue?: gpuGPUQueueDescriptor;
|
|
2511
|
+
}
|
|
2512
|
+
declare interface gpuGPUBufferDescriptor {
|
|
2513
|
+
label: string;
|
|
2514
|
+
size: number | bigint;
|
|
2515
|
+
usage: number;
|
|
2516
|
+
mappedAtCreation: boolean;
|
|
2517
|
+
}
|
|
2518
|
+
declare interface gpuGPUQueueDescriptor {
|
|
2519
|
+
label?: string;
|
|
2520
|
+
}
|
|
2521
|
+
declare abstract class gpuGPUBufferUsage {
|
|
2522
|
+
static readonly MAP_READ: number;
|
|
2523
|
+
static readonly MAP_WRITE: number;
|
|
2524
|
+
static readonly COPY_SRC: number;
|
|
2525
|
+
static readonly COPY_DST: number;
|
|
2526
|
+
static readonly INDEX: number;
|
|
2527
|
+
static readonly VERTEX: number;
|
|
2528
|
+
static readonly UNIFORM: number;
|
|
2529
|
+
static readonly STORAGE: number;
|
|
2530
|
+
static readonly INDIRECT: number;
|
|
2531
|
+
static readonly QUERY_RESOLVE: number;
|
|
2532
|
+
}
|
|
2533
|
+
declare interface gpuGPUBuffer {
|
|
2534
|
+
getMappedRange(size?: number | bigint, param2?: number | bigint): ArrayBuffer;
|
|
2535
|
+
unmap(): void;
|
|
2536
|
+
destroy(): void;
|
|
2537
|
+
mapAsync(
|
|
2538
|
+
offset: number,
|
|
2539
|
+
size?: number | bigint,
|
|
2540
|
+
param3?: number | bigint,
|
|
2541
|
+
): Promise<void>;
|
|
2542
|
+
get size(): number | bigint;
|
|
2543
|
+
get usage(): number;
|
|
2544
|
+
get mapState(): string;
|
|
2545
|
+
}
|
|
2546
|
+
declare abstract class gpuGPUShaderStage {
|
|
2547
|
+
static readonly VERTEX: number;
|
|
2548
|
+
static readonly FRAGMENT: number;
|
|
2549
|
+
static readonly COMPUTE: number;
|
|
2550
|
+
}
|
|
2551
|
+
declare interface gpuGPUBindGroupLayoutDescriptor {
|
|
2552
|
+
label?: string;
|
|
2553
|
+
entries: gpuGPUBindGroupLayoutEntry[];
|
|
2554
|
+
}
|
|
2555
|
+
declare interface gpuGPUBindGroupLayoutEntry {
|
|
2556
|
+
binding: number;
|
|
2557
|
+
visibility: number;
|
|
2558
|
+
buffer?: gpuGPUBufferBindingLayout;
|
|
2559
|
+
sampler?: gpuGPUSamplerBindingLayout;
|
|
2560
|
+
texture?: gpuGPUTextureBindingLayout;
|
|
2561
|
+
storageTexture?: gpuGPUStorageTextureBindingLayout;
|
|
2562
|
+
}
|
|
2563
|
+
declare interface gpuGPUStorageTextureBindingLayout {
|
|
2564
|
+
access?: string;
|
|
2565
|
+
format: string;
|
|
2566
|
+
viewDimension?: string;
|
|
2567
|
+
}
|
|
2568
|
+
declare interface gpuGPUTextureBindingLayout {
|
|
2569
|
+
sampleType?: string;
|
|
2570
|
+
viewDimension?: string;
|
|
2571
|
+
multisampled?: boolean;
|
|
2572
|
+
}
|
|
2573
|
+
declare interface gpuGPUSamplerBindingLayout {
|
|
2574
|
+
type?: string;
|
|
2575
|
+
}
|
|
2576
|
+
declare interface gpuGPUBufferBindingLayout {
|
|
2577
|
+
type?: string;
|
|
2578
|
+
hasDynamicOffset?: boolean;
|
|
2579
|
+
minBindingSize?: number | bigint;
|
|
2580
|
+
}
|
|
2581
|
+
declare interface gpuGPUBindGroupLayout {}
|
|
2582
|
+
declare interface gpuGPUBindGroup {}
|
|
2583
|
+
declare interface gpuGPUBindGroupDescriptor {
|
|
2584
|
+
label?: string;
|
|
2585
|
+
layout: gpuGPUBindGroupLayout;
|
|
2586
|
+
entries: gpuGPUBindGroupEntry[];
|
|
2587
|
+
}
|
|
2588
|
+
declare interface gpuGPUBindGroupEntry {
|
|
2589
|
+
binding: number;
|
|
2590
|
+
resource: gpuGPUBufferBinding | gpuGPUSampler;
|
|
2591
|
+
}
|
|
2592
|
+
declare interface gpuGPUBufferBinding {
|
|
2593
|
+
buffer: gpuGPUBuffer;
|
|
2594
|
+
offset?: number | bigint;
|
|
2595
|
+
size?: number | bigint;
|
|
2596
|
+
}
|
|
2597
|
+
declare interface gpuGPUSampler {}
|
|
2598
|
+
declare interface gpuGPUSamplerDescriptor {
|
|
2599
|
+
label?: string;
|
|
2600
|
+
addressModeU?: string;
|
|
2601
|
+
addressModeV?: string;
|
|
2602
|
+
addressModeW?: string;
|
|
2603
|
+
magFilter?: string;
|
|
2604
|
+
minFilter?: string;
|
|
2605
|
+
mipmapFilter?: string;
|
|
2606
|
+
lodMinClamp?: number;
|
|
2607
|
+
lodMaxClamp?: number;
|
|
2608
|
+
compare: string;
|
|
2609
|
+
maxAnisotropy?: number;
|
|
2610
|
+
}
|
|
2611
|
+
declare interface gpuGPUShaderModule {
|
|
2612
|
+
getCompilationInfo(): Promise<gpuGPUCompilationInfo>;
|
|
2613
|
+
}
|
|
2614
|
+
declare interface gpuGPUShaderModuleDescriptor {
|
|
2615
|
+
label?: string;
|
|
2616
|
+
code: string;
|
|
2617
|
+
}
|
|
2618
|
+
declare interface gpuGPUPipelineLayout {}
|
|
2619
|
+
declare interface gpuGPUPipelineLayoutDescriptor {
|
|
2620
|
+
label?: string;
|
|
2621
|
+
bindGroupLayouts: gpuGPUBindGroupLayout[];
|
|
2622
|
+
}
|
|
2623
|
+
declare interface gpuGPUComputePipeline {
|
|
2624
|
+
getBindGroupLayout(index: number): gpuGPUBindGroupLayout;
|
|
2625
|
+
}
|
|
2626
|
+
declare interface gpuGPUComputePipelineDescriptor {
|
|
2627
|
+
label?: string;
|
|
2628
|
+
compute: gpuGPUProgrammableStage;
|
|
2629
|
+
layout: string | gpuGPUPipelineLayout;
|
|
2630
|
+
}
|
|
2631
|
+
declare interface gpuGPUProgrammableStage {
|
|
2632
|
+
module: gpuGPUShaderModule;
|
|
2633
|
+
entryPoint: string;
|
|
2634
|
+
constants?: Record<string, number>;
|
|
2635
|
+
}
|
|
2636
|
+
declare interface gpuGPUCommandEncoder {
|
|
2637
|
+
get label(): string;
|
|
2638
|
+
beginComputePass(
|
|
2639
|
+
descriptor?: gpuGPUComputePassDescriptor,
|
|
2640
|
+
): gpuGPUComputePassEncoder;
|
|
2641
|
+
beginRenderPass(
|
|
2642
|
+
descriptor: gpuGPURenderPassDescriptor,
|
|
2643
|
+
): gpuGPURenderPassEncoder;
|
|
2644
|
+
copyBufferToBuffer(
|
|
2645
|
+
source: gpuGPUBuffer,
|
|
2646
|
+
sourceOffset: number | bigint,
|
|
2647
|
+
destination: gpuGPUBuffer,
|
|
2648
|
+
destinationOffset: number | bigint,
|
|
2649
|
+
size: number | bigint,
|
|
2650
|
+
): void;
|
|
2651
|
+
finish(param0?: gpuGPUCommandBufferDescriptor): gpuGPUCommandBuffer;
|
|
2652
|
+
copyTextureToBuffer(
|
|
2653
|
+
source: gpuGPUImageCopyTexture,
|
|
2654
|
+
destination: gpuGPUImageCopyBuffer,
|
|
2655
|
+
copySize: Iterable<number> | gpuGPUExtent3DDict,
|
|
2656
|
+
): void;
|
|
2657
|
+
copyBufferToTexture(
|
|
2658
|
+
source: gpuGPUImageCopyBuffer,
|
|
2659
|
+
destination: gpuGPUImageCopyTexture,
|
|
2660
|
+
copySize: Iterable<number> | gpuGPUExtent3DDict,
|
|
2661
|
+
): void;
|
|
2662
|
+
copyTextureToTexture(
|
|
2663
|
+
source: gpuGPUImageCopyTexture,
|
|
2664
|
+
destination: gpuGPUImageCopyTexture,
|
|
2665
|
+
copySize: Iterable<number> | gpuGPUExtent3DDict,
|
|
2666
|
+
): void;
|
|
2667
|
+
clearBuffer(
|
|
2668
|
+
buffer: gpuGPUBuffer,
|
|
2669
|
+
offset?: number | bigint,
|
|
2670
|
+
size?: number | bigint,
|
|
2671
|
+
): void;
|
|
2672
|
+
}
|
|
2673
|
+
declare interface gpuGPUCommandEncoderDescriptor {
|
|
2674
|
+
label?: string;
|
|
2675
|
+
}
|
|
2676
|
+
declare interface gpuGPUComputePassEncoder {
|
|
2677
|
+
setPipeline(pipeline: gpuGPUComputePipeline): void;
|
|
2678
|
+
setBindGroup(
|
|
2679
|
+
index: number,
|
|
2680
|
+
bindGroup: gpuGPUBindGroup | null,
|
|
2681
|
+
dynamicOffsets?: Iterable<number>,
|
|
2682
|
+
): void;
|
|
2683
|
+
dispatchWorkgroups(
|
|
2684
|
+
workgroupCountX: number,
|
|
2685
|
+
workgroupCountY?: number,
|
|
2686
|
+
workgroupCountZ?: number,
|
|
2687
|
+
): void;
|
|
2688
|
+
end(): void;
|
|
2689
|
+
}
|
|
2690
|
+
declare interface gpuGPUComputePassDescriptor {
|
|
2691
|
+
label?: string;
|
|
2692
|
+
timestampWrites?: gpuGPUComputePassTimestampWrites;
|
|
2693
|
+
}
|
|
2694
|
+
declare interface gpuGPUQuerySet {}
|
|
2695
|
+
declare interface gpuGPUQuerySetDescriptor {
|
|
2696
|
+
label?: string;
|
|
2697
|
+
}
|
|
2698
|
+
declare interface gpuGPUComputePassTimestampWrites {
|
|
2699
|
+
querySet: gpuGPUQuerySet;
|
|
2700
|
+
beginningOfPassWriteIndex?: number;
|
|
2701
|
+
endOfPassWriteIndex?: number;
|
|
2702
|
+
}
|
|
2703
|
+
declare interface gpuGPUCommandBufferDescriptor {
|
|
2704
|
+
label?: string;
|
|
2705
|
+
}
|
|
2706
|
+
declare interface gpuGPUCommandBuffer {}
|
|
2707
|
+
declare interface gpuGPUQueue {
|
|
2708
|
+
submit(commandBuffers: gpuGPUCommandBuffer[]): void;
|
|
2709
|
+
writeBuffer(
|
|
2710
|
+
buffer: gpuGPUBuffer,
|
|
2711
|
+
bufferOffset: number | bigint,
|
|
2712
|
+
data: ArrayBuffer | ArrayBufferView,
|
|
2713
|
+
dataOffset?: number | bigint,
|
|
2714
|
+
size?: number | bigint,
|
|
2715
|
+
): void;
|
|
2716
|
+
}
|
|
2717
|
+
declare abstract class gpuGPUMapMode {
|
|
2718
|
+
static readonly READ: number;
|
|
2719
|
+
static readonly WRITE: number;
|
|
2720
|
+
}
|
|
2721
|
+
declare interface gpuGPUAdapterInfo {
|
|
2722
|
+
get vendor(): string;
|
|
2723
|
+
get architecture(): string;
|
|
2724
|
+
get device(): string;
|
|
2725
|
+
get description(): string;
|
|
2726
|
+
}
|
|
2727
|
+
declare interface gpuGPUSupportedFeatures {
|
|
2728
|
+
has(name: string): boolean;
|
|
2729
|
+
keys(): string[];
|
|
2730
|
+
}
|
|
2731
|
+
declare interface gpuGPUSupportedLimits {
|
|
2732
|
+
get maxTextureDimension1D(): number;
|
|
2733
|
+
get maxTextureDimension2D(): number;
|
|
2734
|
+
get maxTextureDimension3D(): number;
|
|
2735
|
+
get maxTextureArrayLayers(): number;
|
|
2736
|
+
get maxBindGroups(): number;
|
|
2737
|
+
get maxBindingsPerBindGroup(): number;
|
|
2738
|
+
get maxDynamicUniformBuffersPerPipelineLayout(): number;
|
|
2739
|
+
get maxDynamicStorageBuffersPerPipelineLayout(): number;
|
|
2740
|
+
get maxSampledTexturesPerShaderStage(): number;
|
|
2741
|
+
get maxSamplersPerShaderStage(): number;
|
|
2742
|
+
get maxStorageBuffersPerShaderStage(): number;
|
|
2743
|
+
get maxStorageTexturesPerShaderStage(): number;
|
|
2744
|
+
get maxUniformBuffersPerShaderStage(): number;
|
|
2745
|
+
get maxUniformBufferBindingSize(): number | bigint;
|
|
2746
|
+
get maxStorageBufferBindingSize(): number | bigint;
|
|
2747
|
+
get minUniformBufferOffsetAlignment(): number;
|
|
2748
|
+
get minStorageBufferOffsetAlignment(): number;
|
|
2749
|
+
get maxVertexBuffers(): number;
|
|
2750
|
+
get maxBufferSize(): number | bigint;
|
|
2751
|
+
get maxVertexAttributes(): number;
|
|
2752
|
+
get maxVertexBufferArrayStride(): number;
|
|
2753
|
+
get maxInterStageShaderComponents(): number;
|
|
2754
|
+
get maxInterStageShaderVariables(): number;
|
|
2755
|
+
get maxColorAttachments(): number;
|
|
2756
|
+
get maxColorAttachmentBytesPerSample(): number;
|
|
2757
|
+
get maxComputeWorkgroupStorageSize(): number;
|
|
2758
|
+
get maxComputeInvocationsPerWorkgroup(): number;
|
|
2759
|
+
get maxComputeWorkgroupSizeX(): number;
|
|
2760
|
+
get maxComputeWorkgroupSizeY(): number;
|
|
2761
|
+
get maxComputeWorkgroupSizeZ(): number;
|
|
2762
|
+
get maxComputeWorkgroupsPerDimension(): number;
|
|
2763
|
+
}
|
|
2764
|
+
declare abstract class gpuGPUError {
|
|
2765
|
+
get message(): string;
|
|
2766
|
+
}
|
|
2767
|
+
declare abstract class gpuGPUOutOfMemoryError extends gpuGPUError {}
|
|
2768
|
+
declare abstract class gpuGPUInternalError extends gpuGPUError {}
|
|
2769
|
+
declare abstract class gpuGPUValidationError extends gpuGPUError {}
|
|
2770
|
+
declare abstract class gpuGPUDeviceLostInfo {
|
|
2771
|
+
get message(): string;
|
|
2772
|
+
get reason(): string;
|
|
2773
|
+
}
|
|
2774
|
+
declare interface gpuGPUCompilationMessage {
|
|
2775
|
+
get message(): string;
|
|
2776
|
+
get type(): string;
|
|
2777
|
+
get lineNum(): number;
|
|
2778
|
+
get linePos(): number;
|
|
2779
|
+
get offset(): number;
|
|
2780
|
+
get length(): number;
|
|
2781
|
+
}
|
|
2782
|
+
declare interface gpuGPUCompilationInfo {
|
|
2783
|
+
get messages(): gpuGPUCompilationMessage[];
|
|
2784
|
+
}
|
|
2785
|
+
declare abstract class gpuGPUTextureUsage {
|
|
2786
|
+
static readonly COPY_SRC: number;
|
|
2787
|
+
static readonly COPY_DST: number;
|
|
2788
|
+
static readonly TEXTURE_BINDING: number;
|
|
2789
|
+
static readonly STORAGE_BINDING: number;
|
|
2790
|
+
static readonly RENDER_ATTACHMENT: number;
|
|
2791
|
+
}
|
|
2792
|
+
declare interface gpuGPUTextureDescriptor {
|
|
2793
|
+
label: string;
|
|
2794
|
+
size: number[] | gpuGPUExtent3DDict;
|
|
2795
|
+
mipLevelCount?: number;
|
|
2796
|
+
sampleCount?: number;
|
|
2797
|
+
dimension?: string;
|
|
2798
|
+
format: string;
|
|
2799
|
+
usage: number;
|
|
2800
|
+
viewFormats?: string[];
|
|
2801
|
+
}
|
|
2802
|
+
declare interface gpuGPUExtent3DDict {
|
|
2803
|
+
width: number;
|
|
2804
|
+
height?: number;
|
|
2805
|
+
depthOrArrayLayers?: number;
|
|
2806
|
+
}
|
|
2807
|
+
declare interface gpuGPUTexture {
|
|
2808
|
+
createView(descriptor?: gpuGPUTextureViewDescriptor): gpuGPUTextureView;
|
|
2809
|
+
destroy(): void;
|
|
2810
|
+
get width(): number;
|
|
2811
|
+
get height(): number;
|
|
2812
|
+
get depthOrArrayLayers(): number;
|
|
2813
|
+
get mipLevelCount(): number;
|
|
2814
|
+
get dimension(): string;
|
|
2815
|
+
get format(): string;
|
|
2816
|
+
get usage(): number;
|
|
2817
|
+
}
|
|
2818
|
+
declare interface gpuGPUTextureView {}
|
|
2819
|
+
declare interface gpuGPUTextureViewDescriptor {
|
|
2820
|
+
label: string;
|
|
2821
|
+
format: string;
|
|
2822
|
+
dimension: string;
|
|
2823
|
+
aspect?: string;
|
|
2824
|
+
baseMipLevel?: number;
|
|
2825
|
+
mipLevelCount: number;
|
|
2826
|
+
baseArrayLayer?: number;
|
|
2827
|
+
arrayLayerCount: number;
|
|
2828
|
+
}
|
|
2829
|
+
declare abstract class gpuGPUColorWrite {
|
|
2830
|
+
static readonly RED: number;
|
|
2831
|
+
static readonly GREEN: number;
|
|
2832
|
+
static readonly BLUE: number;
|
|
2833
|
+
static readonly ALPHA: number;
|
|
2834
|
+
static readonly ALL: number;
|
|
2835
|
+
}
|
|
2836
|
+
declare interface gpuGPURenderPipeline {}
|
|
2837
|
+
declare interface gpuGPURenderPipelineDescriptor {
|
|
2838
|
+
label?: string;
|
|
2839
|
+
layout: string | gpuGPUPipelineLayout;
|
|
2840
|
+
vertex: gpuGPUVertexState;
|
|
2841
|
+
primitive?: gpuGPUPrimitiveState;
|
|
2842
|
+
depthStencil?: gpuGPUDepthStencilState;
|
|
2843
|
+
multisample?: gpuGPUMultisampleState;
|
|
2844
|
+
fragment?: gpuGPUFragmentState;
|
|
2845
|
+
}
|
|
2846
|
+
declare interface gpuGPUVertexState {
|
|
2847
|
+
module: gpuGPUShaderModule;
|
|
2848
|
+
entryPoint: string;
|
|
2849
|
+
constants?: Record<string, number>;
|
|
2850
|
+
buffers?: gpuGPUVertexBufferLayout[];
|
|
2851
|
+
}
|
|
2852
|
+
declare interface gpuGPUVertexBufferLayout {
|
|
2853
|
+
arrayStride: number | bigint;
|
|
2854
|
+
stepMode?: string;
|
|
2855
|
+
attributes: gpuGPUVertexAttribute[];
|
|
2856
|
+
}
|
|
2857
|
+
declare interface gpuGPUVertexAttribute {
|
|
2858
|
+
format: string;
|
|
2859
|
+
offset: number | bigint;
|
|
2860
|
+
shaderLocation: number;
|
|
2861
|
+
}
|
|
2862
|
+
declare interface gpuGPUPrimitiveState {
|
|
2863
|
+
topology?: string;
|
|
2864
|
+
stripIndexFormat?: string;
|
|
2865
|
+
frontFace?: string;
|
|
2866
|
+
cullMode?: string;
|
|
2867
|
+
unclippedDepth?: boolean;
|
|
2868
|
+
}
|
|
2869
|
+
declare interface gpuGPUStencilFaceState {
|
|
2870
|
+
compare?: string;
|
|
2871
|
+
failOp?: string;
|
|
2872
|
+
depthFailOp?: string;
|
|
2873
|
+
passOp?: string;
|
|
2874
|
+
}
|
|
2875
|
+
declare interface gpuGPUDepthStencilState {
|
|
2876
|
+
format: string;
|
|
2877
|
+
depthWriteEnabled: boolean;
|
|
2878
|
+
depthCompare: string;
|
|
2879
|
+
stencilFront?: gpuGPUStencilFaceState;
|
|
2880
|
+
stencilBack?: gpuGPUStencilFaceState;
|
|
2881
|
+
stencilReadMask?: number;
|
|
2882
|
+
stencilWriteMask?: number;
|
|
2883
|
+
depthBias?: number;
|
|
2884
|
+
depthBiasSlopeScale?: number;
|
|
2885
|
+
depthBiasClamp?: number;
|
|
2886
|
+
}
|
|
2887
|
+
declare interface gpuGPUMultisampleState {
|
|
2888
|
+
count?: number;
|
|
2889
|
+
mask?: number;
|
|
2890
|
+
alphaToCoverageEnabled?: boolean;
|
|
2891
|
+
}
|
|
2892
|
+
declare interface gpuGPUFragmentState {
|
|
2893
|
+
module: gpuGPUShaderModule;
|
|
2894
|
+
entryPoint: string;
|
|
2895
|
+
constants?: Record<string, number>;
|
|
2896
|
+
targets: gpuGPUColorTargetState[];
|
|
2897
|
+
}
|
|
2898
|
+
declare interface gpuGPUColorTargetState {
|
|
2899
|
+
format: string;
|
|
2900
|
+
blend: gpuGPUBlendState;
|
|
2901
|
+
writeMask?: number;
|
|
2902
|
+
}
|
|
2903
|
+
declare interface gpuGPUBlendState {
|
|
2904
|
+
color: gpuGPUBlendComponent;
|
|
2905
|
+
alpha: gpuGPUBlendComponent;
|
|
2906
|
+
}
|
|
2907
|
+
declare interface gpuGPUBlendComponent {
|
|
2908
|
+
operation?: string;
|
|
2909
|
+
srcFactor?: string;
|
|
2910
|
+
dstFactor?: string;
|
|
2911
|
+
}
|
|
2912
|
+
declare interface gpuGPURenderPassEncoder {
|
|
2913
|
+
setPipeline(pipeline: gpuGPURenderPipeline): void;
|
|
2914
|
+
draw(
|
|
2915
|
+
vertexCount: number,
|
|
2916
|
+
instanceCount?: number,
|
|
2917
|
+
firstVertex?: number,
|
|
2918
|
+
firstInstance?: number,
|
|
2919
|
+
): void;
|
|
2920
|
+
end(): void;
|
|
2921
|
+
}
|
|
2922
|
+
declare interface gpuGPURenderPassDescriptor {
|
|
2923
|
+
label?: string;
|
|
2924
|
+
colorAttachments: gpuGPURenderPassColorAttachment[];
|
|
2925
|
+
depthStencilAttachment?: gpuGPURenderPassDepthStencilAttachment;
|
|
2926
|
+
occlusionQuerySet?: gpuGPUQuerySet;
|
|
2927
|
+
timestampWrites?: gpuGPURenderPassTimestampWrites;
|
|
2928
|
+
maxDrawCount?: number | bigint;
|
|
2929
|
+
}
|
|
2930
|
+
declare interface gpuGPURenderPassColorAttachment {
|
|
2931
|
+
view: gpuGPUTextureView;
|
|
2932
|
+
depthSlice?: number;
|
|
2933
|
+
resolveTarget?: gpuGPUTextureView;
|
|
2934
|
+
clearValue?: number[] | gpuGPUColorDict;
|
|
2935
|
+
loadOp: string;
|
|
2936
|
+
storeOp: string;
|
|
2937
|
+
}
|
|
2938
|
+
declare interface gpuGPUColorDict {
|
|
2939
|
+
r: number;
|
|
2940
|
+
g: number;
|
|
2941
|
+
b: number;
|
|
2942
|
+
a: number;
|
|
2943
|
+
}
|
|
2944
|
+
declare interface gpuGPURenderPassDepthStencilAttachment {
|
|
2945
|
+
view: gpuGPUTextureView;
|
|
2946
|
+
depthClearValue?: number;
|
|
2947
|
+
depthLoadOp?: string;
|
|
2948
|
+
depthStoreOp?: string;
|
|
2949
|
+
depthReadOnly?: boolean;
|
|
2950
|
+
stencilClearValue?: number;
|
|
2951
|
+
stencilLoadOp?: string;
|
|
2952
|
+
stencilStoreOp?: string;
|
|
2953
|
+
stencilReadOnly?: boolean;
|
|
2954
|
+
}
|
|
2955
|
+
declare interface gpuGPURenderPassTimestampWrites {
|
|
2956
|
+
querySet: gpuGPUQuerySet;
|
|
2957
|
+
beginningOfPassWriteIndex?: number;
|
|
2958
|
+
endOfPassWriteIndex?: number;
|
|
2959
|
+
}
|
|
2960
|
+
declare interface gpuGPUImageCopyTexture {
|
|
2961
|
+
texture: gpuGPUTexture;
|
|
2962
|
+
mipLevel?: number;
|
|
2963
|
+
origin?: number[] | gpuGPUOrigin3DDict;
|
|
2964
|
+
aspect?: string;
|
|
2965
|
+
}
|
|
2966
|
+
declare interface gpuGPUImageCopyBuffer {
|
|
2967
|
+
buffer: gpuGPUBuffer;
|
|
2968
|
+
offset?: number | bigint;
|
|
2969
|
+
bytesPerRow?: number;
|
|
2970
|
+
rowsPerImage?: number;
|
|
2971
|
+
}
|
|
2972
|
+
declare interface gpuGPUOrigin3DDict {
|
|
2973
|
+
x?: number;
|
|
2974
|
+
y?: number;
|
|
2975
|
+
z?: number;
|
|
2976
|
+
}
|
|
1895
2977
|
declare interface BasicImageTransformations {
|
|
1896
2978
|
/**
|
|
1897
2979
|
* Maximum width in image pixels. The value must be an integer.
|
|
@@ -2331,7 +3413,7 @@ declare interface IncomingRequestCfPropertiesBotManagementEnterprise
|
|
|
2331
3413
|
};
|
|
2332
3414
|
}
|
|
2333
3415
|
declare interface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<
|
|
2334
|
-
HostMetadata
|
|
3416
|
+
HostMetadata,
|
|
2335
3417
|
> {
|
|
2336
3418
|
/**
|
|
2337
3419
|
* Custom metadata set per-host in [Cloudflare for SaaS](https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/).
|
|
@@ -2863,25 +3945,51 @@ declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
|
|
|
2863
3945
|
declare type CfProperties<HostMetadata = unknown> =
|
|
2864
3946
|
| IncomingRequestCfProperties<HostMetadata>
|
|
2865
3947
|
| RequestInitCfProperties;
|
|
2866
|
-
declare interface
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
3948
|
+
declare interface D1Meta {
|
|
3949
|
+
duration: number;
|
|
3950
|
+
size_after: number;
|
|
3951
|
+
rows_read: number;
|
|
3952
|
+
rows_written: number;
|
|
3953
|
+
last_row_id: number;
|
|
3954
|
+
changed_db: boolean;
|
|
3955
|
+
changes: number;
|
|
3956
|
+
}
|
|
3957
|
+
declare interface D1Response {
|
|
3958
|
+
success: true;
|
|
3959
|
+
meta: D1Meta & Record<string, unknown>;
|
|
3960
|
+
error?: never;
|
|
3961
|
+
}
|
|
3962
|
+
declare type D1Result<T = unknown> = D1Response & {
|
|
3963
|
+
results: T[];
|
|
3964
|
+
};
|
|
3965
|
+
declare interface D1ExecResult {
|
|
3966
|
+
count: number;
|
|
3967
|
+
duration: number;
|
|
2871
3968
|
}
|
|
2872
3969
|
declare abstract class D1Database {
|
|
2873
3970
|
prepare(query: string): D1PreparedStatement;
|
|
2874
3971
|
dump(): Promise<ArrayBuffer>;
|
|
2875
3972
|
batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;
|
|
2876
|
-
exec
|
|
3973
|
+
exec(query: string): Promise<D1ExecResult>;
|
|
2877
3974
|
}
|
|
2878
3975
|
declare abstract class D1PreparedStatement {
|
|
2879
|
-
bind(...values:
|
|
2880
|
-
first<T = unknown>(colName
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
3976
|
+
bind(...values: unknown[]): D1PreparedStatement;
|
|
3977
|
+
first<T = unknown>(colName: string): Promise<T | null>;
|
|
3978
|
+
first<T = Record<string, unknown>>(): Promise<T | null>;
|
|
3979
|
+
run(): Promise<D1Response>;
|
|
3980
|
+
all<T = Record<string, unknown>>(): Promise<D1Result<T>>;
|
|
3981
|
+
raw<T = unknown[]>(options: {
|
|
3982
|
+
columnNames: true;
|
|
3983
|
+
}): Promise<[string[], ...T[]]>;
|
|
3984
|
+
raw<T = unknown[]>(options?: { columnNames?: false }): Promise<T[]>;
|
|
3985
|
+
}
|
|
3986
|
+
// `Disposable` was added to TypeScript's standard lib types in version 5.2.
|
|
3987
|
+
// To support older TypeScript versions, define an empty `Disposable` interface.
|
|
3988
|
+
// Users won't be able to use `using`/`Symbol.dispose` without upgrading to 5.2,
|
|
3989
|
+
// but this will ensure type checking on older versions still passes.
|
|
3990
|
+
// TypeScript's interface merging will ensure our empty interface is effectively
|
|
3991
|
+
// ignored when `Disposable` is included in the standard lib.
|
|
3992
|
+
declare interface Disposable {}
|
|
2885
3993
|
/**
|
|
2886
3994
|
* An email message that can be sent from a Worker.
|
|
2887
3995
|
*/
|
|
@@ -2902,7 +4010,7 @@ declare interface ForwardableEmailMessage extends EmailMessage {
|
|
|
2902
4010
|
/**
|
|
2903
4011
|
* Stream of the email message content.
|
|
2904
4012
|
*/
|
|
2905
|
-
readonly raw: ReadableStream
|
|
4013
|
+
readonly raw: ReadableStream<Uint8Array>;
|
|
2906
4014
|
/**
|
|
2907
4015
|
* An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
2908
4016
|
*/
|
|
@@ -2937,7 +4045,7 @@ declare abstract class EmailEvent extends ExtendableEvent {
|
|
|
2937
4045
|
declare type EmailExportedHandler<Env = unknown> = (
|
|
2938
4046
|
message: ForwardableEmailMessage,
|
|
2939
4047
|
env: Env,
|
|
2940
|
-
ctx: ExecutionContext
|
|
4048
|
+
ctx: ExecutionContext,
|
|
2941
4049
|
) => void | Promise<void>;
|
|
2942
4050
|
declare module "cloudflare:email" {
|
|
2943
4051
|
let _EmailMessage: {
|
|
@@ -2946,9 +4054,56 @@ declare module "cloudflare:email" {
|
|
|
2946
4054
|
};
|
|
2947
4055
|
export { _EmailMessage as EmailMessage };
|
|
2948
4056
|
}
|
|
4057
|
+
declare interface Hyperdrive {
|
|
4058
|
+
/**
|
|
4059
|
+
* Connect directly to Hyperdrive as if it's your database, returning a TCP socket.
|
|
4060
|
+
*
|
|
4061
|
+
* Calling this method returns an idential socket to if you call
|
|
4062
|
+
* `connect("host:port")` using the `host` and `port` fields from this object.
|
|
4063
|
+
* Pick whichever approach works better with your preferred DB client library.
|
|
4064
|
+
*
|
|
4065
|
+
* Note that this socket is not yet authenticated -- it's expected that your
|
|
4066
|
+
* code (or preferably, the client library of your choice) will authenticate
|
|
4067
|
+
* using the information in this class's readonly fields.
|
|
4068
|
+
*/
|
|
4069
|
+
connect(): Socket;
|
|
4070
|
+
/**
|
|
4071
|
+
* A valid DB connection string that can be passed straight into the typical
|
|
4072
|
+
* client library/driver/ORM. This will typically be the easiest way to use
|
|
4073
|
+
* Hyperdrive.
|
|
4074
|
+
*/
|
|
4075
|
+
readonly connectionString: string;
|
|
4076
|
+
/*
|
|
4077
|
+
* A randomly generated hostname that is only valid within the context of the
|
|
4078
|
+
* currently running Worker which, when passed into `connect()` function from
|
|
4079
|
+
* the "cloudflare:sockets" module, will connect to the Hyperdrive instance
|
|
4080
|
+
* for your database.
|
|
4081
|
+
*/
|
|
4082
|
+
readonly host: string;
|
|
4083
|
+
/*
|
|
4084
|
+
* The port that must be paired the the host field when connecting.
|
|
4085
|
+
*/
|
|
4086
|
+
readonly port: number;
|
|
4087
|
+
/*
|
|
4088
|
+
* The username to use when authenticating to your database via Hyperdrive.
|
|
4089
|
+
* Unlike the host and password, this will be the same every time
|
|
4090
|
+
*/
|
|
4091
|
+
readonly user: string;
|
|
4092
|
+
/*
|
|
4093
|
+
* The randomly generated password to use when authenticating to your
|
|
4094
|
+
* database via Hyperdrive. Like the host field, this password is only valid
|
|
4095
|
+
* within the context of the currently running Worker instance from which
|
|
4096
|
+
* it's read.
|
|
4097
|
+
*/
|
|
4098
|
+
readonly password: string;
|
|
4099
|
+
/*
|
|
4100
|
+
* The name of the database to connect to.
|
|
4101
|
+
*/
|
|
4102
|
+
readonly database: string;
|
|
4103
|
+
}
|
|
2949
4104
|
declare type Params<P extends string = any> = Record<P, string | string[]>;
|
|
2950
4105
|
declare type EventContext<Env, P extends string, Data> = {
|
|
2951
|
-
request: Request
|
|
4106
|
+
request: Request<unknown, IncomingRequestCfProperties<unknown>>;
|
|
2952
4107
|
functionPath: string;
|
|
2953
4108
|
waitUntil: (promise: Promise<any>) => void;
|
|
2954
4109
|
passThroughOnException: () => void;
|
|
@@ -2964,10 +4119,10 @@ declare type EventContext<Env, P extends string, Data> = {
|
|
|
2964
4119
|
declare type PagesFunction<
|
|
2965
4120
|
Env = unknown,
|
|
2966
4121
|
Params extends string = any,
|
|
2967
|
-
Data extends Record<string, unknown> = Record<string, unknown
|
|
4122
|
+
Data extends Record<string, unknown> = Record<string, unknown>,
|
|
2968
4123
|
> = (context: EventContext<Env, Params, Data>) => Response | Promise<Response>;
|
|
2969
4124
|
declare type EventPluginContext<Env, P extends string, Data, PluginArgs> = {
|
|
2970
|
-
request: Request
|
|
4125
|
+
request: Request<unknown, IncomingRequestCfProperties<unknown>>;
|
|
2971
4126
|
functionPath: string;
|
|
2972
4127
|
waitUntil: (promise: Promise<any>) => void;
|
|
2973
4128
|
passThroughOnException: () => void;
|
|
@@ -2985,17 +4140,17 @@ declare type PagesPluginFunction<
|
|
|
2985
4140
|
Env = unknown,
|
|
2986
4141
|
Params extends string = any,
|
|
2987
4142
|
Data extends Record<string, unknown> = Record<string, unknown>,
|
|
2988
|
-
PluginArgs = unknown
|
|
4143
|
+
PluginArgs = unknown,
|
|
2989
4144
|
> = (
|
|
2990
|
-
context: EventPluginContext<Env, Params, Data, PluginArgs
|
|
4145
|
+
context: EventPluginContext<Env, Params, Data, PluginArgs>,
|
|
2991
4146
|
) => Response | Promise<Response>;
|
|
2992
4147
|
declare module "assets:*" {
|
|
2993
4148
|
export const onRequest: PagesFunction;
|
|
2994
4149
|
}
|
|
2995
|
-
// https://developers.cloudflare.com/pub-sub/
|
|
2996
4150
|
// PubSubMessage represents an incoming PubSub message.
|
|
2997
4151
|
// The message includes metadata about the broker, the client, and the payload
|
|
2998
4152
|
// itself.
|
|
4153
|
+
// https://developers.cloudflare.com/pub-sub/
|
|
2999
4154
|
declare interface PubSubMessage {
|
|
3000
4155
|
// Message ID
|
|
3001
4156
|
readonly mid: number;
|
|
@@ -3026,14 +4181,376 @@ declare interface JsonWebKeyWithKid extends JsonWebKey {
|
|
|
3026
4181
|
// Key Identifier of the JWK
|
|
3027
4182
|
readonly kid: string;
|
|
3028
4183
|
}
|
|
4184
|
+
// Namespace for RPC utility types. Unfortunately, we can't use a `module` here as these types need
|
|
4185
|
+
// to referenced by `Fetcher`. This is included in the "importable" version of the types which
|
|
4186
|
+
// strips all `module` blocks.
|
|
4187
|
+
declare namespace Rpc {
|
|
4188
|
+
// Branded types for identifying `WorkerEntrypoint`/`DurableObject`/`Target`s.
|
|
4189
|
+
// TypeScript uses *structural* typing meaning anything with the same shape as type `T` is a `T`.
|
|
4190
|
+
// For the classes exported by `cloudflare:workers` we want *nominal* typing (i.e. we only want to
|
|
4191
|
+
// accept `WorkerEntrypoint` from `cloudflare:workers`, not any other class with the same shape)
|
|
4192
|
+
export const __RPC_STUB_BRAND: "__RPC_STUB_BRAND";
|
|
4193
|
+
export const __RPC_TARGET_BRAND: "__RPC_TARGET_BRAND";
|
|
4194
|
+
export const __WORKER_ENTRYPOINT_BRAND: "__WORKER_ENTRYPOINT_BRAND";
|
|
4195
|
+
export const __DURABLE_OBJECT_BRAND: "__DURABLE_OBJECT_BRAND";
|
|
4196
|
+
export interface RpcTargetBranded {
|
|
4197
|
+
[__RPC_TARGET_BRAND]: never;
|
|
4198
|
+
}
|
|
4199
|
+
export interface WorkerEntrypointBranded {
|
|
4200
|
+
[__WORKER_ENTRYPOINT_BRAND]: never;
|
|
4201
|
+
}
|
|
4202
|
+
export interface DurableObjectBranded {
|
|
4203
|
+
[__DURABLE_OBJECT_BRAND]: never;
|
|
4204
|
+
}
|
|
4205
|
+
export type EntrypointBranded =
|
|
4206
|
+
| WorkerEntrypointBranded
|
|
4207
|
+
| DurableObjectBranded;
|
|
4208
|
+
// Types that can be used through `Stub`s
|
|
4209
|
+
export type Stubable = RpcTargetBranded | ((...args: any[]) => any);
|
|
4210
|
+
// Types that can be passed over RPC
|
|
4211
|
+
type Serializable =
|
|
4212
|
+
// Structured cloneables
|
|
4213
|
+
| void
|
|
4214
|
+
| undefined
|
|
4215
|
+
| null
|
|
4216
|
+
| boolean
|
|
4217
|
+
| number
|
|
4218
|
+
| bigint
|
|
4219
|
+
| string
|
|
4220
|
+
| TypedArray
|
|
4221
|
+
| ArrayBuffer
|
|
4222
|
+
| DataView
|
|
4223
|
+
| Date
|
|
4224
|
+
| Error
|
|
4225
|
+
| RegExp
|
|
4226
|
+
// Structured cloneable composites
|
|
4227
|
+
| Map<Serializable, Serializable>
|
|
4228
|
+
| Set<Serializable>
|
|
4229
|
+
| ReadonlyArray<Serializable>
|
|
4230
|
+
| {
|
|
4231
|
+
[key: string | number]: Serializable;
|
|
4232
|
+
}
|
|
4233
|
+
// Special types
|
|
4234
|
+
| ReadableStream<Uint8Array>
|
|
4235
|
+
| WritableStream<Uint8Array>
|
|
4236
|
+
| Request
|
|
4237
|
+
| Response
|
|
4238
|
+
| Headers
|
|
4239
|
+
| Stub<Stubable>
|
|
4240
|
+
// Serialized as stubs, see `Stubify`
|
|
4241
|
+
| Stubable;
|
|
4242
|
+
// Base type for all RPC stubs, including common memory management methods.
|
|
4243
|
+
// `T` is used as a marker type for unwrapping `Stub`s later.
|
|
4244
|
+
interface StubBase<T extends Stubable> extends Disposable {
|
|
4245
|
+
[__RPC_STUB_BRAND]: T;
|
|
4246
|
+
dup(): this;
|
|
4247
|
+
}
|
|
4248
|
+
export type Stub<T extends Stubable> = Provider<T> & StubBase<T>;
|
|
4249
|
+
// Recursively rewrite all `Stubable` types with `Stub`s
|
|
4250
|
+
type Stubify<T> = T extends Stubable
|
|
4251
|
+
? Stub<T>
|
|
4252
|
+
: T extends Map<infer K, infer V>
|
|
4253
|
+
? Map<Stubify<K>, Stubify<V>>
|
|
4254
|
+
: T extends Set<infer V>
|
|
4255
|
+
? Set<Stubify<V>>
|
|
4256
|
+
: T extends Array<infer V>
|
|
4257
|
+
? Array<Stubify<V>>
|
|
4258
|
+
: T extends ReadonlyArray<infer V>
|
|
4259
|
+
? ReadonlyArray<Stubify<V>>
|
|
4260
|
+
: T extends {
|
|
4261
|
+
[key: string | number]: unknown;
|
|
4262
|
+
}
|
|
4263
|
+
? {
|
|
4264
|
+
[K in keyof T]: Stubify<T[K]>;
|
|
4265
|
+
}
|
|
4266
|
+
: T;
|
|
4267
|
+
// Recursively rewrite all `Stub<T>`s with the corresponding `T`s.
|
|
4268
|
+
// Note we use `StubBase` instead of `Stub` here to avoid circular dependencies:
|
|
4269
|
+
// `Stub` depends on `Provider`, which depends on `Unstubify`, which would depend on `Stub`.
|
|
4270
|
+
type Unstubify<T> =
|
|
4271
|
+
T extends StubBase<infer V>
|
|
4272
|
+
? V
|
|
4273
|
+
: T extends Map<infer K, infer V>
|
|
4274
|
+
? Map<Unstubify<K>, Unstubify<V>>
|
|
4275
|
+
: T extends Set<infer V>
|
|
4276
|
+
? Set<Unstubify<V>>
|
|
4277
|
+
: T extends Array<infer V>
|
|
4278
|
+
? Array<Unstubify<V>>
|
|
4279
|
+
: T extends ReadonlyArray<infer V>
|
|
4280
|
+
? ReadonlyArray<Unstubify<V>>
|
|
4281
|
+
: T extends {
|
|
4282
|
+
[key: string | number]: unknown;
|
|
4283
|
+
}
|
|
4284
|
+
? {
|
|
4285
|
+
[K in keyof T]: Unstubify<T[K]>;
|
|
4286
|
+
}
|
|
4287
|
+
: T;
|
|
4288
|
+
type UnstubifyAll<A extends any[]> = {
|
|
4289
|
+
[I in keyof A]: Unstubify<A[I]>;
|
|
4290
|
+
};
|
|
4291
|
+
// Utility type for adding `Provider`/`Disposable`s to `object` types only.
|
|
4292
|
+
// Note `unknown & T` is equivalent to `T`.
|
|
4293
|
+
type MaybeProvider<T> = T extends object ? Provider<T> : unknown;
|
|
4294
|
+
type MaybeDisposable<T> = T extends object ? Disposable : unknown;
|
|
4295
|
+
// Type for method return or property on an RPC interface.
|
|
4296
|
+
// - Stubable types are replaced by stubs.
|
|
4297
|
+
// - Serializable types are passed by value, with stubable types replaced by stubs
|
|
4298
|
+
// and a top-level `Disposer`.
|
|
4299
|
+
// Everything else can't be passed over PRC.
|
|
4300
|
+
// Technically, we use custom thenables here, but they quack like `Promise`s.
|
|
4301
|
+
// Intersecting with `(Maybe)Provider` allows pipelining.
|
|
4302
|
+
type Result<R> = R extends Stubable
|
|
4303
|
+
? Promise<Stub<R>> & Provider<R>
|
|
4304
|
+
: R extends Serializable
|
|
4305
|
+
? Promise<Stubify<R> & MaybeDisposable<R>> & MaybeProvider<R>
|
|
4306
|
+
: never;
|
|
4307
|
+
// Type for method or property on an RPC interface.
|
|
4308
|
+
// For methods, unwrap `Stub`s in parameters, and rewrite returns to be `Result`s.
|
|
4309
|
+
// Unwrapping `Stub`s allows calling with `Stubable` arguments.
|
|
4310
|
+
// For properties, rewrite types to be `Result`s.
|
|
4311
|
+
// In each case, unwrap `Promise`s.
|
|
4312
|
+
type MethodOrProperty<V> = V extends (...args: infer P) => infer R
|
|
4313
|
+
? (...args: UnstubifyAll<P>) => Result<Awaited<R>>
|
|
4314
|
+
: Result<Awaited<V>>;
|
|
4315
|
+
// Type for the callable part of an `Provider` if `T` is callable.
|
|
4316
|
+
// This is intersected with methods/properties.
|
|
4317
|
+
type MaybeCallableProvider<T> = T extends (...args: any[]) => any
|
|
4318
|
+
? MethodOrProperty<T>
|
|
4319
|
+
: unknown;
|
|
4320
|
+
// Base type for all other types providing RPC-like interfaces.
|
|
4321
|
+
// Rewrites all methods/properties to be `MethodOrProperty`s, while preserving callable types.
|
|
4322
|
+
// `Reserved` names (e.g. stub method names like `dup()`) and symbols can't be accessed over RPC.
|
|
4323
|
+
export type Provider<
|
|
4324
|
+
T extends object,
|
|
4325
|
+
Reserved extends string = never,
|
|
4326
|
+
> = MaybeCallableProvider<T> & {
|
|
4327
|
+
[K in Exclude<
|
|
4328
|
+
keyof T,
|
|
4329
|
+
Reserved | symbol | keyof StubBase<never>
|
|
4330
|
+
>]: MethodOrProperty<T[K]>;
|
|
4331
|
+
};
|
|
4332
|
+
}
|
|
4333
|
+
declare module "cloudflare:workers" {
|
|
4334
|
+
export type RpcStub<T extends Rpc.Stubable> = Rpc.Stub<T>;
|
|
4335
|
+
export const RpcStub: {
|
|
4336
|
+
new <T extends Rpc.Stubable>(value: T): Rpc.Stub<T>;
|
|
4337
|
+
};
|
|
4338
|
+
export abstract class RpcTarget implements Rpc.RpcTargetBranded {
|
|
4339
|
+
[Rpc.__RPC_TARGET_BRAND]: never;
|
|
4340
|
+
}
|
|
4341
|
+
// `protected` fields don't appear in `keyof`s, so can't be accessed over RPC
|
|
4342
|
+
export abstract class WorkerEntrypoint<Env = unknown>
|
|
4343
|
+
implements Rpc.WorkerEntrypointBranded
|
|
4344
|
+
{
|
|
4345
|
+
[Rpc.__WORKER_ENTRYPOINT_BRAND]: never;
|
|
4346
|
+
protected ctx: ExecutionContext;
|
|
4347
|
+
protected env: Env;
|
|
4348
|
+
constructor(ctx: ExecutionContext, env: Env);
|
|
4349
|
+
fetch?(request: Request): Response | Promise<Response>;
|
|
4350
|
+
tail?(events: TraceItem[]): void | Promise<void>;
|
|
4351
|
+
trace?(traces: TraceItem[]): void | Promise<void>;
|
|
4352
|
+
scheduled?(controller: ScheduledController): void | Promise<void>;
|
|
4353
|
+
queue?(batch: MessageBatch<unknown>): void | Promise<void>;
|
|
4354
|
+
test?(controller: TestController): void | Promise<void>;
|
|
4355
|
+
}
|
|
4356
|
+
export abstract class DurableObject<Env = unknown>
|
|
4357
|
+
implements Rpc.DurableObjectBranded
|
|
4358
|
+
{
|
|
4359
|
+
[Rpc.__DURABLE_OBJECT_BRAND]: never;
|
|
4360
|
+
protected ctx: DurableObjectState;
|
|
4361
|
+
protected env: Env;
|
|
4362
|
+
constructor(ctx: DurableObjectState, env: Env);
|
|
4363
|
+
fetch?(request: Request): Response | Promise<Response>;
|
|
4364
|
+
alarm?(): void | Promise<void>;
|
|
4365
|
+
webSocketMessage?(
|
|
4366
|
+
ws: WebSocket,
|
|
4367
|
+
message: string | ArrayBuffer,
|
|
4368
|
+
): void | Promise<void>;
|
|
4369
|
+
webSocketClose?(
|
|
4370
|
+
ws: WebSocket,
|
|
4371
|
+
code: number,
|
|
4372
|
+
reason: string,
|
|
4373
|
+
wasClean: boolean,
|
|
4374
|
+
): void | Promise<void>;
|
|
4375
|
+
webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;
|
|
4376
|
+
}
|
|
4377
|
+
}
|
|
3029
4378
|
declare module "cloudflare:sockets" {
|
|
3030
4379
|
function _connect(
|
|
3031
4380
|
address: string | SocketAddress,
|
|
3032
|
-
options?: SocketOptions
|
|
4381
|
+
options?: SocketOptions,
|
|
3033
4382
|
): Socket;
|
|
3034
4383
|
export { _connect as connect };
|
|
3035
4384
|
}
|
|
3036
|
-
//
|
|
4385
|
+
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
4386
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
4387
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
4388
|
+
/**
|
|
4389
|
+
* Data types supported for holding vector metadata.
|
|
4390
|
+
*/
|
|
4391
|
+
declare type VectorizeVectorMetadataValue =
|
|
4392
|
+
| string
|
|
4393
|
+
| number
|
|
4394
|
+
| boolean
|
|
4395
|
+
| string[];
|
|
4396
|
+
/**
|
|
4397
|
+
* Additional information to associate with a vector.
|
|
4398
|
+
*/
|
|
4399
|
+
declare type VectorizeVectorMetadata =
|
|
4400
|
+
| VectorizeVectorMetadataValue
|
|
4401
|
+
| Record<string, VectorizeVectorMetadataValue>;
|
|
4402
|
+
declare type VectorFloatArray = Float32Array | Float64Array;
|
|
4403
|
+
declare interface VectorizeError {
|
|
4404
|
+
code?: number;
|
|
4405
|
+
error: string;
|
|
4406
|
+
}
|
|
4407
|
+
/**
|
|
4408
|
+
* Comparison logic/operation to use for metadata filtering.
|
|
4409
|
+
*
|
|
4410
|
+
* This list is expected to grow as support for more operations are released.
|
|
4411
|
+
*/
|
|
4412
|
+
declare type VectorizeVectorMetadataFilterOp = "$eq" | "$ne";
|
|
4413
|
+
/**
|
|
4414
|
+
* Filter criteria for vector metadata used to limit the retrieved query result set.
|
|
4415
|
+
*/
|
|
4416
|
+
declare type VectorizeVectorMetadataFilter = {
|
|
4417
|
+
[field: string]:
|
|
4418
|
+
| Exclude<VectorizeVectorMetadataValue, string[]>
|
|
4419
|
+
| null
|
|
4420
|
+
| {
|
|
4421
|
+
[Op in VectorizeVectorMetadataFilterOp]?: Exclude<
|
|
4422
|
+
VectorizeVectorMetadataValue,
|
|
4423
|
+
string[]
|
|
4424
|
+
> | null;
|
|
4425
|
+
};
|
|
4426
|
+
};
|
|
4427
|
+
/**
|
|
4428
|
+
* Supported distance metrics for an index.
|
|
4429
|
+
* Distance metrics determine how other "similar" vectors are determined.
|
|
4430
|
+
*/
|
|
4431
|
+
declare type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product";
|
|
4432
|
+
declare interface VectorizeQueryOptions {
|
|
4433
|
+
topK?: number;
|
|
4434
|
+
namespace?: string;
|
|
4435
|
+
returnValues?: boolean;
|
|
4436
|
+
returnMetadata?: boolean;
|
|
4437
|
+
filter?: VectorizeVectorMetadataFilter;
|
|
4438
|
+
}
|
|
4439
|
+
/**
|
|
4440
|
+
* Information about the configuration of an index.
|
|
4441
|
+
*/
|
|
4442
|
+
declare type VectorizeIndexConfig =
|
|
4443
|
+
| {
|
|
4444
|
+
dimensions: number;
|
|
4445
|
+
metric: VectorizeDistanceMetric;
|
|
4446
|
+
}
|
|
4447
|
+
| {
|
|
4448
|
+
preset: string; // keep this generic, as we'll be adding more presets in the future and this is only in a read capacity
|
|
4449
|
+
};
|
|
4450
|
+
/**
|
|
4451
|
+
* Metadata about an existing index.
|
|
4452
|
+
*/
|
|
4453
|
+
declare interface VectorizeIndexDetails {
|
|
4454
|
+
/** The unique ID of the index */
|
|
4455
|
+
readonly id: string;
|
|
4456
|
+
/** The name of the index. */
|
|
4457
|
+
name: string;
|
|
4458
|
+
/** (optional) A human readable description for the index. */
|
|
4459
|
+
description?: string;
|
|
4460
|
+
/** The index configuration, including the dimension size and distance metric. */
|
|
4461
|
+
config: VectorizeIndexConfig;
|
|
4462
|
+
/** The number of records containing vectors within the index. */
|
|
4463
|
+
vectorsCount: number;
|
|
4464
|
+
}
|
|
4465
|
+
/**
|
|
4466
|
+
* Represents a single vector value set along with its associated metadata.
|
|
4467
|
+
*/
|
|
4468
|
+
declare interface VectorizeVector {
|
|
4469
|
+
/** The ID for the vector. This can be user-defined, and must be unique. It should uniquely identify the object, and is best set based on the ID of what the vector represents. */
|
|
4470
|
+
id: string;
|
|
4471
|
+
/** The vector values */
|
|
4472
|
+
values: VectorFloatArray | number[];
|
|
4473
|
+
/** The namespace this vector belongs to. */
|
|
4474
|
+
namespace?: string;
|
|
4475
|
+
/** Metadata associated with the vector. Includes the values of the other fields and potentially additional details. */
|
|
4476
|
+
metadata?: Record<string, VectorizeVectorMetadata>;
|
|
4477
|
+
}
|
|
4478
|
+
/**
|
|
4479
|
+
* Represents a matched vector for a query along with its score and (if specified) the matching vector information.
|
|
4480
|
+
*/
|
|
4481
|
+
declare type VectorizeMatch = Pick<Partial<VectorizeVector>, "values"> &
|
|
4482
|
+
Omit<VectorizeVector, "values"> & {
|
|
4483
|
+
/** The score or rank for similarity, when returned as a result */
|
|
4484
|
+
score: number;
|
|
4485
|
+
};
|
|
4486
|
+
/**
|
|
4487
|
+
* A set of vector {@link VectorizeMatch} for a particular query.
|
|
4488
|
+
*/
|
|
4489
|
+
declare interface VectorizeMatches {
|
|
4490
|
+
matches: VectorizeMatch[];
|
|
4491
|
+
count: number;
|
|
4492
|
+
}
|
|
4493
|
+
/**
|
|
4494
|
+
* Results of an operation that performed a mutation on a set of vectors.
|
|
4495
|
+
* Here, `ids` is a list of vectors that were successfully processed.
|
|
4496
|
+
*/
|
|
4497
|
+
declare interface VectorizeVectorMutation {
|
|
4498
|
+
/* List of ids of vectors that were successfully processed. */
|
|
4499
|
+
ids: string[];
|
|
4500
|
+
/* Total count of the number of processed vectors. */
|
|
4501
|
+
count: number;
|
|
4502
|
+
}
|
|
4503
|
+
declare abstract class VectorizeIndex {
|
|
4504
|
+
/**
|
|
4505
|
+
* Get information about the currently bound index.
|
|
4506
|
+
* @returns A promise that resolves with information about the current index.
|
|
4507
|
+
*/
|
|
4508
|
+
public describe(): Promise<VectorizeIndexDetails>;
|
|
4509
|
+
/**
|
|
4510
|
+
* Use the provided vector to perform a similarity search across the index.
|
|
4511
|
+
* @param vector Input vector that will be used to drive the similarity search.
|
|
4512
|
+
* @param options Configuration options to massage the returned data.
|
|
4513
|
+
* @returns A promise that resolves with matched and scored vectors.
|
|
4514
|
+
*/
|
|
4515
|
+
public query(
|
|
4516
|
+
vector: VectorFloatArray | number[],
|
|
4517
|
+
options: VectorizeQueryOptions,
|
|
4518
|
+
): Promise<VectorizeMatches>;
|
|
4519
|
+
/**
|
|
4520
|
+
* Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
|
|
4521
|
+
* @param vectors List of vectors that will be inserted.
|
|
4522
|
+
* @returns A promise that resolves with the ids & count of records that were successfully processed.
|
|
4523
|
+
*/
|
|
4524
|
+
public insert(vectors: VectorizeVector[]): Promise<VectorizeVectorMutation>;
|
|
4525
|
+
/**
|
|
4526
|
+
* Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.
|
|
4527
|
+
* @param vectors List of vectors that will be upserted.
|
|
4528
|
+
* @returns A promise that resolves with the ids & count of records that were successfully processed.
|
|
4529
|
+
*/
|
|
4530
|
+
public upsert(vectors: VectorizeVector[]): Promise<VectorizeVectorMutation>;
|
|
4531
|
+
/**
|
|
4532
|
+
* Delete a list of vectors with a matching id.
|
|
4533
|
+
* @param ids List of vector ids that should be deleted.
|
|
4534
|
+
* @returns A promise that resolves with the ids & count of records that were successfully processed (and thus deleted).
|
|
4535
|
+
*/
|
|
4536
|
+
public deleteByIds(ids: string[]): Promise<VectorizeVectorMutation>;
|
|
4537
|
+
/**
|
|
4538
|
+
* Get a list of vectors with a matching id.
|
|
4539
|
+
* @param ids List of vector ids that should be returned.
|
|
4540
|
+
* @returns A promise that resolves with the raw unscored vectors matching the id set.
|
|
4541
|
+
*/
|
|
4542
|
+
public getByIds(ids: string[]): Promise<VectorizeVector[]>;
|
|
4543
|
+
}
|
|
4544
|
+
/**
|
|
4545
|
+
* The interface for "version_metadata" binding
|
|
4546
|
+
* providing metadata about the Worker Version using this binding.
|
|
4547
|
+
*/
|
|
4548
|
+
declare type WorkerVersionMetadata = {
|
|
4549
|
+
/** The ID of the Worker Version using this binding */
|
|
4550
|
+
id: string;
|
|
4551
|
+
/** The tag of the Worker Version using this binding */
|
|
4552
|
+
tag: string;
|
|
4553
|
+
};
|
|
3037
4554
|
declare interface DynamicDispatchLimits {
|
|
3038
4555
|
/**
|
|
3039
4556
|
* Limit CPU time in milliseconds.
|
|
@@ -3069,6 +4586,6 @@ declare interface DispatchNamespace {
|
|
|
3069
4586
|
args?: {
|
|
3070
4587
|
[key: string]: any;
|
|
3071
4588
|
},
|
|
3072
|
-
options?: DynamicDispatchOptions
|
|
4589
|
+
options?: DynamicDispatchOptions,
|
|
3073
4590
|
): Fetcher;
|
|
3074
4591
|
}
|