@cloudflare/workers-types 1.0.9 → 1.20231121.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/2021-11-03/index.d.ts +3803 -0
- package/2021-11-03/index.ts +3791 -0
- package/2022-01-31/index.d.ts +3789 -0
- package/2022-01-31/index.ts +3777 -0
- package/2022-03-21/index.d.ts +3815 -0
- package/2022-03-21/index.ts +3803 -0
- package/2022-08-04/index.d.ts +3816 -0
- package/2022-08-04/index.ts +3804 -0
- package/2022-10-31/index.d.ts +3813 -0
- package/2022-10-31/index.ts +3801 -0
- package/2022-11-30/index.d.ts +3816 -0
- package/2022-11-30/index.ts +3804 -0
- package/2023-03-01/index.d.ts +3817 -0
- package/2023-03-01/index.ts +3805 -0
- package/2023-07-01/index.d.ts +3817 -0
- package/2023-07-01/index.ts +3805 -0
- package/README.md +109 -14
- package/entrypoints.svg +53 -0
- package/experimental/index.d.ts +3874 -0
- package/experimental/index.ts +3862 -0
- package/index.d.ts +3710 -292
- package/index.ts +3791 -0
- package/oldest/index.d.ts +3803 -0
- package/oldest/index.ts +3791 -0
- package/package.json +4 -9
- package/.prettierrc +0 -6
- package/test.ts +0 -6
|
@@ -0,0 +1,3791 @@
|
|
|
1
|
+
/*! *****************************************************************************
|
|
2
|
+
Copyright (c) Cloudflare. All rights reserved.
|
|
3
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
6
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
7
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
9
|
+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
10
|
+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
11
|
+
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
12
|
+
See the Apache Version 2.0 License for specific language governing permissions
|
|
13
|
+
and limitations under the License.
|
|
14
|
+
***************************************************************************** */
|
|
15
|
+
/* eslint-disable */
|
|
16
|
+
// noinspection JSUnusedGlobalSymbols
|
|
17
|
+
export declare class DOMException extends Error {
|
|
18
|
+
constructor(message?: string, name?: string);
|
|
19
|
+
readonly message: string;
|
|
20
|
+
readonly name: string;
|
|
21
|
+
readonly code: number;
|
|
22
|
+
readonly stack: any;
|
|
23
|
+
static readonly INDEX_SIZE_ERR: number;
|
|
24
|
+
static readonly DOMSTRING_SIZE_ERR: number;
|
|
25
|
+
static readonly HIERARCHY_REQUEST_ERR: number;
|
|
26
|
+
static readonly WRONG_DOCUMENT_ERR: number;
|
|
27
|
+
static readonly INVALID_CHARACTER_ERR: number;
|
|
28
|
+
static readonly NO_DATA_ALLOWED_ERR: number;
|
|
29
|
+
static readonly NO_MODIFICATION_ALLOWED_ERR: number;
|
|
30
|
+
static readonly NOT_FOUND_ERR: number;
|
|
31
|
+
static readonly NOT_SUPPORTED_ERR: number;
|
|
32
|
+
static readonly INUSE_ATTRIBUTE_ERR: number;
|
|
33
|
+
static readonly INVALID_STATE_ERR: number;
|
|
34
|
+
static readonly SYNTAX_ERR: number;
|
|
35
|
+
static readonly INVALID_MODIFICATION_ERR: number;
|
|
36
|
+
static readonly NAMESPACE_ERR: number;
|
|
37
|
+
static readonly INVALID_ACCESS_ERR: number;
|
|
38
|
+
static readonly VALIDATION_ERR: number;
|
|
39
|
+
static readonly TYPE_MISMATCH_ERR: number;
|
|
40
|
+
static readonly SECURITY_ERR: number;
|
|
41
|
+
static readonly NETWORK_ERR: number;
|
|
42
|
+
static readonly ABORT_ERR: number;
|
|
43
|
+
static readonly URL_MISMATCH_ERR: number;
|
|
44
|
+
static readonly QUOTA_EXCEEDED_ERR: number;
|
|
45
|
+
static readonly TIMEOUT_ERR: number;
|
|
46
|
+
static readonly INVALID_NODE_TYPE_ERR: number;
|
|
47
|
+
static readonly DATA_CLONE_ERR: number;
|
|
48
|
+
}
|
|
49
|
+
export type WorkerGlobalScopeEventMap = {
|
|
50
|
+
fetch: FetchEvent;
|
|
51
|
+
scheduled: ScheduledEvent;
|
|
52
|
+
queue: QueueEvent;
|
|
53
|
+
unhandledrejection: PromiseRejectionEvent;
|
|
54
|
+
rejectionhandled: PromiseRejectionEvent;
|
|
55
|
+
};
|
|
56
|
+
export declare abstract class WorkerGlobalScope extends EventTarget<WorkerGlobalScopeEventMap> {
|
|
57
|
+
EventTarget: typeof EventTarget;
|
|
58
|
+
}
|
|
59
|
+
export interface Console {
|
|
60
|
+
"assert"(condition?: boolean, ...data: any[]): void;
|
|
61
|
+
clear(): void;
|
|
62
|
+
count(label?: string): void;
|
|
63
|
+
countReset(label?: string): void;
|
|
64
|
+
debug(...data: any[]): void;
|
|
65
|
+
dir(item?: any, options?: any): void;
|
|
66
|
+
dirxml(...data: any[]): void;
|
|
67
|
+
error(...data: any[]): void;
|
|
68
|
+
group(...data: any[]): void;
|
|
69
|
+
groupCollapsed(...data: any[]): void;
|
|
70
|
+
groupEnd(): void;
|
|
71
|
+
info(...data: any[]): void;
|
|
72
|
+
log(...data: any[]): void;
|
|
73
|
+
table(tabularData?: any, properties?: string[]): void;
|
|
74
|
+
time(label?: string): void;
|
|
75
|
+
timeEnd(label?: string): void;
|
|
76
|
+
timeLog(label?: string, ...data: any[]): void;
|
|
77
|
+
timeStamp(label?: string): void;
|
|
78
|
+
trace(...data: any[]): void;
|
|
79
|
+
warn(...data: any[]): void;
|
|
80
|
+
}
|
|
81
|
+
export declare const console: Console;
|
|
82
|
+
export type BufferSource = ArrayBufferView | ArrayBuffer;
|
|
83
|
+
export declare namespace WebAssembly {
|
|
84
|
+
class CompileError extends Error {
|
|
85
|
+
constructor(message?: string);
|
|
86
|
+
}
|
|
87
|
+
class RuntimeError extends Error {
|
|
88
|
+
constructor(message?: string);
|
|
89
|
+
}
|
|
90
|
+
type ValueType =
|
|
91
|
+
| "anyfunc"
|
|
92
|
+
| "externref"
|
|
93
|
+
| "f32"
|
|
94
|
+
| "f64"
|
|
95
|
+
| "i32"
|
|
96
|
+
| "i64"
|
|
97
|
+
| "v128";
|
|
98
|
+
interface GlobalDescriptor {
|
|
99
|
+
value: ValueType;
|
|
100
|
+
mutable?: boolean;
|
|
101
|
+
}
|
|
102
|
+
class Global {
|
|
103
|
+
constructor(descriptor: GlobalDescriptor, value?: any);
|
|
104
|
+
value: any;
|
|
105
|
+
valueOf(): any;
|
|
106
|
+
}
|
|
107
|
+
type ImportValue = ExportValue | number;
|
|
108
|
+
type ModuleImports = Record<string, ImportValue>;
|
|
109
|
+
type Imports = Record<string, ModuleImports>;
|
|
110
|
+
type ExportValue = Function | Global | Memory | Table;
|
|
111
|
+
type Exports = Record<string, ExportValue>;
|
|
112
|
+
class Instance {
|
|
113
|
+
constructor(module: Module, imports?: Imports);
|
|
114
|
+
readonly exports: Exports;
|
|
115
|
+
}
|
|
116
|
+
interface MemoryDescriptor {
|
|
117
|
+
initial: number;
|
|
118
|
+
maximum?: number;
|
|
119
|
+
shared?: boolean;
|
|
120
|
+
}
|
|
121
|
+
class Memory {
|
|
122
|
+
constructor(descriptor: MemoryDescriptor);
|
|
123
|
+
readonly buffer: ArrayBuffer;
|
|
124
|
+
grow(delta: number): number;
|
|
125
|
+
}
|
|
126
|
+
type ImportExportKind = "function" | "global" | "memory" | "table";
|
|
127
|
+
interface ModuleExportDescriptor {
|
|
128
|
+
kind: ImportExportKind;
|
|
129
|
+
name: string;
|
|
130
|
+
}
|
|
131
|
+
interface ModuleImportDescriptor {
|
|
132
|
+
kind: ImportExportKind;
|
|
133
|
+
module: string;
|
|
134
|
+
name: string;
|
|
135
|
+
}
|
|
136
|
+
abstract class Module {
|
|
137
|
+
static customSections(module: Module, sectionName: string): ArrayBuffer[];
|
|
138
|
+
static exports(module: Module): ModuleExportDescriptor[];
|
|
139
|
+
static imports(module: Module): ModuleImportDescriptor[];
|
|
140
|
+
}
|
|
141
|
+
type TableKind = "anyfunc" | "externref";
|
|
142
|
+
interface TableDescriptor {
|
|
143
|
+
element: TableKind;
|
|
144
|
+
initial: number;
|
|
145
|
+
maximum?: number;
|
|
146
|
+
}
|
|
147
|
+
class Table {
|
|
148
|
+
constructor(descriptor: TableDescriptor, value?: any);
|
|
149
|
+
readonly length: number;
|
|
150
|
+
get(index: number): any;
|
|
151
|
+
grow(delta: number, value?: any): number;
|
|
152
|
+
set(index: number, value?: any): void;
|
|
153
|
+
}
|
|
154
|
+
function instantiate(module: Module, imports?: Imports): Promise<Instance>;
|
|
155
|
+
function validate(bytes: BufferSource): boolean;
|
|
156
|
+
}
|
|
157
|
+
/** This ServiceWorker API interface represents the global execution context of a service worker. */
|
|
158
|
+
export interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
159
|
+
DOMException: typeof DOMException;
|
|
160
|
+
WorkerGlobalScope: typeof WorkerGlobalScope;
|
|
161
|
+
btoa(data: string): string;
|
|
162
|
+
atob(data: string): string;
|
|
163
|
+
setTimeout(callback: (...args: any[]) => void, msDelay?: number): number;
|
|
164
|
+
setTimeout<Args extends any[]>(
|
|
165
|
+
callback: (...args: Args) => void,
|
|
166
|
+
msDelay?: number,
|
|
167
|
+
...args: Args
|
|
168
|
+
): number;
|
|
169
|
+
clearTimeout(timeoutId: number | null): void;
|
|
170
|
+
setInterval(callback: (...args: any[]) => void, msDelay?: number): number;
|
|
171
|
+
setInterval<Args extends any[]>(
|
|
172
|
+
callback: (...args: Args) => void,
|
|
173
|
+
msDelay?: number,
|
|
174
|
+
...args: Args
|
|
175
|
+
): number;
|
|
176
|
+
clearInterval(timeoutId: number | null): void;
|
|
177
|
+
queueMicrotask(task: Function): void;
|
|
178
|
+
structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;
|
|
179
|
+
fetch(
|
|
180
|
+
input: RequestInfo,
|
|
181
|
+
init?: RequestInit<RequestInitCfProperties>
|
|
182
|
+
): Promise<Response>;
|
|
183
|
+
self: ServiceWorkerGlobalScope;
|
|
184
|
+
crypto: Crypto;
|
|
185
|
+
caches: CacheStorage;
|
|
186
|
+
scheduler: Scheduler;
|
|
187
|
+
performance: Performance;
|
|
188
|
+
readonly origin: string;
|
|
189
|
+
Event: typeof Event;
|
|
190
|
+
ExtendableEvent: typeof ExtendableEvent;
|
|
191
|
+
CustomEvent: typeof CustomEvent;
|
|
192
|
+
PromiseRejectionEvent: typeof PromiseRejectionEvent;
|
|
193
|
+
FetchEvent: typeof FetchEvent;
|
|
194
|
+
TailEvent: typeof TailEvent;
|
|
195
|
+
TraceEvent: typeof TailEvent;
|
|
196
|
+
ScheduledEvent: typeof ScheduledEvent;
|
|
197
|
+
MessageEvent: typeof MessageEvent;
|
|
198
|
+
CloseEvent: typeof CloseEvent;
|
|
199
|
+
ReadableStreamDefaultReader: typeof ReadableStreamDefaultReader;
|
|
200
|
+
ReadableStreamBYOBReader: typeof ReadableStreamBYOBReader;
|
|
201
|
+
ReadableStream: typeof ReadableStream;
|
|
202
|
+
WritableStream: typeof WritableStream;
|
|
203
|
+
WritableStreamDefaultWriter: typeof WritableStreamDefaultWriter;
|
|
204
|
+
TransformStream: typeof TransformStream;
|
|
205
|
+
ByteLengthQueuingStrategy: typeof ByteLengthQueuingStrategy;
|
|
206
|
+
CountQueuingStrategy: typeof CountQueuingStrategy;
|
|
207
|
+
CompressionStream: typeof CompressionStream;
|
|
208
|
+
DecompressionStream: typeof DecompressionStream;
|
|
209
|
+
TextEncoderStream: typeof TextEncoderStream;
|
|
210
|
+
TextDecoderStream: typeof TextDecoderStream;
|
|
211
|
+
Headers: typeof Headers;
|
|
212
|
+
Body: typeof Body;
|
|
213
|
+
Request: typeof Request;
|
|
214
|
+
Response: typeof Response;
|
|
215
|
+
WebSocket: typeof WebSocket;
|
|
216
|
+
WebSocketPair: typeof WebSocketPair;
|
|
217
|
+
WebSocketRequestResponsePair: typeof WebSocketRequestResponsePair;
|
|
218
|
+
AbortController: typeof AbortController;
|
|
219
|
+
AbortSignal: typeof AbortSignal;
|
|
220
|
+
TextDecoder: typeof TextDecoder;
|
|
221
|
+
TextEncoder: typeof TextEncoder;
|
|
222
|
+
URL: typeof URL;
|
|
223
|
+
URLSearchParams: typeof URLSearchParams;
|
|
224
|
+
URLPattern: typeof URLPattern;
|
|
225
|
+
Blob: typeof Blob;
|
|
226
|
+
File: typeof File;
|
|
227
|
+
FormData: typeof FormData;
|
|
228
|
+
Crypto: typeof Crypto;
|
|
229
|
+
SubtleCrypto: typeof SubtleCrypto;
|
|
230
|
+
CryptoKey: typeof CryptoKey;
|
|
231
|
+
CacheStorage: typeof CacheStorage;
|
|
232
|
+
Cache: typeof Cache;
|
|
233
|
+
FixedLengthStream: typeof FixedLengthStream;
|
|
234
|
+
IdentityTransformStream: typeof IdentityTransformStream;
|
|
235
|
+
HTMLRewriter: typeof HTMLRewriter;
|
|
236
|
+
GPUAdapter: typeof gpuGPUAdapter;
|
|
237
|
+
GPUOutOfMemoryError: typeof gpuGPUOutOfMemoryError;
|
|
238
|
+
GPUValidationError: typeof gpuGPUValidationError;
|
|
239
|
+
GPUInternalError: typeof gpuGPUInternalError;
|
|
240
|
+
GPUDeviceLostInfo: typeof gpuGPUDeviceLostInfo;
|
|
241
|
+
GPUBufferUsage: typeof gpuGPUBufferUsage;
|
|
242
|
+
GPUShaderStage: typeof gpuGPUShaderStage;
|
|
243
|
+
GPUMapMode: typeof gpuGPUMapMode;
|
|
244
|
+
GPUTextureUsage: typeof gpuGPUTextureUsage;
|
|
245
|
+
GPUColorWrite: typeof gpuGPUColorWrite;
|
|
246
|
+
}
|
|
247
|
+
export declare function addEventListener<
|
|
248
|
+
Type extends keyof WorkerGlobalScopeEventMap
|
|
249
|
+
>(
|
|
250
|
+
type: Type,
|
|
251
|
+
handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>,
|
|
252
|
+
options?: EventTargetAddEventListenerOptions | boolean
|
|
253
|
+
): void;
|
|
254
|
+
export declare function removeEventListener<
|
|
255
|
+
Type extends keyof WorkerGlobalScopeEventMap
|
|
256
|
+
>(
|
|
257
|
+
type: Type,
|
|
258
|
+
handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>,
|
|
259
|
+
options?: EventTargetEventListenerOptions | boolean
|
|
260
|
+
): void;
|
|
261
|
+
/** 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. */
|
|
262
|
+
export declare function dispatchEvent(
|
|
263
|
+
event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap]
|
|
264
|
+
): boolean;
|
|
265
|
+
export declare function btoa(data: string): string;
|
|
266
|
+
export declare function atob(data: string): string;
|
|
267
|
+
export declare function setTimeout(
|
|
268
|
+
callback: (...args: any[]) => void,
|
|
269
|
+
msDelay?: number
|
|
270
|
+
): number;
|
|
271
|
+
export declare function setTimeout<Args extends any[]>(
|
|
272
|
+
callback: (...args: Args) => void,
|
|
273
|
+
msDelay?: number,
|
|
274
|
+
...args: Args
|
|
275
|
+
): number;
|
|
276
|
+
export declare function clearTimeout(timeoutId: number | null): void;
|
|
277
|
+
export declare function setInterval(
|
|
278
|
+
callback: (...args: any[]) => void,
|
|
279
|
+
msDelay?: number
|
|
280
|
+
): number;
|
|
281
|
+
export declare function setInterval<Args extends any[]>(
|
|
282
|
+
callback: (...args: Args) => void,
|
|
283
|
+
msDelay?: number,
|
|
284
|
+
...args: Args
|
|
285
|
+
): number;
|
|
286
|
+
export declare function clearInterval(timeoutId: number | null): void;
|
|
287
|
+
export declare function queueMicrotask(task: Function): void;
|
|
288
|
+
export declare function structuredClone<T>(
|
|
289
|
+
value: T,
|
|
290
|
+
options?: StructuredSerializeOptions
|
|
291
|
+
): T;
|
|
292
|
+
export declare function fetch(
|
|
293
|
+
input: RequestInfo,
|
|
294
|
+
init?: RequestInit<RequestInitCfProperties>
|
|
295
|
+
): Promise<Response>;
|
|
296
|
+
export declare const self: ServiceWorkerGlobalScope;
|
|
297
|
+
export declare const crypto: Crypto;
|
|
298
|
+
export declare const caches: CacheStorage;
|
|
299
|
+
export declare const scheduler: Scheduler;
|
|
300
|
+
export declare const performance: Performance;
|
|
301
|
+
export declare const origin: string;
|
|
302
|
+
export interface TestController {}
|
|
303
|
+
export interface ExecutionContext {
|
|
304
|
+
waitUntil(promise: Promise<any>): void;
|
|
305
|
+
passThroughOnException(): void;
|
|
306
|
+
}
|
|
307
|
+
export type ExportedHandlerFetchHandler<
|
|
308
|
+
Env = unknown,
|
|
309
|
+
CfHostMetadata = unknown
|
|
310
|
+
> = (
|
|
311
|
+
request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>,
|
|
312
|
+
env: Env,
|
|
313
|
+
ctx: ExecutionContext
|
|
314
|
+
) => Response | Promise<Response>;
|
|
315
|
+
export type ExportedHandlerTailHandler<Env = unknown> = (
|
|
316
|
+
events: TraceItem[],
|
|
317
|
+
env: Env,
|
|
318
|
+
ctx: ExecutionContext
|
|
319
|
+
) => void | Promise<void>;
|
|
320
|
+
export type ExportedHandlerTraceHandler<Env = unknown> = (
|
|
321
|
+
traces: TraceItem[],
|
|
322
|
+
env: Env,
|
|
323
|
+
ctx: ExecutionContext
|
|
324
|
+
) => void | Promise<void>;
|
|
325
|
+
export type ExportedHandlerScheduledHandler<Env = unknown> = (
|
|
326
|
+
controller: ScheduledController,
|
|
327
|
+
env: Env,
|
|
328
|
+
ctx: ExecutionContext
|
|
329
|
+
) => void | Promise<void>;
|
|
330
|
+
export type ExportedHandlerQueueHandler<Env = unknown, Message = unknown> = (
|
|
331
|
+
batch: MessageBatch<Message>,
|
|
332
|
+
env: Env,
|
|
333
|
+
ctx: ExecutionContext
|
|
334
|
+
) => void | Promise<void>;
|
|
335
|
+
export type ExportedHandlerTestHandler<Env = unknown> = (
|
|
336
|
+
controller: TestController,
|
|
337
|
+
env: Env,
|
|
338
|
+
ctx: ExecutionContext
|
|
339
|
+
) => void | Promise<void>;
|
|
340
|
+
export interface ExportedHandler<
|
|
341
|
+
Env = unknown,
|
|
342
|
+
QueueHandlerMessage = unknown,
|
|
343
|
+
CfHostMetadata = unknown
|
|
344
|
+
> {
|
|
345
|
+
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
|
|
346
|
+
tail?: ExportedHandlerTailHandler<Env>;
|
|
347
|
+
trace?: ExportedHandlerTraceHandler<Env>;
|
|
348
|
+
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
349
|
+
test?: ExportedHandlerTestHandler<Env>;
|
|
350
|
+
email?: EmailExportedHandler<Env>;
|
|
351
|
+
queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage>;
|
|
352
|
+
}
|
|
353
|
+
export interface StructuredSerializeOptions {
|
|
354
|
+
transfer?: any[];
|
|
355
|
+
}
|
|
356
|
+
export declare abstract class PromiseRejectionEvent extends Event {
|
|
357
|
+
readonly promise: Promise<any>;
|
|
358
|
+
readonly reason: any;
|
|
359
|
+
}
|
|
360
|
+
/** 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. */
|
|
361
|
+
export interface Performance {
|
|
362
|
+
readonly timeOrigin: number;
|
|
363
|
+
now(): number;
|
|
364
|
+
}
|
|
365
|
+
export interface DurableObject {
|
|
366
|
+
fetch(request: Request): Response | Promise<Response>;
|
|
367
|
+
alarm?(): void | Promise<void>;
|
|
368
|
+
webSocketMessage?(
|
|
369
|
+
ws: WebSocket,
|
|
370
|
+
message: string | ArrayBuffer
|
|
371
|
+
): void | Promise<void>;
|
|
372
|
+
webSocketClose?(
|
|
373
|
+
ws: WebSocket,
|
|
374
|
+
code: number,
|
|
375
|
+
reason: string,
|
|
376
|
+
wasClean: boolean
|
|
377
|
+
): void | Promise<void>;
|
|
378
|
+
webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;
|
|
379
|
+
}
|
|
380
|
+
export interface DurableObjectStub extends Fetcher {
|
|
381
|
+
readonly id: DurableObjectId;
|
|
382
|
+
readonly name?: string;
|
|
383
|
+
}
|
|
384
|
+
export interface DurableObjectId {
|
|
385
|
+
toString(): string;
|
|
386
|
+
equals(other: DurableObjectId): boolean;
|
|
387
|
+
readonly name?: string;
|
|
388
|
+
}
|
|
389
|
+
export interface DurableObjectNamespace {
|
|
390
|
+
newUniqueId(
|
|
391
|
+
options?: DurableObjectNamespaceNewUniqueIdOptions
|
|
392
|
+
): DurableObjectId;
|
|
393
|
+
idFromName(name: string): DurableObjectId;
|
|
394
|
+
idFromString(id: string): DurableObjectId;
|
|
395
|
+
get(
|
|
396
|
+
id: DurableObjectId,
|
|
397
|
+
options?: DurableObjectNamespaceGetDurableObjectOptions
|
|
398
|
+
): DurableObjectStub;
|
|
399
|
+
jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace;
|
|
400
|
+
}
|
|
401
|
+
export type DurableObjectJurisdiction = "eu" | "fedramp";
|
|
402
|
+
export interface DurableObjectNamespaceNewUniqueIdOptions {
|
|
403
|
+
jurisdiction?: DurableObjectJurisdiction;
|
|
404
|
+
}
|
|
405
|
+
export type DurableObjectLocationHint =
|
|
406
|
+
| "wnam"
|
|
407
|
+
| "enam"
|
|
408
|
+
| "sam"
|
|
409
|
+
| "weur"
|
|
410
|
+
| "eeur"
|
|
411
|
+
| "apac"
|
|
412
|
+
| "oc"
|
|
413
|
+
| "afr"
|
|
414
|
+
| "me";
|
|
415
|
+
export interface DurableObjectNamespaceGetDurableObjectOptions {
|
|
416
|
+
locationHint?: DurableObjectLocationHint;
|
|
417
|
+
}
|
|
418
|
+
export interface DurableObjectState {
|
|
419
|
+
waitUntil(promise: Promise<any>): void;
|
|
420
|
+
readonly id: DurableObjectId;
|
|
421
|
+
readonly storage: DurableObjectStorage;
|
|
422
|
+
blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
|
|
423
|
+
acceptWebSocket(ws: WebSocket, tags?: string[]): void;
|
|
424
|
+
getWebSockets(tag?: string): WebSocket[];
|
|
425
|
+
setWebSocketAutoResponse(maybeReqResp?: WebSocketRequestResponsePair): void;
|
|
426
|
+
getWebSocketAutoResponse(): WebSocketRequestResponsePair | null;
|
|
427
|
+
getWebSocketAutoResponseTimestamp(ws: WebSocket): Date | null;
|
|
428
|
+
}
|
|
429
|
+
export interface DurableObjectTransaction {
|
|
430
|
+
get<T = unknown>(
|
|
431
|
+
key: string,
|
|
432
|
+
options?: DurableObjectGetOptions
|
|
433
|
+
): Promise<T | undefined>;
|
|
434
|
+
get<T = unknown>(
|
|
435
|
+
keys: string[],
|
|
436
|
+
options?: DurableObjectGetOptions
|
|
437
|
+
): Promise<Map<string, T>>;
|
|
438
|
+
list<T = unknown>(
|
|
439
|
+
options?: DurableObjectListOptions
|
|
440
|
+
): Promise<Map<string, T>>;
|
|
441
|
+
put<T>(
|
|
442
|
+
key: string,
|
|
443
|
+
value: T,
|
|
444
|
+
options?: DurableObjectPutOptions
|
|
445
|
+
): Promise<void>;
|
|
446
|
+
put<T>(
|
|
447
|
+
entries: Record<string, T>,
|
|
448
|
+
options?: DurableObjectPutOptions
|
|
449
|
+
): Promise<void>;
|
|
450
|
+
delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;
|
|
451
|
+
delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;
|
|
452
|
+
rollback(): void;
|
|
453
|
+
getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;
|
|
454
|
+
setAlarm(
|
|
455
|
+
scheduledTime: number | Date,
|
|
456
|
+
options?: DurableObjectSetAlarmOptions
|
|
457
|
+
): Promise<void>;
|
|
458
|
+
deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
|
|
459
|
+
}
|
|
460
|
+
export interface DurableObjectStorage {
|
|
461
|
+
get<T = unknown>(
|
|
462
|
+
key: string,
|
|
463
|
+
options?: DurableObjectGetOptions
|
|
464
|
+
): Promise<T | undefined>;
|
|
465
|
+
get<T = unknown>(
|
|
466
|
+
keys: string[],
|
|
467
|
+
options?: DurableObjectGetOptions
|
|
468
|
+
): Promise<Map<string, T>>;
|
|
469
|
+
list<T = unknown>(
|
|
470
|
+
options?: DurableObjectListOptions
|
|
471
|
+
): Promise<Map<string, T>>;
|
|
472
|
+
put<T>(
|
|
473
|
+
key: string,
|
|
474
|
+
value: T,
|
|
475
|
+
options?: DurableObjectPutOptions
|
|
476
|
+
): Promise<void>;
|
|
477
|
+
put<T>(
|
|
478
|
+
entries: Record<string, T>,
|
|
479
|
+
options?: DurableObjectPutOptions
|
|
480
|
+
): Promise<void>;
|
|
481
|
+
delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;
|
|
482
|
+
delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;
|
|
483
|
+
deleteAll(options?: DurableObjectPutOptions): Promise<void>;
|
|
484
|
+
transaction<T>(
|
|
485
|
+
closure: (txn: DurableObjectTransaction) => Promise<T>
|
|
486
|
+
): Promise<T>;
|
|
487
|
+
getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;
|
|
488
|
+
setAlarm(
|
|
489
|
+
scheduledTime: number | Date,
|
|
490
|
+
options?: DurableObjectSetAlarmOptions
|
|
491
|
+
): Promise<void>;
|
|
492
|
+
deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
|
|
493
|
+
sync(): Promise<void>;
|
|
494
|
+
transactionSync<T>(closure: () => T): T;
|
|
495
|
+
}
|
|
496
|
+
export interface DurableObjectListOptions {
|
|
497
|
+
start?: string;
|
|
498
|
+
startAfter?: string;
|
|
499
|
+
end?: string;
|
|
500
|
+
prefix?: string;
|
|
501
|
+
reverse?: boolean;
|
|
502
|
+
limit?: number;
|
|
503
|
+
allowConcurrency?: boolean;
|
|
504
|
+
noCache?: boolean;
|
|
505
|
+
}
|
|
506
|
+
export interface DurableObjectGetOptions {
|
|
507
|
+
allowConcurrency?: boolean;
|
|
508
|
+
noCache?: boolean;
|
|
509
|
+
}
|
|
510
|
+
export interface DurableObjectGetAlarmOptions {
|
|
511
|
+
allowConcurrency?: boolean;
|
|
512
|
+
}
|
|
513
|
+
export interface DurableObjectPutOptions {
|
|
514
|
+
allowConcurrency?: boolean;
|
|
515
|
+
allowUnconfirmed?: boolean;
|
|
516
|
+
noCache?: boolean;
|
|
517
|
+
}
|
|
518
|
+
export interface DurableObjectSetAlarmOptions {
|
|
519
|
+
allowConcurrency?: boolean;
|
|
520
|
+
allowUnconfirmed?: boolean;
|
|
521
|
+
}
|
|
522
|
+
export declare class WebSocketRequestResponsePair {
|
|
523
|
+
constructor(request: string, response: string);
|
|
524
|
+
get request(): string;
|
|
525
|
+
get response(): string;
|
|
526
|
+
}
|
|
527
|
+
export interface AnalyticsEngineDataset {
|
|
528
|
+
writeDataPoint(event?: AnalyticsEngineDataPoint): void;
|
|
529
|
+
}
|
|
530
|
+
export interface AnalyticsEngineDataPoint {
|
|
531
|
+
indexes?: ((ArrayBuffer | string) | null)[];
|
|
532
|
+
doubles?: number[];
|
|
533
|
+
blobs?: ((ArrayBuffer | string) | null)[];
|
|
534
|
+
}
|
|
535
|
+
export declare class Event {
|
|
536
|
+
constructor(type: string, init?: EventInit);
|
|
537
|
+
/** Returns the type of event, e.g. "click", "hashchange", or "submit". */
|
|
538
|
+
readonly type: string;
|
|
539
|
+
/** Returns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE. */
|
|
540
|
+
readonly eventPhase: number;
|
|
541
|
+
/** 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. */
|
|
542
|
+
readonly composed: boolean;
|
|
543
|
+
/** 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. */
|
|
544
|
+
readonly bubbles: boolean;
|
|
545
|
+
/** 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. */
|
|
546
|
+
readonly cancelable: boolean;
|
|
547
|
+
/** Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise. */
|
|
548
|
+
readonly defaultPrevented: boolean;
|
|
549
|
+
/** @deprecated */
|
|
550
|
+
readonly returnValue: boolean;
|
|
551
|
+
/** Returns the object whose event listener's callback is currently being invoked. */
|
|
552
|
+
readonly currentTarget?: EventTarget;
|
|
553
|
+
/** @deprecated */
|
|
554
|
+
readonly srcElement?: EventTarget;
|
|
555
|
+
/** Returns the event's timestamp as the number of milliseconds measured relative to the time origin. */
|
|
556
|
+
readonly timeStamp: number;
|
|
557
|
+
/** Returns true if event was dispatched by the user agent, and false otherwise. */
|
|
558
|
+
readonly isTrusted: boolean;
|
|
559
|
+
cancelBubble: boolean;
|
|
560
|
+
stopImmediatePropagation(): void;
|
|
561
|
+
preventDefault(): void;
|
|
562
|
+
stopPropagation(): void;
|
|
563
|
+
composedPath(): EventTarget[];
|
|
564
|
+
static readonly NONE: number;
|
|
565
|
+
static readonly CAPTURING_PHASE: number;
|
|
566
|
+
static readonly AT_TARGET: number;
|
|
567
|
+
static readonly BUBBLING_PHASE: number;
|
|
568
|
+
}
|
|
569
|
+
export interface EventInit {
|
|
570
|
+
bubbles?: boolean;
|
|
571
|
+
cancelable?: boolean;
|
|
572
|
+
composed?: boolean;
|
|
573
|
+
}
|
|
574
|
+
export type EventListener<EventType extends Event = Event> = (
|
|
575
|
+
event: EventType
|
|
576
|
+
) => void;
|
|
577
|
+
export interface EventListenerObject<EventType extends Event = Event> {
|
|
578
|
+
handleEvent(event: EventType): void;
|
|
579
|
+
}
|
|
580
|
+
export type EventListenerOrEventListenerObject<
|
|
581
|
+
EventType extends Event = Event
|
|
582
|
+
> = EventListener<EventType> | EventListenerObject<EventType>;
|
|
583
|
+
export declare class EventTarget<
|
|
584
|
+
EventMap extends Record<string, Event> = Record<string, Event>
|
|
585
|
+
> {
|
|
586
|
+
constructor();
|
|
587
|
+
addEventListener<Type extends keyof EventMap>(
|
|
588
|
+
type: Type,
|
|
589
|
+
handler: EventListenerOrEventListenerObject<EventMap[Type]>,
|
|
590
|
+
options?: EventTargetAddEventListenerOptions | boolean
|
|
591
|
+
): void;
|
|
592
|
+
removeEventListener<Type extends keyof EventMap>(
|
|
593
|
+
type: Type,
|
|
594
|
+
handler: EventListenerOrEventListenerObject<EventMap[Type]>,
|
|
595
|
+
options?: EventTargetEventListenerOptions | boolean
|
|
596
|
+
): void;
|
|
597
|
+
dispatchEvent(event: EventMap[keyof EventMap]): boolean;
|
|
598
|
+
}
|
|
599
|
+
export interface EventTargetEventListenerOptions {
|
|
600
|
+
capture?: boolean;
|
|
601
|
+
}
|
|
602
|
+
export interface EventTargetAddEventListenerOptions {
|
|
603
|
+
capture?: boolean;
|
|
604
|
+
passive?: boolean;
|
|
605
|
+
once?: boolean;
|
|
606
|
+
signal?: AbortSignal;
|
|
607
|
+
}
|
|
608
|
+
export interface EventTargetHandlerObject {
|
|
609
|
+
handleEvent: (event: Event) => any | undefined;
|
|
610
|
+
}
|
|
611
|
+
export declare class AbortController {
|
|
612
|
+
constructor();
|
|
613
|
+
/** Returns the AbortSignal object associated with this object. */
|
|
614
|
+
readonly signal: AbortSignal;
|
|
615
|
+
abort(reason?: any): void;
|
|
616
|
+
}
|
|
617
|
+
export declare abstract class AbortSignal extends EventTarget {
|
|
618
|
+
static abort(reason?: any): AbortSignal;
|
|
619
|
+
static timeout(delay: number): AbortSignal;
|
|
620
|
+
static any(signals: AbortSignal[]): AbortSignal;
|
|
621
|
+
/** Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. */
|
|
622
|
+
readonly aborted: boolean;
|
|
623
|
+
readonly reason: any;
|
|
624
|
+
throwIfAborted(): void;
|
|
625
|
+
}
|
|
626
|
+
export interface Scheduler {
|
|
627
|
+
wait(delay: number, maybeOptions?: SchedulerWaitOptions): Promise<void>;
|
|
628
|
+
}
|
|
629
|
+
export interface SchedulerWaitOptions {
|
|
630
|
+
signal?: AbortSignal;
|
|
631
|
+
}
|
|
632
|
+
export declare abstract class ExtendableEvent extends Event {
|
|
633
|
+
waitUntil(promise: Promise<any>): void;
|
|
634
|
+
}
|
|
635
|
+
export declare class CustomEvent extends Event {
|
|
636
|
+
constructor(type: string, init?: CustomEventCustomEventInit);
|
|
637
|
+
get detail(): any | undefined;
|
|
638
|
+
}
|
|
639
|
+
export interface CustomEventCustomEventInit {
|
|
640
|
+
bubbles?: boolean;
|
|
641
|
+
cancelable?: boolean;
|
|
642
|
+
composed?: boolean;
|
|
643
|
+
detail?: any;
|
|
644
|
+
}
|
|
645
|
+
export declare class Blob {
|
|
646
|
+
constructor(
|
|
647
|
+
bits?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[],
|
|
648
|
+
options?: BlobOptions
|
|
649
|
+
);
|
|
650
|
+
readonly size: number;
|
|
651
|
+
readonly type: string;
|
|
652
|
+
slice(start?: number, end?: number, type?: string): Blob;
|
|
653
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
654
|
+
text(): Promise<string>;
|
|
655
|
+
stream(): ReadableStream;
|
|
656
|
+
}
|
|
657
|
+
export interface BlobOptions {
|
|
658
|
+
type?: string;
|
|
659
|
+
}
|
|
660
|
+
export declare class File extends Blob {
|
|
661
|
+
constructor(
|
|
662
|
+
bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined,
|
|
663
|
+
name: string,
|
|
664
|
+
options?: FileOptions
|
|
665
|
+
);
|
|
666
|
+
readonly name: string;
|
|
667
|
+
readonly lastModified: number;
|
|
668
|
+
}
|
|
669
|
+
export interface FileOptions {
|
|
670
|
+
type?: string;
|
|
671
|
+
lastModified?: number;
|
|
672
|
+
}
|
|
673
|
+
export declare abstract class CacheStorage {
|
|
674
|
+
open(cacheName: string): Promise<Cache>;
|
|
675
|
+
readonly default: Cache;
|
|
676
|
+
}
|
|
677
|
+
export declare abstract class Cache {
|
|
678
|
+
delete(request: RequestInfo, options?: CacheQueryOptions): Promise<boolean>;
|
|
679
|
+
match(
|
|
680
|
+
request: RequestInfo,
|
|
681
|
+
options?: CacheQueryOptions
|
|
682
|
+
): Promise<Response | undefined>;
|
|
683
|
+
put(request: RequestInfo, response: Response): Promise<void>;
|
|
684
|
+
}
|
|
685
|
+
export interface CacheQueryOptions {
|
|
686
|
+
ignoreMethod?: boolean;
|
|
687
|
+
}
|
|
688
|
+
export declare abstract class Crypto {
|
|
689
|
+
/** Available only in secure contexts. */
|
|
690
|
+
readonly subtle: SubtleCrypto;
|
|
691
|
+
getRandomValues<
|
|
692
|
+
T extends
|
|
693
|
+
| Int8Array
|
|
694
|
+
| Uint8Array
|
|
695
|
+
| Int16Array
|
|
696
|
+
| Uint16Array
|
|
697
|
+
| Int32Array
|
|
698
|
+
| Uint32Array
|
|
699
|
+
| BigInt64Array
|
|
700
|
+
| BigUint64Array
|
|
701
|
+
>(buffer: T): T;
|
|
702
|
+
randomUUID(): string;
|
|
703
|
+
DigestStream: typeof DigestStream;
|
|
704
|
+
}
|
|
705
|
+
export declare abstract class SubtleCrypto {
|
|
706
|
+
encrypt(
|
|
707
|
+
algorithm: string | SubtleCryptoEncryptAlgorithm,
|
|
708
|
+
key: CryptoKey,
|
|
709
|
+
plainText: ArrayBuffer | ArrayBufferView
|
|
710
|
+
): Promise<ArrayBuffer>;
|
|
711
|
+
decrypt(
|
|
712
|
+
algorithm: string | SubtleCryptoEncryptAlgorithm,
|
|
713
|
+
key: CryptoKey,
|
|
714
|
+
cipherText: ArrayBuffer | ArrayBufferView
|
|
715
|
+
): Promise<ArrayBuffer>;
|
|
716
|
+
sign(
|
|
717
|
+
algorithm: string | SubtleCryptoSignAlgorithm,
|
|
718
|
+
key: CryptoKey,
|
|
719
|
+
data: ArrayBuffer | ArrayBufferView
|
|
720
|
+
): Promise<ArrayBuffer>;
|
|
721
|
+
verify(
|
|
722
|
+
algorithm: string | SubtleCryptoSignAlgorithm,
|
|
723
|
+
key: CryptoKey,
|
|
724
|
+
signature: ArrayBuffer | ArrayBufferView,
|
|
725
|
+
data: ArrayBuffer | ArrayBufferView
|
|
726
|
+
): Promise<boolean>;
|
|
727
|
+
digest(
|
|
728
|
+
algorithm: string | SubtleCryptoHashAlgorithm,
|
|
729
|
+
data: ArrayBuffer | ArrayBufferView
|
|
730
|
+
): Promise<ArrayBuffer>;
|
|
731
|
+
generateKey(
|
|
732
|
+
algorithm: string | SubtleCryptoGenerateKeyAlgorithm,
|
|
733
|
+
extractable: boolean,
|
|
734
|
+
keyUsages: string[]
|
|
735
|
+
): Promise<CryptoKey | CryptoKeyPair>;
|
|
736
|
+
deriveKey(
|
|
737
|
+
algorithm: string | SubtleCryptoDeriveKeyAlgorithm,
|
|
738
|
+
baseKey: CryptoKey,
|
|
739
|
+
derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm,
|
|
740
|
+
extractable: boolean,
|
|
741
|
+
keyUsages: string[]
|
|
742
|
+
): Promise<CryptoKey>;
|
|
743
|
+
deriveBits(
|
|
744
|
+
algorithm: string | SubtleCryptoDeriveKeyAlgorithm,
|
|
745
|
+
baseKey: CryptoKey,
|
|
746
|
+
length: number | null
|
|
747
|
+
): Promise<ArrayBuffer>;
|
|
748
|
+
importKey(
|
|
749
|
+
format: string,
|
|
750
|
+
keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey,
|
|
751
|
+
algorithm: string | SubtleCryptoImportKeyAlgorithm,
|
|
752
|
+
extractable: boolean,
|
|
753
|
+
keyUsages: string[]
|
|
754
|
+
): Promise<CryptoKey>;
|
|
755
|
+
exportKey(format: string, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;
|
|
756
|
+
wrapKey(
|
|
757
|
+
format: string,
|
|
758
|
+
key: CryptoKey,
|
|
759
|
+
wrappingKey: CryptoKey,
|
|
760
|
+
wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm
|
|
761
|
+
): Promise<ArrayBuffer>;
|
|
762
|
+
unwrapKey(
|
|
763
|
+
format: string,
|
|
764
|
+
wrappedKey: ArrayBuffer | ArrayBufferView,
|
|
765
|
+
unwrappingKey: CryptoKey,
|
|
766
|
+
unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm,
|
|
767
|
+
unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm,
|
|
768
|
+
extractable: boolean,
|
|
769
|
+
keyUsages: string[]
|
|
770
|
+
): Promise<CryptoKey>;
|
|
771
|
+
timingSafeEqual(
|
|
772
|
+
a: ArrayBuffer | ArrayBufferView,
|
|
773
|
+
b: ArrayBuffer | ArrayBufferView
|
|
774
|
+
): boolean;
|
|
775
|
+
}
|
|
776
|
+
export declare abstract class CryptoKey {
|
|
777
|
+
readonly type: string;
|
|
778
|
+
readonly extractable: boolean;
|
|
779
|
+
readonly algorithm:
|
|
780
|
+
| CryptoKeyKeyAlgorithm
|
|
781
|
+
| CryptoKeyAesKeyAlgorithm
|
|
782
|
+
| CryptoKeyHmacKeyAlgorithm
|
|
783
|
+
| CryptoKeyRsaKeyAlgorithm
|
|
784
|
+
| CryptoKeyEllipticKeyAlgorithm
|
|
785
|
+
| CryptoKeyArbitraryKeyAlgorithm;
|
|
786
|
+
readonly usages: string[];
|
|
787
|
+
}
|
|
788
|
+
export interface CryptoKeyPair {
|
|
789
|
+
publicKey: CryptoKey;
|
|
790
|
+
privateKey: CryptoKey;
|
|
791
|
+
}
|
|
792
|
+
export interface JsonWebKey {
|
|
793
|
+
kty: string;
|
|
794
|
+
use?: string;
|
|
795
|
+
key_ops?: string[];
|
|
796
|
+
alg?: string;
|
|
797
|
+
ext?: boolean;
|
|
798
|
+
crv?: string;
|
|
799
|
+
x?: string;
|
|
800
|
+
y?: string;
|
|
801
|
+
d?: string;
|
|
802
|
+
n?: string;
|
|
803
|
+
e?: string;
|
|
804
|
+
p?: string;
|
|
805
|
+
q?: string;
|
|
806
|
+
dp?: string;
|
|
807
|
+
dq?: string;
|
|
808
|
+
qi?: string;
|
|
809
|
+
oth?: RsaOtherPrimesInfo[];
|
|
810
|
+
k?: string;
|
|
811
|
+
}
|
|
812
|
+
export interface RsaOtherPrimesInfo {
|
|
813
|
+
r?: string;
|
|
814
|
+
d?: string;
|
|
815
|
+
t?: string;
|
|
816
|
+
}
|
|
817
|
+
export interface SubtleCryptoDeriveKeyAlgorithm {
|
|
818
|
+
name: string;
|
|
819
|
+
salt?: ArrayBuffer;
|
|
820
|
+
iterations?: number;
|
|
821
|
+
hash?: string | SubtleCryptoHashAlgorithm;
|
|
822
|
+
$public?: CryptoKey;
|
|
823
|
+
info?: ArrayBuffer;
|
|
824
|
+
}
|
|
825
|
+
export interface SubtleCryptoEncryptAlgorithm {
|
|
826
|
+
name: string;
|
|
827
|
+
iv?: ArrayBuffer;
|
|
828
|
+
additionalData?: ArrayBuffer;
|
|
829
|
+
tagLength?: number;
|
|
830
|
+
counter?: ArrayBuffer;
|
|
831
|
+
length?: number;
|
|
832
|
+
label?: ArrayBuffer;
|
|
833
|
+
}
|
|
834
|
+
export interface SubtleCryptoGenerateKeyAlgorithm {
|
|
835
|
+
name: string;
|
|
836
|
+
hash?: string | SubtleCryptoHashAlgorithm;
|
|
837
|
+
modulusLength?: number;
|
|
838
|
+
publicExponent?: ArrayBuffer;
|
|
839
|
+
length?: number;
|
|
840
|
+
namedCurve?: string;
|
|
841
|
+
}
|
|
842
|
+
export interface SubtleCryptoHashAlgorithm {
|
|
843
|
+
name: string;
|
|
844
|
+
}
|
|
845
|
+
export interface SubtleCryptoImportKeyAlgorithm {
|
|
846
|
+
name: string;
|
|
847
|
+
hash?: string | SubtleCryptoHashAlgorithm;
|
|
848
|
+
length?: number;
|
|
849
|
+
namedCurve?: string;
|
|
850
|
+
compressed?: boolean;
|
|
851
|
+
}
|
|
852
|
+
export interface SubtleCryptoSignAlgorithm {
|
|
853
|
+
name: string;
|
|
854
|
+
hash?: string | SubtleCryptoHashAlgorithm;
|
|
855
|
+
dataLength?: number;
|
|
856
|
+
saltLength?: number;
|
|
857
|
+
}
|
|
858
|
+
export interface CryptoKeyKeyAlgorithm {
|
|
859
|
+
name: string;
|
|
860
|
+
}
|
|
861
|
+
export interface CryptoKeyAesKeyAlgorithm {
|
|
862
|
+
name: string;
|
|
863
|
+
length: number;
|
|
864
|
+
}
|
|
865
|
+
export interface CryptoKeyHmacKeyAlgorithm {
|
|
866
|
+
name: string;
|
|
867
|
+
hash: CryptoKeyKeyAlgorithm;
|
|
868
|
+
length: number;
|
|
869
|
+
}
|
|
870
|
+
export interface CryptoKeyRsaKeyAlgorithm {
|
|
871
|
+
name: string;
|
|
872
|
+
modulusLength: number;
|
|
873
|
+
publicExponent: ArrayBuffer | (ArrayBuffer | ArrayBufferView);
|
|
874
|
+
hash?: CryptoKeyKeyAlgorithm;
|
|
875
|
+
}
|
|
876
|
+
export interface CryptoKeyEllipticKeyAlgorithm {
|
|
877
|
+
name: string;
|
|
878
|
+
namedCurve: string;
|
|
879
|
+
}
|
|
880
|
+
export interface CryptoKeyArbitraryKeyAlgorithm {
|
|
881
|
+
name: string;
|
|
882
|
+
hash?: CryptoKeyKeyAlgorithm;
|
|
883
|
+
namedCurve?: string;
|
|
884
|
+
length?: number;
|
|
885
|
+
}
|
|
886
|
+
export declare class DigestStream extends WritableStream<
|
|
887
|
+
ArrayBuffer | ArrayBufferView
|
|
888
|
+
> {
|
|
889
|
+
constructor(algorithm: string | SubtleCryptoHashAlgorithm);
|
|
890
|
+
readonly digest: Promise<ArrayBuffer>;
|
|
891
|
+
}
|
|
892
|
+
export declare class TextDecoder {
|
|
893
|
+
constructor(decoder?: string, options?: TextDecoderConstructorOptions);
|
|
894
|
+
decode(
|
|
895
|
+
input?: ArrayBuffer | ArrayBufferView,
|
|
896
|
+
options?: TextDecoderDecodeOptions
|
|
897
|
+
): string;
|
|
898
|
+
readonly encoding: string;
|
|
899
|
+
readonly fatal: boolean;
|
|
900
|
+
readonly ignoreBOM: boolean;
|
|
901
|
+
}
|
|
902
|
+
export declare class TextEncoder {
|
|
903
|
+
constructor();
|
|
904
|
+
encode(input?: string): Uint8Array;
|
|
905
|
+
encodeInto(
|
|
906
|
+
input: string,
|
|
907
|
+
buffer: ArrayBuffer | ArrayBufferView
|
|
908
|
+
): TextEncoderEncodeIntoResult;
|
|
909
|
+
readonly encoding: string;
|
|
910
|
+
}
|
|
911
|
+
export interface TextDecoderConstructorOptions {
|
|
912
|
+
fatal: boolean;
|
|
913
|
+
ignoreBOM: boolean;
|
|
914
|
+
}
|
|
915
|
+
export interface TextDecoderDecodeOptions {
|
|
916
|
+
stream: boolean;
|
|
917
|
+
}
|
|
918
|
+
export interface TextEncoderEncodeIntoResult {
|
|
919
|
+
read: number;
|
|
920
|
+
written: number;
|
|
921
|
+
}
|
|
922
|
+
export declare class FormData {
|
|
923
|
+
constructor();
|
|
924
|
+
append(name: string, value: string): void;
|
|
925
|
+
append(name: string, value: Blob, filename?: string): void;
|
|
926
|
+
delete(name: string): void;
|
|
927
|
+
get(name: string): (File | string) | null;
|
|
928
|
+
getAll(name: string): (File | string)[];
|
|
929
|
+
has(name: string): boolean;
|
|
930
|
+
set(name: string, value: string): void;
|
|
931
|
+
set(name: string, value: Blob, filename?: string): void;
|
|
932
|
+
entries(): IterableIterator<[key: string, value: File | string]>;
|
|
933
|
+
keys(): IterableIterator<string>;
|
|
934
|
+
values(): IterableIterator<File | string>;
|
|
935
|
+
forEach<This = unknown>(
|
|
936
|
+
callback: (
|
|
937
|
+
this: This,
|
|
938
|
+
value: File | string,
|
|
939
|
+
key: string,
|
|
940
|
+
parent: FormData
|
|
941
|
+
) => void,
|
|
942
|
+
thisArg?: This
|
|
943
|
+
): void;
|
|
944
|
+
[Symbol.iterator](): IterableIterator<[key: string, value: File | string]>;
|
|
945
|
+
}
|
|
946
|
+
export interface ContentOptions {
|
|
947
|
+
html?: boolean;
|
|
948
|
+
}
|
|
949
|
+
export declare class HTMLRewriter {
|
|
950
|
+
constructor();
|
|
951
|
+
on(
|
|
952
|
+
selector: string,
|
|
953
|
+
handlers: HTMLRewriterElementContentHandlers
|
|
954
|
+
): HTMLRewriter;
|
|
955
|
+
onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter;
|
|
956
|
+
transform(response: Response): Response;
|
|
957
|
+
}
|
|
958
|
+
export interface HTMLRewriterElementContentHandlers {
|
|
959
|
+
element?(element: Element): void | Promise<void>;
|
|
960
|
+
comments?(comment: Comment): void | Promise<void>;
|
|
961
|
+
text?(element: Text): void | Promise<void>;
|
|
962
|
+
}
|
|
963
|
+
export interface HTMLRewriterDocumentContentHandlers {
|
|
964
|
+
doctype?(doctype: Doctype): void | Promise<void>;
|
|
965
|
+
comments?(comment: Comment): void | Promise<void>;
|
|
966
|
+
text?(text: Text): void | Promise<void>;
|
|
967
|
+
end?(end: DocumentEnd): void | Promise<void>;
|
|
968
|
+
}
|
|
969
|
+
export interface Doctype {
|
|
970
|
+
readonly name: string | null;
|
|
971
|
+
readonly publicId: string | null;
|
|
972
|
+
readonly systemId: string | null;
|
|
973
|
+
}
|
|
974
|
+
export interface Element {
|
|
975
|
+
tagName: string;
|
|
976
|
+
readonly attributes: IterableIterator<string[]>;
|
|
977
|
+
readonly removed: boolean;
|
|
978
|
+
readonly namespaceURI: string;
|
|
979
|
+
getAttribute(name: string): string | null;
|
|
980
|
+
hasAttribute(name: string): boolean;
|
|
981
|
+
setAttribute(name: string, value: string): Element;
|
|
982
|
+
removeAttribute(name: string): Element;
|
|
983
|
+
before(content: string, options?: ContentOptions): Element;
|
|
984
|
+
after(content: string, options?: ContentOptions): Element;
|
|
985
|
+
prepend(content: string, options?: ContentOptions): Element;
|
|
986
|
+
append(content: string, options?: ContentOptions): Element;
|
|
987
|
+
replace(content: string, options?: ContentOptions): Element;
|
|
988
|
+
remove(): Element;
|
|
989
|
+
removeAndKeepContent(): Element;
|
|
990
|
+
setInnerContent(content: string, options?: ContentOptions): Element;
|
|
991
|
+
onEndTag(handler: (tag: EndTag) => void | Promise<void>): void;
|
|
992
|
+
}
|
|
993
|
+
export interface EndTag {
|
|
994
|
+
name: string;
|
|
995
|
+
before(content: string, options?: ContentOptions): EndTag;
|
|
996
|
+
after(content: string, options?: ContentOptions): EndTag;
|
|
997
|
+
remove(): EndTag;
|
|
998
|
+
}
|
|
999
|
+
export interface Comment {
|
|
1000
|
+
text: string;
|
|
1001
|
+
readonly removed: boolean;
|
|
1002
|
+
before(content: string, options?: ContentOptions): Comment;
|
|
1003
|
+
after(content: string, options?: ContentOptions): Comment;
|
|
1004
|
+
replace(content: string, options?: ContentOptions): Comment;
|
|
1005
|
+
remove(): Comment;
|
|
1006
|
+
}
|
|
1007
|
+
export interface Text {
|
|
1008
|
+
readonly text: string;
|
|
1009
|
+
readonly lastInTextNode: boolean;
|
|
1010
|
+
readonly removed: boolean;
|
|
1011
|
+
before(content: string, options?: ContentOptions): Text;
|
|
1012
|
+
after(content: string, options?: ContentOptions): Text;
|
|
1013
|
+
replace(content: string, options?: ContentOptions): Text;
|
|
1014
|
+
remove(): Text;
|
|
1015
|
+
}
|
|
1016
|
+
export interface DocumentEnd {
|
|
1017
|
+
append(content: string, options?: ContentOptions): DocumentEnd;
|
|
1018
|
+
}
|
|
1019
|
+
export declare abstract class FetchEvent extends ExtendableEvent {
|
|
1020
|
+
readonly request: Request;
|
|
1021
|
+
respondWith(promise: Response | Promise<Response>): void;
|
|
1022
|
+
passThroughOnException(): void;
|
|
1023
|
+
}
|
|
1024
|
+
export type HeadersInit =
|
|
1025
|
+
| Headers
|
|
1026
|
+
| Iterable<Iterable<string>>
|
|
1027
|
+
| Record<string, string>;
|
|
1028
|
+
export declare class Headers {
|
|
1029
|
+
constructor(init?: HeadersInit);
|
|
1030
|
+
get(name: string): string | null;
|
|
1031
|
+
getAll(name: string): string[];
|
|
1032
|
+
has(name: string): boolean;
|
|
1033
|
+
set(name: string, value: string): void;
|
|
1034
|
+
append(name: string, value: string): void;
|
|
1035
|
+
delete(name: string): void;
|
|
1036
|
+
forEach<This = unknown>(
|
|
1037
|
+
callback: (this: This, value: string, key: string, parent: Headers) => void,
|
|
1038
|
+
thisArg?: This
|
|
1039
|
+
): void;
|
|
1040
|
+
entries(): IterableIterator<[key: string, value: string]>;
|
|
1041
|
+
keys(): IterableIterator<string>;
|
|
1042
|
+
values(): IterableIterator<string>;
|
|
1043
|
+
[Symbol.iterator](): IterableIterator<[key: string, value: string]>;
|
|
1044
|
+
}
|
|
1045
|
+
export type BodyInit =
|
|
1046
|
+
| ReadableStream<Uint8Array>
|
|
1047
|
+
| string
|
|
1048
|
+
| ArrayBuffer
|
|
1049
|
+
| ArrayBufferView
|
|
1050
|
+
| Blob
|
|
1051
|
+
| URLSearchParams
|
|
1052
|
+
| FormData;
|
|
1053
|
+
export declare abstract class Body {
|
|
1054
|
+
readonly body: ReadableStream | null;
|
|
1055
|
+
readonly bodyUsed: boolean;
|
|
1056
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
1057
|
+
text(): Promise<string>;
|
|
1058
|
+
json<T>(): Promise<T>;
|
|
1059
|
+
formData(): Promise<FormData>;
|
|
1060
|
+
blob(): Promise<Blob>;
|
|
1061
|
+
}
|
|
1062
|
+
export declare class Response extends Body {
|
|
1063
|
+
constructor(body?: BodyInit | null, init?: ResponseInit);
|
|
1064
|
+
static redirect(url: string, status?: number): Response;
|
|
1065
|
+
static json(any: any, maybeInit?: ResponseInit | Response): Response;
|
|
1066
|
+
clone(): Response;
|
|
1067
|
+
readonly status: number;
|
|
1068
|
+
readonly statusText: string;
|
|
1069
|
+
readonly headers: Headers;
|
|
1070
|
+
readonly ok: boolean;
|
|
1071
|
+
readonly redirected: boolean;
|
|
1072
|
+
readonly url: string;
|
|
1073
|
+
readonly webSocket: WebSocket | null;
|
|
1074
|
+
readonly cf?: any;
|
|
1075
|
+
}
|
|
1076
|
+
export interface ResponseInit {
|
|
1077
|
+
status?: number;
|
|
1078
|
+
statusText?: string;
|
|
1079
|
+
headers?: HeadersInit;
|
|
1080
|
+
cf?: any;
|
|
1081
|
+
webSocket?: WebSocket | null;
|
|
1082
|
+
encodeBody?: "automatic" | "manual";
|
|
1083
|
+
}
|
|
1084
|
+
export type RequestInfo<
|
|
1085
|
+
CfHostMetadata = unknown,
|
|
1086
|
+
Cf = CfProperties<CfHostMetadata>
|
|
1087
|
+
> = Request<CfHostMetadata, Cf> | string | URL;
|
|
1088
|
+
export declare class Request<
|
|
1089
|
+
CfHostMetadata = unknown,
|
|
1090
|
+
Cf = CfProperties<CfHostMetadata>
|
|
1091
|
+
> extends Body {
|
|
1092
|
+
constructor(input: RequestInfo<CfProperties>, init?: RequestInit<Cf>);
|
|
1093
|
+
clone(): Request<CfHostMetadata, Cf>;
|
|
1094
|
+
/** Returns request's HTTP method, which is "GET" by default. */
|
|
1095
|
+
readonly method: string;
|
|
1096
|
+
/** Returns the URL of request as a string. */
|
|
1097
|
+
readonly url: string;
|
|
1098
|
+
/** 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. */
|
|
1099
|
+
readonly headers: Headers;
|
|
1100
|
+
/** 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. */
|
|
1101
|
+
readonly redirect: string;
|
|
1102
|
+
readonly fetcher: Fetcher | null;
|
|
1103
|
+
/** Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler. */
|
|
1104
|
+
readonly signal: AbortSignal;
|
|
1105
|
+
readonly cf?: Cf;
|
|
1106
|
+
/** 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] */
|
|
1107
|
+
readonly integrity: string;
|
|
1108
|
+
/** Returns a boolean indicating whether or not request can outlive the global in which it was created. */
|
|
1109
|
+
readonly keepalive: boolean;
|
|
1110
|
+
}
|
|
1111
|
+
export interface RequestInit<Cf = CfProperties> {
|
|
1112
|
+
/** A string to set request's method. */
|
|
1113
|
+
method?: string;
|
|
1114
|
+
/** A Headers object, an object literal, or an array of two-item arrays to set request's headers. */
|
|
1115
|
+
headers?: HeadersInit;
|
|
1116
|
+
/** A BodyInit object or null to set request's body. */
|
|
1117
|
+
body?: BodyInit | null;
|
|
1118
|
+
/** A string indicating whether request follows redirects, results in an error upon encountering a redirect, or returns the redirect (in an opaque fashion). Sets request's redirect. */
|
|
1119
|
+
redirect?: string;
|
|
1120
|
+
fetcher?: Fetcher | null;
|
|
1121
|
+
cf?: Cf;
|
|
1122
|
+
/** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
|
|
1123
|
+
integrity?: string;
|
|
1124
|
+
/** An AbortSignal to set request's signal. */
|
|
1125
|
+
signal?: AbortSignal | null;
|
|
1126
|
+
}
|
|
1127
|
+
export declare abstract class Fetcher {
|
|
1128
|
+
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
1129
|
+
connect(address: SocketAddress | string, options?: SocketOptions): Socket;
|
|
1130
|
+
}
|
|
1131
|
+
export interface FetcherPutOptions {
|
|
1132
|
+
expiration?: number;
|
|
1133
|
+
expirationTtl?: number;
|
|
1134
|
+
}
|
|
1135
|
+
export interface KVNamespaceListKey<Metadata, Key extends string = string> {
|
|
1136
|
+
name: Key;
|
|
1137
|
+
expiration?: number;
|
|
1138
|
+
metadata?: Metadata;
|
|
1139
|
+
}
|
|
1140
|
+
export type KVNamespaceListResult<Metadata, Key extends string = string> =
|
|
1141
|
+
| {
|
|
1142
|
+
list_complete: false;
|
|
1143
|
+
keys: KVNamespaceListKey<Metadata, Key>[];
|
|
1144
|
+
cursor: string;
|
|
1145
|
+
cacheStatus: string | null;
|
|
1146
|
+
}
|
|
1147
|
+
| {
|
|
1148
|
+
list_complete: true;
|
|
1149
|
+
keys: KVNamespaceListKey<Metadata, Key>[];
|
|
1150
|
+
cacheStatus: string | null;
|
|
1151
|
+
};
|
|
1152
|
+
export interface KVNamespace<Key extends string = string> {
|
|
1153
|
+
get(
|
|
1154
|
+
key: Key,
|
|
1155
|
+
options?: Partial<KVNamespaceGetOptions<undefined>>
|
|
1156
|
+
): Promise<string | null>;
|
|
1157
|
+
get(key: Key, type: "text"): Promise<string | null>;
|
|
1158
|
+
get<ExpectedValue = unknown>(
|
|
1159
|
+
key: Key,
|
|
1160
|
+
type: "json"
|
|
1161
|
+
): Promise<ExpectedValue | null>;
|
|
1162
|
+
get(key: Key, type: "arrayBuffer"): Promise<ArrayBuffer | null>;
|
|
1163
|
+
get(key: Key, type: "stream"): Promise<ReadableStream | null>;
|
|
1164
|
+
get(
|
|
1165
|
+
key: Key,
|
|
1166
|
+
options?: KVNamespaceGetOptions<"text">
|
|
1167
|
+
): Promise<string | null>;
|
|
1168
|
+
get<ExpectedValue = unknown>(
|
|
1169
|
+
key: Key,
|
|
1170
|
+
options?: KVNamespaceGetOptions<"json">
|
|
1171
|
+
): Promise<ExpectedValue | null>;
|
|
1172
|
+
get(
|
|
1173
|
+
key: Key,
|
|
1174
|
+
options?: KVNamespaceGetOptions<"arrayBuffer">
|
|
1175
|
+
): Promise<ArrayBuffer | null>;
|
|
1176
|
+
get(
|
|
1177
|
+
key: Key,
|
|
1178
|
+
options?: KVNamespaceGetOptions<"stream">
|
|
1179
|
+
): Promise<ReadableStream | null>;
|
|
1180
|
+
list<Metadata = unknown>(
|
|
1181
|
+
options?: KVNamespaceListOptions
|
|
1182
|
+
): Promise<KVNamespaceListResult<Metadata, Key>>;
|
|
1183
|
+
put(
|
|
1184
|
+
key: Key,
|
|
1185
|
+
value: string | ArrayBuffer | ArrayBufferView | ReadableStream,
|
|
1186
|
+
options?: KVNamespacePutOptions
|
|
1187
|
+
): Promise<void>;
|
|
1188
|
+
getWithMetadata<Metadata = unknown>(
|
|
1189
|
+
key: Key,
|
|
1190
|
+
options?: Partial<KVNamespaceGetOptions<undefined>>
|
|
1191
|
+
): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
|
|
1192
|
+
getWithMetadata<Metadata = unknown>(
|
|
1193
|
+
key: Key,
|
|
1194
|
+
type: "text"
|
|
1195
|
+
): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
|
|
1196
|
+
getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(
|
|
1197
|
+
key: Key,
|
|
1198
|
+
type: "json"
|
|
1199
|
+
): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;
|
|
1200
|
+
getWithMetadata<Metadata = unknown>(
|
|
1201
|
+
key: Key,
|
|
1202
|
+
type: "arrayBuffer"
|
|
1203
|
+
): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;
|
|
1204
|
+
getWithMetadata<Metadata = unknown>(
|
|
1205
|
+
key: Key,
|
|
1206
|
+
type: "stream"
|
|
1207
|
+
): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;
|
|
1208
|
+
getWithMetadata<Metadata = unknown>(
|
|
1209
|
+
key: Key,
|
|
1210
|
+
options: KVNamespaceGetOptions<"text">
|
|
1211
|
+
): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
|
|
1212
|
+
getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(
|
|
1213
|
+
key: Key,
|
|
1214
|
+
options: KVNamespaceGetOptions<"json">
|
|
1215
|
+
): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;
|
|
1216
|
+
getWithMetadata<Metadata = unknown>(
|
|
1217
|
+
key: Key,
|
|
1218
|
+
options: KVNamespaceGetOptions<"arrayBuffer">
|
|
1219
|
+
): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;
|
|
1220
|
+
getWithMetadata<Metadata = unknown>(
|
|
1221
|
+
key: Key,
|
|
1222
|
+
options: KVNamespaceGetOptions<"stream">
|
|
1223
|
+
): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;
|
|
1224
|
+
delete(key: Key): Promise<void>;
|
|
1225
|
+
}
|
|
1226
|
+
export interface KVNamespaceListOptions {
|
|
1227
|
+
limit?: number;
|
|
1228
|
+
prefix?: string | null;
|
|
1229
|
+
cursor?: string | null;
|
|
1230
|
+
}
|
|
1231
|
+
export interface KVNamespaceGetOptions<Type> {
|
|
1232
|
+
type: Type;
|
|
1233
|
+
cacheTtl?: number;
|
|
1234
|
+
}
|
|
1235
|
+
export interface KVNamespacePutOptions {
|
|
1236
|
+
expiration?: number;
|
|
1237
|
+
expirationTtl?: number;
|
|
1238
|
+
metadata?: any | null;
|
|
1239
|
+
}
|
|
1240
|
+
export interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
|
|
1241
|
+
value: Value | null;
|
|
1242
|
+
metadata: Metadata | null;
|
|
1243
|
+
cacheStatus: string | null;
|
|
1244
|
+
}
|
|
1245
|
+
export type QueueContentType = "text" | "bytes" | "json" | "v8";
|
|
1246
|
+
export interface Queue<Body = unknown> {
|
|
1247
|
+
send(message: Body, options?: QueueSendOptions): Promise<void>;
|
|
1248
|
+
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
1249
|
+
}
|
|
1250
|
+
export interface QueueSendOptions {
|
|
1251
|
+
contentType?: QueueContentType;
|
|
1252
|
+
}
|
|
1253
|
+
export interface MessageSendRequest<Body = unknown> {
|
|
1254
|
+
body: Body;
|
|
1255
|
+
contentType?: QueueContentType;
|
|
1256
|
+
}
|
|
1257
|
+
export interface Message<Body = unknown> {
|
|
1258
|
+
readonly id: string;
|
|
1259
|
+
readonly timestamp: Date;
|
|
1260
|
+
readonly body: Body;
|
|
1261
|
+
retry(): void;
|
|
1262
|
+
ack(): void;
|
|
1263
|
+
}
|
|
1264
|
+
export interface QueueEvent<Body = unknown> extends ExtendableEvent {
|
|
1265
|
+
readonly messages: readonly Message<Body>[];
|
|
1266
|
+
readonly queue: string;
|
|
1267
|
+
retryAll(): void;
|
|
1268
|
+
ackAll(): void;
|
|
1269
|
+
}
|
|
1270
|
+
export interface MessageBatch<Body = unknown> {
|
|
1271
|
+
readonly messages: readonly Message<Body>[];
|
|
1272
|
+
readonly queue: string;
|
|
1273
|
+
retryAll(): void;
|
|
1274
|
+
ackAll(): void;
|
|
1275
|
+
}
|
|
1276
|
+
export interface R2Error extends Error {
|
|
1277
|
+
readonly name: string;
|
|
1278
|
+
readonly code: number;
|
|
1279
|
+
readonly message: string;
|
|
1280
|
+
readonly action: string;
|
|
1281
|
+
readonly stack: any;
|
|
1282
|
+
}
|
|
1283
|
+
export interface R2ListOptions {
|
|
1284
|
+
limit?: number;
|
|
1285
|
+
prefix?: string;
|
|
1286
|
+
cursor?: string;
|
|
1287
|
+
delimiter?: string;
|
|
1288
|
+
startAfter?: string;
|
|
1289
|
+
}
|
|
1290
|
+
export declare abstract class R2Bucket {
|
|
1291
|
+
head(key: string): Promise<R2Object | null>;
|
|
1292
|
+
get(
|
|
1293
|
+
key: string,
|
|
1294
|
+
options: R2GetOptions & {
|
|
1295
|
+
onlyIf: R2Conditional | Headers;
|
|
1296
|
+
}
|
|
1297
|
+
): Promise<R2ObjectBody | R2Object | null>;
|
|
1298
|
+
get(key: string, options?: R2GetOptions): Promise<R2ObjectBody | null>;
|
|
1299
|
+
put(
|
|
1300
|
+
key: string,
|
|
1301
|
+
value:
|
|
1302
|
+
| ReadableStream
|
|
1303
|
+
| ArrayBuffer
|
|
1304
|
+
| ArrayBufferView
|
|
1305
|
+
| string
|
|
1306
|
+
| null
|
|
1307
|
+
| Blob,
|
|
1308
|
+
options?: R2PutOptions & {
|
|
1309
|
+
onlyIf: R2Conditional | Headers;
|
|
1310
|
+
}
|
|
1311
|
+
): Promise<R2Object | null>;
|
|
1312
|
+
put(
|
|
1313
|
+
key: string,
|
|
1314
|
+
value:
|
|
1315
|
+
| ReadableStream
|
|
1316
|
+
| ArrayBuffer
|
|
1317
|
+
| ArrayBufferView
|
|
1318
|
+
| string
|
|
1319
|
+
| null
|
|
1320
|
+
| Blob,
|
|
1321
|
+
options?: R2PutOptions
|
|
1322
|
+
): Promise<R2Object>;
|
|
1323
|
+
createMultipartUpload(
|
|
1324
|
+
key: string,
|
|
1325
|
+
options?: R2MultipartOptions
|
|
1326
|
+
): Promise<R2MultipartUpload>;
|
|
1327
|
+
resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload;
|
|
1328
|
+
delete(keys: string | string[]): Promise<void>;
|
|
1329
|
+
list(options?: R2ListOptions): Promise<R2Objects>;
|
|
1330
|
+
}
|
|
1331
|
+
export interface R2MultipartUpload {
|
|
1332
|
+
readonly key: string;
|
|
1333
|
+
readonly uploadId: string;
|
|
1334
|
+
uploadPart(
|
|
1335
|
+
partNumber: number,
|
|
1336
|
+
value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob
|
|
1337
|
+
): Promise<R2UploadedPart>;
|
|
1338
|
+
abort(): Promise<void>;
|
|
1339
|
+
complete(uploadedParts: R2UploadedPart[]): Promise<R2Object>;
|
|
1340
|
+
}
|
|
1341
|
+
export interface R2UploadedPart {
|
|
1342
|
+
partNumber: number;
|
|
1343
|
+
etag: string;
|
|
1344
|
+
}
|
|
1345
|
+
export declare abstract class R2Object {
|
|
1346
|
+
readonly key: string;
|
|
1347
|
+
readonly version: string;
|
|
1348
|
+
readonly size: number;
|
|
1349
|
+
readonly etag: string;
|
|
1350
|
+
readonly httpEtag: string;
|
|
1351
|
+
readonly checksums: R2Checksums;
|
|
1352
|
+
readonly uploaded: Date;
|
|
1353
|
+
readonly httpMetadata?: R2HTTPMetadata;
|
|
1354
|
+
readonly customMetadata?: Record<string, string>;
|
|
1355
|
+
readonly range?: R2Range;
|
|
1356
|
+
writeHttpMetadata(headers: Headers): void;
|
|
1357
|
+
}
|
|
1358
|
+
export interface R2ObjectBody extends R2Object {
|
|
1359
|
+
get body(): ReadableStream;
|
|
1360
|
+
get bodyUsed(): boolean;
|
|
1361
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
1362
|
+
text(): Promise<string>;
|
|
1363
|
+
json<T>(): Promise<T>;
|
|
1364
|
+
blob(): Promise<Blob>;
|
|
1365
|
+
}
|
|
1366
|
+
export type R2Range =
|
|
1367
|
+
| {
|
|
1368
|
+
offset: number;
|
|
1369
|
+
length?: number;
|
|
1370
|
+
}
|
|
1371
|
+
| {
|
|
1372
|
+
offset?: number;
|
|
1373
|
+
length: number;
|
|
1374
|
+
}
|
|
1375
|
+
| {
|
|
1376
|
+
suffix: number;
|
|
1377
|
+
};
|
|
1378
|
+
export interface R2Conditional {
|
|
1379
|
+
etagMatches?: string;
|
|
1380
|
+
etagDoesNotMatch?: string;
|
|
1381
|
+
uploadedBefore?: Date;
|
|
1382
|
+
uploadedAfter?: Date;
|
|
1383
|
+
secondsGranularity?: boolean;
|
|
1384
|
+
}
|
|
1385
|
+
export interface R2GetOptions {
|
|
1386
|
+
onlyIf?: R2Conditional | Headers;
|
|
1387
|
+
range?: R2Range | Headers;
|
|
1388
|
+
}
|
|
1389
|
+
export interface R2PutOptions {
|
|
1390
|
+
onlyIf?: R2Conditional | Headers;
|
|
1391
|
+
httpMetadata?: R2HTTPMetadata | Headers;
|
|
1392
|
+
customMetadata?: Record<string, string>;
|
|
1393
|
+
md5?: ArrayBuffer | string;
|
|
1394
|
+
sha1?: ArrayBuffer | string;
|
|
1395
|
+
sha256?: ArrayBuffer | string;
|
|
1396
|
+
sha384?: ArrayBuffer | string;
|
|
1397
|
+
sha512?: ArrayBuffer | string;
|
|
1398
|
+
}
|
|
1399
|
+
export interface R2MultipartOptions {
|
|
1400
|
+
httpMetadata?: R2HTTPMetadata | Headers;
|
|
1401
|
+
customMetadata?: Record<string, string>;
|
|
1402
|
+
}
|
|
1403
|
+
export interface R2Checksums {
|
|
1404
|
+
readonly md5?: ArrayBuffer;
|
|
1405
|
+
readonly sha1?: ArrayBuffer;
|
|
1406
|
+
readonly sha256?: ArrayBuffer;
|
|
1407
|
+
readonly sha384?: ArrayBuffer;
|
|
1408
|
+
readonly sha512?: ArrayBuffer;
|
|
1409
|
+
toJSON(): R2StringChecksums;
|
|
1410
|
+
}
|
|
1411
|
+
export interface R2StringChecksums {
|
|
1412
|
+
md5?: string;
|
|
1413
|
+
sha1?: string;
|
|
1414
|
+
sha256?: string;
|
|
1415
|
+
sha384?: string;
|
|
1416
|
+
sha512?: string;
|
|
1417
|
+
}
|
|
1418
|
+
export interface R2HTTPMetadata {
|
|
1419
|
+
contentType?: string;
|
|
1420
|
+
contentLanguage?: string;
|
|
1421
|
+
contentDisposition?: string;
|
|
1422
|
+
contentEncoding?: string;
|
|
1423
|
+
cacheControl?: string;
|
|
1424
|
+
cacheExpiry?: Date;
|
|
1425
|
+
}
|
|
1426
|
+
export type R2Objects = {
|
|
1427
|
+
objects: R2Object[];
|
|
1428
|
+
delimitedPrefixes: string[];
|
|
1429
|
+
} & (
|
|
1430
|
+
| {
|
|
1431
|
+
truncated: true;
|
|
1432
|
+
cursor: string;
|
|
1433
|
+
}
|
|
1434
|
+
| {
|
|
1435
|
+
truncated: false;
|
|
1436
|
+
}
|
|
1437
|
+
);
|
|
1438
|
+
export declare abstract class ScheduledEvent extends ExtendableEvent {
|
|
1439
|
+
readonly scheduledTime: number;
|
|
1440
|
+
readonly cron: string;
|
|
1441
|
+
noRetry(): void;
|
|
1442
|
+
}
|
|
1443
|
+
export interface ScheduledController {
|
|
1444
|
+
readonly scheduledTime: number;
|
|
1445
|
+
readonly cron: string;
|
|
1446
|
+
noRetry(): void;
|
|
1447
|
+
}
|
|
1448
|
+
export interface QueuingStrategy<T = any> {
|
|
1449
|
+
highWaterMark?: number | bigint;
|
|
1450
|
+
size?: (chunk: T) => number | bigint;
|
|
1451
|
+
}
|
|
1452
|
+
export interface UnderlyingSink<W = any> {
|
|
1453
|
+
type?: string;
|
|
1454
|
+
start?: (controller: WritableStreamDefaultController) => void | Promise<void>;
|
|
1455
|
+
write?: (
|
|
1456
|
+
chunk: W,
|
|
1457
|
+
controller: WritableStreamDefaultController
|
|
1458
|
+
) => void | Promise<void>;
|
|
1459
|
+
abort?: (reason: any) => void | Promise<void>;
|
|
1460
|
+
close?: () => void | Promise<void>;
|
|
1461
|
+
}
|
|
1462
|
+
export interface UnderlyingByteSource {
|
|
1463
|
+
type: "bytes";
|
|
1464
|
+
autoAllocateChunkSize?: number;
|
|
1465
|
+
start?: (controller: ReadableByteStreamController) => void | Promise<void>;
|
|
1466
|
+
pull?: (controller: ReadableByteStreamController) => void | Promise<void>;
|
|
1467
|
+
cancel?: (reason: any) => void | Promise<void>;
|
|
1468
|
+
}
|
|
1469
|
+
export interface UnderlyingSource<R = any> {
|
|
1470
|
+
type?: "" | undefined;
|
|
1471
|
+
start?: (
|
|
1472
|
+
controller: ReadableStreamDefaultController<R>
|
|
1473
|
+
) => void | Promise<void>;
|
|
1474
|
+
pull?: (
|
|
1475
|
+
controller: ReadableStreamDefaultController<R>
|
|
1476
|
+
) => void | Promise<void>;
|
|
1477
|
+
cancel?: (reason: any) => void | Promise<void>;
|
|
1478
|
+
}
|
|
1479
|
+
export interface Transformer<I = any, O = any> {
|
|
1480
|
+
readableType?: string;
|
|
1481
|
+
writableType?: string;
|
|
1482
|
+
start?: (
|
|
1483
|
+
controller: TransformStreamDefaultController<O>
|
|
1484
|
+
) => void | Promise<void>;
|
|
1485
|
+
transform?: (
|
|
1486
|
+
chunk: I,
|
|
1487
|
+
controller: TransformStreamDefaultController<O>
|
|
1488
|
+
) => void | Promise<void>;
|
|
1489
|
+
flush?: (
|
|
1490
|
+
controller: TransformStreamDefaultController<O>
|
|
1491
|
+
) => void | Promise<void>;
|
|
1492
|
+
}
|
|
1493
|
+
export interface StreamPipeOptions {
|
|
1494
|
+
/**
|
|
1495
|
+
* Pipes this readable stream to a given writable stream destination. The way in which the piping process behaves under various error conditions can be customized with a number of passed options. It returns a promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered.
|
|
1496
|
+
*
|
|
1497
|
+
* Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.
|
|
1498
|
+
*
|
|
1499
|
+
* Errors and closures of the source and destination streams propagate as follows:
|
|
1500
|
+
*
|
|
1501
|
+
* An error in this source readable stream will abort destination, unless preventAbort is truthy. The returned promise will be rejected with the source's error, or with any error that occurs during aborting the destination.
|
|
1502
|
+
*
|
|
1503
|
+
* An error in destination will cancel this source readable stream, unless preventCancel is truthy. The returned promise will be rejected with the destination's error, or with any error that occurs during canceling the source.
|
|
1504
|
+
*
|
|
1505
|
+
* When this source readable stream closes, destination will be closed, unless preventClose is truthy. The returned promise will be fulfilled once this process completes, unless an error is encountered while closing the destination, in which case it will be rejected with that error.
|
|
1506
|
+
*
|
|
1507
|
+
* If destination starts out closed or closing, this source readable stream will be canceled, unless preventCancel is true. The returned promise will be rejected with an error indicating piping to a closed stream failed, or with any error that occurs during canceling the source.
|
|
1508
|
+
*
|
|
1509
|
+
* The signal option can be set to an AbortSignal to allow aborting an ongoing pipe operation via the corresponding AbortController. In this case, this source readable stream will be canceled, and destination aborted, unless the respective options preventCancel or preventAbort are set.
|
|
1510
|
+
*/
|
|
1511
|
+
preventClose?: boolean;
|
|
1512
|
+
preventAbort?: boolean;
|
|
1513
|
+
preventCancel?: boolean;
|
|
1514
|
+
signal?: AbortSignal;
|
|
1515
|
+
}
|
|
1516
|
+
export type ReadableStreamReadResult<R = any> =
|
|
1517
|
+
| {
|
|
1518
|
+
done: false;
|
|
1519
|
+
value: R;
|
|
1520
|
+
}
|
|
1521
|
+
| {
|
|
1522
|
+
done: true;
|
|
1523
|
+
value?: undefined;
|
|
1524
|
+
};
|
|
1525
|
+
/** 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. */
|
|
1526
|
+
export interface ReadableStream<R = any> {
|
|
1527
|
+
readonly locked: boolean;
|
|
1528
|
+
cancel(reason?: any): Promise<void>;
|
|
1529
|
+
getReader(): ReadableStreamDefaultReader<R>;
|
|
1530
|
+
getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader;
|
|
1531
|
+
pipeThrough<T>(
|
|
1532
|
+
transform: ReadableWritablePair<T, R>,
|
|
1533
|
+
options?: StreamPipeOptions
|
|
1534
|
+
): ReadableStream<T>;
|
|
1535
|
+
pipeTo(
|
|
1536
|
+
destination: WritableStream<R>,
|
|
1537
|
+
options?: StreamPipeOptions
|
|
1538
|
+
): Promise<void>;
|
|
1539
|
+
tee(): [ReadableStream<R>, ReadableStream<R>];
|
|
1540
|
+
values(options?: ReadableStreamValuesOptions): AsyncIterableIterator<R>;
|
|
1541
|
+
[Symbol.asyncIterator](
|
|
1542
|
+
options?: ReadableStreamValuesOptions
|
|
1543
|
+
): AsyncIterableIterator<R>;
|
|
1544
|
+
}
|
|
1545
|
+
export declare const ReadableStream: {
|
|
1546
|
+
prototype: ReadableStream;
|
|
1547
|
+
new (
|
|
1548
|
+
underlyingSource: UnderlyingByteSource,
|
|
1549
|
+
strategy?: QueuingStrategy<Uint8Array>
|
|
1550
|
+
): ReadableStream<Uint8Array>;
|
|
1551
|
+
new <R = any>(
|
|
1552
|
+
underlyingSource?: UnderlyingSource<R>,
|
|
1553
|
+
strategy?: QueuingStrategy<R>
|
|
1554
|
+
): ReadableStream<R>;
|
|
1555
|
+
};
|
|
1556
|
+
export declare class ReadableStreamDefaultReader<R = any> {
|
|
1557
|
+
constructor(stream: ReadableStream);
|
|
1558
|
+
readonly closed: Promise<void>;
|
|
1559
|
+
cancel(reason?: any): Promise<void>;
|
|
1560
|
+
read(): Promise<ReadableStreamReadResult<R>>;
|
|
1561
|
+
releaseLock(): void;
|
|
1562
|
+
}
|
|
1563
|
+
export declare class ReadableStreamBYOBReader {
|
|
1564
|
+
constructor(stream: ReadableStream);
|
|
1565
|
+
readonly closed: Promise<void>;
|
|
1566
|
+
cancel(reason?: any): Promise<void>;
|
|
1567
|
+
read<T extends ArrayBufferView>(
|
|
1568
|
+
view: T
|
|
1569
|
+
): Promise<ReadableStreamReadResult<T>>;
|
|
1570
|
+
releaseLock(): void;
|
|
1571
|
+
readAtLeast<T extends ArrayBufferView>(
|
|
1572
|
+
minElements: number,
|
|
1573
|
+
view: T
|
|
1574
|
+
): Promise<ReadableStreamReadResult<T>>;
|
|
1575
|
+
}
|
|
1576
|
+
export interface ReadableStreamGetReaderOptions {
|
|
1577
|
+
mode: "byob";
|
|
1578
|
+
}
|
|
1579
|
+
export interface ReadableStreamBYOBRequest {
|
|
1580
|
+
readonly view: Uint8Array | null;
|
|
1581
|
+
respond(bytesWritten: number): void;
|
|
1582
|
+
respondWithNewView(view: ArrayBuffer | ArrayBufferView): void;
|
|
1583
|
+
readonly atLeast: number | null;
|
|
1584
|
+
}
|
|
1585
|
+
export interface ReadableStreamDefaultController<R = any> {
|
|
1586
|
+
readonly desiredSize: number | null;
|
|
1587
|
+
close(): void;
|
|
1588
|
+
enqueue(chunk?: R): void;
|
|
1589
|
+
error(reason: any): void;
|
|
1590
|
+
}
|
|
1591
|
+
export interface ReadableByteStreamController {
|
|
1592
|
+
readonly byobRequest: ReadableStreamBYOBRequest | null;
|
|
1593
|
+
readonly desiredSize: number | null;
|
|
1594
|
+
close(): void;
|
|
1595
|
+
enqueue(chunk: ArrayBuffer | ArrayBufferView): void;
|
|
1596
|
+
error(reason: any): void;
|
|
1597
|
+
}
|
|
1598
|
+
/** 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. */
|
|
1599
|
+
export interface WritableStreamDefaultController {
|
|
1600
|
+
readonly signal: AbortSignal;
|
|
1601
|
+
error(reason?: any): void;
|
|
1602
|
+
}
|
|
1603
|
+
export interface TransformStreamDefaultController<O = any> {
|
|
1604
|
+
get desiredSize(): number | null;
|
|
1605
|
+
enqueue(chunk?: O): void;
|
|
1606
|
+
error(reason: any): void;
|
|
1607
|
+
terminate(): void;
|
|
1608
|
+
}
|
|
1609
|
+
export interface ReadableWritablePair<R = any, W = any> {
|
|
1610
|
+
/**
|
|
1611
|
+
* Provides a convenient, chainable way of piping this readable stream through a transform stream (or any other { writable, readable } pair). It simply pipes the stream into the writable side of the supplied pair, and returns the readable side for further use.
|
|
1612
|
+
*
|
|
1613
|
+
* Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.
|
|
1614
|
+
*/
|
|
1615
|
+
writable: WritableStream<W>;
|
|
1616
|
+
readable: ReadableStream<R>;
|
|
1617
|
+
}
|
|
1618
|
+
export declare class WritableStream<W = any> {
|
|
1619
|
+
constructor(
|
|
1620
|
+
underlyingSink?: UnderlyingSink,
|
|
1621
|
+
queuingStrategy?: QueuingStrategy
|
|
1622
|
+
);
|
|
1623
|
+
readonly locked: boolean;
|
|
1624
|
+
abort(reason?: any): Promise<void>;
|
|
1625
|
+
close(): Promise<void>;
|
|
1626
|
+
getWriter(): WritableStreamDefaultWriter<W>;
|
|
1627
|
+
}
|
|
1628
|
+
export declare class WritableStreamDefaultWriter<W = any> {
|
|
1629
|
+
constructor(stream: WritableStream);
|
|
1630
|
+
readonly closed: Promise<void>;
|
|
1631
|
+
readonly ready: Promise<void>;
|
|
1632
|
+
readonly desiredSize: number | null;
|
|
1633
|
+
abort(reason?: any): Promise<void>;
|
|
1634
|
+
close(): Promise<void>;
|
|
1635
|
+
write(chunk?: W): Promise<void>;
|
|
1636
|
+
releaseLock(): void;
|
|
1637
|
+
}
|
|
1638
|
+
export declare class TransformStream<I = any, O = any> {
|
|
1639
|
+
constructor(
|
|
1640
|
+
transformer?: Transformer<I, O>,
|
|
1641
|
+
writableStrategy?: QueuingStrategy<I>,
|
|
1642
|
+
readableStrategy?: QueuingStrategy<O>
|
|
1643
|
+
);
|
|
1644
|
+
readonly readable: ReadableStream<O>;
|
|
1645
|
+
readonly writable: WritableStream<I>;
|
|
1646
|
+
}
|
|
1647
|
+
export declare class FixedLengthStream extends IdentityTransformStream {
|
|
1648
|
+
constructor(
|
|
1649
|
+
expectedLength: number | bigint,
|
|
1650
|
+
queuingStrategy?: IdentityTransformStreamQueuingStrategy
|
|
1651
|
+
);
|
|
1652
|
+
}
|
|
1653
|
+
export declare class IdentityTransformStream extends TransformStream<
|
|
1654
|
+
ArrayBuffer | ArrayBufferView,
|
|
1655
|
+
Uint8Array
|
|
1656
|
+
> {
|
|
1657
|
+
constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);
|
|
1658
|
+
}
|
|
1659
|
+
export interface IdentityTransformStreamQueuingStrategy {
|
|
1660
|
+
highWaterMark?: number | bigint;
|
|
1661
|
+
}
|
|
1662
|
+
export interface ReadableStreamValuesOptions {
|
|
1663
|
+
preventCancel?: boolean;
|
|
1664
|
+
}
|
|
1665
|
+
export declare class CompressionStream extends TransformStream<
|
|
1666
|
+
ArrayBuffer | ArrayBufferView,
|
|
1667
|
+
Uint8Array
|
|
1668
|
+
> {
|
|
1669
|
+
constructor(format: "gzip" | "deflate" | "deflate-raw");
|
|
1670
|
+
}
|
|
1671
|
+
export declare class DecompressionStream extends TransformStream<
|
|
1672
|
+
ArrayBuffer | ArrayBufferView,
|
|
1673
|
+
Uint8Array
|
|
1674
|
+
> {
|
|
1675
|
+
constructor(format: "gzip" | "deflate" | "deflate-raw");
|
|
1676
|
+
}
|
|
1677
|
+
export declare class TextEncoderStream extends TransformStream<
|
|
1678
|
+
string,
|
|
1679
|
+
Uint8Array
|
|
1680
|
+
> {
|
|
1681
|
+
constructor();
|
|
1682
|
+
}
|
|
1683
|
+
export declare class TextDecoderStream extends TransformStream<
|
|
1684
|
+
ArrayBuffer | ArrayBufferView,
|
|
1685
|
+
string
|
|
1686
|
+
> {
|
|
1687
|
+
constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit);
|
|
1688
|
+
}
|
|
1689
|
+
export interface TextDecoderStreamTextDecoderStreamInit {
|
|
1690
|
+
fatal?: boolean;
|
|
1691
|
+
}
|
|
1692
|
+
export declare class ByteLengthQueuingStrategy
|
|
1693
|
+
implements QueuingStrategy<ArrayBufferView>
|
|
1694
|
+
{
|
|
1695
|
+
constructor(init: QueuingStrategyInit);
|
|
1696
|
+
get highWaterMark(): number;
|
|
1697
|
+
get size(): (chunk?: any) => number;
|
|
1698
|
+
}
|
|
1699
|
+
export declare class CountQueuingStrategy implements QueuingStrategy {
|
|
1700
|
+
constructor(init: QueuingStrategyInit);
|
|
1701
|
+
get highWaterMark(): number;
|
|
1702
|
+
get size(): (chunk?: any) => number;
|
|
1703
|
+
}
|
|
1704
|
+
export interface QueuingStrategyInit {
|
|
1705
|
+
/**
|
|
1706
|
+
* Creates a new ByteLengthQueuingStrategy with the provided high water mark.
|
|
1707
|
+
*
|
|
1708
|
+
* Note that the provided high water mark will not be validated ahead of time. Instead, if it is negative, NaN, or not a number, the resulting ByteLengthQueuingStrategy will cause the corresponding stream constructor to throw.
|
|
1709
|
+
*/
|
|
1710
|
+
highWaterMark: number;
|
|
1711
|
+
}
|
|
1712
|
+
export declare abstract class TailEvent extends ExtendableEvent {
|
|
1713
|
+
readonly events: TraceItem[];
|
|
1714
|
+
readonly traces: TraceItem[];
|
|
1715
|
+
}
|
|
1716
|
+
export interface TraceItem {
|
|
1717
|
+
readonly event:
|
|
1718
|
+
| (
|
|
1719
|
+
| TraceItemFetchEventInfo
|
|
1720
|
+
| TraceItemScheduledEventInfo
|
|
1721
|
+
| TraceItemAlarmEventInfo
|
|
1722
|
+
| TraceItemQueueEventInfo
|
|
1723
|
+
| TraceItemEmailEventInfo
|
|
1724
|
+
| TraceItemTailEventInfo
|
|
1725
|
+
| TraceItemCustomEventInfo
|
|
1726
|
+
)
|
|
1727
|
+
| null;
|
|
1728
|
+
readonly eventTimestamp: number | null;
|
|
1729
|
+
readonly logs: TraceLog[];
|
|
1730
|
+
readonly exceptions: TraceException[];
|
|
1731
|
+
readonly diagnosticsChannelEvents: TraceDiagnosticChannelEvent[];
|
|
1732
|
+
readonly scriptName: string | null;
|
|
1733
|
+
readonly dispatchNamespace?: string;
|
|
1734
|
+
readonly scriptTags?: string[];
|
|
1735
|
+
readonly outcome: string;
|
|
1736
|
+
}
|
|
1737
|
+
export interface TraceItemAlarmEventInfo {
|
|
1738
|
+
readonly scheduledTime: Date;
|
|
1739
|
+
}
|
|
1740
|
+
export interface TraceItemCustomEventInfo {}
|
|
1741
|
+
export interface TraceItemScheduledEventInfo {
|
|
1742
|
+
readonly scheduledTime: number;
|
|
1743
|
+
readonly cron: string;
|
|
1744
|
+
}
|
|
1745
|
+
export interface TraceItemQueueEventInfo {
|
|
1746
|
+
readonly queue: string;
|
|
1747
|
+
readonly batchSize: number;
|
|
1748
|
+
}
|
|
1749
|
+
export interface TraceItemEmailEventInfo {
|
|
1750
|
+
readonly mailFrom: string;
|
|
1751
|
+
readonly rcptTo: string;
|
|
1752
|
+
readonly rawSize: number;
|
|
1753
|
+
}
|
|
1754
|
+
export interface TraceItemTailEventInfo {
|
|
1755
|
+
readonly consumedEvents: TraceItemTailEventInfoTailItem[];
|
|
1756
|
+
}
|
|
1757
|
+
export interface TraceItemTailEventInfoTailItem {
|
|
1758
|
+
readonly scriptName: string | null;
|
|
1759
|
+
}
|
|
1760
|
+
export interface TraceItemFetchEventInfo {
|
|
1761
|
+
readonly response?: TraceItemFetchEventInfoResponse;
|
|
1762
|
+
readonly request: TraceItemFetchEventInfoRequest;
|
|
1763
|
+
}
|
|
1764
|
+
export interface TraceItemFetchEventInfoRequest {
|
|
1765
|
+
readonly cf?: any;
|
|
1766
|
+
readonly headers: Record<string, string>;
|
|
1767
|
+
readonly method: string;
|
|
1768
|
+
readonly url: string;
|
|
1769
|
+
getUnredacted(): TraceItemFetchEventInfoRequest;
|
|
1770
|
+
}
|
|
1771
|
+
export interface TraceItemFetchEventInfoResponse {
|
|
1772
|
+
readonly status: number;
|
|
1773
|
+
}
|
|
1774
|
+
export interface TraceLog {
|
|
1775
|
+
readonly timestamp: number;
|
|
1776
|
+
readonly level: string;
|
|
1777
|
+
readonly message: any;
|
|
1778
|
+
}
|
|
1779
|
+
export interface TraceException {
|
|
1780
|
+
readonly timestamp: number;
|
|
1781
|
+
readonly message: string;
|
|
1782
|
+
readonly name: string;
|
|
1783
|
+
}
|
|
1784
|
+
export interface TraceDiagnosticChannelEvent {
|
|
1785
|
+
readonly timestamp: number;
|
|
1786
|
+
readonly channel: string;
|
|
1787
|
+
readonly message: any;
|
|
1788
|
+
}
|
|
1789
|
+
export interface TraceMetrics {
|
|
1790
|
+
readonly cpuTime: number;
|
|
1791
|
+
readonly wallTime: number;
|
|
1792
|
+
}
|
|
1793
|
+
export interface UnsafeTraceMetrics {
|
|
1794
|
+
fromTrace(item: TraceItem): TraceMetrics;
|
|
1795
|
+
}
|
|
1796
|
+
export declare class URL {
|
|
1797
|
+
constructor(url: string | URL, base?: string | URL);
|
|
1798
|
+
href: string;
|
|
1799
|
+
readonly origin: string;
|
|
1800
|
+
protocol: string;
|
|
1801
|
+
username: string;
|
|
1802
|
+
password: string;
|
|
1803
|
+
host: string;
|
|
1804
|
+
hostname: string;
|
|
1805
|
+
port: string;
|
|
1806
|
+
pathname: string;
|
|
1807
|
+
search: string;
|
|
1808
|
+
readonly searchParams: URLSearchParams;
|
|
1809
|
+
hash: string;
|
|
1810
|
+
toString(): string;
|
|
1811
|
+
toJSON(): string;
|
|
1812
|
+
}
|
|
1813
|
+
export declare class URLSearchParams {
|
|
1814
|
+
constructor(
|
|
1815
|
+
init?:
|
|
1816
|
+
| URLSearchParams
|
|
1817
|
+
| string
|
|
1818
|
+
| Record<string, string>
|
|
1819
|
+
| [key: string, value: string][]
|
|
1820
|
+
);
|
|
1821
|
+
get size(): number;
|
|
1822
|
+
append(name: string, value: string): void;
|
|
1823
|
+
delete(name: string): void;
|
|
1824
|
+
get(name: string): string | null;
|
|
1825
|
+
getAll(name: string): string[];
|
|
1826
|
+
has(name: string): boolean;
|
|
1827
|
+
set(name: string, value: string): void;
|
|
1828
|
+
sort(): void;
|
|
1829
|
+
entries(): IterableIterator<[key: string, value: string]>;
|
|
1830
|
+
keys(): IterableIterator<string>;
|
|
1831
|
+
values(): IterableIterator<string>;
|
|
1832
|
+
forEach<This = unknown>(
|
|
1833
|
+
callback: (
|
|
1834
|
+
this: This,
|
|
1835
|
+
value: string,
|
|
1836
|
+
key: string,
|
|
1837
|
+
parent: URLSearchParams
|
|
1838
|
+
) => void,
|
|
1839
|
+
thisArg?: This
|
|
1840
|
+
): void;
|
|
1841
|
+
toString(): string;
|
|
1842
|
+
[Symbol.iterator](): IterableIterator<[key: string, value: string]>;
|
|
1843
|
+
}
|
|
1844
|
+
export declare class URLPattern {
|
|
1845
|
+
constructor(input?: string | URLPatternURLPatternInit, baseURL?: string);
|
|
1846
|
+
get protocol(): string;
|
|
1847
|
+
get username(): string;
|
|
1848
|
+
get password(): string;
|
|
1849
|
+
get hostname(): string;
|
|
1850
|
+
get port(): string;
|
|
1851
|
+
get pathname(): string;
|
|
1852
|
+
get search(): string;
|
|
1853
|
+
get hash(): string;
|
|
1854
|
+
test(input?: string | URLPatternURLPatternInit, baseURL?: string): boolean;
|
|
1855
|
+
exec(
|
|
1856
|
+
input?: string | URLPatternURLPatternInit,
|
|
1857
|
+
baseURL?: string
|
|
1858
|
+
): URLPatternURLPatternResult | null;
|
|
1859
|
+
}
|
|
1860
|
+
export interface URLPatternURLPatternInit {
|
|
1861
|
+
protocol?: string;
|
|
1862
|
+
username?: string;
|
|
1863
|
+
password?: string;
|
|
1864
|
+
hostname?: string;
|
|
1865
|
+
port?: string;
|
|
1866
|
+
pathname?: string;
|
|
1867
|
+
search?: string;
|
|
1868
|
+
hash?: string;
|
|
1869
|
+
baseURL?: string;
|
|
1870
|
+
}
|
|
1871
|
+
export interface URLPatternURLPatternComponentResult {
|
|
1872
|
+
input: string;
|
|
1873
|
+
groups: Record<string, string>;
|
|
1874
|
+
}
|
|
1875
|
+
export interface URLPatternURLPatternResult {
|
|
1876
|
+
inputs: (string | URLPatternURLPatternInit)[];
|
|
1877
|
+
protocol: URLPatternURLPatternComponentResult;
|
|
1878
|
+
username: URLPatternURLPatternComponentResult;
|
|
1879
|
+
password: URLPatternURLPatternComponentResult;
|
|
1880
|
+
hostname: URLPatternURLPatternComponentResult;
|
|
1881
|
+
port: URLPatternURLPatternComponentResult;
|
|
1882
|
+
pathname: URLPatternURLPatternComponentResult;
|
|
1883
|
+
search: URLPatternURLPatternComponentResult;
|
|
1884
|
+
hash: URLPatternURLPatternComponentResult;
|
|
1885
|
+
}
|
|
1886
|
+
export declare class CloseEvent extends Event {
|
|
1887
|
+
constructor(type: string, initializer: CloseEventInit);
|
|
1888
|
+
/** Returns the WebSocket connection close code provided by the server. */
|
|
1889
|
+
readonly code: number;
|
|
1890
|
+
/** Returns the WebSocket connection close reason provided by the server. */
|
|
1891
|
+
readonly reason: string;
|
|
1892
|
+
/** Returns true if the connection closed cleanly; false otherwise. */
|
|
1893
|
+
readonly wasClean: boolean;
|
|
1894
|
+
}
|
|
1895
|
+
export interface CloseEventInit {
|
|
1896
|
+
code?: number;
|
|
1897
|
+
reason?: string;
|
|
1898
|
+
wasClean?: boolean;
|
|
1899
|
+
}
|
|
1900
|
+
export declare class MessageEvent extends Event {
|
|
1901
|
+
constructor(type: string, initializer: MessageEventInit);
|
|
1902
|
+
readonly data: ArrayBuffer | string;
|
|
1903
|
+
}
|
|
1904
|
+
export interface MessageEventInit {
|
|
1905
|
+
data: ArrayBuffer | string;
|
|
1906
|
+
}
|
|
1907
|
+
/** Events providing information related to errors in scripts or in files. */
|
|
1908
|
+
export interface ErrorEvent extends Event {
|
|
1909
|
+
readonly filename: string;
|
|
1910
|
+
readonly message: string;
|
|
1911
|
+
readonly lineno: number;
|
|
1912
|
+
readonly colno: number;
|
|
1913
|
+
readonly error: any;
|
|
1914
|
+
}
|
|
1915
|
+
export type WebSocketEventMap = {
|
|
1916
|
+
close: CloseEvent;
|
|
1917
|
+
message: MessageEvent;
|
|
1918
|
+
open: Event;
|
|
1919
|
+
error: ErrorEvent;
|
|
1920
|
+
};
|
|
1921
|
+
export declare class WebSocket extends EventTarget<WebSocketEventMap> {
|
|
1922
|
+
constructor(url: string, protocols?: string[] | string);
|
|
1923
|
+
accept(): void;
|
|
1924
|
+
send(message: (ArrayBuffer | ArrayBufferView) | string): void;
|
|
1925
|
+
close(code?: number, reason?: string): void;
|
|
1926
|
+
serializeAttachment(attachment: any): void;
|
|
1927
|
+
deserializeAttachment(): any | null;
|
|
1928
|
+
static readonly READY_STATE_CONNECTING: number;
|
|
1929
|
+
static readonly READY_STATE_OPEN: number;
|
|
1930
|
+
static readonly READY_STATE_CLOSING: number;
|
|
1931
|
+
static readonly READY_STATE_CLOSED: number;
|
|
1932
|
+
/** Returns the state of the WebSocket object's connection. It can have the values described below. */
|
|
1933
|
+
readonly readyState: number;
|
|
1934
|
+
/** Returns the URL that was used to establish the WebSocket connection. */
|
|
1935
|
+
readonly url: string | null;
|
|
1936
|
+
/** 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. */
|
|
1937
|
+
readonly protocol: string | null;
|
|
1938
|
+
/** Returns the extensions selected by the server, if any. */
|
|
1939
|
+
readonly extensions: string | null;
|
|
1940
|
+
}
|
|
1941
|
+
export declare const WebSocketPair: {
|
|
1942
|
+
new (): {
|
|
1943
|
+
0: WebSocket;
|
|
1944
|
+
1: WebSocket;
|
|
1945
|
+
};
|
|
1946
|
+
};
|
|
1947
|
+
export interface Socket {
|
|
1948
|
+
get readable(): ReadableStream;
|
|
1949
|
+
get writable(): WritableStream;
|
|
1950
|
+
get closed(): Promise<void>;
|
|
1951
|
+
close(): Promise<void>;
|
|
1952
|
+
startTls(options?: TlsOptions): Socket;
|
|
1953
|
+
}
|
|
1954
|
+
export interface SocketOptions {
|
|
1955
|
+
secureTransport?: string;
|
|
1956
|
+
allowHalfOpen: boolean;
|
|
1957
|
+
}
|
|
1958
|
+
export interface SocketAddress {
|
|
1959
|
+
hostname: string;
|
|
1960
|
+
port: number;
|
|
1961
|
+
}
|
|
1962
|
+
export interface TlsOptions {
|
|
1963
|
+
expectedServerHostname?: string;
|
|
1964
|
+
}
|
|
1965
|
+
export declare abstract class gpuGPUAdapter {
|
|
1966
|
+
requestDevice(param1?: gpuGPUDeviceDescriptor): Promise<gpuGPUDevice>;
|
|
1967
|
+
requestAdapterInfo(unmaskHints?: string[]): Promise<gpuGPUAdapterInfo>;
|
|
1968
|
+
get features(): gpuGPUSupportedFeatures;
|
|
1969
|
+
get limits(): gpuGPUSupportedLimits;
|
|
1970
|
+
}
|
|
1971
|
+
export interface gpuGPUDevice extends EventTarget {
|
|
1972
|
+
createBuffer(param1: gpuGPUBufferDescriptor): gpuGPUBuffer;
|
|
1973
|
+
createBindGroupLayout(
|
|
1974
|
+
descriptor: gpuGPUBindGroupLayoutDescriptor
|
|
1975
|
+
): gpuGPUBindGroupLayout;
|
|
1976
|
+
createBindGroup(descriptor: gpuGPUBindGroupDescriptor): gpuGPUBindGroup;
|
|
1977
|
+
createSampler(descriptor: gpuGPUSamplerDescriptor): gpuGPUSampler;
|
|
1978
|
+
createShaderModule(
|
|
1979
|
+
descriptor: gpuGPUShaderModuleDescriptor
|
|
1980
|
+
): gpuGPUShaderModule;
|
|
1981
|
+
createPipelineLayout(
|
|
1982
|
+
descriptor: gpuGPUPipelineLayoutDescriptor
|
|
1983
|
+
): gpuGPUPipelineLayout;
|
|
1984
|
+
createComputePipeline(
|
|
1985
|
+
descriptor: gpuGPUComputePipelineDescriptor
|
|
1986
|
+
): gpuGPUComputePipeline;
|
|
1987
|
+
createRenderPipeline(
|
|
1988
|
+
descriptor: gpuGPURenderPipelineDescriptor
|
|
1989
|
+
): gpuGPURenderPipeline;
|
|
1990
|
+
createCommandEncoder(
|
|
1991
|
+
descriptor?: gpuGPUCommandEncoderDescriptor
|
|
1992
|
+
): gpuGPUCommandEncoder;
|
|
1993
|
+
createTexture(param1: gpuGPUTextureDescriptor): gpuGPUTexture;
|
|
1994
|
+
destroy(): void;
|
|
1995
|
+
createQuerySet(descriptor: gpuGPUQuerySetDescriptor): gpuGPUQuerySet;
|
|
1996
|
+
pushErrorScope(filter: string): void;
|
|
1997
|
+
popErrorScope(): Promise<gpuGPUError | null>;
|
|
1998
|
+
get queue(): gpuGPUQueue;
|
|
1999
|
+
get lost(): Promise<gpuGPUDeviceLostInfo>;
|
|
2000
|
+
get features(): gpuGPUSupportedFeatures;
|
|
2001
|
+
get limits(): gpuGPUSupportedLimits;
|
|
2002
|
+
}
|
|
2003
|
+
export interface gpuGPUDeviceDescriptor {
|
|
2004
|
+
label?: string;
|
|
2005
|
+
requiredFeatures?: string[];
|
|
2006
|
+
requiredLimits?: Record<string, number | bigint>;
|
|
2007
|
+
defaultQueue?: gpuGPUQueueDescriptor;
|
|
2008
|
+
}
|
|
2009
|
+
export interface gpuGPUBufferDescriptor {
|
|
2010
|
+
label: string;
|
|
2011
|
+
size: number | bigint;
|
|
2012
|
+
usage: number;
|
|
2013
|
+
mappedAtCreation: boolean;
|
|
2014
|
+
}
|
|
2015
|
+
export interface gpuGPUQueueDescriptor {
|
|
2016
|
+
label?: string;
|
|
2017
|
+
}
|
|
2018
|
+
export declare abstract class gpuGPUBufferUsage {
|
|
2019
|
+
static readonly MAP_READ: number;
|
|
2020
|
+
static readonly MAP_WRITE: number;
|
|
2021
|
+
static readonly COPY_SRC: number;
|
|
2022
|
+
static readonly COPY_DST: number;
|
|
2023
|
+
static readonly INDEX: number;
|
|
2024
|
+
static readonly VERTEX: number;
|
|
2025
|
+
static readonly UNIFORM: number;
|
|
2026
|
+
static readonly STORAGE: number;
|
|
2027
|
+
static readonly INDIRECT: number;
|
|
2028
|
+
static readonly QUERY_RESOLVE: number;
|
|
2029
|
+
}
|
|
2030
|
+
export interface gpuGPUBuffer {
|
|
2031
|
+
getMappedRange(size?: number | bigint, param2?: number | bigint): ArrayBuffer;
|
|
2032
|
+
unmap(): void;
|
|
2033
|
+
destroy(): void;
|
|
2034
|
+
mapAsync(
|
|
2035
|
+
mode: number,
|
|
2036
|
+
offset?: number | bigint,
|
|
2037
|
+
size?: number | bigint
|
|
2038
|
+
): Promise<void>;
|
|
2039
|
+
get size(): number | bigint;
|
|
2040
|
+
get usage(): number;
|
|
2041
|
+
get mapState(): string;
|
|
2042
|
+
}
|
|
2043
|
+
export declare abstract class gpuGPUShaderStage {
|
|
2044
|
+
static readonly VERTEX: number;
|
|
2045
|
+
static readonly FRAGMENT: number;
|
|
2046
|
+
static readonly COMPUTE: number;
|
|
2047
|
+
}
|
|
2048
|
+
export interface gpuGPUBindGroupLayoutDescriptor {
|
|
2049
|
+
label?: string;
|
|
2050
|
+
entries: gpuGPUBindGroupLayoutEntry[];
|
|
2051
|
+
}
|
|
2052
|
+
export interface gpuGPUBindGroupLayoutEntry {
|
|
2053
|
+
binding: number;
|
|
2054
|
+
visibility: number;
|
|
2055
|
+
buffer?: gpuGPUBufferBindingLayout;
|
|
2056
|
+
sampler?: gpuGPUSamplerBindingLayout;
|
|
2057
|
+
texture?: gpuGPUTextureBindingLayout;
|
|
2058
|
+
storageTexture?: gpuGPUStorageTextureBindingLayout;
|
|
2059
|
+
}
|
|
2060
|
+
export interface gpuGPUStorageTextureBindingLayout {
|
|
2061
|
+
access?: string;
|
|
2062
|
+
format: string;
|
|
2063
|
+
viewDimension?: string;
|
|
2064
|
+
}
|
|
2065
|
+
export interface gpuGPUTextureBindingLayout {
|
|
2066
|
+
sampleType?: string;
|
|
2067
|
+
viewDimension?: string;
|
|
2068
|
+
multisampled?: boolean;
|
|
2069
|
+
}
|
|
2070
|
+
export interface gpuGPUSamplerBindingLayout {
|
|
2071
|
+
type?: string;
|
|
2072
|
+
}
|
|
2073
|
+
export interface gpuGPUBufferBindingLayout {
|
|
2074
|
+
type?: string;
|
|
2075
|
+
hasDynamicOffset?: boolean;
|
|
2076
|
+
minBindingSize?: number | bigint;
|
|
2077
|
+
}
|
|
2078
|
+
export interface gpuGPUBindGroupLayout {}
|
|
2079
|
+
export interface gpuGPUBindGroup {}
|
|
2080
|
+
export interface gpuGPUBindGroupDescriptor {
|
|
2081
|
+
label?: string;
|
|
2082
|
+
layout: gpuGPUBindGroupLayout;
|
|
2083
|
+
entries: gpuGPUBindGroupEntry[];
|
|
2084
|
+
}
|
|
2085
|
+
export interface gpuGPUBindGroupEntry {
|
|
2086
|
+
binding: number;
|
|
2087
|
+
resource: gpuGPUBufferBinding | gpuGPUSampler;
|
|
2088
|
+
}
|
|
2089
|
+
export interface gpuGPUBufferBinding {
|
|
2090
|
+
buffer: gpuGPUBuffer;
|
|
2091
|
+
offset?: number | bigint;
|
|
2092
|
+
size?: number | bigint;
|
|
2093
|
+
}
|
|
2094
|
+
export interface gpuGPUSampler {}
|
|
2095
|
+
export interface gpuGPUSamplerDescriptor {
|
|
2096
|
+
label?: string;
|
|
2097
|
+
addressModeU?: string;
|
|
2098
|
+
addressModeV?: string;
|
|
2099
|
+
addressModeW?: string;
|
|
2100
|
+
magFilter?: string;
|
|
2101
|
+
minFilter?: string;
|
|
2102
|
+
mipmapFilter?: string;
|
|
2103
|
+
lodMinClamp?: number;
|
|
2104
|
+
lodMaxClamp?: number;
|
|
2105
|
+
compare: string;
|
|
2106
|
+
maxAnisotropy?: number;
|
|
2107
|
+
}
|
|
2108
|
+
export interface gpuGPUShaderModule {
|
|
2109
|
+
getCompilationInfo(): Promise<gpuGPUCompilationInfo>;
|
|
2110
|
+
}
|
|
2111
|
+
export interface gpuGPUShaderModuleDescriptor {
|
|
2112
|
+
label?: string;
|
|
2113
|
+
code: string;
|
|
2114
|
+
}
|
|
2115
|
+
export interface gpuGPUPipelineLayout {}
|
|
2116
|
+
export interface gpuGPUPipelineLayoutDescriptor {
|
|
2117
|
+
label?: string;
|
|
2118
|
+
bindGroupLayouts: gpuGPUBindGroupLayout[];
|
|
2119
|
+
}
|
|
2120
|
+
export interface gpuGPUComputePipeline {
|
|
2121
|
+
getBindGroupLayout(index: number): gpuGPUBindGroupLayout;
|
|
2122
|
+
}
|
|
2123
|
+
export interface gpuGPUComputePipelineDescriptor {
|
|
2124
|
+
label?: string;
|
|
2125
|
+
compute: gpuGPUProgrammableStage;
|
|
2126
|
+
layout: string | gpuGPUPipelineLayout;
|
|
2127
|
+
}
|
|
2128
|
+
export interface gpuGPUProgrammableStage {
|
|
2129
|
+
module: gpuGPUShaderModule;
|
|
2130
|
+
entryPoint: string;
|
|
2131
|
+
constants?: Record<string, number>;
|
|
2132
|
+
}
|
|
2133
|
+
export interface gpuGPUCommandEncoder {
|
|
2134
|
+
get label(): string;
|
|
2135
|
+
beginComputePass(
|
|
2136
|
+
descriptor?: gpuGPUComputePassDescriptor
|
|
2137
|
+
): gpuGPUComputePassEncoder;
|
|
2138
|
+
beginRenderPass(
|
|
2139
|
+
descriptor: gpuGPURenderPassDescriptor
|
|
2140
|
+
): gpuGPURenderPassEncoder;
|
|
2141
|
+
copyBufferToBuffer(
|
|
2142
|
+
source: gpuGPUBuffer,
|
|
2143
|
+
sourceOffset: number | bigint,
|
|
2144
|
+
destination: gpuGPUBuffer,
|
|
2145
|
+
destinationOffset: number | bigint,
|
|
2146
|
+
size: number | bigint
|
|
2147
|
+
): void;
|
|
2148
|
+
finish(param0?: gpuGPUCommandBufferDescriptor): gpuGPUCommandBuffer;
|
|
2149
|
+
}
|
|
2150
|
+
export interface gpuGPUCommandEncoderDescriptor {
|
|
2151
|
+
label?: string;
|
|
2152
|
+
}
|
|
2153
|
+
export interface gpuGPUComputePassEncoder {
|
|
2154
|
+
setPipeline(pipeline: gpuGPUComputePipeline): void;
|
|
2155
|
+
setBindGroup(
|
|
2156
|
+
index: number,
|
|
2157
|
+
bindGroup: gpuGPUBindGroup | null,
|
|
2158
|
+
dynamicOffsets?: Iterable<number>
|
|
2159
|
+
): void;
|
|
2160
|
+
dispatchWorkgroups(
|
|
2161
|
+
workgroupCountX: number,
|
|
2162
|
+
workgroupCountY?: number,
|
|
2163
|
+
workgroupCountZ?: number
|
|
2164
|
+
): void;
|
|
2165
|
+
end(): void;
|
|
2166
|
+
}
|
|
2167
|
+
export interface gpuGPUComputePassDescriptor {
|
|
2168
|
+
label?: string;
|
|
2169
|
+
timestampWrites?: gpuGPUComputePassTimestampWrite[];
|
|
2170
|
+
}
|
|
2171
|
+
export interface gpuGPUQuerySet {}
|
|
2172
|
+
export interface gpuGPUQuerySetDescriptor {
|
|
2173
|
+
label?: string;
|
|
2174
|
+
}
|
|
2175
|
+
export interface gpuGPUComputePassTimestampWrite {
|
|
2176
|
+
querySet: gpuGPUQuerySet;
|
|
2177
|
+
queryIndex: number;
|
|
2178
|
+
location: string;
|
|
2179
|
+
}
|
|
2180
|
+
export interface gpuGPUCommandBufferDescriptor {
|
|
2181
|
+
label?: string;
|
|
2182
|
+
}
|
|
2183
|
+
export interface gpuGPUCommandBuffer {}
|
|
2184
|
+
export interface gpuGPUQueue {
|
|
2185
|
+
submit(commandBuffers: gpuGPUCommandBuffer[]): void;
|
|
2186
|
+
writeBuffer(
|
|
2187
|
+
buffer: gpuGPUBuffer,
|
|
2188
|
+
bufferOffset: number | bigint,
|
|
2189
|
+
data: ArrayBuffer | ArrayBufferView,
|
|
2190
|
+
dataOffset?: number | bigint,
|
|
2191
|
+
size?: number | bigint
|
|
2192
|
+
): void;
|
|
2193
|
+
}
|
|
2194
|
+
export declare abstract class gpuGPUMapMode {
|
|
2195
|
+
static readonly READ: number;
|
|
2196
|
+
static readonly WRITE: number;
|
|
2197
|
+
}
|
|
2198
|
+
export interface gpuGPUAdapterInfo {
|
|
2199
|
+
get vendor(): string;
|
|
2200
|
+
get architecture(): string;
|
|
2201
|
+
get device(): string;
|
|
2202
|
+
get description(): string;
|
|
2203
|
+
}
|
|
2204
|
+
export interface gpuGPUSupportedFeatures {
|
|
2205
|
+
has(name: string): boolean;
|
|
2206
|
+
keys(): string[];
|
|
2207
|
+
}
|
|
2208
|
+
export interface gpuGPUSupportedLimits {
|
|
2209
|
+
get maxTextureDimension1D(): number;
|
|
2210
|
+
get maxTextureDimension2D(): number;
|
|
2211
|
+
get maxTextureDimension3D(): number;
|
|
2212
|
+
get maxTextureArrayLayers(): number;
|
|
2213
|
+
get maxBindGroups(): number;
|
|
2214
|
+
get maxBindingsPerBindGroup(): number;
|
|
2215
|
+
get maxDynamicUniformBuffersPerPipelineLayout(): number;
|
|
2216
|
+
get maxDynamicStorageBuffersPerPipelineLayout(): number;
|
|
2217
|
+
get maxSampledTexturesPerShaderStage(): number;
|
|
2218
|
+
get maxSamplersPerShaderStage(): number;
|
|
2219
|
+
get maxStorageBuffersPerShaderStage(): number;
|
|
2220
|
+
get maxStorageTexturesPerShaderStage(): number;
|
|
2221
|
+
get maxUniformBuffersPerShaderStage(): number;
|
|
2222
|
+
get maxUniformBufferBindingSize(): number | bigint;
|
|
2223
|
+
get maxStorageBufferBindingSize(): number | bigint;
|
|
2224
|
+
get minUniformBufferOffsetAlignment(): number;
|
|
2225
|
+
get minStorageBufferOffsetAlignment(): number;
|
|
2226
|
+
get maxVertexBuffers(): number;
|
|
2227
|
+
get maxBufferSize(): number | bigint;
|
|
2228
|
+
get maxVertexAttributes(): number;
|
|
2229
|
+
get maxVertexBufferArrayStride(): number;
|
|
2230
|
+
get maxInterStageShaderComponents(): number;
|
|
2231
|
+
get maxInterStageShaderVariables(): number;
|
|
2232
|
+
get maxColorAttachments(): number;
|
|
2233
|
+
get maxColorAttachmentBytesPerSample(): number;
|
|
2234
|
+
get maxComputeWorkgroupStorageSize(): number;
|
|
2235
|
+
get maxComputeInvocationsPerWorkgroup(): number;
|
|
2236
|
+
get maxComputeWorkgroupSizeX(): number;
|
|
2237
|
+
get maxComputeWorkgroupSizeY(): number;
|
|
2238
|
+
get maxComputeWorkgroupSizeZ(): number;
|
|
2239
|
+
get maxComputeWorkgroupsPerDimension(): number;
|
|
2240
|
+
}
|
|
2241
|
+
export declare abstract class gpuGPUError {
|
|
2242
|
+
get message(): string;
|
|
2243
|
+
}
|
|
2244
|
+
export declare abstract class gpuGPUOutOfMemoryError extends gpuGPUError {}
|
|
2245
|
+
export declare abstract class gpuGPUInternalError extends gpuGPUError {}
|
|
2246
|
+
export declare abstract class gpuGPUValidationError extends gpuGPUError {}
|
|
2247
|
+
export declare abstract class gpuGPUDeviceLostInfo {
|
|
2248
|
+
get message(): string;
|
|
2249
|
+
get reason(): string;
|
|
2250
|
+
}
|
|
2251
|
+
export interface gpuGPUCompilationMessage {
|
|
2252
|
+
get message(): string;
|
|
2253
|
+
get type(): string;
|
|
2254
|
+
get lineNum(): number;
|
|
2255
|
+
get linePos(): number;
|
|
2256
|
+
get offset(): number;
|
|
2257
|
+
get length(): number;
|
|
2258
|
+
}
|
|
2259
|
+
export interface gpuGPUCompilationInfo {
|
|
2260
|
+
get messages(): gpuGPUCompilationMessage[];
|
|
2261
|
+
}
|
|
2262
|
+
export declare abstract class gpuGPUTextureUsage {
|
|
2263
|
+
static readonly COPY_SRC: number;
|
|
2264
|
+
static readonly COPY_DST: number;
|
|
2265
|
+
static readonly TEXTURE_BINDING: number;
|
|
2266
|
+
static readonly STORAGE_BINDING: number;
|
|
2267
|
+
static readonly RENDER_ATTACHMENT: number;
|
|
2268
|
+
}
|
|
2269
|
+
export interface gpuGPUTextureDescriptor {
|
|
2270
|
+
label: string;
|
|
2271
|
+
size: number[] | gpuGPUExtent3DDict;
|
|
2272
|
+
mipLevelCount?: number;
|
|
2273
|
+
sampleCount?: number;
|
|
2274
|
+
dimension?: string;
|
|
2275
|
+
format: string;
|
|
2276
|
+
usage: number;
|
|
2277
|
+
viewFormats?: string[];
|
|
2278
|
+
}
|
|
2279
|
+
export interface gpuGPUExtent3DDict {
|
|
2280
|
+
width: number;
|
|
2281
|
+
height?: number;
|
|
2282
|
+
depthOrArrayLayers?: number;
|
|
2283
|
+
}
|
|
2284
|
+
export interface gpuGPUTexture {
|
|
2285
|
+
createView(descriptor?: gpuGPUTextureViewDescriptor): gpuGPUTextureView;
|
|
2286
|
+
destroy(): void;
|
|
2287
|
+
get width(): number;
|
|
2288
|
+
get height(): number;
|
|
2289
|
+
get depthOrArrayLayers(): number;
|
|
2290
|
+
get mipLevelCount(): number;
|
|
2291
|
+
get dimension(): string;
|
|
2292
|
+
get format(): string;
|
|
2293
|
+
get usage(): number;
|
|
2294
|
+
}
|
|
2295
|
+
export interface gpuGPUTextureView {}
|
|
2296
|
+
export interface gpuGPUTextureViewDescriptor {
|
|
2297
|
+
label: string;
|
|
2298
|
+
format: string;
|
|
2299
|
+
dimension: string;
|
|
2300
|
+
aspect?: string;
|
|
2301
|
+
baseMipLevel?: number;
|
|
2302
|
+
mipLevelCount: number;
|
|
2303
|
+
baseArrayLayer?: number;
|
|
2304
|
+
arrayLayerCount: number;
|
|
2305
|
+
}
|
|
2306
|
+
export declare abstract class gpuGPUColorWrite {
|
|
2307
|
+
static readonly RED: number;
|
|
2308
|
+
static readonly GREEN: number;
|
|
2309
|
+
static readonly BLUE: number;
|
|
2310
|
+
static readonly ALPHA: number;
|
|
2311
|
+
static readonly ALL: number;
|
|
2312
|
+
}
|
|
2313
|
+
export interface gpuGPURenderPipeline {}
|
|
2314
|
+
export interface gpuGPURenderPipelineDescriptor {
|
|
2315
|
+
label?: string;
|
|
2316
|
+
layout: string | gpuGPUPipelineLayout;
|
|
2317
|
+
vertex: gpuGPUVertexState;
|
|
2318
|
+
primitive?: gpuGPUPrimitiveState;
|
|
2319
|
+
depthStencil?: gpuGPUDepthStencilState;
|
|
2320
|
+
multisample?: gpuGPUMultisampleState;
|
|
2321
|
+
fragment?: gpuGPUFragmentState;
|
|
2322
|
+
}
|
|
2323
|
+
export interface gpuGPUVertexState {
|
|
2324
|
+
module: gpuGPUShaderModule;
|
|
2325
|
+
entryPoint: string;
|
|
2326
|
+
constants?: Record<string, number>;
|
|
2327
|
+
buffers?: gpuGPUVertexBufferLayout[];
|
|
2328
|
+
}
|
|
2329
|
+
export interface gpuGPUVertexBufferLayout {
|
|
2330
|
+
arrayStride: number | bigint;
|
|
2331
|
+
stepMode?: string;
|
|
2332
|
+
attributes: gpuGPUVertexAttribute[];
|
|
2333
|
+
}
|
|
2334
|
+
export interface gpuGPUVertexAttribute {
|
|
2335
|
+
format: string;
|
|
2336
|
+
offset: number | bigint;
|
|
2337
|
+
shaderLocation: number;
|
|
2338
|
+
}
|
|
2339
|
+
export interface gpuGPUPrimitiveState {
|
|
2340
|
+
topology?: string;
|
|
2341
|
+
stripIndexFormat?: string;
|
|
2342
|
+
frontFace?: string;
|
|
2343
|
+
cullMode?: string;
|
|
2344
|
+
unclippedDepth?: boolean;
|
|
2345
|
+
}
|
|
2346
|
+
export interface gpuGPUStencilFaceState {
|
|
2347
|
+
compare?: string;
|
|
2348
|
+
failOp?: string;
|
|
2349
|
+
depthFailOp?: string;
|
|
2350
|
+
passOp?: string;
|
|
2351
|
+
}
|
|
2352
|
+
export interface gpuGPUDepthStencilState {
|
|
2353
|
+
format: string;
|
|
2354
|
+
depthWriteEnabled: boolean;
|
|
2355
|
+
depthCompare: string;
|
|
2356
|
+
stencilFront?: gpuGPUStencilFaceState;
|
|
2357
|
+
stencilBack?: gpuGPUStencilFaceState;
|
|
2358
|
+
stencilReadMask?: number;
|
|
2359
|
+
stencilWriteMask?: number;
|
|
2360
|
+
depthBias?: number;
|
|
2361
|
+
depthBiasSlopeScale?: number;
|
|
2362
|
+
depthBiasClamp?: number;
|
|
2363
|
+
}
|
|
2364
|
+
export interface gpuGPUMultisampleState {
|
|
2365
|
+
count?: number;
|
|
2366
|
+
mask?: number;
|
|
2367
|
+
alphaToCoverageEnabled?: boolean;
|
|
2368
|
+
}
|
|
2369
|
+
export interface gpuGPUFragmentState {
|
|
2370
|
+
module: gpuGPUShaderModule;
|
|
2371
|
+
entryPoint: string;
|
|
2372
|
+
constants?: Record<string, number>;
|
|
2373
|
+
targets: gpuGPUColorTargetState[];
|
|
2374
|
+
}
|
|
2375
|
+
export interface gpuGPUColorTargetState {
|
|
2376
|
+
format: string;
|
|
2377
|
+
blend: gpuGPUBlendState;
|
|
2378
|
+
writeMask?: number;
|
|
2379
|
+
}
|
|
2380
|
+
export interface gpuGPUBlendState {
|
|
2381
|
+
color: gpuGPUBlendComponent;
|
|
2382
|
+
alpha: gpuGPUBlendComponent;
|
|
2383
|
+
}
|
|
2384
|
+
export interface gpuGPUBlendComponent {
|
|
2385
|
+
operation?: string;
|
|
2386
|
+
srcFactor?: string;
|
|
2387
|
+
dstFactor?: string;
|
|
2388
|
+
}
|
|
2389
|
+
export interface gpuGPURenderPassEncoder {
|
|
2390
|
+
setPipeline(pipeline: gpuGPURenderPipeline): void;
|
|
2391
|
+
draw(
|
|
2392
|
+
vertexCount: number,
|
|
2393
|
+
instanceCount?: number,
|
|
2394
|
+
firstVertex?: number,
|
|
2395
|
+
firstInstance?: number
|
|
2396
|
+
): void;
|
|
2397
|
+
}
|
|
2398
|
+
export interface gpuGPURenderPassDescriptor {
|
|
2399
|
+
label?: string;
|
|
2400
|
+
colorAttachments: gpuGPURenderPassColorAttachment[];
|
|
2401
|
+
depthStencilAttachment?: gpuGPURenderPassDepthStencilAttachment;
|
|
2402
|
+
occlusionQuerySet?: gpuGPUQuerySet;
|
|
2403
|
+
timestampWrites?: gpuGPURenderPassTimestampWrite[];
|
|
2404
|
+
maxDrawCount?: number | bigint;
|
|
2405
|
+
}
|
|
2406
|
+
export interface gpuGPURenderPassColorAttachment {
|
|
2407
|
+
view: gpuGPUTextureView;
|
|
2408
|
+
depthSlice?: number;
|
|
2409
|
+
resolveTarget?: gpuGPUTextureView;
|
|
2410
|
+
clearValue?: number[] | gpuGPUColorDict;
|
|
2411
|
+
loadOp: string;
|
|
2412
|
+
storeOp: string;
|
|
2413
|
+
}
|
|
2414
|
+
export interface gpuGPUColorDict {
|
|
2415
|
+
r: number;
|
|
2416
|
+
g: number;
|
|
2417
|
+
b: number;
|
|
2418
|
+
a: number;
|
|
2419
|
+
}
|
|
2420
|
+
export interface gpuGPURenderPassDepthStencilAttachment {
|
|
2421
|
+
view: gpuGPUTextureView;
|
|
2422
|
+
depthClearValue?: number;
|
|
2423
|
+
depthLoadOp?: string;
|
|
2424
|
+
depthStoreOp?: string;
|
|
2425
|
+
depthReadOnly?: boolean;
|
|
2426
|
+
stencilClearValue?: number;
|
|
2427
|
+
stencilLoadOp?: string;
|
|
2428
|
+
stencilStoreOp?: string;
|
|
2429
|
+
stencilReadOnly?: boolean;
|
|
2430
|
+
}
|
|
2431
|
+
export interface gpuGPURenderPassTimestampWrite {
|
|
2432
|
+
querySet: gpuGPUQuerySet;
|
|
2433
|
+
queryIndex: number;
|
|
2434
|
+
location: string;
|
|
2435
|
+
}
|
|
2436
|
+
export interface BasicImageTransformations {
|
|
2437
|
+
/**
|
|
2438
|
+
* Maximum width in image pixels. The value must be an integer.
|
|
2439
|
+
*/
|
|
2440
|
+
width?: number;
|
|
2441
|
+
/**
|
|
2442
|
+
* Maximum height in image pixels. The value must be an integer.
|
|
2443
|
+
*/
|
|
2444
|
+
height?: number;
|
|
2445
|
+
/**
|
|
2446
|
+
* Resizing mode as a string. It affects interpretation of width and height
|
|
2447
|
+
* options:
|
|
2448
|
+
* - scale-down: Similar to contain, but the image is never enlarged. If
|
|
2449
|
+
* the image is larger than given width or height, it will be resized.
|
|
2450
|
+
* Otherwise its original size will be kept.
|
|
2451
|
+
* - contain: Resizes to maximum size that fits within the given width and
|
|
2452
|
+
* height. If only a single dimension is given (e.g. only width), the
|
|
2453
|
+
* image will be shrunk or enlarged to exactly match that dimension.
|
|
2454
|
+
* Aspect ratio is always preserved.
|
|
2455
|
+
* - cover: Resizes (shrinks or enlarges) to fill the entire area of width
|
|
2456
|
+
* and height. If the image has an aspect ratio different from the ratio
|
|
2457
|
+
* of width and height, it will be cropped to fit.
|
|
2458
|
+
* - crop: The image will be shrunk and cropped to fit within the area
|
|
2459
|
+
* specified by width and height. The image will not be enlarged. For images
|
|
2460
|
+
* smaller than the given dimensions it's the same as scale-down. For
|
|
2461
|
+
* images larger than the given dimensions, it's the same as cover.
|
|
2462
|
+
* See also trim.
|
|
2463
|
+
* - pad: Resizes to the maximum size that fits within the given width and
|
|
2464
|
+
* height, and then fills the remaining area with a background color
|
|
2465
|
+
* (white by default). Use of this mode is not recommended, as the same
|
|
2466
|
+
* effect can be more efficiently achieved with the contain mode and the
|
|
2467
|
+
* CSS object-fit: contain property.
|
|
2468
|
+
*/
|
|
2469
|
+
fit?: "scale-down" | "contain" | "cover" | "crop" | "pad";
|
|
2470
|
+
/**
|
|
2471
|
+
* When cropping with fit: "cover", this defines the side or point that should
|
|
2472
|
+
* be left uncropped. The value is either a string
|
|
2473
|
+
* "left", "right", "top", "bottom", "auto", or "center" (the default),
|
|
2474
|
+
* or an object {x, y} containing focal point coordinates in the original
|
|
2475
|
+
* image expressed as fractions ranging from 0.0 (top or left) to 1.0
|
|
2476
|
+
* (bottom or right), 0.5 being the center. {fit: "cover", gravity: "top"} will
|
|
2477
|
+
* crop bottom or left and right sides as necessary, but won’t crop anything
|
|
2478
|
+
* from the top. {fit: "cover", gravity: {x:0.5, y:0.2}} will crop each side to
|
|
2479
|
+
* preserve as much as possible around a point at 20% of the height of the
|
|
2480
|
+
* source image.
|
|
2481
|
+
*/
|
|
2482
|
+
gravity?:
|
|
2483
|
+
| "left"
|
|
2484
|
+
| "right"
|
|
2485
|
+
| "top"
|
|
2486
|
+
| "bottom"
|
|
2487
|
+
| "center"
|
|
2488
|
+
| "auto"
|
|
2489
|
+
| BasicImageTransformationsGravityCoordinates;
|
|
2490
|
+
/**
|
|
2491
|
+
* Background color to add underneath the image. Applies only to images with
|
|
2492
|
+
* transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…),
|
|
2493
|
+
* hsl(…), etc.)
|
|
2494
|
+
*/
|
|
2495
|
+
background?: string;
|
|
2496
|
+
/**
|
|
2497
|
+
* Number of degrees (90, 180, 270) to rotate the image by. width and height
|
|
2498
|
+
* options refer to axes after rotation.
|
|
2499
|
+
*/
|
|
2500
|
+
rotate?: 0 | 90 | 180 | 270 | 360;
|
|
2501
|
+
}
|
|
2502
|
+
export interface BasicImageTransformationsGravityCoordinates {
|
|
2503
|
+
x: number;
|
|
2504
|
+
y: number;
|
|
2505
|
+
}
|
|
2506
|
+
/**
|
|
2507
|
+
* In addition to the properties you can set in the RequestInit dict
|
|
2508
|
+
* that you pass as an argument to the Request constructor, you can
|
|
2509
|
+
* set certain properties of a `cf` object to control how Cloudflare
|
|
2510
|
+
* features are applied to that new Request.
|
|
2511
|
+
*
|
|
2512
|
+
* Note: Currently, these properties cannot be tested in the
|
|
2513
|
+
* playground.
|
|
2514
|
+
*/
|
|
2515
|
+
export interface RequestInitCfProperties extends Record<string, unknown> {
|
|
2516
|
+
cacheEverything?: boolean;
|
|
2517
|
+
/**
|
|
2518
|
+
* A request's cache key is what determines if two requests are
|
|
2519
|
+
* "the same" for caching purposes. If a request has the same cache key
|
|
2520
|
+
* as some previous request, then we can serve the same cached response for
|
|
2521
|
+
* both. (e.g. 'some-key')
|
|
2522
|
+
*
|
|
2523
|
+
* Only available for Enterprise customers.
|
|
2524
|
+
*/
|
|
2525
|
+
cacheKey?: string;
|
|
2526
|
+
/**
|
|
2527
|
+
* This allows you to append additional Cache-Tag response headers
|
|
2528
|
+
* to the origin response without modifications to the origin server.
|
|
2529
|
+
* This will allow for greater control over the Purge by Cache Tag feature
|
|
2530
|
+
* utilizing changes only in the Workers process.
|
|
2531
|
+
*
|
|
2532
|
+
* Only available for Enterprise customers.
|
|
2533
|
+
*/
|
|
2534
|
+
cacheTags?: string[];
|
|
2535
|
+
/**
|
|
2536
|
+
* Force response to be cached for a given number of seconds. (e.g. 300)
|
|
2537
|
+
*/
|
|
2538
|
+
cacheTtl?: number;
|
|
2539
|
+
/**
|
|
2540
|
+
* Force response to be cached for a given number of seconds based on the Origin status code.
|
|
2541
|
+
* (e.g. { '200-299': 86400, '404': 1, '500-599': 0 })
|
|
2542
|
+
*/
|
|
2543
|
+
cacheTtlByStatus?: Record<string, number>;
|
|
2544
|
+
scrapeShield?: boolean;
|
|
2545
|
+
apps?: boolean;
|
|
2546
|
+
image?: RequestInitCfPropertiesImage;
|
|
2547
|
+
minify?: RequestInitCfPropertiesImageMinify;
|
|
2548
|
+
mirage?: boolean;
|
|
2549
|
+
polish?: "lossy" | "lossless" | "off";
|
|
2550
|
+
/**
|
|
2551
|
+
* Redirects the request to an alternate origin server. You can use this,
|
|
2552
|
+
* for example, to implement load balancing across several origins.
|
|
2553
|
+
* (e.g.us-east.example.com)
|
|
2554
|
+
*
|
|
2555
|
+
* Note - For security reasons, the hostname set in resolveOverride must
|
|
2556
|
+
* be proxied on the same Cloudflare zone of the incoming request.
|
|
2557
|
+
* Otherwise, the setting is ignored. CNAME hosts are allowed, so to
|
|
2558
|
+
* resolve to a host under a different domain or a DNS only domain first
|
|
2559
|
+
* declare a CNAME record within your own zone’s DNS mapping to the
|
|
2560
|
+
* external hostname, set proxy on Cloudflare, then set resolveOverride
|
|
2561
|
+
* to point to that CNAME record.
|
|
2562
|
+
*/
|
|
2563
|
+
resolveOverride?: string;
|
|
2564
|
+
}
|
|
2565
|
+
export interface RequestInitCfPropertiesImageDraw
|
|
2566
|
+
extends BasicImageTransformations {
|
|
2567
|
+
/**
|
|
2568
|
+
* Absolute URL of the image file to use for the drawing. It can be any of
|
|
2569
|
+
* the supported file formats. For drawing of watermarks or non-rectangular
|
|
2570
|
+
* overlays we recommend using PNG or WebP images.
|
|
2571
|
+
*/
|
|
2572
|
+
url: string;
|
|
2573
|
+
/**
|
|
2574
|
+
* Floating-point number between 0 (transparent) and 1 (opaque).
|
|
2575
|
+
* For example, opacity: 0.5 makes overlay semitransparent.
|
|
2576
|
+
*/
|
|
2577
|
+
opacity?: number;
|
|
2578
|
+
/**
|
|
2579
|
+
* - If set to true, the overlay image will be tiled to cover the entire
|
|
2580
|
+
* area. This is useful for stock-photo-like watermarks.
|
|
2581
|
+
* - If set to "x", the overlay image will be tiled horizontally only
|
|
2582
|
+
* (form a line).
|
|
2583
|
+
* - If set to "y", the overlay image will be tiled vertically only
|
|
2584
|
+
* (form a line).
|
|
2585
|
+
*/
|
|
2586
|
+
repeat?: true | "x" | "y";
|
|
2587
|
+
/**
|
|
2588
|
+
* Position of the overlay image relative to a given edge. Each property is
|
|
2589
|
+
* an offset in pixels. 0 aligns exactly to the edge. For example, left: 10
|
|
2590
|
+
* positions left side of the overlay 10 pixels from the left edge of the
|
|
2591
|
+
* image it's drawn over. bottom: 0 aligns bottom of the overlay with bottom
|
|
2592
|
+
* of the background image.
|
|
2593
|
+
*
|
|
2594
|
+
* Setting both left & right, or both top & bottom is an error.
|
|
2595
|
+
*
|
|
2596
|
+
* If no position is specified, the image will be centered.
|
|
2597
|
+
*/
|
|
2598
|
+
top?: number;
|
|
2599
|
+
left?: number;
|
|
2600
|
+
bottom?: number;
|
|
2601
|
+
right?: number;
|
|
2602
|
+
}
|
|
2603
|
+
export interface RequestInitCfPropertiesImage
|
|
2604
|
+
extends BasicImageTransformations {
|
|
2605
|
+
/**
|
|
2606
|
+
* Device Pixel Ratio. Default 1. Multiplier for width/height that makes it
|
|
2607
|
+
* easier to specify higher-DPI sizes in <img srcset>.
|
|
2608
|
+
*/
|
|
2609
|
+
dpr?: number;
|
|
2610
|
+
/**
|
|
2611
|
+
* An object with four properties {left, top, right, bottom} that specify
|
|
2612
|
+
* a number of pixels to cut off on each side. Allows removal of borders
|
|
2613
|
+
* or cutting out a specific fragment of an image. Trimming is performed
|
|
2614
|
+
* before resizing or rotation. Takes dpr into account.
|
|
2615
|
+
*/
|
|
2616
|
+
trim?: {
|
|
2617
|
+
left?: number;
|
|
2618
|
+
top?: number;
|
|
2619
|
+
right?: number;
|
|
2620
|
+
bottom?: number;
|
|
2621
|
+
};
|
|
2622
|
+
/**
|
|
2623
|
+
* Quality setting from 1-100 (useful values are in 60-90 range). Lower values
|
|
2624
|
+
* make images look worse, but load faster. The default is 85. It applies only
|
|
2625
|
+
* to JPEG and WebP images. It doesn’t have any effect on PNG.
|
|
2626
|
+
*/
|
|
2627
|
+
quality?: number;
|
|
2628
|
+
/**
|
|
2629
|
+
* Output format to generate. It can be:
|
|
2630
|
+
* - avif: generate images in AVIF format.
|
|
2631
|
+
* - webp: generate images in Google WebP format. Set quality to 100 to get
|
|
2632
|
+
* the WebP-lossless format.
|
|
2633
|
+
* - json: instead of generating an image, outputs information about the
|
|
2634
|
+
* image, in JSON format. The JSON object will contain image size
|
|
2635
|
+
* (before and after resizing), source image’s MIME type, file size, etc.
|
|
2636
|
+
* - jpeg: generate images in JPEG format.
|
|
2637
|
+
* - png: generate images in PNG format.
|
|
2638
|
+
*/
|
|
2639
|
+
format?: "avif" | "webp" | "json" | "jpeg" | "png";
|
|
2640
|
+
/**
|
|
2641
|
+
* Whether to preserve animation frames from input files. Default is true.
|
|
2642
|
+
* Setting it to false reduces animations to still images. This setting is
|
|
2643
|
+
* recommended when enlarging images or processing arbitrary user content,
|
|
2644
|
+
* because large GIF animations can weigh tens or even hundreds of megabytes.
|
|
2645
|
+
* It is also useful to set anim:false when using format:"json" to get the
|
|
2646
|
+
* response quicker without the number of frames.
|
|
2647
|
+
*/
|
|
2648
|
+
anim?: boolean;
|
|
2649
|
+
/**
|
|
2650
|
+
* What EXIF data should be preserved in the output image. Note that EXIF
|
|
2651
|
+
* rotation and embedded color profiles are always applied ("baked in" into
|
|
2652
|
+
* the image), and aren't affected by this option. Note that if the Polish
|
|
2653
|
+
* feature is enabled, all metadata may have been removed already and this
|
|
2654
|
+
* option may have no effect.
|
|
2655
|
+
* - keep: Preserve most of EXIF metadata, including GPS location if there's
|
|
2656
|
+
* any.
|
|
2657
|
+
* - copyright: Only keep the copyright tag, and discard everything else.
|
|
2658
|
+
* This is the default behavior for JPEG files.
|
|
2659
|
+
* - none: Discard all invisible EXIF metadata. Currently WebP and PNG
|
|
2660
|
+
* output formats always discard metadata.
|
|
2661
|
+
*/
|
|
2662
|
+
metadata?: "keep" | "copyright" | "none";
|
|
2663
|
+
/**
|
|
2664
|
+
* Strength of sharpening filter to apply to the image. Floating-point
|
|
2665
|
+
* number between 0 (no sharpening, default) and 10 (maximum). 1.0 is a
|
|
2666
|
+
* recommended value for downscaled images.
|
|
2667
|
+
*/
|
|
2668
|
+
sharpen?: number;
|
|
2669
|
+
/**
|
|
2670
|
+
* Radius of a blur filter (approximate gaussian). Maximum supported radius
|
|
2671
|
+
* is 250.
|
|
2672
|
+
*/
|
|
2673
|
+
blur?: number;
|
|
2674
|
+
/**
|
|
2675
|
+
* Overlays are drawn in the order they appear in the array (last array
|
|
2676
|
+
* entry is the topmost layer).
|
|
2677
|
+
*/
|
|
2678
|
+
draw?: RequestInitCfPropertiesImageDraw[];
|
|
2679
|
+
/**
|
|
2680
|
+
* Fetching image from authenticated origin. Setting this property will
|
|
2681
|
+
* pass authentication headers (Authorization, Cookie, etc.) through to
|
|
2682
|
+
* the origin.
|
|
2683
|
+
*/
|
|
2684
|
+
"origin-auth"?: "share-publicly";
|
|
2685
|
+
/**
|
|
2686
|
+
* Adds a border around the image. The border is added after resizing. Border
|
|
2687
|
+
* width takes dpr into account, and can be specified either using a single
|
|
2688
|
+
* width property, or individually for each side.
|
|
2689
|
+
*/
|
|
2690
|
+
border?:
|
|
2691
|
+
| {
|
|
2692
|
+
color: string;
|
|
2693
|
+
width: number;
|
|
2694
|
+
}
|
|
2695
|
+
| {
|
|
2696
|
+
color: string;
|
|
2697
|
+
top: number;
|
|
2698
|
+
right: number;
|
|
2699
|
+
bottom: number;
|
|
2700
|
+
left: number;
|
|
2701
|
+
};
|
|
2702
|
+
/**
|
|
2703
|
+
* Increase brightness by a factor. A value of 1.0 equals no change, a value
|
|
2704
|
+
* of 0.5 equals half brightness, and a value of 2.0 equals twice as bright.
|
|
2705
|
+
* 0 is ignored.
|
|
2706
|
+
*/
|
|
2707
|
+
brightness?: number;
|
|
2708
|
+
/**
|
|
2709
|
+
* Increase contrast by a factor. A value of 1.0 equals no change, a value of
|
|
2710
|
+
* 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
|
|
2711
|
+
* ignored.
|
|
2712
|
+
*/
|
|
2713
|
+
contrast?: number;
|
|
2714
|
+
/**
|
|
2715
|
+
* Increase exposure by a factor. A value of 1.0 equals no change, a value of
|
|
2716
|
+
* 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.
|
|
2717
|
+
*/
|
|
2718
|
+
gamma?: number;
|
|
2719
|
+
/**
|
|
2720
|
+
* Slightly reduces latency on a cache miss by selecting a
|
|
2721
|
+
* quickest-to-compress file format, at a cost of increased file size and
|
|
2722
|
+
* lower image quality. It will usually override the format option and choose
|
|
2723
|
+
* JPEG over WebP or AVIF. We do not recommend using this option, except in
|
|
2724
|
+
* unusual circumstances like resizing uncacheable dynamically-generated
|
|
2725
|
+
* images.
|
|
2726
|
+
*/
|
|
2727
|
+
compression?: "fast";
|
|
2728
|
+
}
|
|
2729
|
+
export interface RequestInitCfPropertiesImageMinify {
|
|
2730
|
+
javascript?: boolean;
|
|
2731
|
+
css?: boolean;
|
|
2732
|
+
html?: boolean;
|
|
2733
|
+
}
|
|
2734
|
+
/**
|
|
2735
|
+
* Request metadata provided by Cloudflare's edge.
|
|
2736
|
+
*/
|
|
2737
|
+
export type IncomingRequestCfProperties<HostMetadata = unknown> =
|
|
2738
|
+
IncomingRequestCfPropertiesBase &
|
|
2739
|
+
IncomingRequestCfPropertiesBotManagementEnterprise &
|
|
2740
|
+
IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> &
|
|
2741
|
+
IncomingRequestCfPropertiesGeographicInformation &
|
|
2742
|
+
IncomingRequestCfPropertiesCloudflareAccessOrApiShield;
|
|
2743
|
+
export interface IncomingRequestCfPropertiesBase
|
|
2744
|
+
extends Record<string, unknown> {
|
|
2745
|
+
/**
|
|
2746
|
+
* [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request.
|
|
2747
|
+
*
|
|
2748
|
+
* @example 395747
|
|
2749
|
+
*/
|
|
2750
|
+
asn: number;
|
|
2751
|
+
/**
|
|
2752
|
+
* The organization which owns the ASN of the incoming request.
|
|
2753
|
+
*
|
|
2754
|
+
* @example "Google Cloud"
|
|
2755
|
+
*/
|
|
2756
|
+
asOrganization: string;
|
|
2757
|
+
/**
|
|
2758
|
+
* The original value of the `Accept-Encoding` header if Cloudflare modified it.
|
|
2759
|
+
*
|
|
2760
|
+
* @example "gzip, deflate, br"
|
|
2761
|
+
*/
|
|
2762
|
+
clientAcceptEncoding?: string;
|
|
2763
|
+
/**
|
|
2764
|
+
* The number of milliseconds it took for the request to reach your worker.
|
|
2765
|
+
*
|
|
2766
|
+
* @example 22
|
|
2767
|
+
*/
|
|
2768
|
+
clientTcpRtt?: number;
|
|
2769
|
+
/**
|
|
2770
|
+
* The three-letter [IATA](https://en.wikipedia.org/wiki/IATA_airport_code)
|
|
2771
|
+
* airport code of the data center that the request hit.
|
|
2772
|
+
*
|
|
2773
|
+
* @example "DFW"
|
|
2774
|
+
*/
|
|
2775
|
+
colo: string;
|
|
2776
|
+
/**
|
|
2777
|
+
* Represents the upstream's response to a
|
|
2778
|
+
* [TCP `keepalive` message](https://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html)
|
|
2779
|
+
* from cloudflare.
|
|
2780
|
+
*
|
|
2781
|
+
* For workers with no upstream, this will always be `1`.
|
|
2782
|
+
*
|
|
2783
|
+
* @example 3
|
|
2784
|
+
*/
|
|
2785
|
+
edgeRequestKeepAliveStatus: IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus;
|
|
2786
|
+
/**
|
|
2787
|
+
* The HTTP Protocol the request used.
|
|
2788
|
+
*
|
|
2789
|
+
* @example "HTTP/2"
|
|
2790
|
+
*/
|
|
2791
|
+
httpProtocol: string;
|
|
2792
|
+
/**
|
|
2793
|
+
* The browser-requested prioritization information in the request object.
|
|
2794
|
+
*
|
|
2795
|
+
* If no information was set, defaults to the empty string `""`
|
|
2796
|
+
*
|
|
2797
|
+
* @example "weight=192;exclusive=0;group=3;group-weight=127"
|
|
2798
|
+
* @default ""
|
|
2799
|
+
*/
|
|
2800
|
+
requestPriority: string;
|
|
2801
|
+
/**
|
|
2802
|
+
* The TLS version of the connection to Cloudflare.
|
|
2803
|
+
* In requests served over plaintext (without TLS), this property is the empty string `""`.
|
|
2804
|
+
*
|
|
2805
|
+
* @example "TLSv1.3"
|
|
2806
|
+
*/
|
|
2807
|
+
tlsVersion: string;
|
|
2808
|
+
/**
|
|
2809
|
+
* The cipher for the connection to Cloudflare.
|
|
2810
|
+
* In requests served over plaintext (without TLS), this property is the empty string `""`.
|
|
2811
|
+
*
|
|
2812
|
+
* @example "AEAD-AES128-GCM-SHA256"
|
|
2813
|
+
*/
|
|
2814
|
+
tlsCipher: string;
|
|
2815
|
+
/**
|
|
2816
|
+
* Metadata containing the [`HELLO`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2) and [`FINISHED`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9) messages from this request's TLS handshake.
|
|
2817
|
+
*
|
|
2818
|
+
* If the incoming request was served over plaintext (without TLS) this field is undefined.
|
|
2819
|
+
*/
|
|
2820
|
+
tlsExportedAuthenticator?: IncomingRequestCfPropertiesExportedAuthenticatorMetadata;
|
|
2821
|
+
}
|
|
2822
|
+
export interface IncomingRequestCfPropertiesBotManagementBase {
|
|
2823
|
+
/**
|
|
2824
|
+
* Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot,
|
|
2825
|
+
* represented as an integer percentage between `1` (almost certainly a bot) and `99` (almost certainly human).
|
|
2826
|
+
*
|
|
2827
|
+
* @example 54
|
|
2828
|
+
*/
|
|
2829
|
+
score: number;
|
|
2830
|
+
/**
|
|
2831
|
+
* A boolean value that is true if the request comes from a good bot, like Google or Bing.
|
|
2832
|
+
* Most customers choose to allow this traffic. For more details, see [Traffic from known bots](https://developers.cloudflare.com/firewall/known-issues-and-faq/#how-does-firewall-rules-handle-traffic-from-known-bots).
|
|
2833
|
+
*/
|
|
2834
|
+
verifiedBot: boolean;
|
|
2835
|
+
/**
|
|
2836
|
+
* A boolean value that is true if the request originates from a
|
|
2837
|
+
* Cloudflare-verified proxy service.
|
|
2838
|
+
*/
|
|
2839
|
+
corporateProxy: boolean;
|
|
2840
|
+
/**
|
|
2841
|
+
* A boolean value that's true if the request matches [file extensions](https://developers.cloudflare.com/bots/reference/static-resources/) for many types of static resources.
|
|
2842
|
+
*/
|
|
2843
|
+
staticResource: boolean;
|
|
2844
|
+
/**
|
|
2845
|
+
* List of IDs that correlate to the Bot Management heuristic detections made on a request (you can have multiple heuristic detections on the same request).
|
|
2846
|
+
*/
|
|
2847
|
+
detectionIds: number[];
|
|
2848
|
+
}
|
|
2849
|
+
export interface IncomingRequestCfPropertiesBotManagement {
|
|
2850
|
+
/**
|
|
2851
|
+
* Results of Cloudflare's Bot Management analysis
|
|
2852
|
+
*/
|
|
2853
|
+
botManagement: IncomingRequestCfPropertiesBotManagementBase;
|
|
2854
|
+
/**
|
|
2855
|
+
* Duplicate of `botManagement.score`.
|
|
2856
|
+
*
|
|
2857
|
+
* @deprecated
|
|
2858
|
+
*/
|
|
2859
|
+
clientTrustScore: number;
|
|
2860
|
+
}
|
|
2861
|
+
export interface IncomingRequestCfPropertiesBotManagementEnterprise
|
|
2862
|
+
extends IncomingRequestCfPropertiesBotManagement {
|
|
2863
|
+
/**
|
|
2864
|
+
* Results of Cloudflare's Bot Management analysis
|
|
2865
|
+
*/
|
|
2866
|
+
botManagement: IncomingRequestCfPropertiesBotManagementBase & {
|
|
2867
|
+
/**
|
|
2868
|
+
* A [JA3 Fingerprint](https://developers.cloudflare.com/bots/concepts/ja3-fingerprint/) to help profile specific SSL/TLS clients
|
|
2869
|
+
* across different destination IPs, Ports, and X509 certificates.
|
|
2870
|
+
*/
|
|
2871
|
+
ja3Hash: string;
|
|
2872
|
+
};
|
|
2873
|
+
}
|
|
2874
|
+
export interface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<
|
|
2875
|
+
HostMetadata
|
|
2876
|
+
> {
|
|
2877
|
+
/**
|
|
2878
|
+
* Custom metadata set per-host in [Cloudflare for SaaS](https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/).
|
|
2879
|
+
*
|
|
2880
|
+
* This field is only present if you have Cloudflare for SaaS enabled on your account
|
|
2881
|
+
* and you have followed the [required steps to enable it]((https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/domain-support/custom-metadata/)).
|
|
2882
|
+
*/
|
|
2883
|
+
hostMetadata: HostMetadata;
|
|
2884
|
+
}
|
|
2885
|
+
export interface IncomingRequestCfPropertiesCloudflareAccessOrApiShield {
|
|
2886
|
+
/**
|
|
2887
|
+
* Information about the client certificate presented to Cloudflare.
|
|
2888
|
+
*
|
|
2889
|
+
* This is populated when the incoming request is served over TLS using
|
|
2890
|
+
* either Cloudflare Access or API Shield (mTLS)
|
|
2891
|
+
* and the presented SSL certificate has a valid
|
|
2892
|
+
* [Certificate Serial Number](https://ldapwiki.com/wiki/Certificate%20Serial%20Number)
|
|
2893
|
+
* (i.e., not `null` or `""`).
|
|
2894
|
+
*
|
|
2895
|
+
* Otherwise, a set of placeholder values are used.
|
|
2896
|
+
*
|
|
2897
|
+
* The property `certPresented` will be set to `"1"` when
|
|
2898
|
+
* the object is populated (i.e. the above conditions were met).
|
|
2899
|
+
*/
|
|
2900
|
+
tlsClientAuth:
|
|
2901
|
+
| IncomingRequestCfPropertiesTLSClientAuth
|
|
2902
|
+
| IncomingRequestCfPropertiesTLSClientAuthPlaceholder;
|
|
2903
|
+
}
|
|
2904
|
+
/**
|
|
2905
|
+
* Metadata about the request's TLS handshake
|
|
2906
|
+
*/
|
|
2907
|
+
export interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata {
|
|
2908
|
+
/**
|
|
2909
|
+
* The client's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal
|
|
2910
|
+
*
|
|
2911
|
+
* @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d"
|
|
2912
|
+
*/
|
|
2913
|
+
clientHandshake: string;
|
|
2914
|
+
/**
|
|
2915
|
+
* The server's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal
|
|
2916
|
+
*
|
|
2917
|
+
* @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d"
|
|
2918
|
+
*/
|
|
2919
|
+
serverHandshake: string;
|
|
2920
|
+
/**
|
|
2921
|
+
* The client's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal
|
|
2922
|
+
*
|
|
2923
|
+
* @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b"
|
|
2924
|
+
*/
|
|
2925
|
+
clientFinished: string;
|
|
2926
|
+
/**
|
|
2927
|
+
* The server's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal
|
|
2928
|
+
*
|
|
2929
|
+
* @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b"
|
|
2930
|
+
*/
|
|
2931
|
+
serverFinished: string;
|
|
2932
|
+
}
|
|
2933
|
+
/**
|
|
2934
|
+
* Geographic data about the request's origin.
|
|
2935
|
+
*/
|
|
2936
|
+
export interface IncomingRequestCfPropertiesGeographicInformation {
|
|
2937
|
+
/**
|
|
2938
|
+
* The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from.
|
|
2939
|
+
*
|
|
2940
|
+
* If your worker is [configured to accept TOR connections](https://support.cloudflare.com/hc/en-us/articles/203306930-Understanding-Cloudflare-Tor-support-and-Onion-Routing), this may also be `"T1"`, indicating a request that originated over TOR.
|
|
2941
|
+
*
|
|
2942
|
+
* If Cloudflare is unable to determine where the request originated this property is omitted.
|
|
2943
|
+
*
|
|
2944
|
+
* The country code `"T1"` is used for requests originating on TOR.
|
|
2945
|
+
*
|
|
2946
|
+
* @example "GB"
|
|
2947
|
+
*/
|
|
2948
|
+
country?: Iso3166Alpha2Code | "T1";
|
|
2949
|
+
/**
|
|
2950
|
+
* If present, this property indicates that the request originated in the EU
|
|
2951
|
+
*
|
|
2952
|
+
* @example "1"
|
|
2953
|
+
*/
|
|
2954
|
+
isEUCountry?: "1";
|
|
2955
|
+
/**
|
|
2956
|
+
* A two-letter code indicating the continent the request originated from.
|
|
2957
|
+
*
|
|
2958
|
+
* @example "AN"
|
|
2959
|
+
*/
|
|
2960
|
+
continent?: ContinentCode;
|
|
2961
|
+
/**
|
|
2962
|
+
* The city the request originated from
|
|
2963
|
+
*
|
|
2964
|
+
* @example "Austin"
|
|
2965
|
+
*/
|
|
2966
|
+
city?: string;
|
|
2967
|
+
/**
|
|
2968
|
+
* Postal code of the incoming request
|
|
2969
|
+
*
|
|
2970
|
+
* @example "78701"
|
|
2971
|
+
*/
|
|
2972
|
+
postalCode?: string;
|
|
2973
|
+
/**
|
|
2974
|
+
* Latitude of the incoming request
|
|
2975
|
+
*
|
|
2976
|
+
* @example "30.27130"
|
|
2977
|
+
*/
|
|
2978
|
+
latitude?: string;
|
|
2979
|
+
/**
|
|
2980
|
+
* Longitude of the incoming request
|
|
2981
|
+
*
|
|
2982
|
+
* @example "-97.74260"
|
|
2983
|
+
*/
|
|
2984
|
+
longitude?: string;
|
|
2985
|
+
/**
|
|
2986
|
+
* Timezone of the incoming request
|
|
2987
|
+
*
|
|
2988
|
+
* @example "America/Chicago"
|
|
2989
|
+
*/
|
|
2990
|
+
timezone?: string;
|
|
2991
|
+
/**
|
|
2992
|
+
* If known, the ISO 3166-2 name for the first level region associated with
|
|
2993
|
+
* the IP address of the incoming request
|
|
2994
|
+
*
|
|
2995
|
+
* @example "Texas"
|
|
2996
|
+
*/
|
|
2997
|
+
region?: string;
|
|
2998
|
+
/**
|
|
2999
|
+
* If known, the ISO 3166-2 code for the first-level region associated with
|
|
3000
|
+
* the IP address of the incoming request
|
|
3001
|
+
*
|
|
3002
|
+
* @example "TX"
|
|
3003
|
+
*/
|
|
3004
|
+
regionCode?: string;
|
|
3005
|
+
/**
|
|
3006
|
+
* Metro code (DMA) of the incoming request
|
|
3007
|
+
*
|
|
3008
|
+
* @example "635"
|
|
3009
|
+
*/
|
|
3010
|
+
metroCode?: string;
|
|
3011
|
+
}
|
|
3012
|
+
/** Data about the incoming request's TLS certificate */
|
|
3013
|
+
export interface IncomingRequestCfPropertiesTLSClientAuth {
|
|
3014
|
+
/** Always `"1"`, indicating that the certificate was presented */
|
|
3015
|
+
certPresented: "1";
|
|
3016
|
+
/**
|
|
3017
|
+
* Result of certificate verification.
|
|
3018
|
+
*
|
|
3019
|
+
* @example "FAILED:self signed certificate"
|
|
3020
|
+
*/
|
|
3021
|
+
certVerified: Exclude<CertVerificationStatus, "NONE">;
|
|
3022
|
+
/** The presented certificate's revokation status.
|
|
3023
|
+
*
|
|
3024
|
+
* - A value of `"1"` indicates the certificate has been revoked
|
|
3025
|
+
* - A value of `"0"` indicates the certificate has not been revoked
|
|
3026
|
+
*/
|
|
3027
|
+
certRevoked: "1" | "0";
|
|
3028
|
+
/**
|
|
3029
|
+
* The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html)
|
|
3030
|
+
*
|
|
3031
|
+
* @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare"
|
|
3032
|
+
*/
|
|
3033
|
+
certIssuerDN: string;
|
|
3034
|
+
/**
|
|
3035
|
+
* The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html)
|
|
3036
|
+
*
|
|
3037
|
+
* @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare"
|
|
3038
|
+
*/
|
|
3039
|
+
certSubjectDN: string;
|
|
3040
|
+
/**
|
|
3041
|
+
* The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted)
|
|
3042
|
+
*
|
|
3043
|
+
* @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare"
|
|
3044
|
+
*/
|
|
3045
|
+
certIssuerDNRFC2253: string;
|
|
3046
|
+
/**
|
|
3047
|
+
* The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted)
|
|
3048
|
+
*
|
|
3049
|
+
* @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare"
|
|
3050
|
+
*/
|
|
3051
|
+
certSubjectDNRFC2253: string;
|
|
3052
|
+
/** The certificate issuer's distinguished name (legacy policies) */
|
|
3053
|
+
certIssuerDNLegacy: string;
|
|
3054
|
+
/** The certificate subject's distinguished name (legacy policies) */
|
|
3055
|
+
certSubjectDNLegacy: string;
|
|
3056
|
+
/**
|
|
3057
|
+
* The certificate's serial number
|
|
3058
|
+
*
|
|
3059
|
+
* @example "00936EACBE07F201DF"
|
|
3060
|
+
*/
|
|
3061
|
+
certSerial: string;
|
|
3062
|
+
/**
|
|
3063
|
+
* The certificate issuer's serial number
|
|
3064
|
+
*
|
|
3065
|
+
* @example "2489002934BDFEA34"
|
|
3066
|
+
*/
|
|
3067
|
+
certIssuerSerial: string;
|
|
3068
|
+
/**
|
|
3069
|
+
* The certificate's Subject Key Identifier
|
|
3070
|
+
*
|
|
3071
|
+
* @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4"
|
|
3072
|
+
*/
|
|
3073
|
+
certSKI: string;
|
|
3074
|
+
/**
|
|
3075
|
+
* The certificate issuer's Subject Key Identifier
|
|
3076
|
+
*
|
|
3077
|
+
* @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4"
|
|
3078
|
+
*/
|
|
3079
|
+
certIssuerSKI: string;
|
|
3080
|
+
/**
|
|
3081
|
+
* The certificate's SHA-1 fingerprint
|
|
3082
|
+
*
|
|
3083
|
+
* @example "6b9109f323999e52259cda7373ff0b4d26bd232e"
|
|
3084
|
+
*/
|
|
3085
|
+
certFingerprintSHA1: string;
|
|
3086
|
+
/**
|
|
3087
|
+
* The certificate's SHA-256 fingerprint
|
|
3088
|
+
*
|
|
3089
|
+
* @example "acf77cf37b4156a2708e34c4eb755f9b5dbbe5ebb55adfec8f11493438d19e6ad3f157f81fa3b98278453d5652b0c1fd1d71e5695ae4d709803a4d3f39de9dea"
|
|
3090
|
+
*/
|
|
3091
|
+
certFingerprintSHA256: string;
|
|
3092
|
+
/**
|
|
3093
|
+
* The effective starting date of the certificate
|
|
3094
|
+
*
|
|
3095
|
+
* @example "Dec 22 19:39:00 2018 GMT"
|
|
3096
|
+
*/
|
|
3097
|
+
certNotBefore: string;
|
|
3098
|
+
/**
|
|
3099
|
+
* The effective expiration date of the certificate
|
|
3100
|
+
*
|
|
3101
|
+
* @example "Dec 22 19:39:00 2018 GMT"
|
|
3102
|
+
*/
|
|
3103
|
+
certNotAfter: string;
|
|
3104
|
+
}
|
|
3105
|
+
/** Placeholder values for TLS Client Authorization */
|
|
3106
|
+
export interface IncomingRequestCfPropertiesTLSClientAuthPlaceholder {
|
|
3107
|
+
certPresented: "0";
|
|
3108
|
+
certVerified: "NONE";
|
|
3109
|
+
certRevoked: "0";
|
|
3110
|
+
certIssuerDN: "";
|
|
3111
|
+
certSubjectDN: "";
|
|
3112
|
+
certIssuerDNRFC2253: "";
|
|
3113
|
+
certSubjectDNRFC2253: "";
|
|
3114
|
+
certIssuerDNLegacy: "";
|
|
3115
|
+
certSubjectDNLegacy: "";
|
|
3116
|
+
certSerial: "";
|
|
3117
|
+
certIssuerSerial: "";
|
|
3118
|
+
certSKI: "";
|
|
3119
|
+
certIssuerSKI: "";
|
|
3120
|
+
certFingerprintSHA1: "";
|
|
3121
|
+
certFingerprintSHA256: "";
|
|
3122
|
+
certNotBefore: "";
|
|
3123
|
+
certNotAfter: "";
|
|
3124
|
+
}
|
|
3125
|
+
/** Possible outcomes of TLS verification */
|
|
3126
|
+
export type CertVerificationStatus =
|
|
3127
|
+
/** Authentication succeeded */
|
|
3128
|
+
| "SUCCESS"
|
|
3129
|
+
/** No certificate was presented */
|
|
3130
|
+
| "NONE"
|
|
3131
|
+
/** Failed because the certificate was self-signed */
|
|
3132
|
+
| "FAILED:self signed certificate"
|
|
3133
|
+
/** Failed because the certificate failed a trust chain check */
|
|
3134
|
+
| "FAILED:unable to verify the first certificate"
|
|
3135
|
+
/** Failed because the certificate not yet valid */
|
|
3136
|
+
| "FAILED:certificate is not yet valid"
|
|
3137
|
+
/** Failed because the certificate is expired */
|
|
3138
|
+
| "FAILED:certificate has expired"
|
|
3139
|
+
/** Failed for another unspecified reason */
|
|
3140
|
+
| "FAILED";
|
|
3141
|
+
/**
|
|
3142
|
+
* An upstream endpoint's response to a TCP `keepalive` message from Cloudflare.
|
|
3143
|
+
*/
|
|
3144
|
+
export type IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus =
|
|
3145
|
+
| 0 /** Unknown */
|
|
3146
|
+
| 1 /** no keepalives (not found) */
|
|
3147
|
+
| 2 /** no connection re-use, opening keepalive connection failed */
|
|
3148
|
+
| 3 /** no connection re-use, keepalive accepted and saved */
|
|
3149
|
+
| 4 /** connection re-use, refused by the origin server (`TCP FIN`) */
|
|
3150
|
+
| 5; /** connection re-use, accepted by the origin server */
|
|
3151
|
+
/** ISO 3166-1 Alpha-2 codes */
|
|
3152
|
+
export type Iso3166Alpha2Code =
|
|
3153
|
+
| "AD"
|
|
3154
|
+
| "AE"
|
|
3155
|
+
| "AF"
|
|
3156
|
+
| "AG"
|
|
3157
|
+
| "AI"
|
|
3158
|
+
| "AL"
|
|
3159
|
+
| "AM"
|
|
3160
|
+
| "AO"
|
|
3161
|
+
| "AQ"
|
|
3162
|
+
| "AR"
|
|
3163
|
+
| "AS"
|
|
3164
|
+
| "AT"
|
|
3165
|
+
| "AU"
|
|
3166
|
+
| "AW"
|
|
3167
|
+
| "AX"
|
|
3168
|
+
| "AZ"
|
|
3169
|
+
| "BA"
|
|
3170
|
+
| "BB"
|
|
3171
|
+
| "BD"
|
|
3172
|
+
| "BE"
|
|
3173
|
+
| "BF"
|
|
3174
|
+
| "BG"
|
|
3175
|
+
| "BH"
|
|
3176
|
+
| "BI"
|
|
3177
|
+
| "BJ"
|
|
3178
|
+
| "BL"
|
|
3179
|
+
| "BM"
|
|
3180
|
+
| "BN"
|
|
3181
|
+
| "BO"
|
|
3182
|
+
| "BQ"
|
|
3183
|
+
| "BR"
|
|
3184
|
+
| "BS"
|
|
3185
|
+
| "BT"
|
|
3186
|
+
| "BV"
|
|
3187
|
+
| "BW"
|
|
3188
|
+
| "BY"
|
|
3189
|
+
| "BZ"
|
|
3190
|
+
| "CA"
|
|
3191
|
+
| "CC"
|
|
3192
|
+
| "CD"
|
|
3193
|
+
| "CF"
|
|
3194
|
+
| "CG"
|
|
3195
|
+
| "CH"
|
|
3196
|
+
| "CI"
|
|
3197
|
+
| "CK"
|
|
3198
|
+
| "CL"
|
|
3199
|
+
| "CM"
|
|
3200
|
+
| "CN"
|
|
3201
|
+
| "CO"
|
|
3202
|
+
| "CR"
|
|
3203
|
+
| "CU"
|
|
3204
|
+
| "CV"
|
|
3205
|
+
| "CW"
|
|
3206
|
+
| "CX"
|
|
3207
|
+
| "CY"
|
|
3208
|
+
| "CZ"
|
|
3209
|
+
| "DE"
|
|
3210
|
+
| "DJ"
|
|
3211
|
+
| "DK"
|
|
3212
|
+
| "DM"
|
|
3213
|
+
| "DO"
|
|
3214
|
+
| "DZ"
|
|
3215
|
+
| "EC"
|
|
3216
|
+
| "EE"
|
|
3217
|
+
| "EG"
|
|
3218
|
+
| "EH"
|
|
3219
|
+
| "ER"
|
|
3220
|
+
| "ES"
|
|
3221
|
+
| "ET"
|
|
3222
|
+
| "FI"
|
|
3223
|
+
| "FJ"
|
|
3224
|
+
| "FK"
|
|
3225
|
+
| "FM"
|
|
3226
|
+
| "FO"
|
|
3227
|
+
| "FR"
|
|
3228
|
+
| "GA"
|
|
3229
|
+
| "GB"
|
|
3230
|
+
| "GD"
|
|
3231
|
+
| "GE"
|
|
3232
|
+
| "GF"
|
|
3233
|
+
| "GG"
|
|
3234
|
+
| "GH"
|
|
3235
|
+
| "GI"
|
|
3236
|
+
| "GL"
|
|
3237
|
+
| "GM"
|
|
3238
|
+
| "GN"
|
|
3239
|
+
| "GP"
|
|
3240
|
+
| "GQ"
|
|
3241
|
+
| "GR"
|
|
3242
|
+
| "GS"
|
|
3243
|
+
| "GT"
|
|
3244
|
+
| "GU"
|
|
3245
|
+
| "GW"
|
|
3246
|
+
| "GY"
|
|
3247
|
+
| "HK"
|
|
3248
|
+
| "HM"
|
|
3249
|
+
| "HN"
|
|
3250
|
+
| "HR"
|
|
3251
|
+
| "HT"
|
|
3252
|
+
| "HU"
|
|
3253
|
+
| "ID"
|
|
3254
|
+
| "IE"
|
|
3255
|
+
| "IL"
|
|
3256
|
+
| "IM"
|
|
3257
|
+
| "IN"
|
|
3258
|
+
| "IO"
|
|
3259
|
+
| "IQ"
|
|
3260
|
+
| "IR"
|
|
3261
|
+
| "IS"
|
|
3262
|
+
| "IT"
|
|
3263
|
+
| "JE"
|
|
3264
|
+
| "JM"
|
|
3265
|
+
| "JO"
|
|
3266
|
+
| "JP"
|
|
3267
|
+
| "KE"
|
|
3268
|
+
| "KG"
|
|
3269
|
+
| "KH"
|
|
3270
|
+
| "KI"
|
|
3271
|
+
| "KM"
|
|
3272
|
+
| "KN"
|
|
3273
|
+
| "KP"
|
|
3274
|
+
| "KR"
|
|
3275
|
+
| "KW"
|
|
3276
|
+
| "KY"
|
|
3277
|
+
| "KZ"
|
|
3278
|
+
| "LA"
|
|
3279
|
+
| "LB"
|
|
3280
|
+
| "LC"
|
|
3281
|
+
| "LI"
|
|
3282
|
+
| "LK"
|
|
3283
|
+
| "LR"
|
|
3284
|
+
| "LS"
|
|
3285
|
+
| "LT"
|
|
3286
|
+
| "LU"
|
|
3287
|
+
| "LV"
|
|
3288
|
+
| "LY"
|
|
3289
|
+
| "MA"
|
|
3290
|
+
| "MC"
|
|
3291
|
+
| "MD"
|
|
3292
|
+
| "ME"
|
|
3293
|
+
| "MF"
|
|
3294
|
+
| "MG"
|
|
3295
|
+
| "MH"
|
|
3296
|
+
| "MK"
|
|
3297
|
+
| "ML"
|
|
3298
|
+
| "MM"
|
|
3299
|
+
| "MN"
|
|
3300
|
+
| "MO"
|
|
3301
|
+
| "MP"
|
|
3302
|
+
| "MQ"
|
|
3303
|
+
| "MR"
|
|
3304
|
+
| "MS"
|
|
3305
|
+
| "MT"
|
|
3306
|
+
| "MU"
|
|
3307
|
+
| "MV"
|
|
3308
|
+
| "MW"
|
|
3309
|
+
| "MX"
|
|
3310
|
+
| "MY"
|
|
3311
|
+
| "MZ"
|
|
3312
|
+
| "NA"
|
|
3313
|
+
| "NC"
|
|
3314
|
+
| "NE"
|
|
3315
|
+
| "NF"
|
|
3316
|
+
| "NG"
|
|
3317
|
+
| "NI"
|
|
3318
|
+
| "NL"
|
|
3319
|
+
| "NO"
|
|
3320
|
+
| "NP"
|
|
3321
|
+
| "NR"
|
|
3322
|
+
| "NU"
|
|
3323
|
+
| "NZ"
|
|
3324
|
+
| "OM"
|
|
3325
|
+
| "PA"
|
|
3326
|
+
| "PE"
|
|
3327
|
+
| "PF"
|
|
3328
|
+
| "PG"
|
|
3329
|
+
| "PH"
|
|
3330
|
+
| "PK"
|
|
3331
|
+
| "PL"
|
|
3332
|
+
| "PM"
|
|
3333
|
+
| "PN"
|
|
3334
|
+
| "PR"
|
|
3335
|
+
| "PS"
|
|
3336
|
+
| "PT"
|
|
3337
|
+
| "PW"
|
|
3338
|
+
| "PY"
|
|
3339
|
+
| "QA"
|
|
3340
|
+
| "RE"
|
|
3341
|
+
| "RO"
|
|
3342
|
+
| "RS"
|
|
3343
|
+
| "RU"
|
|
3344
|
+
| "RW"
|
|
3345
|
+
| "SA"
|
|
3346
|
+
| "SB"
|
|
3347
|
+
| "SC"
|
|
3348
|
+
| "SD"
|
|
3349
|
+
| "SE"
|
|
3350
|
+
| "SG"
|
|
3351
|
+
| "SH"
|
|
3352
|
+
| "SI"
|
|
3353
|
+
| "SJ"
|
|
3354
|
+
| "SK"
|
|
3355
|
+
| "SL"
|
|
3356
|
+
| "SM"
|
|
3357
|
+
| "SN"
|
|
3358
|
+
| "SO"
|
|
3359
|
+
| "SR"
|
|
3360
|
+
| "SS"
|
|
3361
|
+
| "ST"
|
|
3362
|
+
| "SV"
|
|
3363
|
+
| "SX"
|
|
3364
|
+
| "SY"
|
|
3365
|
+
| "SZ"
|
|
3366
|
+
| "TC"
|
|
3367
|
+
| "TD"
|
|
3368
|
+
| "TF"
|
|
3369
|
+
| "TG"
|
|
3370
|
+
| "TH"
|
|
3371
|
+
| "TJ"
|
|
3372
|
+
| "TK"
|
|
3373
|
+
| "TL"
|
|
3374
|
+
| "TM"
|
|
3375
|
+
| "TN"
|
|
3376
|
+
| "TO"
|
|
3377
|
+
| "TR"
|
|
3378
|
+
| "TT"
|
|
3379
|
+
| "TV"
|
|
3380
|
+
| "TW"
|
|
3381
|
+
| "TZ"
|
|
3382
|
+
| "UA"
|
|
3383
|
+
| "UG"
|
|
3384
|
+
| "UM"
|
|
3385
|
+
| "US"
|
|
3386
|
+
| "UY"
|
|
3387
|
+
| "UZ"
|
|
3388
|
+
| "VA"
|
|
3389
|
+
| "VC"
|
|
3390
|
+
| "VE"
|
|
3391
|
+
| "VG"
|
|
3392
|
+
| "VI"
|
|
3393
|
+
| "VN"
|
|
3394
|
+
| "VU"
|
|
3395
|
+
| "WF"
|
|
3396
|
+
| "WS"
|
|
3397
|
+
| "YE"
|
|
3398
|
+
| "YT"
|
|
3399
|
+
| "ZA"
|
|
3400
|
+
| "ZM"
|
|
3401
|
+
| "ZW";
|
|
3402
|
+
/** The 2-letter continent codes Cloudflare uses */
|
|
3403
|
+
export type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
|
|
3404
|
+
export type CfProperties<HostMetadata = unknown> =
|
|
3405
|
+
| IncomingRequestCfProperties<HostMetadata>
|
|
3406
|
+
| RequestInitCfProperties;
|
|
3407
|
+
export interface D1Meta {
|
|
3408
|
+
duration: number;
|
|
3409
|
+
size_after: number;
|
|
3410
|
+
rows_read: number;
|
|
3411
|
+
rows_written: number;
|
|
3412
|
+
last_row_id: number;
|
|
3413
|
+
changed_db: boolean;
|
|
3414
|
+
changes: number;
|
|
3415
|
+
}
|
|
3416
|
+
export interface D1Result<T = unknown> {
|
|
3417
|
+
results: T[];
|
|
3418
|
+
success: true;
|
|
3419
|
+
meta: D1Meta & Record<string, unknown>;
|
|
3420
|
+
error?: never;
|
|
3421
|
+
}
|
|
3422
|
+
export interface D1ExecResult {
|
|
3423
|
+
count: number;
|
|
3424
|
+
duration: number;
|
|
3425
|
+
}
|
|
3426
|
+
export declare abstract class D1Database {
|
|
3427
|
+
prepare(query: string): D1PreparedStatement;
|
|
3428
|
+
dump(): Promise<ArrayBuffer>;
|
|
3429
|
+
batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;
|
|
3430
|
+
exec(query: string): Promise<D1ExecResult>;
|
|
3431
|
+
}
|
|
3432
|
+
export declare abstract class D1PreparedStatement {
|
|
3433
|
+
bind(...values: unknown[]): D1PreparedStatement;
|
|
3434
|
+
first<T = unknown>(colName: string): Promise<T | null>;
|
|
3435
|
+
first<T = Record<string, unknown>>(): Promise<T | null>;
|
|
3436
|
+
run<T = Record<string, unknown>>(): Promise<D1Result<T>>;
|
|
3437
|
+
all<T = Record<string, unknown>>(): Promise<D1Result<T>>;
|
|
3438
|
+
raw<T = unknown[]>(): Promise<T[]>;
|
|
3439
|
+
}
|
|
3440
|
+
/**
|
|
3441
|
+
* An email message that can be sent from a Worker.
|
|
3442
|
+
*/
|
|
3443
|
+
export interface EmailMessage {
|
|
3444
|
+
/**
|
|
3445
|
+
* Envelope From attribute of the email message.
|
|
3446
|
+
*/
|
|
3447
|
+
readonly from: string;
|
|
3448
|
+
/**
|
|
3449
|
+
* Envelope To attribute of the email message.
|
|
3450
|
+
*/
|
|
3451
|
+
readonly to: string;
|
|
3452
|
+
}
|
|
3453
|
+
/**
|
|
3454
|
+
* An email message that is sent to a consumer Worker and can be rejected/forwarded.
|
|
3455
|
+
*/
|
|
3456
|
+
export interface ForwardableEmailMessage extends EmailMessage {
|
|
3457
|
+
/**
|
|
3458
|
+
* Stream of the email message content.
|
|
3459
|
+
*/
|
|
3460
|
+
readonly raw: ReadableStream;
|
|
3461
|
+
/**
|
|
3462
|
+
* An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
3463
|
+
*/
|
|
3464
|
+
readonly headers: Headers;
|
|
3465
|
+
/**
|
|
3466
|
+
* Size of the email message content.
|
|
3467
|
+
*/
|
|
3468
|
+
readonly rawSize: number;
|
|
3469
|
+
/**
|
|
3470
|
+
* Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason.
|
|
3471
|
+
* @param reason The reject reason.
|
|
3472
|
+
* @returns void
|
|
3473
|
+
*/
|
|
3474
|
+
setReject(reason: string): void;
|
|
3475
|
+
/**
|
|
3476
|
+
* Forward this email message to a verified destination address of the account.
|
|
3477
|
+
* @param rcptTo Verified destination address.
|
|
3478
|
+
* @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
3479
|
+
* @returns A promise that resolves when the email message is forwarded.
|
|
3480
|
+
*/
|
|
3481
|
+
forward(rcptTo: string, headers?: Headers): Promise<void>;
|
|
3482
|
+
}
|
|
3483
|
+
/**
|
|
3484
|
+
* A binding that allows a Worker to send email messages.
|
|
3485
|
+
*/
|
|
3486
|
+
export interface SendEmail {
|
|
3487
|
+
send(message: EmailMessage): Promise<void>;
|
|
3488
|
+
}
|
|
3489
|
+
export declare abstract class EmailEvent extends ExtendableEvent {
|
|
3490
|
+
readonly message: ForwardableEmailMessage;
|
|
3491
|
+
}
|
|
3492
|
+
export type EmailExportedHandler<Env = unknown> = (
|
|
3493
|
+
message: ForwardableEmailMessage,
|
|
3494
|
+
env: Env,
|
|
3495
|
+
ctx: ExecutionContext
|
|
3496
|
+
) => void | Promise<void>;
|
|
3497
|
+
export interface Hyperdrive {
|
|
3498
|
+
/**
|
|
3499
|
+
* Connect directly to Hyperdrive as if it's your database, returning a TCP socket.
|
|
3500
|
+
*
|
|
3501
|
+
* Calling this method returns an idential socket to if you call
|
|
3502
|
+
* `connect("host:port")` using the `host` and `port` fields from this object.
|
|
3503
|
+
* Pick whichever approach works better with your preferred DB client library.
|
|
3504
|
+
*
|
|
3505
|
+
* Note that this socket is not yet authenticated -- it's expected that your
|
|
3506
|
+
* code (or preferably, the client library of your choice) will authenticate
|
|
3507
|
+
* using the information in this class's readonly fields.
|
|
3508
|
+
*/
|
|
3509
|
+
connect(): Socket;
|
|
3510
|
+
/**
|
|
3511
|
+
* A valid DB connection string that can be passed straight into the typical
|
|
3512
|
+
* client library/driver/ORM. This will typically be the easiest way to use
|
|
3513
|
+
* Hyperdrive.
|
|
3514
|
+
*/
|
|
3515
|
+
readonly connectionString: string;
|
|
3516
|
+
/*
|
|
3517
|
+
* A randomly generated hostname that is only valid within the context of the
|
|
3518
|
+
* currently running Worker which, when passed into `connect()` function from
|
|
3519
|
+
* the "cloudflare:sockets" module, will connect to the Hyperdrive instance
|
|
3520
|
+
* for your database.
|
|
3521
|
+
*/
|
|
3522
|
+
readonly host: string;
|
|
3523
|
+
/*
|
|
3524
|
+
* The port that must be paired the the host field when connecting.
|
|
3525
|
+
*/
|
|
3526
|
+
readonly port: string;
|
|
3527
|
+
/*
|
|
3528
|
+
* The username to use when authenticating to your database via Hyperdrive.
|
|
3529
|
+
* Unlike the host and password, this will be the same every time
|
|
3530
|
+
*/
|
|
3531
|
+
readonly user: string;
|
|
3532
|
+
/*
|
|
3533
|
+
* The randomly generated password to use when authenticating to your
|
|
3534
|
+
* database via Hyperdrive. Like the host field, this password is only valid
|
|
3535
|
+
* within the context of the currently running Worker instance from which
|
|
3536
|
+
* it's read.
|
|
3537
|
+
*/
|
|
3538
|
+
readonly password: string;
|
|
3539
|
+
/*
|
|
3540
|
+
* The name of the database to connect to.
|
|
3541
|
+
*/
|
|
3542
|
+
readonly database: string;
|
|
3543
|
+
}
|
|
3544
|
+
export type Params<P extends string = any> = Record<P, string | string[]>;
|
|
3545
|
+
export type EventContext<Env, P extends string, Data> = {
|
|
3546
|
+
request: Request;
|
|
3547
|
+
functionPath: string;
|
|
3548
|
+
waitUntil: (promise: Promise<any>) => void;
|
|
3549
|
+
passThroughOnException: () => void;
|
|
3550
|
+
next: (input?: Request | string, init?: RequestInit) => Promise<Response>;
|
|
3551
|
+
env: Env & {
|
|
3552
|
+
ASSETS: {
|
|
3553
|
+
fetch: typeof fetch;
|
|
3554
|
+
};
|
|
3555
|
+
};
|
|
3556
|
+
params: Params<P>;
|
|
3557
|
+
data: Data;
|
|
3558
|
+
};
|
|
3559
|
+
export type PagesFunction<
|
|
3560
|
+
Env = unknown,
|
|
3561
|
+
Params extends string = any,
|
|
3562
|
+
Data extends Record<string, unknown> = Record<string, unknown>
|
|
3563
|
+
> = (context: EventContext<Env, Params, Data>) => Response | Promise<Response>;
|
|
3564
|
+
export type EventPluginContext<Env, P extends string, Data, PluginArgs> = {
|
|
3565
|
+
request: Request;
|
|
3566
|
+
functionPath: string;
|
|
3567
|
+
waitUntil: (promise: Promise<any>) => void;
|
|
3568
|
+
passThroughOnException: () => void;
|
|
3569
|
+
next: (input?: Request | string, init?: RequestInit) => Promise<Response>;
|
|
3570
|
+
env: Env & {
|
|
3571
|
+
ASSETS: {
|
|
3572
|
+
fetch: typeof fetch;
|
|
3573
|
+
};
|
|
3574
|
+
};
|
|
3575
|
+
params: Params<P>;
|
|
3576
|
+
data: Data;
|
|
3577
|
+
pluginArgs: PluginArgs;
|
|
3578
|
+
};
|
|
3579
|
+
export type PagesPluginFunction<
|
|
3580
|
+
Env = unknown,
|
|
3581
|
+
Params extends string = any,
|
|
3582
|
+
Data extends Record<string, unknown> = Record<string, unknown>,
|
|
3583
|
+
PluginArgs = unknown
|
|
3584
|
+
> = (
|
|
3585
|
+
context: EventPluginContext<Env, Params, Data, PluginArgs>
|
|
3586
|
+
) => Response | Promise<Response>;
|
|
3587
|
+
// PubSubMessage represents an incoming PubSub message.
|
|
3588
|
+
// The message includes metadata about the broker, the client, and the payload
|
|
3589
|
+
// itself.
|
|
3590
|
+
// https://developers.cloudflare.com/pub-sub/
|
|
3591
|
+
export interface PubSubMessage {
|
|
3592
|
+
// Message ID
|
|
3593
|
+
readonly mid: number;
|
|
3594
|
+
// MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT
|
|
3595
|
+
readonly broker: string;
|
|
3596
|
+
// The MQTT topic the message was sent on.
|
|
3597
|
+
readonly topic: string;
|
|
3598
|
+
// The client ID of the client that published this message.
|
|
3599
|
+
readonly clientId: string;
|
|
3600
|
+
// The unique identifier (JWT ID) used by the client to authenticate, if token
|
|
3601
|
+
// auth was used.
|
|
3602
|
+
readonly jti?: string;
|
|
3603
|
+
// A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker
|
|
3604
|
+
// received the message from the client.
|
|
3605
|
+
readonly receivedAt: number;
|
|
3606
|
+
// An (optional) string with the MIME type of the payload, if set by the
|
|
3607
|
+
// client.
|
|
3608
|
+
readonly contentType: string;
|
|
3609
|
+
// Set to 1 when the payload is a UTF-8 string
|
|
3610
|
+
// https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063
|
|
3611
|
+
readonly payloadFormatIndicator: number;
|
|
3612
|
+
// Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays.
|
|
3613
|
+
// You can use payloadFormatIndicator to inspect this before decoding.
|
|
3614
|
+
payload: string | Uint8Array;
|
|
3615
|
+
}
|
|
3616
|
+
// JsonWebKey extended by kid parameter
|
|
3617
|
+
export interface JsonWebKeyWithKid extends JsonWebKey {
|
|
3618
|
+
// Key Identifier of the JWK
|
|
3619
|
+
readonly kid: string;
|
|
3620
|
+
}
|
|
3621
|
+
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
3622
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
3623
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
3624
|
+
/**
|
|
3625
|
+
* Additional information to associate with a vector.
|
|
3626
|
+
*/
|
|
3627
|
+
export type VectorizeVectorMetadata =
|
|
3628
|
+
| string
|
|
3629
|
+
| number
|
|
3630
|
+
| boolean
|
|
3631
|
+
| string[]
|
|
3632
|
+
| Record<string, string | number | boolean | string[]>;
|
|
3633
|
+
export type VectorFloatArray = Float32Array | Float64Array;
|
|
3634
|
+
export interface VectorizeError {
|
|
3635
|
+
code?: number;
|
|
3636
|
+
error: string;
|
|
3637
|
+
}
|
|
3638
|
+
/**
|
|
3639
|
+
* Supported distance metrics for an index.
|
|
3640
|
+
* Distance metrics determine how other "similar" vectors are determined.
|
|
3641
|
+
*/
|
|
3642
|
+
export type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product";
|
|
3643
|
+
export interface VectorizeQueryOptions {
|
|
3644
|
+
topK?: number;
|
|
3645
|
+
namespace?: string;
|
|
3646
|
+
returnValues?: boolean;
|
|
3647
|
+
returnMetadata?: boolean;
|
|
3648
|
+
}
|
|
3649
|
+
/**
|
|
3650
|
+
* Information about the configuration of an index.
|
|
3651
|
+
*/
|
|
3652
|
+
export type VectorizeIndexConfig =
|
|
3653
|
+
| {
|
|
3654
|
+
dimensions: number;
|
|
3655
|
+
metric: VectorizeDistanceMetric;
|
|
3656
|
+
}
|
|
3657
|
+
| {
|
|
3658
|
+
preset: string; // keep this generic, as we'll be adding more presets in the future and this is only in a read capacity
|
|
3659
|
+
};
|
|
3660
|
+
/**
|
|
3661
|
+
* Metadata about an existing index.
|
|
3662
|
+
*/
|
|
3663
|
+
export interface VectorizeIndexDetails {
|
|
3664
|
+
/** The unique ID of the index */
|
|
3665
|
+
readonly id: string;
|
|
3666
|
+
/** The name of the index. */
|
|
3667
|
+
name: string;
|
|
3668
|
+
/** (optional) A human readable description for the index. */
|
|
3669
|
+
description?: string;
|
|
3670
|
+
/** The index configuration, including the dimension size and distance metric. */
|
|
3671
|
+
config: VectorizeIndexConfig;
|
|
3672
|
+
/** The number of records containing vectors within the index. */
|
|
3673
|
+
vectorsCount: number;
|
|
3674
|
+
}
|
|
3675
|
+
/**
|
|
3676
|
+
* Represents a single vector value set along with its associated metadata.
|
|
3677
|
+
*/
|
|
3678
|
+
export interface VectorizeVector {
|
|
3679
|
+
/** 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. */
|
|
3680
|
+
id: string;
|
|
3681
|
+
/** The vector values */
|
|
3682
|
+
values: VectorFloatArray | number[];
|
|
3683
|
+
/** The namespace this vector belongs to. */
|
|
3684
|
+
namespace?: string;
|
|
3685
|
+
/** Metadata associated with the vector. Includes the values of the other fields and potentially additional details. */
|
|
3686
|
+
metadata?: Record<string, VectorizeVectorMetadata>;
|
|
3687
|
+
}
|
|
3688
|
+
/**
|
|
3689
|
+
* Represents a matched vector for a query along with its score and (if specified) the matching vector information.
|
|
3690
|
+
*/
|
|
3691
|
+
export type VectorizeMatch = Pick<Partial<VectorizeVector>, "values"> &
|
|
3692
|
+
Omit<VectorizeVector, "values"> & {
|
|
3693
|
+
/** The score or rank for similarity, when returned as a result */
|
|
3694
|
+
score: number;
|
|
3695
|
+
};
|
|
3696
|
+
/**
|
|
3697
|
+
* A set of vector {@link VectorizeMatch} for a particular query.
|
|
3698
|
+
*/
|
|
3699
|
+
export interface VectorizeMatches {
|
|
3700
|
+
matches: VectorizeMatch[];
|
|
3701
|
+
count: number;
|
|
3702
|
+
}
|
|
3703
|
+
/**
|
|
3704
|
+
* Results of an operation that performed a mutation on a set of vectors.
|
|
3705
|
+
* Here, `ids` is a list of vectors that were successfully processed.
|
|
3706
|
+
*/
|
|
3707
|
+
export interface VectorizeVectorMutation {
|
|
3708
|
+
/* List of ids of vectors that were successfully processed. */
|
|
3709
|
+
ids: string[];
|
|
3710
|
+
/* Total count of the number of processed vectors. */
|
|
3711
|
+
count: number;
|
|
3712
|
+
}
|
|
3713
|
+
export declare abstract class VectorizeIndex {
|
|
3714
|
+
/**
|
|
3715
|
+
* Get information about the currently bound index.
|
|
3716
|
+
* @returns A promise that resolves with information about the current index.
|
|
3717
|
+
*/
|
|
3718
|
+
public describe(): Promise<VectorizeIndexDetails>;
|
|
3719
|
+
/**
|
|
3720
|
+
* Use the provided vector to perform a similarity search across the index.
|
|
3721
|
+
* @param vector Input vector that will be used to drive the similarity search.
|
|
3722
|
+
* @param options Configuration options to massage the returned data.
|
|
3723
|
+
* @returns A promise that resolves with matched and scored vectors.
|
|
3724
|
+
*/
|
|
3725
|
+
public query(
|
|
3726
|
+
vector: VectorFloatArray | number[],
|
|
3727
|
+
options: VectorizeQueryOptions
|
|
3728
|
+
): Promise<VectorizeMatches>;
|
|
3729
|
+
/**
|
|
3730
|
+
* Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
|
|
3731
|
+
* @param vectors List of vectors that will be inserted.
|
|
3732
|
+
* @returns A promise that resolves with the ids & count of records that were successfully processed.
|
|
3733
|
+
*/
|
|
3734
|
+
public insert(vectors: VectorizeVector[]): Promise<VectorizeVectorMutation>;
|
|
3735
|
+
/**
|
|
3736
|
+
* Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.
|
|
3737
|
+
* @param vectors List of vectors that will be upserted.
|
|
3738
|
+
* @returns A promise that resolves with the ids & count of records that were successfully processed.
|
|
3739
|
+
*/
|
|
3740
|
+
public upsert(vectors: VectorizeVector[]): Promise<VectorizeVectorMutation>;
|
|
3741
|
+
/**
|
|
3742
|
+
* Delete a list of vectors with a matching id.
|
|
3743
|
+
* @param ids List of vector ids that should be deleted.
|
|
3744
|
+
* @returns A promise that resolves with the ids & count of records that were successfully processed (and thus deleted).
|
|
3745
|
+
*/
|
|
3746
|
+
public deleteByIds(ids: string[]): Promise<VectorizeVectorMutation>;
|
|
3747
|
+
/**
|
|
3748
|
+
* Get a list of vectors with a matching id.
|
|
3749
|
+
* @param ids List of vector ids that should be returned.
|
|
3750
|
+
* @returns A promise that resolves with the raw unscored vectors matching the id set.
|
|
3751
|
+
*/
|
|
3752
|
+
public getByIds(ids: string[]): Promise<VectorizeVector[]>;
|
|
3753
|
+
}
|
|
3754
|
+
export interface DynamicDispatchLimits {
|
|
3755
|
+
/**
|
|
3756
|
+
* Limit CPU time in milliseconds.
|
|
3757
|
+
*/
|
|
3758
|
+
cpuMs?: number;
|
|
3759
|
+
/**
|
|
3760
|
+
* Limit number of subrequests.
|
|
3761
|
+
*/
|
|
3762
|
+
subRequests?: number;
|
|
3763
|
+
}
|
|
3764
|
+
export interface DynamicDispatchOptions {
|
|
3765
|
+
/**
|
|
3766
|
+
* Limit resources of invoked Worker script.
|
|
3767
|
+
*/
|
|
3768
|
+
limits?: DynamicDispatchLimits;
|
|
3769
|
+
/**
|
|
3770
|
+
* Arguments for outbound Worker script, if configured.
|
|
3771
|
+
*/
|
|
3772
|
+
outbound?: {
|
|
3773
|
+
[key: string]: any;
|
|
3774
|
+
};
|
|
3775
|
+
}
|
|
3776
|
+
export interface DispatchNamespace {
|
|
3777
|
+
/**
|
|
3778
|
+
* @param name Name of the Worker script.
|
|
3779
|
+
* @param args Arguments to Worker script.
|
|
3780
|
+
* @param options Options for Dynamic Dispatch invocation.
|
|
3781
|
+
* @returns A Fetcher object that allows you to send requests to the Worker script.
|
|
3782
|
+
* @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.
|
|
3783
|
+
*/
|
|
3784
|
+
get(
|
|
3785
|
+
name: string,
|
|
3786
|
+
args?: {
|
|
3787
|
+
[key: string]: any;
|
|
3788
|
+
},
|
|
3789
|
+
options?: DynamicDispatchOptions
|
|
3790
|
+
): Fetcher;
|
|
3791
|
+
}
|