@cloudflare/workers-types 3.18.0 → 4.20221111.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/2021-11-03/index.d.ts +2794 -0
- package/2021-11-03/index.ts +2799 -0
- package/2022-01-31/index.d.ts +2782 -0
- package/2022-01-31/index.ts +2787 -0
- package/2022-03-21/index.d.ts +2788 -0
- package/2022-03-21/index.ts +2793 -0
- package/2022-08-04/index.d.ts +2789 -0
- package/2022-08-04/index.ts +2794 -0
- package/README.md +72 -35
- package/experimental/index.d.ts +2788 -0
- package/experimental/index.ts +2793 -0
- package/index.d.ts +1399 -1399
- package/index.ts +2799 -0
- package/oldest/index.d.ts +2794 -0
- package/oldest/index.ts +2799 -0
- package/package.json +4 -27
- package/LICENSE +0 -29
package/index.d.ts
CHANGED
|
@@ -1,247 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
declare class Blob {
|
|
20
|
-
constructor(bits?: BlobBits, options?: BlobOptions);
|
|
21
|
-
readonly size: number;
|
|
22
|
-
readonly type: string;
|
|
23
|
-
slice(start?: number, end?: number, type?: string): Blob;
|
|
24
|
-
arrayBuffer(): Promise<ArrayBuffer>;
|
|
25
|
-
text(): Promise<string>;
|
|
26
|
-
stream(): ReadableStream;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
declare type BlobBits = (ArrayBuffer | string | Blob)[];
|
|
30
|
-
|
|
31
|
-
interface BlobOptions {
|
|
32
|
-
type?: string;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
declare abstract class Body {
|
|
36
|
-
readonly body: ReadableStream | null;
|
|
37
|
-
readonly bodyUsed: boolean;
|
|
38
|
-
arrayBuffer(): Promise<ArrayBuffer>;
|
|
39
|
-
text(): Promise<string>;
|
|
40
|
-
json<T>(): Promise<T>;
|
|
41
|
-
formData(): Promise<FormData>;
|
|
42
|
-
blob(): Promise<Blob>;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
declare type BodyInit =
|
|
46
|
-
| ReadableStream
|
|
47
|
-
| string
|
|
48
|
-
| ArrayBuffer
|
|
49
|
-
| Blob
|
|
50
|
-
| URLSearchParams
|
|
51
|
-
| FormData;
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Back compat for code migrating to older definitions.
|
|
55
|
-
* @deprecated Use BodyInit instead.
|
|
56
|
-
*/
|
|
57
|
-
declare type BodyInitializer = BodyInit;
|
|
58
|
-
|
|
59
|
-
declare class ByteLengthQueuingStrategy {
|
|
60
|
-
constructor(init: QueuingStrategyInit);
|
|
61
|
-
readonly highWaterMark: number;
|
|
62
|
-
size(chunk?: any): number;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
declare abstract class Cache {
|
|
66
|
-
delete(
|
|
67
|
-
request: Request | string,
|
|
68
|
-
options?: CacheQueryOptions
|
|
69
|
-
): Promise<boolean>;
|
|
70
|
-
match(
|
|
71
|
-
request: Request | string,
|
|
72
|
-
options?: CacheQueryOptions
|
|
73
|
-
): Promise<Response | undefined>;
|
|
74
|
-
put(request: Request | string, response: Response): Promise<void>;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
interface CacheQueryOptions {
|
|
78
|
-
ignoreMethod?: boolean;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
declare abstract class CacheStorage {
|
|
82
|
-
open(cacheName: string): Promise<Cache>;
|
|
83
|
-
readonly default: Cache;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
interface CfRequestInit extends Omit<RequestInit, "cf"> {
|
|
87
|
-
cf?: RequestInitCfProperties;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Back compat support with older types.
|
|
92
|
-
* @deprecated Use CfRequestInit instead.
|
|
93
|
-
*/
|
|
94
|
-
declare type CfRequestInitializerDict = CfRequestInit;
|
|
95
|
-
|
|
96
|
-
declare class CloseEvent extends Event {
|
|
97
|
-
constructor(type: string, initializer: CloseEventInit);
|
|
98
|
-
readonly code: number;
|
|
99
|
-
readonly reason: string;
|
|
100
|
-
readonly wasClean: boolean;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
interface CloseEventInit {
|
|
104
|
-
code?: number;
|
|
105
|
-
reason?: string;
|
|
106
|
-
wasClean?: boolean;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Back compat for code migrating from older definitions.
|
|
111
|
-
* @deprecated Use CloseEventInit instead.
|
|
112
|
-
*/
|
|
113
|
-
declare type CloseEventInitializer = CloseEventInit;
|
|
114
|
-
|
|
115
|
-
interface Comment {
|
|
116
|
-
text: string;
|
|
117
|
-
readonly removed: boolean;
|
|
118
|
-
before(content: Content, options?: ContentOptions): Comment;
|
|
119
|
-
after(content: Content, options?: ContentOptions): Comment;
|
|
120
|
-
replace(content: Content, options?: ContentOptions): Comment;
|
|
121
|
-
remove(): Comment;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
declare class CompressionStream extends TransformStream {
|
|
125
|
-
constructor(format: "gzip" | "deflate");
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
interface Console {
|
|
129
|
-
debug(...data: any[]): void;
|
|
130
|
-
error(...data: any[]): void;
|
|
131
|
-
info(...data: any[]): void;
|
|
132
|
-
log(...data: any[]): void;
|
|
133
|
-
warn(...data: any[]): void;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
declare type Content = string | ReadableStream | Response;
|
|
137
|
-
|
|
138
|
-
interface ContentOptions {
|
|
139
|
-
html?: boolean;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
declare class CountQueuingStrategy {
|
|
143
|
-
constructor(init: QueuingStrategyInit);
|
|
144
|
-
readonly highWaterMark: number;
|
|
145
|
-
size(chunk?: any): number;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
declare abstract class Crypto {
|
|
149
|
-
readonly subtle: SubtleCrypto;
|
|
150
|
-
getRandomValues<
|
|
151
|
-
T extends
|
|
152
|
-
| Int8Array
|
|
153
|
-
| Uint8Array
|
|
154
|
-
| Int16Array
|
|
155
|
-
| Uint16Array
|
|
156
|
-
| Int32Array
|
|
157
|
-
| Uint32Array
|
|
158
|
-
| BigInt64Array
|
|
159
|
-
| BigUint64Array
|
|
160
|
-
>(buffer: T): T;
|
|
161
|
-
randomUUID(): string;
|
|
162
|
-
DigestStream: typeof DigestStream;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
declare abstract class CryptoKey {
|
|
166
|
-
readonly type: string;
|
|
167
|
-
readonly extractable: boolean;
|
|
168
|
-
readonly algorithm: CryptoKeyAlgorithmVariant;
|
|
169
|
-
readonly usages: string[];
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
interface CryptoKeyAesKeyAlgorithm {
|
|
173
|
-
name: string;
|
|
174
|
-
length: number;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
declare type CryptoKeyAlgorithmVariant =
|
|
178
|
-
| CryptoKeyKeyAlgorithm
|
|
179
|
-
| CryptoKeyAesKeyAlgorithm
|
|
180
|
-
| CryptoKeyHmacKeyAlgorithm
|
|
181
|
-
| CryptoKeyRsaKeyAlgorithm
|
|
182
|
-
| CryptoKeyEllipticKeyAlgorithm
|
|
183
|
-
| CryptoKeyArbitraryKeyAlgorithm;
|
|
184
|
-
|
|
185
|
-
interface CryptoKeyArbitraryKeyAlgorithm {
|
|
186
|
-
name: string;
|
|
187
|
-
hash?: CryptoKeyKeyAlgorithm;
|
|
188
|
-
namedCurve?: string;
|
|
189
|
-
length?: number;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
interface CryptoKeyEllipticKeyAlgorithm {
|
|
193
|
-
name: string;
|
|
194
|
-
namedCurve: string;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
interface CryptoKeyHmacKeyAlgorithm {
|
|
198
|
-
name: string;
|
|
199
|
-
hash: CryptoKeyKeyAlgorithm;
|
|
200
|
-
length: number;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
interface CryptoKeyKeyAlgorithm {
|
|
204
|
-
name: string;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
interface CryptoKeyPair {
|
|
208
|
-
publicKey: CryptoKey;
|
|
209
|
-
privateKey: CryptoKey;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
interface CryptoKeyRsaKeyAlgorithm {
|
|
213
|
-
name: string;
|
|
214
|
-
modulusLength: number;
|
|
215
|
-
publicExponent: ArrayBuffer;
|
|
216
|
-
hash?: CryptoKeyKeyAlgorithm;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
interface D1Database {
|
|
220
|
-
prepare(query: string): D1PreparedStatement;
|
|
221
|
-
dump(): Promise<ArrayBuffer>;
|
|
222
|
-
batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;
|
|
223
|
-
exec<T = unknown>(query: string): Promise<D1Result<T>>;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
interface D1PreparedStatement {
|
|
227
|
-
bind(...values: any[]): D1PreparedStatement;
|
|
228
|
-
first<T = unknown>(colName?: string): Promise<T>;
|
|
229
|
-
run<T = unknown>(): Promise<D1Result<T>>;
|
|
230
|
-
all<T = unknown>(): Promise<D1Result<T>>;
|
|
231
|
-
raw<T = unknown>(): Promise<T[]>;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
declare type D1Result<T = unknown> = {
|
|
235
|
-
results?: T[];
|
|
236
|
-
lastRowId: number | null;
|
|
237
|
-
changes: number;
|
|
238
|
-
duration: number;
|
|
239
|
-
error?: string;
|
|
240
|
-
};
|
|
241
|
-
|
|
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
|
|
242
17
|
declare class DOMException extends Error {
|
|
243
18
|
constructor(message?: string, name?: string);
|
|
19
|
+
readonly message: string;
|
|
20
|
+
readonly name: string;
|
|
244
21
|
readonly code: number;
|
|
22
|
+
readonly stack: any;
|
|
245
23
|
static readonly INDEX_SIZE_ERR: number;
|
|
246
24
|
static readonly DOMSTRING_SIZE_ERR: number;
|
|
247
25
|
static readonly HIERARCHY_REQUEST_ERR: number;
|
|
@@ -268,58 +46,292 @@ declare class DOMException extends Error {
|
|
|
268
46
|
static readonly INVALID_NODE_TYPE_ERR: number;
|
|
269
47
|
static readonly DATA_CLONE_ERR: number;
|
|
270
48
|
}
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
49
|
+
declare type WorkerGlobalScopeEventMap = {
|
|
50
|
+
fetch: FetchEvent;
|
|
51
|
+
scheduled: ScheduledEvent;
|
|
52
|
+
unhandledrejection: PromiseRejectionEvent;
|
|
53
|
+
rejectionhandled: PromiseRejectionEvent;
|
|
54
|
+
};
|
|
55
|
+
declare abstract class WorkerGlobalScope extends EventTarget<WorkerGlobalScopeEventMap> {
|
|
56
|
+
EventTarget: typeof EventTarget;
|
|
57
|
+
}
|
|
58
|
+
declare interface Console {
|
|
59
|
+
"assert"(condition?: boolean, ...data: any[]): void;
|
|
60
|
+
clear(): void;
|
|
61
|
+
count(label?: string): void;
|
|
62
|
+
countReset(label?: string): void;
|
|
63
|
+
debug(...data: any[]): void;
|
|
64
|
+
dir(item?: any, options?: any): void;
|
|
65
|
+
dirxml(...data: any[]): void;
|
|
66
|
+
error(...data: any[]): void;
|
|
67
|
+
group(...data: any[]): void;
|
|
68
|
+
groupCollapsed(...data: any[]): void;
|
|
69
|
+
groupEnd(): void;
|
|
70
|
+
info(...data: any[]): void;
|
|
71
|
+
log(...data: any[]): void;
|
|
72
|
+
table(tabularData?: any, properties?: string[]): void;
|
|
73
|
+
time(label?: string): void;
|
|
74
|
+
timeEnd(label?: string): void;
|
|
75
|
+
timeLog(label?: string, ...data: any[]): void;
|
|
76
|
+
timeStamp(label?: string): void;
|
|
77
|
+
trace(...data: any[]): void;
|
|
78
|
+
warn(...data: any[]): void;
|
|
274
79
|
}
|
|
275
|
-
|
|
276
|
-
declare
|
|
277
|
-
|
|
278
|
-
|
|
80
|
+
declare const console: Console;
|
|
81
|
+
declare type BufferSource = ArrayBufferView | ArrayBuffer;
|
|
82
|
+
declare namespace WebAssembly {
|
|
83
|
+
class CompileError extends Error {
|
|
84
|
+
constructor(message?: string);
|
|
85
|
+
}
|
|
86
|
+
class RuntimeError extends Error {
|
|
87
|
+
constructor(message?: string);
|
|
88
|
+
}
|
|
89
|
+
type ValueType =
|
|
90
|
+
| "anyfunc"
|
|
91
|
+
| "externref"
|
|
92
|
+
| "f32"
|
|
93
|
+
| "f64"
|
|
94
|
+
| "i32"
|
|
95
|
+
| "i64"
|
|
96
|
+
| "v128";
|
|
97
|
+
interface GlobalDescriptor {
|
|
98
|
+
value: ValueType;
|
|
99
|
+
mutable?: boolean;
|
|
100
|
+
}
|
|
101
|
+
class Global {
|
|
102
|
+
constructor(descriptor: GlobalDescriptor, value?: any);
|
|
103
|
+
value: any;
|
|
104
|
+
valueOf(): any;
|
|
105
|
+
}
|
|
106
|
+
type ImportValue = ExportValue | number;
|
|
107
|
+
type ModuleImports = Record<string, ImportValue>;
|
|
108
|
+
type Imports = Record<string, ModuleImports>;
|
|
109
|
+
type ExportValue = Function | Global | Memory | Table;
|
|
110
|
+
type Exports = Record<string, ExportValue>;
|
|
111
|
+
class Instance {
|
|
112
|
+
constructor(module: Module, imports?: Imports);
|
|
113
|
+
readonly exports: Exports;
|
|
114
|
+
}
|
|
115
|
+
interface MemoryDescriptor {
|
|
116
|
+
initial: number;
|
|
117
|
+
maximum?: number;
|
|
118
|
+
shared?: boolean;
|
|
119
|
+
}
|
|
120
|
+
class Memory {
|
|
121
|
+
constructor(descriptor: MemoryDescriptor);
|
|
122
|
+
readonly buffer: ArrayBuffer;
|
|
123
|
+
grow(delta: number): number;
|
|
124
|
+
}
|
|
125
|
+
type ImportExportKind = "function" | "global" | "memory" | "table";
|
|
126
|
+
interface ModuleExportDescriptor {
|
|
127
|
+
kind: ImportExportKind;
|
|
128
|
+
name: string;
|
|
129
|
+
}
|
|
130
|
+
interface ModuleImportDescriptor {
|
|
131
|
+
kind: ImportExportKind;
|
|
132
|
+
module: string;
|
|
133
|
+
name: string;
|
|
134
|
+
}
|
|
135
|
+
abstract class Module {
|
|
136
|
+
static customSections(module: Module, sectionName: string): ArrayBuffer[];
|
|
137
|
+
static exports(module: Module): ModuleExportDescriptor[];
|
|
138
|
+
static imports(module: Module): ModuleImportDescriptor[];
|
|
139
|
+
}
|
|
140
|
+
type TableKind = "anyfunc" | "externref";
|
|
141
|
+
interface TableDescriptor {
|
|
142
|
+
element: TableKind;
|
|
143
|
+
initial: number;
|
|
144
|
+
maximum?: number;
|
|
145
|
+
}
|
|
146
|
+
class Table {
|
|
147
|
+
constructor(descriptor: TableDescriptor, value?: any);
|
|
148
|
+
readonly length: number;
|
|
149
|
+
get(index: number): any;
|
|
150
|
+
grow(delta: number, value?: any): number;
|
|
151
|
+
set(index: number, value?: any): void;
|
|
152
|
+
}
|
|
153
|
+
function instantiate(module: Module, imports?: Imports): Promise<Instance>;
|
|
154
|
+
function validate(bytes: BufferSource): boolean;
|
|
155
|
+
}
|
|
156
|
+
/** This ServiceWorker API interface represents the global execution context of a service worker. */
|
|
157
|
+
declare interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
158
|
+
DOMException: typeof DOMException;
|
|
159
|
+
WorkerGlobalScope: typeof WorkerGlobalScope;
|
|
160
|
+
btoa(data: string): string;
|
|
161
|
+
atob(data: string): string;
|
|
162
|
+
setTimeout(callback: (...args: any[]) => void, msDelay?: number): number;
|
|
163
|
+
setTimeout<Args extends any[]>(
|
|
164
|
+
callback: (...args: Args) => void,
|
|
165
|
+
msDelay?: number,
|
|
166
|
+
...args: Args
|
|
167
|
+
): number;
|
|
168
|
+
clearTimeout(timeoutId: number | null): void;
|
|
169
|
+
setInterval(callback: (...args: any[]) => void, msDelay?: number): number;
|
|
170
|
+
setInterval<Args extends any[]>(
|
|
171
|
+
callback: (...args: Args) => void,
|
|
172
|
+
msDelay?: number,
|
|
173
|
+
...args: Args
|
|
174
|
+
): number;
|
|
175
|
+
clearInterval(timeoutId: number | null): void;
|
|
176
|
+
queueMicrotask(task: Function): void;
|
|
177
|
+
structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;
|
|
178
|
+
fetch(
|
|
179
|
+
input: RequestInfo,
|
|
180
|
+
init?: RequestInit<RequestInitCfProperties>
|
|
181
|
+
): Promise<Response>;
|
|
182
|
+
self: ServiceWorkerGlobalScope;
|
|
183
|
+
crypto: Crypto;
|
|
184
|
+
caches: CacheStorage;
|
|
185
|
+
scheduler: Scheduler;
|
|
186
|
+
Event: typeof Event;
|
|
187
|
+
ExtendableEvent: typeof ExtendableEvent;
|
|
188
|
+
PromiseRejectionEvent: typeof PromiseRejectionEvent;
|
|
189
|
+
FetchEvent: typeof FetchEvent;
|
|
190
|
+
TraceEvent: typeof TraceEvent;
|
|
191
|
+
ScheduledEvent: typeof ScheduledEvent;
|
|
192
|
+
MessageEvent: typeof MessageEvent;
|
|
193
|
+
CloseEvent: typeof CloseEvent;
|
|
194
|
+
ReadableStreamDefaultReader: typeof ReadableStreamDefaultReader;
|
|
195
|
+
ReadableStreamBYOBReader: typeof ReadableStreamBYOBReader;
|
|
196
|
+
ReadableStream: typeof ReadableStream;
|
|
197
|
+
WritableStream: typeof WritableStream;
|
|
198
|
+
WritableStreamDefaultWriter: typeof WritableStreamDefaultWriter;
|
|
199
|
+
TransformStream: typeof TransformStream;
|
|
200
|
+
ByteLengthQueuingStrategy: typeof ByteLengthQueuingStrategy;
|
|
201
|
+
CountQueuingStrategy: typeof CountQueuingStrategy;
|
|
202
|
+
CompressionStream: typeof CompressionStream;
|
|
203
|
+
DecompressionStream: typeof DecompressionStream;
|
|
204
|
+
TextEncoderStream: typeof TextEncoderStream;
|
|
205
|
+
TextDecoderStream: typeof TextDecoderStream;
|
|
206
|
+
Headers: typeof Headers;
|
|
207
|
+
Body: typeof Body;
|
|
208
|
+
Request: typeof Request;
|
|
209
|
+
Response: typeof Response;
|
|
210
|
+
WebSocket: typeof WebSocket;
|
|
211
|
+
WebSocketPair: typeof WebSocketPair;
|
|
212
|
+
AbortController: typeof AbortController;
|
|
213
|
+
AbortSignal: typeof AbortSignal;
|
|
214
|
+
TextDecoder: typeof TextDecoder;
|
|
215
|
+
TextEncoder: typeof TextEncoder;
|
|
216
|
+
URL: typeof URL;
|
|
217
|
+
URLSearchParams: typeof URLSearchParams;
|
|
218
|
+
URLPattern: typeof URLPattern;
|
|
219
|
+
Blob: typeof Blob;
|
|
220
|
+
File: typeof File;
|
|
221
|
+
FormData: typeof FormData;
|
|
222
|
+
Crypto: typeof Crypto;
|
|
223
|
+
SubtleCrypto: typeof SubtleCrypto;
|
|
224
|
+
CryptoKey: typeof CryptoKey;
|
|
225
|
+
CacheStorage: typeof CacheStorage;
|
|
226
|
+
Cache: typeof Cache;
|
|
227
|
+
FixedLengthStream: typeof FixedLengthStream;
|
|
228
|
+
IdentityTransformStream: typeof IdentityTransformStream;
|
|
229
|
+
HTMLRewriter: typeof HTMLRewriter;
|
|
230
|
+
connect(address: string, options?: SocketOptions): Socket;
|
|
279
231
|
}
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
232
|
+
declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(
|
|
233
|
+
type: Type,
|
|
234
|
+
handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>,
|
|
235
|
+
options?: EventTargetAddEventListenerOptions | boolean
|
|
236
|
+
): void;
|
|
237
|
+
declare function removeEventListener<
|
|
238
|
+
Type extends keyof WorkerGlobalScopeEventMap
|
|
239
|
+
>(
|
|
240
|
+
type: Type,
|
|
241
|
+
handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>,
|
|
242
|
+
options?: EventTargetEventListenerOptions | boolean
|
|
243
|
+
): void;
|
|
244
|
+
/** 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. */
|
|
245
|
+
declare function dispatchEvent(
|
|
246
|
+
event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap]
|
|
247
|
+
): boolean;
|
|
248
|
+
declare function btoa(data: string): string;
|
|
249
|
+
declare function atob(data: string): string;
|
|
250
|
+
declare function setTimeout(
|
|
251
|
+
callback: (...args: any[]) => void,
|
|
252
|
+
msDelay?: number
|
|
253
|
+
): number;
|
|
254
|
+
declare function setTimeout<Args extends any[]>(
|
|
255
|
+
callback: (...args: Args) => void,
|
|
256
|
+
msDelay?: number,
|
|
257
|
+
...args: Args
|
|
258
|
+
): number;
|
|
259
|
+
declare function clearTimeout(timeoutId: number | null): void;
|
|
260
|
+
declare function setInterval(
|
|
261
|
+
callback: (...args: any[]) => void,
|
|
262
|
+
msDelay?: number
|
|
263
|
+
): number;
|
|
264
|
+
declare function setInterval<Args extends any[]>(
|
|
265
|
+
callback: (...args: Args) => void,
|
|
266
|
+
msDelay?: number,
|
|
267
|
+
...args: Args
|
|
268
|
+
): number;
|
|
269
|
+
declare function clearInterval(timeoutId: number | null): void;
|
|
270
|
+
declare function queueMicrotask(task: Function): void;
|
|
271
|
+
declare function structuredClone<T>(
|
|
272
|
+
value: T,
|
|
273
|
+
options?: StructuredSerializeOptions
|
|
274
|
+
): T;
|
|
275
|
+
declare function fetch(
|
|
276
|
+
input: RequestInfo,
|
|
277
|
+
init?: RequestInit<RequestInitCfProperties>
|
|
278
|
+
): Promise<Response>;
|
|
279
|
+
declare const self: ServiceWorkerGlobalScope;
|
|
280
|
+
declare const crypto: Crypto;
|
|
281
|
+
declare const caches: CacheStorage;
|
|
282
|
+
declare const scheduler: Scheduler;
|
|
283
|
+
declare function connect(address: string, options?: SocketOptions): Socket;
|
|
284
|
+
declare interface ExecutionContext {
|
|
285
|
+
waitUntil(promise: void | Promise<void>): void;
|
|
286
|
+
passThroughOnException(): void;
|
|
285
287
|
}
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
288
|
+
declare type ExportedHandlerFetchHandler<Env = unknown> = (
|
|
289
|
+
request: Request,
|
|
290
|
+
env: Env,
|
|
291
|
+
ctx: ExecutionContext
|
|
292
|
+
) => Response | Promise<Response>;
|
|
293
|
+
declare type ExportedHandlerTraceHandler<Env = unknown> = (
|
|
294
|
+
traces: TraceItem[],
|
|
295
|
+
env: Env,
|
|
296
|
+
ctx: ExecutionContext
|
|
297
|
+
) => void | Promise<void>;
|
|
298
|
+
declare type ExportedHandlerScheduledHandler<Env = unknown> = (
|
|
299
|
+
controller: ScheduledController,
|
|
300
|
+
env: Env,
|
|
301
|
+
ctx: ExecutionContext
|
|
302
|
+
) => void | Promise<void>;
|
|
303
|
+
declare type ExportedHandlerQueueHandler<Env = unknown, Message = unknown> = (
|
|
304
|
+
batch: MessageBatch<Message>,
|
|
305
|
+
env: Env,
|
|
306
|
+
ctx: ExecutionContext
|
|
307
|
+
) => void | Promise<void>;
|
|
308
|
+
declare interface ExportedHandler<Env = unknown, QueueMessage = unknown> {
|
|
309
|
+
fetch?: ExportedHandlerFetchHandler<Env>;
|
|
310
|
+
trace?: ExportedHandlerTraceHandler<Env>;
|
|
311
|
+
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
312
|
+
queue?: ExportedHandlerQueueHandler<Env, QueueMessage>;
|
|
289
313
|
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
fetch(request: Request): Promise<Response>;
|
|
293
|
-
alarm?(): Promise<void>;
|
|
314
|
+
declare interface StructuredSerializeOptions {
|
|
315
|
+
transfer?: any[];
|
|
294
316
|
}
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
317
|
+
declare abstract class PromiseRejectionEvent extends Event {
|
|
318
|
+
readonly promise: Promise<any>;
|
|
319
|
+
readonly reason: any;
|
|
298
320
|
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
noCache?: boolean;
|
|
321
|
+
declare interface DurableObject {
|
|
322
|
+
fetch(request: Request): Response | Promise<Response>;
|
|
323
|
+
alarm?(): void | Promise<void>;
|
|
303
324
|
}
|
|
304
|
-
|
|
305
|
-
|
|
325
|
+
declare interface DurableObjectStub extends Fetcher {
|
|
326
|
+
readonly id: DurableObjectId;
|
|
327
|
+
readonly name?: string;
|
|
328
|
+
}
|
|
329
|
+
declare interface DurableObjectId {
|
|
306
330
|
toString(): string;
|
|
307
331
|
equals(other: DurableObjectId): boolean;
|
|
308
332
|
readonly name?: string;
|
|
309
333
|
}
|
|
310
|
-
|
|
311
|
-
interface DurableObjectListOptions {
|
|
312
|
-
start?: string;
|
|
313
|
-
startAfter?: string;
|
|
314
|
-
end?: string;
|
|
315
|
-
prefix?: string;
|
|
316
|
-
reverse?: boolean;
|
|
317
|
-
limit?: number;
|
|
318
|
-
allowConcurrency?: boolean;
|
|
319
|
-
noCache?: boolean;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
interface DurableObjectNamespace {
|
|
334
|
+
declare interface DurableObjectNamespace {
|
|
323
335
|
newUniqueId(
|
|
324
336
|
options?: DurableObjectNamespaceNewUniqueIdOptions
|
|
325
337
|
): DurableObjectId;
|
|
@@ -327,30 +339,16 @@ interface DurableObjectNamespace {
|
|
|
327
339
|
idFromString(id: string): DurableObjectId;
|
|
328
340
|
get(id: DurableObjectId): DurableObjectStub;
|
|
329
341
|
}
|
|
330
|
-
|
|
331
|
-
interface DurableObjectNamespaceNewUniqueIdOptions {
|
|
342
|
+
declare interface DurableObjectNamespaceNewUniqueIdOptions {
|
|
332
343
|
jurisdiction?: string;
|
|
333
344
|
}
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
allowUnconfirmed?: boolean;
|
|
338
|
-
noCache?: boolean;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
interface DurableObjectSetAlarmOptions {
|
|
342
|
-
allowConcurrency?: boolean;
|
|
343
|
-
allowUnconfirmed?: boolean;
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
interface DurableObjectState {
|
|
347
|
-
waitUntil(promise: Promise<any>): void;
|
|
348
|
-
id: DurableObjectId;
|
|
345
|
+
declare interface DurableObjectState {
|
|
346
|
+
waitUntil(promise: void | Promise<void>): void;
|
|
347
|
+
readonly id: DurableObjectId;
|
|
349
348
|
readonly storage: DurableObjectStorage;
|
|
350
349
|
blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
|
|
351
350
|
}
|
|
352
|
-
|
|
353
|
-
interface DurableObjectStorage {
|
|
351
|
+
declare interface DurableObjectTransaction {
|
|
354
352
|
get<T = unknown>(
|
|
355
353
|
key: string,
|
|
356
354
|
options?: DurableObjectGetOptions
|
|
@@ -373,44 +371,15 @@ interface DurableObjectStorage {
|
|
|
373
371
|
): Promise<void>;
|
|
374
372
|
delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;
|
|
375
373
|
delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;
|
|
376
|
-
|
|
377
|
-
transaction<T>(
|
|
378
|
-
closure: (txn: DurableObjectTransaction) => Promise<T>
|
|
379
|
-
): Promise<T>;
|
|
374
|
+
rollback(): void;
|
|
380
375
|
getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;
|
|
381
376
|
setAlarm(
|
|
382
377
|
scheduledTime: number | Date,
|
|
383
378
|
options?: DurableObjectSetAlarmOptions
|
|
384
379
|
): Promise<void>;
|
|
385
380
|
deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
|
|
386
|
-
sync(): Promise<void>;
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
/**
|
|
390
|
-
*
|
|
391
|
-
* @deprecated Don't use. Introduced incidentally in workers-types 3.x. Scheduled for removal.
|
|
392
|
-
*/
|
|
393
|
-
declare type DurableObjectStorageOperationsGetOptions = DurableObjectGetOptions;
|
|
394
|
-
|
|
395
|
-
/**
|
|
396
|
-
*
|
|
397
|
-
* @deprecated Don't use. Introduced incidentally in workers-types 3.x. Scheduled for removal.
|
|
398
|
-
*/
|
|
399
|
-
declare type DurableObjectStorageOperationsListOptions =
|
|
400
|
-
DurableObjectListOptions;
|
|
401
|
-
|
|
402
|
-
/**
|
|
403
|
-
*
|
|
404
|
-
* @deprecated Don't use. Introduced incidentally in workers-types 3.x. Scheduled for removal.
|
|
405
|
-
*/
|
|
406
|
-
declare type DurableObjectStorageOperationsPutOptions = DurableObjectPutOptions;
|
|
407
|
-
|
|
408
|
-
interface DurableObjectStub extends Fetcher {
|
|
409
|
-
readonly id: DurableObjectId;
|
|
410
|
-
readonly name?: string;
|
|
411
381
|
}
|
|
412
|
-
|
|
413
|
-
interface DurableObjectTransaction {
|
|
382
|
+
declare interface DurableObjectStorage {
|
|
414
383
|
get<T = unknown>(
|
|
415
384
|
key: string,
|
|
416
385
|
options?: DurableObjectGetOptions
|
|
@@ -433,62 +402,75 @@ interface DurableObjectTransaction {
|
|
|
433
402
|
): Promise<void>;
|
|
434
403
|
delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;
|
|
435
404
|
delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;
|
|
436
|
-
|
|
405
|
+
deleteAll(options?: DurableObjectPutOptions): Promise<void>;
|
|
406
|
+
transaction<T>(
|
|
407
|
+
closure: (txn: DurableObjectTransaction) => Promise<T>
|
|
408
|
+
): Promise<T>;
|
|
437
409
|
getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;
|
|
438
410
|
setAlarm(
|
|
439
411
|
scheduledTime: number | Date,
|
|
440
412
|
options?: DurableObjectSetAlarmOptions
|
|
441
413
|
): Promise<void>;
|
|
442
414
|
deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
|
|
415
|
+
sync(): Promise<void>;
|
|
443
416
|
}
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
removeAttribute(name: string): Element;
|
|
454
|
-
before(content: Content, options?: ContentOptions): Element;
|
|
455
|
-
after(content: Content, options?: ContentOptions): Element;
|
|
456
|
-
prepend(content: Content, options?: ContentOptions): Element;
|
|
457
|
-
append(content: Content, options?: ContentOptions): Element;
|
|
458
|
-
replace(content: Content, options?: ContentOptions): Element;
|
|
459
|
-
remove(): Element;
|
|
460
|
-
removeAndKeepContent(): Element;
|
|
461
|
-
setInnerContent(content: Content, options?: ContentOptions): Element;
|
|
462
|
-
onEndTag(handler: (tag: EndTag) => void | Promise<void>): void;
|
|
417
|
+
declare interface DurableObjectListOptions {
|
|
418
|
+
start?: string;
|
|
419
|
+
startAfter?: string;
|
|
420
|
+
end?: string;
|
|
421
|
+
prefix?: string;
|
|
422
|
+
reverse?: boolean;
|
|
423
|
+
limit?: number;
|
|
424
|
+
allowConcurrency?: boolean;
|
|
425
|
+
noCache?: boolean;
|
|
463
426
|
}
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
427
|
+
declare interface DurableObjectGetOptions {
|
|
428
|
+
allowConcurrency?: boolean;
|
|
429
|
+
noCache?: boolean;
|
|
430
|
+
}
|
|
431
|
+
declare interface DurableObjectGetAlarmOptions {
|
|
432
|
+
allowConcurrency?: boolean;
|
|
433
|
+
}
|
|
434
|
+
declare interface DurableObjectPutOptions {
|
|
435
|
+
allowConcurrency?: boolean;
|
|
436
|
+
allowUnconfirmed?: boolean;
|
|
437
|
+
noCache?: boolean;
|
|
438
|
+
}
|
|
439
|
+
declare interface DurableObjectSetAlarmOptions {
|
|
440
|
+
allowConcurrency?: boolean;
|
|
441
|
+
allowUnconfirmed?: boolean;
|
|
470
442
|
}
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
443
|
+
declare interface AnalyticsEngineDataset {
|
|
444
|
+
writeDataPoint(event?: AnalyticsEngineDataPoint): void;
|
|
445
|
+
}
|
|
446
|
+
declare interface AnalyticsEngineDataPoint {
|
|
447
|
+
indexes?: ((ArrayBuffer | string) | null)[];
|
|
448
|
+
doubles?: number[];
|
|
449
|
+
blobs?: ((ArrayBuffer | string) | null)[];
|
|
478
450
|
}
|
|
479
|
-
|
|
480
451
|
declare class Event {
|
|
481
452
|
constructor(type: string, init?: EventInit);
|
|
453
|
+
/** Returns the type of event, e.g. "click", "hashchange", or "submit". */
|
|
482
454
|
readonly type: string;
|
|
455
|
+
/** Returns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE. */
|
|
483
456
|
readonly eventPhase: number;
|
|
457
|
+
/** 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. */
|
|
484
458
|
readonly composed: boolean;
|
|
459
|
+
/** 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. */
|
|
485
460
|
readonly bubbles: boolean;
|
|
461
|
+
/** 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. */
|
|
486
462
|
readonly cancelable: boolean;
|
|
463
|
+
/** Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise. */
|
|
487
464
|
readonly defaultPrevented: boolean;
|
|
465
|
+
/** @deprecated */
|
|
488
466
|
readonly returnValue: boolean;
|
|
467
|
+
/** Returns the object whose event listener's callback is currently being invoked. */
|
|
489
468
|
readonly currentTarget?: EventTarget;
|
|
469
|
+
/** @deprecated */
|
|
490
470
|
readonly srcElement?: EventTarget;
|
|
471
|
+
/** Returns the event's timestamp as the number of milliseconds measured relative to the time origin. */
|
|
491
472
|
readonly timeStamp: number;
|
|
473
|
+
/** Returns true if event was dispatched by the user agent, and false otherwise. */
|
|
492
474
|
readonly isTrusted: boolean;
|
|
493
475
|
cancelBubble: boolean;
|
|
494
476
|
stopImmediatePropagation(): void;
|
|
@@ -500,25 +482,20 @@ declare class Event {
|
|
|
500
482
|
static readonly AT_TARGET: number;
|
|
501
483
|
static readonly BUBBLING_PHASE: number;
|
|
502
484
|
}
|
|
503
|
-
|
|
504
|
-
interface EventInit {
|
|
485
|
+
declare interface EventInit {
|
|
505
486
|
bubbles?: boolean;
|
|
506
487
|
cancelable?: boolean;
|
|
507
488
|
composed?: boolean;
|
|
508
489
|
}
|
|
509
|
-
|
|
510
490
|
declare type EventListener<EventType extends Event = Event> = (
|
|
511
491
|
event: EventType
|
|
512
492
|
) => void;
|
|
513
|
-
|
|
514
|
-
interface EventListenerObject<EventType extends Event = Event> {
|
|
493
|
+
declare interface EventListenerObject<EventType extends Event = Event> {
|
|
515
494
|
handleEvent(event: EventType): void;
|
|
516
495
|
}
|
|
517
|
-
|
|
518
496
|
declare type EventListenerOrEventListenerObject<
|
|
519
497
|
EventType extends Event = Event
|
|
520
498
|
> = EventListener<EventType> | EventListenerObject<EventType>;
|
|
521
|
-
|
|
522
499
|
declare class EventTarget<
|
|
523
500
|
EventMap extends Record<string, Event> = Record<string, Event>
|
|
524
501
|
> {
|
|
@@ -535,102 +512,342 @@ declare class EventTarget<
|
|
|
535
512
|
): void;
|
|
536
513
|
dispatchEvent(event: EventMap[keyof EventMap]): boolean;
|
|
537
514
|
}
|
|
538
|
-
|
|
539
|
-
|
|
515
|
+
declare interface EventTargetEventListenerOptions {
|
|
516
|
+
capture?: boolean;
|
|
517
|
+
}
|
|
518
|
+
declare interface EventTargetAddEventListenerOptions {
|
|
540
519
|
capture?: boolean;
|
|
541
520
|
passive?: boolean;
|
|
542
521
|
once?: boolean;
|
|
543
522
|
signal?: AbortSignal;
|
|
544
523
|
}
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
capture?: boolean;
|
|
524
|
+
declare interface EventTargetHandlerObject {
|
|
525
|
+
handleEvent: (event: Event) => any | undefined;
|
|
548
526
|
}
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
527
|
+
declare class AbortController {
|
|
528
|
+
constructor();
|
|
529
|
+
/** Returns the AbortSignal object associated with this object. */
|
|
530
|
+
readonly signal: AbortSignal;
|
|
531
|
+
abort(reason?: any): void;
|
|
552
532
|
}
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
533
|
+
declare abstract class AbortSignal extends EventTarget {
|
|
534
|
+
static abort(reason?: any): AbortSignal;
|
|
535
|
+
static timeout(delay: number): AbortSignal;
|
|
536
|
+
/** Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. */
|
|
537
|
+
readonly aborted: boolean;
|
|
538
|
+
readonly reason: any;
|
|
539
|
+
throwIfAborted(): void;
|
|
557
540
|
}
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
fetch?: ExportedHandlerFetchHandler<Env>;
|
|
561
|
-
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
541
|
+
declare interface Scheduler {
|
|
542
|
+
wait(delay: number, maybeOptions?: SchedulerWaitOptions): Promise<void>;
|
|
562
543
|
}
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
544
|
+
declare interface SchedulerWaitOptions {
|
|
545
|
+
signal?: AbortSignal;
|
|
546
|
+
}
|
|
547
|
+
declare abstract class ExtendableEvent extends Event {
|
|
548
|
+
waitUntil(promise: void | Promise<void>): void;
|
|
549
|
+
}
|
|
550
|
+
declare class Blob {
|
|
551
|
+
constructor(
|
|
552
|
+
bits?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[],
|
|
553
|
+
options?: BlobOptions
|
|
554
|
+
);
|
|
555
|
+
readonly size: number;
|
|
556
|
+
readonly type: string;
|
|
557
|
+
slice(start?: number, end?: number, type?: string): Blob;
|
|
558
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
559
|
+
text(): Promise<string>;
|
|
560
|
+
stream(): ReadableStream;
|
|
561
|
+
}
|
|
562
|
+
declare interface BlobOptions {
|
|
563
|
+
type?: string;
|
|
564
|
+
}
|
|
565
|
+
declare class File extends Blob {
|
|
566
|
+
constructor(
|
|
567
|
+
bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined,
|
|
568
|
+
name: string,
|
|
569
|
+
options?: FileOptions
|
|
570
|
+
);
|
|
571
|
+
readonly name: string;
|
|
572
|
+
readonly lastModified: number;
|
|
573
|
+
}
|
|
574
|
+
declare interface FileOptions {
|
|
575
|
+
type?: string;
|
|
576
|
+
lastModified?: number;
|
|
577
|
+
}
|
|
578
|
+
declare abstract class CacheStorage {
|
|
579
|
+
open(cacheName: string): Promise<Cache>;
|
|
580
|
+
readonly default: Cache;
|
|
581
|
+
}
|
|
582
|
+
declare abstract class Cache {
|
|
583
|
+
delete(request: RequestInfo, options?: CacheQueryOptions): Promise<boolean>;
|
|
584
|
+
match(
|
|
585
|
+
request: RequestInfo,
|
|
586
|
+
options?: CacheQueryOptions
|
|
587
|
+
): Promise<Response | undefined>;
|
|
588
|
+
put(request: RequestInfo, response: Response): Promise<void>;
|
|
589
|
+
}
|
|
590
|
+
declare interface CacheQueryOptions {
|
|
591
|
+
ignoreMethod?: boolean;
|
|
592
|
+
}
|
|
593
|
+
declare abstract class Crypto {
|
|
594
|
+
/** Available only in secure contexts. */
|
|
595
|
+
readonly subtle: SubtleCrypto;
|
|
596
|
+
getRandomValues<
|
|
597
|
+
T extends
|
|
598
|
+
| Int8Array
|
|
599
|
+
| Uint8Array
|
|
600
|
+
| Int16Array
|
|
601
|
+
| Uint16Array
|
|
602
|
+
| Int32Array
|
|
603
|
+
| Uint32Array
|
|
604
|
+
| BigInt64Array
|
|
605
|
+
| BigUint64Array
|
|
606
|
+
>(buffer: T): T;
|
|
607
|
+
randomUUID(): string;
|
|
608
|
+
DigestStream: typeof DigestStream;
|
|
609
|
+
}
|
|
610
|
+
declare abstract class SubtleCrypto {
|
|
611
|
+
encrypt(
|
|
612
|
+
algorithm: string | SubtleCryptoEncryptAlgorithm,
|
|
613
|
+
key: CryptoKey,
|
|
614
|
+
plainText: ArrayBuffer | ArrayBufferView
|
|
615
|
+
): Promise<ArrayBuffer>;
|
|
616
|
+
decrypt(
|
|
617
|
+
algorithm: string | SubtleCryptoEncryptAlgorithm,
|
|
618
|
+
key: CryptoKey,
|
|
619
|
+
cipherText: ArrayBuffer | ArrayBufferView
|
|
620
|
+
): Promise<ArrayBuffer>;
|
|
621
|
+
sign(
|
|
622
|
+
algorithm: string | SubtleCryptoSignAlgorithm,
|
|
623
|
+
key: CryptoKey,
|
|
624
|
+
data: ArrayBuffer | ArrayBufferView
|
|
625
|
+
): Promise<ArrayBuffer>;
|
|
626
|
+
verify(
|
|
627
|
+
algorithm: string | SubtleCryptoSignAlgorithm,
|
|
628
|
+
key: CryptoKey,
|
|
629
|
+
signature: ArrayBuffer | ArrayBufferView,
|
|
630
|
+
data: ArrayBuffer | ArrayBufferView
|
|
631
|
+
): Promise<boolean>;
|
|
632
|
+
digest(
|
|
633
|
+
algorithm: string | SubtleCryptoHashAlgorithm,
|
|
634
|
+
data: ArrayBuffer | ArrayBufferView
|
|
635
|
+
): Promise<ArrayBuffer>;
|
|
636
|
+
generateKey(
|
|
637
|
+
algorithm: string | SubtleCryptoGenerateKeyAlgorithm,
|
|
638
|
+
extractable: boolean,
|
|
639
|
+
keyUsages: string[]
|
|
640
|
+
): Promise<CryptoKey | CryptoKeyPair>;
|
|
641
|
+
deriveKey(
|
|
642
|
+
algorithm: string | SubtleCryptoDeriveKeyAlgorithm,
|
|
643
|
+
baseKey: CryptoKey,
|
|
644
|
+
derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm,
|
|
645
|
+
extractable: boolean,
|
|
646
|
+
keyUsages: string[]
|
|
647
|
+
): Promise<CryptoKey>;
|
|
648
|
+
deriveBits(
|
|
649
|
+
algorithm: string | SubtleCryptoDeriveKeyAlgorithm,
|
|
650
|
+
baseKey: CryptoKey,
|
|
651
|
+
length: number | null
|
|
652
|
+
): Promise<ArrayBuffer>;
|
|
653
|
+
importKey(
|
|
654
|
+
format: string,
|
|
655
|
+
keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey,
|
|
656
|
+
algorithm: string | SubtleCryptoImportKeyAlgorithm,
|
|
657
|
+
extractable: boolean,
|
|
658
|
+
keyUsages: string[]
|
|
659
|
+
): Promise<CryptoKey>;
|
|
660
|
+
exportKey(format: string, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;
|
|
661
|
+
wrapKey(
|
|
662
|
+
format: string,
|
|
663
|
+
key: CryptoKey,
|
|
664
|
+
wrappingKey: CryptoKey,
|
|
665
|
+
wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm
|
|
666
|
+
): Promise<ArrayBuffer>;
|
|
667
|
+
unwrapKey(
|
|
668
|
+
format: string,
|
|
669
|
+
wrappedKey: ArrayBuffer | ArrayBufferView,
|
|
670
|
+
unwrappingKey: CryptoKey,
|
|
671
|
+
unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm,
|
|
672
|
+
unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm,
|
|
673
|
+
extractable: boolean,
|
|
674
|
+
keyUsages: string[]
|
|
675
|
+
): Promise<CryptoKey>;
|
|
676
|
+
timingSafeEqual(
|
|
677
|
+
a: ArrayBuffer | ArrayBufferView,
|
|
678
|
+
b: ArrayBuffer | ArrayBufferView
|
|
679
|
+
): boolean;
|
|
680
|
+
}
|
|
681
|
+
declare abstract class CryptoKey {
|
|
682
|
+
readonly type: string;
|
|
683
|
+
readonly extractable: boolean;
|
|
684
|
+
readonly algorithm:
|
|
685
|
+
| CryptoKeyKeyAlgorithm
|
|
686
|
+
| CryptoKeyAesKeyAlgorithm
|
|
687
|
+
| CryptoKeyHmacKeyAlgorithm
|
|
688
|
+
| CryptoKeyRsaKeyAlgorithm
|
|
689
|
+
| CryptoKeyEllipticKeyAlgorithm
|
|
690
|
+
| CryptoKeyArbitraryKeyAlgorithm;
|
|
691
|
+
readonly usages: string[];
|
|
692
|
+
}
|
|
693
|
+
declare interface CryptoKeyPair {
|
|
694
|
+
publicKey: CryptoKey;
|
|
695
|
+
privateKey: CryptoKey;
|
|
696
|
+
}
|
|
697
|
+
declare interface JsonWebKey {
|
|
698
|
+
kty: string;
|
|
699
|
+
use?: string;
|
|
700
|
+
key_ops?: string[];
|
|
701
|
+
alg?: string;
|
|
702
|
+
ext?: boolean;
|
|
703
|
+
crv?: string;
|
|
704
|
+
x?: string;
|
|
705
|
+
y?: string;
|
|
706
|
+
d?: string;
|
|
707
|
+
n?: string;
|
|
708
|
+
e?: string;
|
|
709
|
+
p?: string;
|
|
710
|
+
q?: string;
|
|
711
|
+
dp?: string;
|
|
712
|
+
dq?: string;
|
|
713
|
+
qi?: string;
|
|
714
|
+
oth?: RsaOtherPrimesInfo[];
|
|
715
|
+
k?: string;
|
|
716
|
+
}
|
|
717
|
+
declare interface RsaOtherPrimesInfo {
|
|
718
|
+
r?: string;
|
|
719
|
+
d?: string;
|
|
720
|
+
t?: string;
|
|
721
|
+
}
|
|
722
|
+
declare interface SubtleCryptoDeriveKeyAlgorithm {
|
|
723
|
+
name: string;
|
|
724
|
+
salt?: ArrayBuffer;
|
|
725
|
+
iterations?: number;
|
|
726
|
+
hash?: string | SubtleCryptoHashAlgorithm;
|
|
727
|
+
$public?: CryptoKey;
|
|
728
|
+
info?: ArrayBuffer;
|
|
729
|
+
}
|
|
730
|
+
declare interface SubtleCryptoEncryptAlgorithm {
|
|
731
|
+
name: string;
|
|
732
|
+
iv?: ArrayBuffer;
|
|
733
|
+
additionalData?: ArrayBuffer;
|
|
734
|
+
tagLength?: number;
|
|
735
|
+
counter?: ArrayBuffer;
|
|
736
|
+
length?: number;
|
|
737
|
+
label?: ArrayBuffer;
|
|
738
|
+
}
|
|
739
|
+
declare interface SubtleCryptoGenerateKeyAlgorithm {
|
|
740
|
+
name: string;
|
|
741
|
+
hash?: string | SubtleCryptoHashAlgorithm;
|
|
742
|
+
modulusLength?: number;
|
|
743
|
+
publicExponent?: ArrayBuffer;
|
|
744
|
+
length?: number;
|
|
745
|
+
namedCurve?: string;
|
|
746
|
+
}
|
|
747
|
+
declare interface SubtleCryptoHashAlgorithm {
|
|
748
|
+
name: string;
|
|
749
|
+
}
|
|
750
|
+
declare interface SubtleCryptoImportKeyAlgorithm {
|
|
751
|
+
name: string;
|
|
752
|
+
hash?: string | SubtleCryptoHashAlgorithm;
|
|
753
|
+
length?: number;
|
|
754
|
+
namedCurve?: string;
|
|
755
|
+
compressed?: boolean;
|
|
756
|
+
}
|
|
757
|
+
declare interface SubtleCryptoSignAlgorithm {
|
|
758
|
+
name: string;
|
|
759
|
+
hash?: string | SubtleCryptoHashAlgorithm;
|
|
760
|
+
dataLength?: number;
|
|
761
|
+
saltLength?: number;
|
|
762
|
+
}
|
|
763
|
+
declare interface CryptoKeyKeyAlgorithm {
|
|
764
|
+
name: string;
|
|
765
|
+
}
|
|
766
|
+
declare interface CryptoKeyAesKeyAlgorithm {
|
|
767
|
+
name: string;
|
|
768
|
+
length: number;
|
|
769
|
+
}
|
|
770
|
+
declare interface CryptoKeyHmacKeyAlgorithm {
|
|
771
|
+
name: string;
|
|
772
|
+
hash: CryptoKeyKeyAlgorithm;
|
|
773
|
+
length: number;
|
|
774
|
+
}
|
|
775
|
+
declare interface CryptoKeyRsaKeyAlgorithm {
|
|
776
|
+
name: string;
|
|
777
|
+
modulusLength: number;
|
|
778
|
+
publicExponent: ArrayBuffer;
|
|
779
|
+
hash?: CryptoKeyKeyAlgorithm;
|
|
780
|
+
}
|
|
781
|
+
declare interface CryptoKeyEllipticKeyAlgorithm {
|
|
782
|
+
name: string;
|
|
783
|
+
namedCurve: string;
|
|
784
|
+
}
|
|
785
|
+
declare interface CryptoKeyArbitraryKeyAlgorithm {
|
|
786
|
+
name: string;
|
|
787
|
+
hash?: CryptoKeyKeyAlgorithm;
|
|
788
|
+
namedCurve?: string;
|
|
789
|
+
length?: number;
|
|
579
790
|
}
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
791
|
+
declare class DigestStream extends WritableStream<
|
|
792
|
+
ArrayBuffer | ArrayBufferView
|
|
793
|
+
> {
|
|
794
|
+
constructor(algorithm: string | SubtleCryptoHashAlgorithm);
|
|
795
|
+
readonly digest: Promise<ArrayBuffer>;
|
|
585
796
|
}
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
):
|
|
797
|
+
declare class TextDecoder {
|
|
798
|
+
constructor(decoder?: string, options?: TextDecoderConstructorOptions);
|
|
799
|
+
decode(
|
|
800
|
+
input?: ArrayBuffer | ArrayBufferView,
|
|
801
|
+
options?: TextDecoderDecodeOptions
|
|
802
|
+
): string;
|
|
803
|
+
readonly encoding: string;
|
|
804
|
+
readonly fatal: boolean;
|
|
805
|
+
readonly ignoreBOM: boolean;
|
|
592
806
|
}
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
readonly
|
|
807
|
+
declare class TextEncoder {
|
|
808
|
+
constructor();
|
|
809
|
+
encode(input?: string): Uint8Array;
|
|
810
|
+
encodeInto(input: string, buffer: Uint8Array): TextEncoderEncodeIntoResult;
|
|
811
|
+
readonly encoding: string;
|
|
598
812
|
}
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
lastModified?: number;
|
|
813
|
+
declare interface TextDecoderConstructorOptions {
|
|
814
|
+
fatal: boolean;
|
|
815
|
+
ignoreBOM: boolean;
|
|
603
816
|
}
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
817
|
+
declare interface TextDecoderDecodeOptions {
|
|
818
|
+
stream: boolean;
|
|
819
|
+
}
|
|
820
|
+
declare interface TextEncoderEncodeIntoResult {
|
|
821
|
+
read: number;
|
|
822
|
+
written: number;
|
|
607
823
|
}
|
|
608
|
-
|
|
609
824
|
declare class FormData {
|
|
610
825
|
constructor();
|
|
611
826
|
append(name: string, value: string): void;
|
|
612
827
|
append(name: string, value: Blob, filename?: string): void;
|
|
613
828
|
delete(name: string): void;
|
|
614
|
-
get(name: string):
|
|
615
|
-
getAll(name: string):
|
|
829
|
+
get(name: string): string | null;
|
|
830
|
+
getAll(name: string): string[];
|
|
616
831
|
has(name: string): boolean;
|
|
617
832
|
set(name: string, value: string): void;
|
|
618
833
|
set(name: string, value: Blob, filename?: string): void;
|
|
619
|
-
entries(): IterableIterator<[key: string, value:
|
|
834
|
+
entries(): IterableIterator<[key: string, value: string]>;
|
|
620
835
|
keys(): IterableIterator<string>;
|
|
621
|
-
values(): IterableIterator<
|
|
836
|
+
values(): IterableIterator<File | string>;
|
|
622
837
|
forEach<This = unknown>(
|
|
623
838
|
callback: (
|
|
624
839
|
this: This,
|
|
625
|
-
value:
|
|
840
|
+
value: string,
|
|
626
841
|
key: string,
|
|
627
842
|
parent: FormData
|
|
628
843
|
) => void,
|
|
629
844
|
thisArg?: This
|
|
630
845
|
): void;
|
|
631
|
-
[Symbol.iterator](): IterableIterator<[key: string, value:
|
|
846
|
+
[Symbol.iterator](): IterableIterator<[key: string, value: string]>;
|
|
847
|
+
}
|
|
848
|
+
declare interface ContentOptions {
|
|
849
|
+
html?: boolean;
|
|
632
850
|
}
|
|
633
|
-
|
|
634
851
|
declare class HTMLRewriter {
|
|
635
852
|
constructor();
|
|
636
853
|
on(
|
|
@@ -640,20 +857,76 @@ declare class HTMLRewriter {
|
|
|
640
857
|
onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter;
|
|
641
858
|
transform(response: Response): Response;
|
|
642
859
|
}
|
|
643
|
-
|
|
644
|
-
|
|
860
|
+
declare interface HTMLRewriterElementContentHandlers {
|
|
861
|
+
element?(element: Element): void | Promise<void>;
|
|
862
|
+
comments?(comment: Comment): void | Promise<void>;
|
|
863
|
+
text?(element: Text): void | Promise<void>;
|
|
864
|
+
}
|
|
865
|
+
declare interface HTMLRewriterDocumentContentHandlers {
|
|
645
866
|
doctype?(doctype: Doctype): void | Promise<void>;
|
|
646
867
|
comments?(comment: Comment): void | Promise<void>;
|
|
647
868
|
text?(text: Text): void | Promise<void>;
|
|
648
869
|
end?(end: DocumentEnd): void | Promise<void>;
|
|
649
870
|
}
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
text?(text: Text): void | Promise<void>;
|
|
871
|
+
declare interface Doctype {
|
|
872
|
+
readonly name: string | null;
|
|
873
|
+
readonly publicId: string | null;
|
|
874
|
+
readonly systemId: string | null;
|
|
655
875
|
}
|
|
656
|
-
|
|
876
|
+
declare interface Element {
|
|
877
|
+
tagName: string;
|
|
878
|
+
readonly attributes: IterableIterator<string[]>;
|
|
879
|
+
readonly removed: boolean;
|
|
880
|
+
readonly namespaceURI: string;
|
|
881
|
+
getAttribute(name: string): string | null;
|
|
882
|
+
hasAttribute(name: string): boolean;
|
|
883
|
+
setAttribute(name: string, value: string): Element;
|
|
884
|
+
removeAttribute(name: string): Element;
|
|
885
|
+
before(content: string, options?: ContentOptions): Element;
|
|
886
|
+
after(content: string, options?: ContentOptions): Element;
|
|
887
|
+
prepend(content: string, options?: ContentOptions): Element;
|
|
888
|
+
append(content: string, options?: ContentOptions): Element;
|
|
889
|
+
replace(content: string, options?: ContentOptions): Element;
|
|
890
|
+
remove(): Element;
|
|
891
|
+
removeAndKeepContent(): Element;
|
|
892
|
+
setInnerContent(content: string, options?: ContentOptions): Element;
|
|
893
|
+
onEndTag(handler: (tag: EndTag) => void | Promise<void>): void;
|
|
894
|
+
}
|
|
895
|
+
declare interface EndTag {
|
|
896
|
+
name: string;
|
|
897
|
+
before(content: string, options?: ContentOptions): EndTag;
|
|
898
|
+
after(content: string, options?: ContentOptions): EndTag;
|
|
899
|
+
remove(): EndTag;
|
|
900
|
+
}
|
|
901
|
+
declare interface Comment {
|
|
902
|
+
text: string;
|
|
903
|
+
readonly removed: boolean;
|
|
904
|
+
before(content: string, options?: ContentOptions): Comment;
|
|
905
|
+
after(content: string, options?: ContentOptions): Comment;
|
|
906
|
+
replace(content: string, options?: ContentOptions): Comment;
|
|
907
|
+
remove(): Comment;
|
|
908
|
+
}
|
|
909
|
+
declare interface Text {
|
|
910
|
+
readonly text: string;
|
|
911
|
+
readonly lastInTextNode: boolean;
|
|
912
|
+
readonly removed: boolean;
|
|
913
|
+
before(content: string, options?: ContentOptions): Text;
|
|
914
|
+
after(content: string, options?: ContentOptions): Text;
|
|
915
|
+
replace(content: string, options?: ContentOptions): Text;
|
|
916
|
+
remove(): Text;
|
|
917
|
+
}
|
|
918
|
+
declare interface DocumentEnd {
|
|
919
|
+
append(content: string, options?: ContentOptions): DocumentEnd;
|
|
920
|
+
}
|
|
921
|
+
declare abstract class FetchEvent extends ExtendableEvent {
|
|
922
|
+
readonly request: Request;
|
|
923
|
+
respondWith(promise: Response | Promise<Response>): void;
|
|
924
|
+
passThroughOnException(): void;
|
|
925
|
+
}
|
|
926
|
+
declare type HeadersInit =
|
|
927
|
+
| Headers
|
|
928
|
+
| Iterable<Iterable<string>>
|
|
929
|
+
| Record<string, string>;
|
|
657
930
|
declare class Headers {
|
|
658
931
|
constructor(init?: HeadersInit);
|
|
659
932
|
get(name: string): string | null;
|
|
@@ -671,217 +944,219 @@ declare class Headers {
|
|
|
671
944
|
values(): IterableIterator<string>;
|
|
672
945
|
[Symbol.iterator](): IterableIterator<[key: string, value: string]>;
|
|
673
946
|
}
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
|
677
|
-
|
|
|
678
|
-
|
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
947
|
+
declare type BodyInit =
|
|
948
|
+
| ReadableStream<Uint8Array>
|
|
949
|
+
| string
|
|
950
|
+
| ArrayBuffer
|
|
951
|
+
| ArrayBufferView
|
|
952
|
+
| Blob
|
|
953
|
+
| URLSearchParams
|
|
954
|
+
| FormData;
|
|
955
|
+
declare abstract class Body {
|
|
956
|
+
readonly body: ReadableStream | null;
|
|
957
|
+
readonly bodyUsed: boolean;
|
|
958
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
959
|
+
text(): Promise<string>;
|
|
960
|
+
json<T>(): Promise<T>;
|
|
961
|
+
formData(): Promise<FormData>;
|
|
962
|
+
blob(): Promise<Blob>;
|
|
688
963
|
}
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
p?: string;
|
|
703
|
-
q?: string;
|
|
704
|
-
dp?: string;
|
|
705
|
-
dq?: string;
|
|
706
|
-
qi?: string;
|
|
707
|
-
oth?: RsaOtherPrimesInfo[];
|
|
708
|
-
k?: string;
|
|
964
|
+
declare class Response extends Body {
|
|
965
|
+
constructor(body?: BodyInit | null, init?: ResponseInit);
|
|
966
|
+
static redirect(url: string, status?: number): Response;
|
|
967
|
+
static json(any: any, maybeInit?: ResponseInit | Response): Response;
|
|
968
|
+
clone(): Response;
|
|
969
|
+
readonly status: number;
|
|
970
|
+
readonly statusText: string;
|
|
971
|
+
readonly headers: Headers;
|
|
972
|
+
readonly ok: boolean;
|
|
973
|
+
readonly redirected: boolean;
|
|
974
|
+
readonly url: string;
|
|
975
|
+
readonly webSocket: WebSocket | null;
|
|
976
|
+
readonly cf?: any;
|
|
709
977
|
}
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
978
|
+
declare interface ResponseInit {
|
|
979
|
+
status?: number;
|
|
980
|
+
statusText?: string;
|
|
981
|
+
headers?: HeadersInit;
|
|
982
|
+
cf?: any;
|
|
983
|
+
webSocket?: WebSocket | null;
|
|
984
|
+
encodeBody?: "automatic" | "manual";
|
|
985
|
+
}
|
|
986
|
+
declare type RequestInfo = Request | string | URL;
|
|
987
|
+
declare class Request<CfHostMetadata = unknown> extends Body {
|
|
988
|
+
constructor(input: RequestInfo, init?: RequestInit);
|
|
989
|
+
clone(): Request<CfHostMetadata>;
|
|
990
|
+
/** Returns request's HTTP method, which is "GET" by default. */
|
|
991
|
+
readonly method: string;
|
|
992
|
+
/** Returns the URL of request as a string. */
|
|
993
|
+
readonly url: string;
|
|
994
|
+
/** 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. */
|
|
995
|
+
readonly headers: Headers;
|
|
996
|
+
/** 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. */
|
|
997
|
+
readonly redirect: string;
|
|
998
|
+
readonly fetcher: Fetcher | null;
|
|
999
|
+
/** Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler. */
|
|
1000
|
+
readonly signal: AbortSignal;
|
|
1001
|
+
readonly cf?: IncomingRequestCfProperties<CfHostMetadata>;
|
|
1002
|
+
}
|
|
1003
|
+
declare interface RequestInit<
|
|
1004
|
+
CfType = IncomingRequestCfProperties | RequestInitCfProperties
|
|
1005
|
+
> {
|
|
1006
|
+
/** A string to set request's method. */
|
|
1007
|
+
method?: string;
|
|
1008
|
+
/** A Headers object, an object literal, or an array of two-item arrays to set request's headers. */
|
|
1009
|
+
headers?: HeadersInit;
|
|
1010
|
+
/** A BodyInit object or null to set request's body. */
|
|
1011
|
+
body?: BodyInit | null;
|
|
1012
|
+
/** 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. */
|
|
1013
|
+
redirect?: string;
|
|
1014
|
+
fetcher?: Fetcher | null;
|
|
1015
|
+
cf?: CfType;
|
|
1016
|
+
/** An AbortSignal to set request's signal. */
|
|
1017
|
+
signal?: AbortSignal | null;
|
|
1018
|
+
}
|
|
1019
|
+
declare abstract class Fetcher {
|
|
1020
|
+
fetch(
|
|
1021
|
+
input: RequestInfo,
|
|
1022
|
+
init?: RequestInit<RequestInitCfProperties>
|
|
1023
|
+
): Promise<Response>;
|
|
1024
|
+
connect(address: string, options?: SocketOptions): Socket;
|
|
1025
|
+
}
|
|
1026
|
+
declare interface FetcherPutOptions {
|
|
1027
|
+
expiration?: number;
|
|
1028
|
+
expirationTtl?: number;
|
|
1029
|
+
}
|
|
1030
|
+
declare interface KVNamespaceListKey<Metadata, Key extends string = string> {
|
|
1031
|
+
name: Key;
|
|
1032
|
+
expiration?: number;
|
|
1033
|
+
metadata?: Metadata;
|
|
1034
|
+
}
|
|
1035
|
+
declare type KVNamespaceListResult<Metadata, Key extends string = string> =
|
|
1036
|
+
| {
|
|
1037
|
+
list_complete: false;
|
|
1038
|
+
keys: KVNamespaceListKey<Metadata, Key>[];
|
|
1039
|
+
cursor: string;
|
|
1040
|
+
}
|
|
1041
|
+
| {
|
|
1042
|
+
list_complete: true;
|
|
1043
|
+
keys: KVNamespaceListKey<Metadata, Key>[];
|
|
1044
|
+
};
|
|
1045
|
+
declare interface KVNamespace<Key extends string = string> {
|
|
716
1046
|
get(
|
|
717
|
-
key:
|
|
1047
|
+
key: Key,
|
|
718
1048
|
options?: Partial<KVNamespaceGetOptions<undefined>>
|
|
719
1049
|
): Promise<string | null>;
|
|
720
|
-
get(key:
|
|
1050
|
+
get(key: Key, type: "text"): Promise<string | null>;
|
|
721
1051
|
get<ExpectedValue = unknown>(
|
|
722
|
-
key:
|
|
1052
|
+
key: Key,
|
|
723
1053
|
type: "json"
|
|
724
1054
|
): Promise<ExpectedValue | null>;
|
|
725
|
-
get(key:
|
|
726
|
-
get(key:
|
|
727
|
-
get(
|
|
1055
|
+
get(key: Key, type: "arrayBuffer"): Promise<ArrayBuffer | null>;
|
|
1056
|
+
get(key: Key, type: "stream"): Promise<ReadableStream | null>;
|
|
1057
|
+
get(
|
|
1058
|
+
key: Key,
|
|
1059
|
+
options?: KVNamespaceGetOptions<"text">
|
|
1060
|
+
): Promise<string | null>;
|
|
728
1061
|
get<ExpectedValue = unknown>(
|
|
729
|
-
key:
|
|
730
|
-
options
|
|
1062
|
+
key: Key,
|
|
1063
|
+
options?: KVNamespaceGetOptions<"json">
|
|
731
1064
|
): Promise<ExpectedValue | null>;
|
|
732
1065
|
get(
|
|
733
|
-
key:
|
|
734
|
-
options
|
|
735
|
-
): Promise<
|
|
1066
|
+
key: Key,
|
|
1067
|
+
options?: KVNamespaceGetOptions<"arrayBuffer">
|
|
1068
|
+
): Promise<string | null>;
|
|
736
1069
|
get(
|
|
737
|
-
key:
|
|
738
|
-
options
|
|
739
|
-
): Promise<
|
|
1070
|
+
key: Key,
|
|
1071
|
+
options?: KVNamespaceGetOptions<"stream">
|
|
1072
|
+
): Promise<string | null>;
|
|
740
1073
|
list<Metadata = unknown>(
|
|
741
1074
|
options?: KVNamespaceListOptions
|
|
742
|
-
): Promise<KVNamespaceListResult<Metadata>>;
|
|
743
|
-
/**
|
|
744
|
-
* Creates a new key-value pair, or updates the value for a particular key.
|
|
745
|
-
* @param key key to associate with the value. A key cannot be empty, `.` or `..`. All other keys are valid.
|
|
746
|
-
* @param value value to store. The type is inferred. The maximum size of a value is 25MB.
|
|
747
|
-
* @returns Returns a `Promise` that you should `await` on in order to verify a successful update.
|
|
748
|
-
* @example
|
|
749
|
-
* await NAMESPACE.put(key, value);
|
|
750
|
-
*/
|
|
1075
|
+
): Promise<KVNamespaceListResult<Metadata, Key>>;
|
|
751
1076
|
put(
|
|
752
|
-
key:
|
|
1077
|
+
key: Key,
|
|
753
1078
|
value: string | ArrayBuffer | ArrayBufferView | ReadableStream,
|
|
754
1079
|
options?: KVNamespacePutOptions
|
|
755
1080
|
): Promise<void>;
|
|
756
1081
|
getWithMetadata<Metadata = unknown>(
|
|
757
|
-
key:
|
|
1082
|
+
key: Key,
|
|
758
1083
|
options?: Partial<KVNamespaceGetOptions<undefined>>
|
|
759
1084
|
): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
|
|
760
1085
|
getWithMetadata<Metadata = unknown>(
|
|
761
|
-
key:
|
|
1086
|
+
key: Key,
|
|
762
1087
|
type: "text"
|
|
763
1088
|
): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
|
|
764
1089
|
getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(
|
|
765
|
-
key:
|
|
1090
|
+
key: Key,
|
|
766
1091
|
type: "json"
|
|
767
1092
|
): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;
|
|
768
1093
|
getWithMetadata<Metadata = unknown>(
|
|
769
|
-
key:
|
|
1094
|
+
key: Key,
|
|
770
1095
|
type: "arrayBuffer"
|
|
771
1096
|
): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;
|
|
772
1097
|
getWithMetadata<Metadata = unknown>(
|
|
773
|
-
key:
|
|
1098
|
+
key: Key,
|
|
774
1099
|
type: "stream"
|
|
775
1100
|
): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;
|
|
776
1101
|
getWithMetadata<Metadata = unknown>(
|
|
777
|
-
key:
|
|
1102
|
+
key: Key,
|
|
778
1103
|
options: KVNamespaceGetOptions<"text">
|
|
779
1104
|
): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
|
|
780
1105
|
getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(
|
|
781
|
-
key:
|
|
1106
|
+
key: Key,
|
|
782
1107
|
options: KVNamespaceGetOptions<"json">
|
|
783
1108
|
): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;
|
|
784
1109
|
getWithMetadata<Metadata = unknown>(
|
|
785
|
-
key:
|
|
1110
|
+
key: Key,
|
|
786
1111
|
options: KVNamespaceGetOptions<"arrayBuffer">
|
|
787
1112
|
): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;
|
|
788
1113
|
getWithMetadata<Metadata = unknown>(
|
|
789
|
-
key:
|
|
1114
|
+
key: Key,
|
|
790
1115
|
options: KVNamespaceGetOptions<"stream">
|
|
791
1116
|
): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;
|
|
792
|
-
delete(
|
|
793
|
-
}
|
|
794
|
-
|
|
795
|
-
interface KVNamespaceGetOptions<Type> {
|
|
796
|
-
type: Type;
|
|
797
|
-
cacheTtl?: number;
|
|
798
|
-
}
|
|
799
|
-
|
|
800
|
-
interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
|
|
801
|
-
value: Value | null;
|
|
802
|
-
metadata: Metadata | null;
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
interface KVNamespaceListKey<Metadata> {
|
|
806
|
-
name: string;
|
|
807
|
-
expiration?: number;
|
|
808
|
-
metadata?: Metadata;
|
|
1117
|
+
delete(key: Key): Promise<void>;
|
|
809
1118
|
}
|
|
810
|
-
|
|
811
|
-
interface KVNamespaceListOptions {
|
|
1119
|
+
declare interface KVNamespaceListOptions {
|
|
812
1120
|
limit?: number;
|
|
813
1121
|
prefix?: string | null;
|
|
814
1122
|
cursor?: string | null;
|
|
815
1123
|
}
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
list_complete: boolean;
|
|
820
|
-
cursor?: string;
|
|
1124
|
+
declare interface KVNamespaceGetOptions<Type> {
|
|
1125
|
+
type: Type;
|
|
1126
|
+
cacheTtl?: number;
|
|
821
1127
|
}
|
|
822
|
-
|
|
823
|
-
interface KVNamespacePutOptions {
|
|
1128
|
+
declare interface KVNamespacePutOptions {
|
|
824
1129
|
expiration?: number;
|
|
825
1130
|
expirationTtl?: number;
|
|
826
1131
|
metadata?: any | null;
|
|
827
1132
|
}
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
readonly data: ArrayBuffer | string;
|
|
832
|
-
}
|
|
833
|
-
|
|
834
|
-
interface MessageEventInit {
|
|
835
|
-
data: ArrayBuffer | string;
|
|
836
|
-
}
|
|
837
|
-
|
|
838
|
-
/**
|
|
839
|
-
* Back compat for code migrating from older definitions.
|
|
840
|
-
* @deprecated Use MessageEventInit instead.
|
|
841
|
-
*/
|
|
842
|
-
declare type MessageEventInitializer = MessageEventInit;
|
|
843
|
-
|
|
844
|
-
declare abstract class Navigator {
|
|
845
|
-
readonly userAgent: string;
|
|
846
|
-
}
|
|
847
|
-
|
|
848
|
-
/**
|
|
849
|
-
* Transitionary name.
|
|
850
|
-
* @deprecated Use StreamPipeOptions
|
|
851
|
-
*/
|
|
852
|
-
interface PipeToOptions {
|
|
853
|
-
preventClose?: boolean;
|
|
854
|
-
preventAbort?: boolean;
|
|
855
|
-
preventCancel?: boolean;
|
|
856
|
-
signal?: AbortSignal;
|
|
857
|
-
}
|
|
858
|
-
|
|
859
|
-
declare abstract class PromiseRejectionEvent extends Event {
|
|
860
|
-
readonly promise: Promise<any>;
|
|
861
|
-
readonly reason: any;
|
|
1133
|
+
declare interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
|
|
1134
|
+
value: Value | null;
|
|
1135
|
+
metadata: Metadata | null;
|
|
862
1136
|
}
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
1137
|
+
declare interface R2Error extends Error {
|
|
1138
|
+
readonly name: string;
|
|
1139
|
+
readonly code: number;
|
|
1140
|
+
readonly message: string;
|
|
1141
|
+
readonly action: string;
|
|
1142
|
+
readonly stack: any;
|
|
866
1143
|
}
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
*/
|
|
877
|
-
get(
|
|
878
|
-
key: string,
|
|
879
|
-
options: R2GetOptions
|
|
880
|
-
): Promise<R2ObjectBody | R2Object | null>;
|
|
1144
|
+
declare interface R2ListOptions {
|
|
1145
|
+
limit?: number;
|
|
1146
|
+
prefix?: string;
|
|
1147
|
+
cursor?: string;
|
|
1148
|
+
delimiter?: string;
|
|
1149
|
+
startAfter?: string;
|
|
1150
|
+
}
|
|
1151
|
+
declare abstract class R2Bucket {
|
|
1152
|
+
head(key: string): Promise<R2Object | null>;
|
|
881
1153
|
get(
|
|
882
1154
|
key: string,
|
|
883
|
-
options
|
|
1155
|
+
options: R2GetOptions & {
|
|
1156
|
+
onlyIf: R2Conditional | Headers;
|
|
1157
|
+
}
|
|
884
1158
|
): Promise<R2ObjectBody | R2Object | null>;
|
|
1159
|
+
get(key: string, options?: R2GetOptions): Promise<R2ObjectBody | null>;
|
|
885
1160
|
put(
|
|
886
1161
|
key: string,
|
|
887
1162
|
value:
|
|
@@ -893,85 +1168,28 @@ interface R2Bucket {
|
|
|
893
1168
|
| Blob,
|
|
894
1169
|
options?: R2PutOptions
|
|
895
1170
|
): Promise<R2Object>;
|
|
1171
|
+
createMultipartUpload(
|
|
1172
|
+
key: string,
|
|
1173
|
+
options?: R2MultipartOptions
|
|
1174
|
+
): Promise<R2MultipartUpload>;
|
|
1175
|
+
resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload;
|
|
896
1176
|
delete(keys: string | string[]): Promise<void>;
|
|
897
1177
|
list(options?: R2ListOptions): Promise<R2Objects>;
|
|
898
1178
|
}
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
* Perform the operation conditionally based on meeting the defined criteria.
|
|
913
|
-
*/
|
|
914
|
-
interface R2Conditional {
|
|
915
|
-
etagMatches?: string;
|
|
916
|
-
etagDoesNotMatch?: string;
|
|
917
|
-
uploadedBefore?: Date;
|
|
918
|
-
uploadedAfter?: Date;
|
|
919
|
-
secondsGranularity?: boolean;
|
|
920
|
-
}
|
|
921
|
-
|
|
922
|
-
/**
|
|
923
|
-
* Options for retrieving the object metadata nad payload.
|
|
924
|
-
*/
|
|
925
|
-
interface R2GetOptions {
|
|
926
|
-
onlyIf?: R2Conditional | Headers;
|
|
927
|
-
range?: R2Range | Headers;
|
|
928
|
-
}
|
|
929
|
-
|
|
930
|
-
/**
|
|
931
|
-
* Metadata that's automatically rendered into R2 HTTP API endpoints.
|
|
932
|
-
* ```
|
|
933
|
-
* * contentType -> content-type
|
|
934
|
-
* * contentLanguage -> content-language
|
|
935
|
-
* etc...
|
|
936
|
-
* ```
|
|
937
|
-
* This data is echoed back on GET responses based on what was originally
|
|
938
|
-
* assigned to the object (and can typically also be overriden when issuing
|
|
939
|
-
* the GET request).
|
|
940
|
-
*/
|
|
941
|
-
interface R2HTTPMetadata {
|
|
942
|
-
contentType?: string;
|
|
943
|
-
contentLanguage?: string;
|
|
944
|
-
contentDisposition?: string;
|
|
945
|
-
contentEncoding?: string;
|
|
946
|
-
cacheControl?: string;
|
|
947
|
-
cacheExpiry?: Date;
|
|
948
|
-
}
|
|
949
|
-
|
|
950
|
-
interface R2ListOptions {
|
|
951
|
-
limit?: number;
|
|
952
|
-
prefix?: string;
|
|
953
|
-
cursor?: string;
|
|
954
|
-
delimiter?: string;
|
|
955
|
-
startAfter?: string;
|
|
956
|
-
/**
|
|
957
|
-
* If you populate this array, then items returned will include this metadata.
|
|
958
|
-
* A tradeoff is that fewer results may be returned depending on how big this
|
|
959
|
-
* data is. For now the caps are TBD but expect the total memory usage for a list
|
|
960
|
-
* operation may need to be <1MB or even <128kb depending on how many list operations
|
|
961
|
-
* you are sending into one bucket. Make sure to look at `truncated` for the result
|
|
962
|
-
* rather than having logic like
|
|
963
|
-
* ```
|
|
964
|
-
* while (listed.length < limit) {
|
|
965
|
-
* listed = myBucket.list({ limit, include: ['customMetadata'] })
|
|
966
|
-
* }
|
|
967
|
-
* ```
|
|
968
|
-
*/
|
|
969
|
-
include?: ("httpMetadata" | "customMetadata")[];
|
|
1179
|
+
declare interface R2MultipartUpload {
|
|
1180
|
+
readonly key: string;
|
|
1181
|
+
readonly uploadId: string;
|
|
1182
|
+
uploadPart(
|
|
1183
|
+
partNumber: number,
|
|
1184
|
+
value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob
|
|
1185
|
+
): Promise<R2UploadedPart>;
|
|
1186
|
+
abort(): Promise<void>;
|
|
1187
|
+
complete(uploadedParts: R2UploadedPart[]): Promise<R2Object>;
|
|
1188
|
+
}
|
|
1189
|
+
declare interface R2UploadedPart {
|
|
1190
|
+
partNumber: number;
|
|
1191
|
+
etag: string;
|
|
970
1192
|
}
|
|
971
|
-
|
|
972
|
-
/**
|
|
973
|
-
* The metadata for the object.
|
|
974
|
-
*/
|
|
975
1193
|
declare abstract class R2Object {
|
|
976
1194
|
readonly key: string;
|
|
977
1195
|
readonly version: string;
|
|
@@ -985,27 +1203,38 @@ declare abstract class R2Object {
|
|
|
985
1203
|
readonly range?: R2Range;
|
|
986
1204
|
writeHttpMetadata(headers: Headers): void;
|
|
987
1205
|
}
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
*/
|
|
992
|
-
interface R2ObjectBody extends R2Object {
|
|
993
|
-
readonly body: ReadableStream;
|
|
994
|
-
readonly bodyUsed: boolean;
|
|
1206
|
+
declare interface R2ObjectBody extends R2Object {
|
|
1207
|
+
get body(): ReadableStream;
|
|
1208
|
+
get bodyUsed(): boolean;
|
|
995
1209
|
arrayBuffer(): Promise<ArrayBuffer>;
|
|
996
1210
|
text(): Promise<string>;
|
|
997
1211
|
json<T>(): Promise<T>;
|
|
998
1212
|
blob(): Promise<Blob>;
|
|
999
1213
|
}
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1214
|
+
declare type R2Range =
|
|
1215
|
+
| {
|
|
1216
|
+
offset: number;
|
|
1217
|
+
length?: number;
|
|
1218
|
+
}
|
|
1219
|
+
| {
|
|
1220
|
+
offset?: number;
|
|
1221
|
+
length: number;
|
|
1222
|
+
}
|
|
1223
|
+
| {
|
|
1224
|
+
suffix: number;
|
|
1225
|
+
};
|
|
1226
|
+
declare interface R2Conditional {
|
|
1227
|
+
etagMatches?: string;
|
|
1228
|
+
etagDoesNotMatch?: string;
|
|
1229
|
+
uploadedBefore?: Date;
|
|
1230
|
+
uploadedAfter?: Date;
|
|
1231
|
+
secondsGranularity?: boolean;
|
|
1006
1232
|
}
|
|
1007
|
-
|
|
1008
|
-
|
|
1233
|
+
declare interface R2GetOptions {
|
|
1234
|
+
onlyIf?: R2Conditional | Headers;
|
|
1235
|
+
range?: R2Range | Headers;
|
|
1236
|
+
}
|
|
1237
|
+
declare interface R2PutOptions {
|
|
1009
1238
|
onlyIf?: R2Conditional | Headers;
|
|
1010
1239
|
httpMetadata?: R2HTTPMetadata | Headers;
|
|
1011
1240
|
customMetadata?: Record<string, string>;
|
|
@@ -1015,464 +1244,316 @@ interface R2PutOptions {
|
|
|
1015
1244
|
sha384?: ArrayBuffer | string;
|
|
1016
1245
|
sha512?: ArrayBuffer | string;
|
|
1017
1246
|
}
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
| { offset?: number; length: number }
|
|
1022
|
-
| { suffix: number };
|
|
1023
|
-
|
|
1024
|
-
interface ReadResult {
|
|
1025
|
-
value?: any;
|
|
1026
|
-
done: boolean;
|
|
1027
|
-
}
|
|
1028
|
-
|
|
1029
|
-
declare abstract class ReadableByteStreamController {
|
|
1030
|
-
readonly byobRequest: ReadableStreamBYOBRequest | null;
|
|
1031
|
-
readonly desiredSize: number | null;
|
|
1032
|
-
close(): void;
|
|
1033
|
-
enqueue(chunk: ArrayBuffer | ArrayBufferView): void;
|
|
1034
|
-
error(reason: any): void;
|
|
1035
|
-
}
|
|
1036
|
-
|
|
1037
|
-
declare class ReadableStream {
|
|
1038
|
-
constructor(
|
|
1039
|
-
underlyingSource?: UnderlyingSource,
|
|
1040
|
-
queuingStrategy?: StreamQueuingStrategy
|
|
1041
|
-
);
|
|
1042
|
-
readonly locked: boolean;
|
|
1043
|
-
cancel(reason?: any): Promise<void>;
|
|
1044
|
-
getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader;
|
|
1045
|
-
getReader(): ReadableStreamDefaultReader;
|
|
1046
|
-
pipeThrough(
|
|
1047
|
-
transform: ReadableStreamTransform,
|
|
1048
|
-
options?: PipeToOptions
|
|
1049
|
-
): ReadableStream;
|
|
1050
|
-
pipeTo(destination: WritableStream, options?: PipeToOptions): Promise<void>;
|
|
1051
|
-
tee(): [ReadableStream, ReadableStream];
|
|
1052
|
-
values(options?: ReadableStreamValuesOptions): AsyncIterableIterator<any>;
|
|
1053
|
-
[Symbol.asyncIterator](
|
|
1054
|
-
options?: ReadableStreamValuesOptions
|
|
1055
|
-
): AsyncIterableIterator<any>;
|
|
1056
|
-
}
|
|
1057
|
-
|
|
1058
|
-
declare class ReadableStreamBYOBReader {
|
|
1059
|
-
constructor(stream: ReadableStream);
|
|
1060
|
-
readonly closed: Promise<void>;
|
|
1061
|
-
cancel(reason?: any): Promise<void>;
|
|
1062
|
-
read<T extends ArrayBufferView>(
|
|
1063
|
-
view: T
|
|
1064
|
-
): Promise<ReadableStreamReadResult<T>>;
|
|
1065
|
-
releaseLock(): void;
|
|
1066
|
-
readAtLeast(
|
|
1067
|
-
minBytes: number,
|
|
1068
|
-
view: Uint8Array
|
|
1069
|
-
): Promise<ReadableStreamReadResult<Uint8Array>>;
|
|
1070
|
-
}
|
|
1071
|
-
|
|
1072
|
-
declare abstract class ReadableStreamBYOBRequest {
|
|
1073
|
-
readonly view: Uint8Array | null;
|
|
1074
|
-
respond(bytesWritten: number): void;
|
|
1075
|
-
respondWithNewView(view: ArrayBuffer | ArrayBufferView): void;
|
|
1076
|
-
readonly atLeast: number | null;
|
|
1077
|
-
}
|
|
1078
|
-
|
|
1079
|
-
declare abstract class ReadableStreamDefaultController {
|
|
1080
|
-
readonly desiredSize: number | null;
|
|
1081
|
-
close(): void;
|
|
1082
|
-
enqueue(chunk?: any): void;
|
|
1083
|
-
error(reason: any): void;
|
|
1084
|
-
}
|
|
1085
|
-
|
|
1086
|
-
declare class ReadableStreamDefaultReader {
|
|
1087
|
-
constructor(stream: ReadableStream);
|
|
1088
|
-
readonly closed: Promise<void>;
|
|
1089
|
-
cancel(reason?: any): Promise<void>;
|
|
1090
|
-
read(): Promise<ReadableStreamReadResult<any>>;
|
|
1091
|
-
releaseLock(): void;
|
|
1092
|
-
}
|
|
1093
|
-
|
|
1094
|
-
interface ReadableStreamGetReaderOptions {
|
|
1095
|
-
mode: string;
|
|
1096
|
-
}
|
|
1097
|
-
|
|
1098
|
-
/**
|
|
1099
|
-
* Back-compat alias.
|
|
1100
|
-
* @deprecated Use StreamPipeOptions
|
|
1101
|
-
*/
|
|
1102
|
-
declare type ReadableStreamPipeToOptions = PipeToOptions;
|
|
1103
|
-
|
|
1104
|
-
declare type ReadableStreamReadResult<T = any> =
|
|
1105
|
-
| { done: true; value: undefined }
|
|
1106
|
-
| { done: false; value: T };
|
|
1107
|
-
|
|
1108
|
-
/**
|
|
1109
|
-
* Back-compat alias.
|
|
1110
|
-
* @deprecated Use ReadableStreamBYOBReader
|
|
1111
|
-
*/
|
|
1112
|
-
declare type ReadableStreamReadableStreamBYOBReader = ReadableStreamBYOBReader;
|
|
1113
|
-
|
|
1114
|
-
/**
|
|
1115
|
-
* Back-compat alias.
|
|
1116
|
-
* @deprecated Use ReadableStreamDefaultReader
|
|
1117
|
-
*/
|
|
1118
|
-
declare type ReadableStreamReadableStreamDefaultReader =
|
|
1119
|
-
ReadableStreamDefaultReader;
|
|
1120
|
-
|
|
1121
|
-
interface ReadableStreamTransform {
|
|
1122
|
-
writable: WritableStream;
|
|
1123
|
-
readable: ReadableStream;
|
|
1124
|
-
}
|
|
1125
|
-
|
|
1126
|
-
interface ReadableStreamValuesOptions {
|
|
1127
|
-
preventCancel?: boolean;
|
|
1128
|
-
}
|
|
1129
|
-
|
|
1130
|
-
declare class Request extends Body {
|
|
1131
|
-
constructor(input: Request | string, init?: RequestInit | Request);
|
|
1132
|
-
clone(): Request;
|
|
1133
|
-
readonly method: string;
|
|
1134
|
-
readonly url: string;
|
|
1135
|
-
readonly headers: Headers;
|
|
1136
|
-
readonly redirect: string;
|
|
1137
|
-
readonly fetcher: Fetcher | null;
|
|
1138
|
-
readonly signal: AbortSignal;
|
|
1139
|
-
/**
|
|
1140
|
-
* In addition to the properties on the standard `Request` object,
|
|
1141
|
-
* the `cf` object contains extra information about the request provided
|
|
1142
|
-
* by Cloudflare's edge.
|
|
1143
|
-
*
|
|
1144
|
-
* Returns undefined when accessed in the playground.
|
|
1145
|
-
*/
|
|
1146
|
-
readonly cf?: IncomingRequestCfProperties;
|
|
1147
|
-
}
|
|
1148
|
-
|
|
1149
|
-
interface RequestInit {
|
|
1150
|
-
method?: string;
|
|
1151
|
-
headers?: HeadersInit;
|
|
1152
|
-
body?: BodyInit | null;
|
|
1153
|
-
redirect?: string;
|
|
1154
|
-
fetcher?: Fetcher | null;
|
|
1155
|
-
/**
|
|
1156
|
-
* cf is a union of these two types because there are multiple
|
|
1157
|
-
* scenarios in which it might be one or the other.
|
|
1158
|
-
*
|
|
1159
|
-
* IncomingRequestCfProperties is required to allow
|
|
1160
|
-
* new Request(someUrl, event.request)
|
|
1161
|
-
*
|
|
1162
|
-
* RequestInitCfProperties is required to allow
|
|
1163
|
-
* new Request(event.request, {cf: { ... } })
|
|
1164
|
-
* fetch(someUrl, {cf: { ... } })
|
|
1165
|
-
*/
|
|
1166
|
-
cf?: IncomingRequestCfProperties | RequestInitCfProperties;
|
|
1167
|
-
signal?: AbortSignal | null;
|
|
1168
|
-
}
|
|
1169
|
-
|
|
1170
|
-
/**
|
|
1171
|
-
* Back compat for code migrating from older definitions.
|
|
1172
|
-
* @deprecated Use RequestInit instead.
|
|
1173
|
-
*/
|
|
1174
|
-
declare type RequestInitializerDict = RequestInit;
|
|
1175
|
-
|
|
1176
|
-
declare class Response extends Body {
|
|
1177
|
-
constructor(bodyInit?: BodyInit | null, maybeInit?: ResponseInit | Response);
|
|
1178
|
-
static redirect(url: string, status?: number): Response;
|
|
1179
|
-
static json(any: any, maybeInit?: ResponseInit | Response): Response;
|
|
1180
|
-
clone(): Response;
|
|
1181
|
-
readonly status: number;
|
|
1182
|
-
readonly statusText: string;
|
|
1183
|
-
readonly headers: Headers;
|
|
1184
|
-
readonly ok: boolean;
|
|
1185
|
-
readonly redirected: boolean;
|
|
1186
|
-
readonly url: string;
|
|
1187
|
-
readonly webSocket: WebSocket | null;
|
|
1188
|
-
readonly cf?: Object;
|
|
1247
|
+
declare interface R2MultipartOptions {
|
|
1248
|
+
httpMetadata?: R2HTTPMetadata | Headers;
|
|
1249
|
+
customMetadata?: Record<string, string>;
|
|
1189
1250
|
}
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1251
|
+
declare interface R2Checksums {
|
|
1252
|
+
readonly md5?: ArrayBuffer;
|
|
1253
|
+
readonly sha1?: ArrayBuffer;
|
|
1254
|
+
readonly sha256?: ArrayBuffer;
|
|
1255
|
+
readonly sha384?: ArrayBuffer;
|
|
1256
|
+
readonly sha512?: ArrayBuffer;
|
|
1257
|
+
toJSON(): R2StringChecksums;
|
|
1258
|
+
}
|
|
1259
|
+
declare interface R2StringChecksums {
|
|
1260
|
+
md5?: string;
|
|
1261
|
+
sha1?: string;
|
|
1262
|
+
sha256?: string;
|
|
1263
|
+
sha384?: string;
|
|
1264
|
+
sha512?: string;
|
|
1265
|
+
}
|
|
1266
|
+
declare interface R2HTTPMetadata {
|
|
1267
|
+
contentType?: string;
|
|
1268
|
+
contentLanguage?: string;
|
|
1269
|
+
contentDisposition?: string;
|
|
1270
|
+
contentEncoding?: string;
|
|
1271
|
+
cacheControl?: string;
|
|
1272
|
+
cacheExpiry?: Date;
|
|
1198
1273
|
}
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
declare type ResponseInitializerDict = ResponseInit;
|
|
1205
|
-
|
|
1206
|
-
interface RsaOtherPrimesInfo {
|
|
1207
|
-
r?: string;
|
|
1208
|
-
d?: string;
|
|
1209
|
-
t?: string;
|
|
1274
|
+
declare interface R2Objects {
|
|
1275
|
+
objects: R2Object[];
|
|
1276
|
+
truncated: boolean;
|
|
1277
|
+
cursor?: string;
|
|
1278
|
+
delimitedPrefixes: string[];
|
|
1210
1279
|
}
|
|
1211
|
-
|
|
1212
|
-
interface ScheduledController {
|
|
1280
|
+
declare abstract class ScheduledEvent extends ExtendableEvent {
|
|
1213
1281
|
readonly scheduledTime: number;
|
|
1214
1282
|
readonly cron: string;
|
|
1215
1283
|
noRetry(): void;
|
|
1216
1284
|
}
|
|
1217
|
-
|
|
1218
|
-
declare abstract class ScheduledEvent extends ExtendableEvent {
|
|
1285
|
+
declare interface ScheduledController {
|
|
1219
1286
|
readonly scheduledTime: number;
|
|
1220
1287
|
readonly cron: string;
|
|
1221
1288
|
noRetry(): void;
|
|
1222
1289
|
}
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1290
|
+
declare interface QueuingStrategy<T = any> {
|
|
1291
|
+
highWaterMark?: number | bigint;
|
|
1292
|
+
size?: (chunk: T) => number | bigint;
|
|
1226
1293
|
}
|
|
1227
|
-
|
|
1228
|
-
|
|
1294
|
+
declare interface UnderlyingSink<W = any> {
|
|
1295
|
+
type?: string;
|
|
1296
|
+
start?: (controller: WritableStreamDefaultController) => void | Promise<void>;
|
|
1297
|
+
write?: (
|
|
1298
|
+
chunk: W,
|
|
1299
|
+
controller: WritableStreamDefaultController
|
|
1300
|
+
) => void | Promise<void>;
|
|
1301
|
+
abort?: (reason: any) => void | Promise<void>;
|
|
1302
|
+
close?: () => void | Promise<void>;
|
|
1303
|
+
}
|
|
1304
|
+
declare interface UnderlyingByteSource {
|
|
1305
|
+
type: "bytes";
|
|
1306
|
+
autoAllocateChunkSize?: number;
|
|
1307
|
+
start?: (controller: ReadableByteStreamController) => void | Promise<void>;
|
|
1308
|
+
pull?: (controller: ReadableByteStreamController) => void | Promise<void>;
|
|
1309
|
+
cancel?: (reason: any) => void | Promise<void>;
|
|
1310
|
+
}
|
|
1311
|
+
declare interface UnderlyingSource<R = any> {
|
|
1312
|
+
type?: "" | undefined;
|
|
1313
|
+
start?: (
|
|
1314
|
+
controller: ReadableStreamDefaultController<R>
|
|
1315
|
+
) => void | Promise<void>;
|
|
1316
|
+
pull?: (
|
|
1317
|
+
controller: ReadableStreamDefaultController<R>
|
|
1318
|
+
) => void | Promise<void>;
|
|
1319
|
+
cancel?: (reason: any) => void | Promise<void>;
|
|
1320
|
+
}
|
|
1321
|
+
declare interface Transformer<I = any, O = any> {
|
|
1322
|
+
readableType?: string;
|
|
1323
|
+
writableType?: string;
|
|
1324
|
+
start?: (
|
|
1325
|
+
controller: TransformStreamDefaultController<O>
|
|
1326
|
+
) => void | Promise<void>;
|
|
1327
|
+
transform?: (
|
|
1328
|
+
chunk: I,
|
|
1329
|
+
controller: TransformStreamDefaultController<O>
|
|
1330
|
+
) => void | Promise<void>;
|
|
1331
|
+
flush?: (
|
|
1332
|
+
controller: TransformStreamDefaultController<O>
|
|
1333
|
+
) => void | Promise<void>;
|
|
1334
|
+
}
|
|
1335
|
+
declare interface StreamPipeOptions {
|
|
1336
|
+
/**
|
|
1337
|
+
* 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.
|
|
1338
|
+
*
|
|
1339
|
+
* Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.
|
|
1340
|
+
*
|
|
1341
|
+
* Errors and closures of the source and destination streams propagate as follows:
|
|
1342
|
+
*
|
|
1343
|
+
* 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.
|
|
1344
|
+
*
|
|
1345
|
+
* 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.
|
|
1346
|
+
*
|
|
1347
|
+
* 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.
|
|
1348
|
+
*
|
|
1349
|
+
* 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.
|
|
1350
|
+
*
|
|
1351
|
+
* 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.
|
|
1352
|
+
*/
|
|
1353
|
+
preventClose?: boolean;
|
|
1354
|
+
preventAbort?: boolean;
|
|
1355
|
+
preventCancel?: boolean;
|
|
1229
1356
|
signal?: AbortSignal;
|
|
1230
1357
|
}
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
):
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
):
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1358
|
+
declare type ReadableStreamReadResult<R = any> =
|
|
1359
|
+
| {
|
|
1360
|
+
done: false;
|
|
1361
|
+
value: R;
|
|
1362
|
+
}
|
|
1363
|
+
| {
|
|
1364
|
+
done: true;
|
|
1365
|
+
value?: undefined;
|
|
1366
|
+
};
|
|
1367
|
+
/** 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. */
|
|
1368
|
+
declare interface ReadableStream<R = any> {
|
|
1369
|
+
readonly locked: boolean;
|
|
1370
|
+
cancel(reason?: any): Promise<void>;
|
|
1371
|
+
getReader(): ReadableStreamDefaultReader<R>;
|
|
1372
|
+
getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader;
|
|
1373
|
+
pipeThrough<T>(
|
|
1374
|
+
transform: ReadableWritablePair<T, R>,
|
|
1375
|
+
options?: StreamPipeOptions
|
|
1376
|
+
): ReadableStream<T>;
|
|
1377
|
+
pipeTo(
|
|
1378
|
+
destination: WritableStream<R>,
|
|
1379
|
+
options?: StreamPipeOptions
|
|
1380
|
+
): Promise<void>;
|
|
1381
|
+
tee(): [ReadableStream<R>, ReadableStream<R>];
|
|
1382
|
+
values(options?: ReadableStreamValuesOptions): AsyncIterableIterator<R>;
|
|
1383
|
+
[Symbol.asyncIterator](
|
|
1384
|
+
options?: ReadableStreamValuesOptions
|
|
1385
|
+
): AsyncIterableIterator<R>;
|
|
1386
|
+
}
|
|
1387
|
+
declare const ReadableStream: {
|
|
1388
|
+
prototype: ReadableStream;
|
|
1389
|
+
new (
|
|
1390
|
+
underlyingSource: UnderlyingByteSource,
|
|
1391
|
+
strategy?: QueuingStrategy<Uint8Array>
|
|
1392
|
+
): ReadableStream<Uint8Array>;
|
|
1393
|
+
new <R = any>(
|
|
1394
|
+
underlyingSource?: UnderlyingSource<R>,
|
|
1395
|
+
strategy?: QueuingStrategy<R>
|
|
1396
|
+
): ReadableStream<R>;
|
|
1397
|
+
};
|
|
1398
|
+
declare class ReadableStreamDefaultReader<R = any> {
|
|
1399
|
+
constructor(stream: ReadableStream);
|
|
1400
|
+
readonly closed: Promise<void>;
|
|
1401
|
+
cancel(reason?: any): Promise<void>;
|
|
1402
|
+
read(): Promise<ReadableStreamReadResult<R>>;
|
|
1403
|
+
releaseLock(): void;
|
|
1263
1404
|
}
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1405
|
+
declare class ReadableStreamBYOBReader {
|
|
1406
|
+
constructor(stream: ReadableStream);
|
|
1407
|
+
readonly closed: Promise<void>;
|
|
1408
|
+
cancel(reason?: any): Promise<void>;
|
|
1409
|
+
read<T extends ArrayBufferView>(
|
|
1410
|
+
view: T
|
|
1411
|
+
): Promise<ReadableStreamReadResult<T>>;
|
|
1412
|
+
releaseLock(): void;
|
|
1413
|
+
readAtLeast<T extends ArrayBufferView>(
|
|
1414
|
+
minElements: number,
|
|
1415
|
+
view: T
|
|
1416
|
+
): Promise<ReadableStreamReadResult<T>>;
|
|
1267
1417
|
}
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
interface StreamQueuingStrategy {
|
|
1272
|
-
highWaterMark?: bigint;
|
|
1273
|
-
size(chunk: any): number;
|
|
1418
|
+
declare interface ReadableStreamGetReaderOptions {
|
|
1419
|
+
mode: "byob";
|
|
1274
1420
|
}
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
plainText: ArrayBuffer | ArrayBufferView
|
|
1281
|
-
): Promise<ArrayBuffer>;
|
|
1282
|
-
decrypt(
|
|
1283
|
-
algorithm: string | SubtleCryptoEncryptAlgorithm,
|
|
1284
|
-
key: CryptoKey,
|
|
1285
|
-
cipherText: ArrayBuffer | ArrayBufferView
|
|
1286
|
-
): Promise<ArrayBuffer>;
|
|
1287
|
-
sign(
|
|
1288
|
-
algorithm: string | SubtleCryptoSignAlgorithm,
|
|
1289
|
-
key: CryptoKey,
|
|
1290
|
-
data: ArrayBuffer | ArrayBufferView
|
|
1291
|
-
): Promise<ArrayBuffer>;
|
|
1292
|
-
verify(
|
|
1293
|
-
algorithm: string | SubtleCryptoSignAlgorithm,
|
|
1294
|
-
key: CryptoKey,
|
|
1295
|
-
signature: ArrayBuffer | ArrayBufferView,
|
|
1296
|
-
data: ArrayBuffer | ArrayBufferView
|
|
1297
|
-
): Promise<boolean>;
|
|
1298
|
-
digest(
|
|
1299
|
-
algorithm: string | SubtleCryptoHashAlgorithm,
|
|
1300
|
-
data: ArrayBuffer | ArrayBufferView
|
|
1301
|
-
): Promise<ArrayBuffer>;
|
|
1302
|
-
generateKey(
|
|
1303
|
-
algorithm: string | SubtleCryptoGenerateKeyAlgorithm,
|
|
1304
|
-
extractable: boolean,
|
|
1305
|
-
keyUsages: string[]
|
|
1306
|
-
): Promise<CryptoKey | CryptoKeyPair>;
|
|
1307
|
-
deriveKey(
|
|
1308
|
-
algorithm: string | SubtleCryptoDeriveKeyAlgorithm,
|
|
1309
|
-
baseKey: CryptoKey,
|
|
1310
|
-
derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm,
|
|
1311
|
-
extractable: boolean,
|
|
1312
|
-
keyUsages: string[]
|
|
1313
|
-
): Promise<CryptoKey>;
|
|
1314
|
-
deriveBits(
|
|
1315
|
-
algorithm: string | SubtleCryptoDeriveKeyAlgorithm,
|
|
1316
|
-
baseKey: CryptoKey,
|
|
1317
|
-
length: number | null
|
|
1318
|
-
): Promise<ArrayBuffer>;
|
|
1319
|
-
importKey(
|
|
1320
|
-
format: string,
|
|
1321
|
-
keyData: ArrayBuffer | JsonWebKey,
|
|
1322
|
-
algorithm: string | SubtleCryptoImportKeyAlgorithm,
|
|
1323
|
-
extractable: boolean,
|
|
1324
|
-
keyUsages: string[]
|
|
1325
|
-
): Promise<CryptoKey>;
|
|
1326
|
-
exportKey(format: string, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;
|
|
1327
|
-
wrapKey(
|
|
1328
|
-
format: string,
|
|
1329
|
-
key: CryptoKey,
|
|
1330
|
-
wrappingKey: CryptoKey,
|
|
1331
|
-
wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm
|
|
1332
|
-
): Promise<ArrayBuffer>;
|
|
1333
|
-
unwrapKey(
|
|
1334
|
-
format: string,
|
|
1335
|
-
wrappedKey: ArrayBuffer | ArrayBufferView,
|
|
1336
|
-
unwrappingKey: CryptoKey,
|
|
1337
|
-
unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm,
|
|
1338
|
-
unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm,
|
|
1339
|
-
extractable: boolean,
|
|
1340
|
-
keyUsages: string[]
|
|
1341
|
-
): Promise<CryptoKey>;
|
|
1342
|
-
timingSafeEqual(
|
|
1343
|
-
a: ArrayBuffer | ArrayBufferView,
|
|
1344
|
-
b: ArrayBuffer | ArrayBufferView
|
|
1345
|
-
): boolean;
|
|
1421
|
+
declare interface ReadableStreamBYOBRequest {
|
|
1422
|
+
readonly view: Uint8Array | null;
|
|
1423
|
+
respond(bytesWritten: number): void;
|
|
1424
|
+
respondWithNewView(view: ArrayBuffer | ArrayBufferView): void;
|
|
1425
|
+
readonly atLeast: number | null;
|
|
1346
1426
|
}
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
hash?: string | SubtleCryptoHashAlgorithm;
|
|
1353
|
-
public?: CryptoKey;
|
|
1354
|
-
info?: ArrayBuffer;
|
|
1427
|
+
declare interface ReadableStreamDefaultController<R = any> {
|
|
1428
|
+
readonly desiredSize: number | null;
|
|
1429
|
+
close(): void;
|
|
1430
|
+
enqueue(chunk?: R): void;
|
|
1431
|
+
error(reason: any): void;
|
|
1355
1432
|
}
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
counter?: ArrayBuffer;
|
|
1363
|
-
length?: number;
|
|
1364
|
-
label?: ArrayBuffer;
|
|
1433
|
+
declare interface ReadableByteStreamController {
|
|
1434
|
+
readonly byobRequest: ReadableStreamBYOBRequest | null;
|
|
1435
|
+
readonly desiredSize: number | null;
|
|
1436
|
+
close(): void;
|
|
1437
|
+
enqueue(chunk: ArrayBuffer | ArrayBufferView): void;
|
|
1438
|
+
error(reason: any): void;
|
|
1365
1439
|
}
|
|
1366
|
-
|
|
1367
|
-
interface
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
modulusLength?: number;
|
|
1371
|
-
publicExponent?: ArrayBuffer;
|
|
1372
|
-
length?: number;
|
|
1373
|
-
namedCurve?: string;
|
|
1440
|
+
/** 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. */
|
|
1441
|
+
declare interface WritableStreamDefaultController {
|
|
1442
|
+
readonly signal: AbortSignal;
|
|
1443
|
+
error(reason?: any): void;
|
|
1374
1444
|
}
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1445
|
+
declare interface TransformStreamDefaultController<O = any> {
|
|
1446
|
+
get desiredSize(): number | null;
|
|
1447
|
+
enqueue(chunk?: O): void;
|
|
1448
|
+
error(reason: any): void;
|
|
1449
|
+
terminate(): void;
|
|
1378
1450
|
}
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1451
|
+
declare interface ReadableWritablePair<R = any, W = any> {
|
|
1452
|
+
/**
|
|
1453
|
+
* 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.
|
|
1454
|
+
*
|
|
1455
|
+
* Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.
|
|
1456
|
+
*/
|
|
1457
|
+
writable: WritableStream<W>;
|
|
1458
|
+
readable: ReadableStream<R>;
|
|
1386
1459
|
}
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
* @deprecated Don't use. Introduced incidentally in 3.x. Scheduled for removal.
|
|
1397
|
-
*/
|
|
1398
|
-
declare type SubtleCryptoJsonWebKeyRsaOtherPrimesInfo = RsaOtherPrimesInfo;
|
|
1399
|
-
|
|
1400
|
-
interface SubtleCryptoSignAlgorithm {
|
|
1401
|
-
name: string;
|
|
1402
|
-
hash?: string | SubtleCryptoHashAlgorithm;
|
|
1403
|
-
dataLength?: number;
|
|
1404
|
-
saltLength?: number;
|
|
1460
|
+
declare class WritableStream<W = any> {
|
|
1461
|
+
constructor(
|
|
1462
|
+
underlyingSink?: UnderlyingSink,
|
|
1463
|
+
queuingStrategy?: QueuingStrategy
|
|
1464
|
+
);
|
|
1465
|
+
readonly locked: boolean;
|
|
1466
|
+
abort(reason?: any): Promise<void>;
|
|
1467
|
+
close(): Promise<void>;
|
|
1468
|
+
getWriter(): WritableStreamDefaultWriter<W>;
|
|
1405
1469
|
}
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
readonly
|
|
1409
|
-
readonly
|
|
1410
|
-
readonly
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1470
|
+
declare class WritableStreamDefaultWriter<W = any> {
|
|
1471
|
+
constructor(stream: WritableStream);
|
|
1472
|
+
readonly closed: Promise<void>;
|
|
1473
|
+
readonly ready: Promise<void>;
|
|
1474
|
+
readonly desiredSize: number | null;
|
|
1475
|
+
abort(reason?: any): Promise<void>;
|
|
1476
|
+
close(): Promise<void>;
|
|
1477
|
+
write(chunk?: W): Promise<void>;
|
|
1478
|
+
releaseLock(): void;
|
|
1415
1479
|
}
|
|
1416
|
-
|
|
1417
|
-
declare class TextDecoder {
|
|
1480
|
+
declare class TransformStream<I = any, O = any> {
|
|
1418
1481
|
constructor(
|
|
1419
|
-
|
|
1420
|
-
|
|
1482
|
+
transformer?: Transformer<I, O>,
|
|
1483
|
+
writableStrategy?: QueuingStrategy<I>,
|
|
1484
|
+
readableStrategy?: QueuingStrategy<O>
|
|
1421
1485
|
);
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
options?: TextDecoderDecodeOptions
|
|
1425
|
-
): string;
|
|
1426
|
-
readonly encoding: string;
|
|
1427
|
-
readonly fatal: boolean;
|
|
1428
|
-
readonly ignoreBOM: boolean;
|
|
1486
|
+
readonly readable: ReadableStream<O>;
|
|
1487
|
+
readonly writable: WritableStream<I>;
|
|
1429
1488
|
}
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
fatal: boolean;
|
|
1433
|
-
ignoreBOM: boolean;
|
|
1489
|
+
declare class FixedLengthStream extends IdentityTransformStream {
|
|
1490
|
+
constructor(expectedLength: number | bigint);
|
|
1434
1491
|
}
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1492
|
+
declare class IdentityTransformStream extends TransformStream<
|
|
1493
|
+
ArrayBuffer | ArrayBufferView,
|
|
1494
|
+
Uint8Array
|
|
1495
|
+
> {
|
|
1496
|
+
constructor();
|
|
1438
1497
|
}
|
|
1439
|
-
|
|
1440
|
-
|
|
1498
|
+
declare interface ReadableStreamValuesOptions {
|
|
1499
|
+
preventCancel?: boolean;
|
|
1500
|
+
}
|
|
1501
|
+
declare class CompressionStream extends TransformStream<
|
|
1502
|
+
ArrayBuffer | ArrayBufferView,
|
|
1503
|
+
Uint8Array
|
|
1504
|
+
> {
|
|
1505
|
+
constructor(format: "gzip" | "deflate");
|
|
1506
|
+
}
|
|
1507
|
+
declare class DecompressionStream extends TransformStream<
|
|
1508
|
+
ArrayBuffer | ArrayBufferView,
|
|
1509
|
+
Uint8Array
|
|
1510
|
+
> {
|
|
1511
|
+
constructor(format: "gzip" | "deflate");
|
|
1512
|
+
}
|
|
1513
|
+
declare class TextEncoderStream extends TransformStream<string, Uint8Array> {
|
|
1514
|
+
constructor();
|
|
1515
|
+
}
|
|
1516
|
+
declare class TextDecoderStream extends TransformStream<
|
|
1517
|
+
ArrayBuffer | ArrayBufferView,
|
|
1518
|
+
string
|
|
1519
|
+
> {
|
|
1441
1520
|
constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit);
|
|
1442
1521
|
}
|
|
1443
|
-
|
|
1444
|
-
interface TextDecoderStreamTextDecoderStreamInit {
|
|
1522
|
+
declare interface TextDecoderStreamTextDecoderStreamInit {
|
|
1445
1523
|
fatal?: boolean;
|
|
1446
1524
|
}
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1525
|
+
declare class ByteLengthQueuingStrategy
|
|
1526
|
+
implements QueuingStrategy<ArrayBufferView>
|
|
1527
|
+
{
|
|
1528
|
+
constructor(init: QueuingStrategyInit);
|
|
1529
|
+
get highWaterMark(): number;
|
|
1530
|
+
get size(): (chunk?: any) => number;
|
|
1453
1531
|
}
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1532
|
+
declare class CountQueuingStrategy implements QueuingStrategy {
|
|
1533
|
+
constructor(init: QueuingStrategyInit);
|
|
1534
|
+
get highWaterMark(): number;
|
|
1535
|
+
get size(): (chunk?: any) => number;
|
|
1458
1536
|
}
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1537
|
+
declare interface QueuingStrategyInit {
|
|
1538
|
+
/**
|
|
1539
|
+
* Creates a new ByteLengthQueuingStrategy with the provided high water mark.
|
|
1540
|
+
*
|
|
1541
|
+
* 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.
|
|
1542
|
+
*/
|
|
1543
|
+
highWaterMark: number;
|
|
1462
1544
|
}
|
|
1463
|
-
|
|
1464
|
-
interface TraceEvent extends ExtendableEvent {
|
|
1545
|
+
declare abstract class TraceEvent extends ExtendableEvent {
|
|
1465
1546
|
readonly traces: TraceItem[];
|
|
1466
1547
|
}
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1548
|
+
declare interface TraceItem {
|
|
1549
|
+
readonly event:
|
|
1550
|
+
| (
|
|
1551
|
+
| TraceItemFetchEventInfo
|
|
1552
|
+
| TraceItemScheduledEventInfo
|
|
1553
|
+
| TraceItemAlarmEventInfo
|
|
1554
|
+
| TraceItemCustomEventInfo
|
|
1555
|
+
)
|
|
1556
|
+
| null;
|
|
1476
1557
|
readonly eventTimestamp: number | null;
|
|
1477
1558
|
readonly logs: TraceLog[];
|
|
1478
1559
|
readonly exceptions: TraceException[];
|
|
@@ -1480,76 +1561,47 @@ interface TraceItem {
|
|
|
1480
1561
|
readonly dispatchNamespace?: string;
|
|
1481
1562
|
readonly outcome: string;
|
|
1482
1563
|
}
|
|
1483
|
-
|
|
1484
|
-
interface TraceItemAlarmEventInfo {
|
|
1564
|
+
declare interface TraceItemAlarmEventInfo {
|
|
1485
1565
|
readonly scheduledTime: Date;
|
|
1486
1566
|
}
|
|
1487
|
-
|
|
1488
|
-
declare
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
interface TraceItemFetchEventInfo {
|
|
1567
|
+
declare interface TraceItemCustomEventInfo {}
|
|
1568
|
+
declare interface TraceItemScheduledEventInfo {
|
|
1569
|
+
readonly scheduledTime: number;
|
|
1570
|
+
readonly cron: string;
|
|
1571
|
+
}
|
|
1572
|
+
declare interface TraceItemFetchEventInfo {
|
|
1494
1573
|
readonly response?: TraceItemFetchEventInfoResponse;
|
|
1495
1574
|
readonly request: TraceItemFetchEventInfoRequest;
|
|
1496
1575
|
}
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
readonly cf?: Object;
|
|
1576
|
+
declare interface TraceItemFetchEventInfoRequest {
|
|
1577
|
+
readonly cf?: any;
|
|
1500
1578
|
readonly headers: Record<string, string>;
|
|
1501
1579
|
readonly method: string;
|
|
1502
1580
|
readonly url: string;
|
|
1503
1581
|
getUnredacted(): TraceItemFetchEventInfoRequest;
|
|
1504
1582
|
}
|
|
1505
|
-
|
|
1506
|
-
interface TraceItemFetchEventInfoResponse {
|
|
1583
|
+
declare interface TraceItemFetchEventInfoResponse {
|
|
1507
1584
|
readonly status: number;
|
|
1508
1585
|
}
|
|
1509
|
-
|
|
1510
|
-
interface TraceItemScheduledEventInfo {
|
|
1511
|
-
readonly scheduledTime: number;
|
|
1512
|
-
readonly cron: string;
|
|
1513
|
-
}
|
|
1514
|
-
|
|
1515
|
-
interface TraceLog {
|
|
1586
|
+
declare interface TraceLog {
|
|
1516
1587
|
readonly timestamp: number;
|
|
1517
1588
|
readonly level: string;
|
|
1518
|
-
readonly message:
|
|
1589
|
+
readonly message: any;
|
|
1519
1590
|
}
|
|
1520
|
-
|
|
1521
|
-
|
|
1591
|
+
declare interface TraceException {
|
|
1592
|
+
readonly timestamp: number;
|
|
1593
|
+
readonly message: string;
|
|
1594
|
+
readonly name: string;
|
|
1595
|
+
}
|
|
1596
|
+
declare interface TraceMetrics {
|
|
1522
1597
|
readonly cpuTime: number;
|
|
1523
1598
|
readonly wallTime: number;
|
|
1524
1599
|
}
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
constructor(
|
|
1528
|
-
maybeTransformer?: Transformer,
|
|
1529
|
-
maybeWritableStrategy?: StreamQueuingStrategy,
|
|
1530
|
-
maybeReadableStrategy?: StreamQueuingStrategy
|
|
1531
|
-
);
|
|
1532
|
-
readonly readable: ReadableStream;
|
|
1533
|
-
readonly writable: WritableStream;
|
|
1534
|
-
}
|
|
1535
|
-
|
|
1536
|
-
interface TransformStreamDefaultController {
|
|
1537
|
-
readonly desiredSize: number | null;
|
|
1538
|
-
enqueue(chunk: any): void;
|
|
1539
|
-
error(reason: any): void;
|
|
1540
|
-
terminate(): void;
|
|
1541
|
-
}
|
|
1542
|
-
|
|
1543
|
-
interface Transformer {
|
|
1544
|
-
readableType?: string;
|
|
1545
|
-
writableType?: string;
|
|
1546
|
-
start?(controller: TransformStreamDefaultController): any;
|
|
1547
|
-
transform?(chunk: any, controller: TransformStreamDefaultController): any;
|
|
1548
|
-
flush?(controller: TransformStreamDefaultController): any;
|
|
1600
|
+
declare interface UnsafeTraceMetrics {
|
|
1601
|
+
fromTrace(item: TraceItem): TraceMetrics;
|
|
1549
1602
|
}
|
|
1550
|
-
|
|
1551
1603
|
declare class URL {
|
|
1552
|
-
constructor(url: string, base?: string);
|
|
1604
|
+
constructor(url: string | URL, base?: string | URL);
|
|
1553
1605
|
href: string;
|
|
1554
1606
|
readonly origin: string;
|
|
1555
1607
|
protocol: string;
|
|
@@ -1563,32 +1615,55 @@ declare class URL {
|
|
|
1563
1615
|
readonly searchParams: URLSearchParams;
|
|
1564
1616
|
hash: string;
|
|
1565
1617
|
toString(): string;
|
|
1566
|
-
toJSON(): string;
|
|
1618
|
+
toJSON(): string;
|
|
1619
|
+
}
|
|
1620
|
+
declare class URLSearchParams {
|
|
1621
|
+
constructor(
|
|
1622
|
+
init?:
|
|
1623
|
+
| URLSearchParams
|
|
1624
|
+
| string
|
|
1625
|
+
| Record<string, string>
|
|
1626
|
+
| [key: string, value: string][]
|
|
1627
|
+
);
|
|
1628
|
+
append(name: string, value: string): void;
|
|
1629
|
+
delete(name: string): void;
|
|
1630
|
+
get(name: string): string | null;
|
|
1631
|
+
getAll(name: string): string[];
|
|
1632
|
+
has(name: string): boolean;
|
|
1633
|
+
set(name: string, value: string): void;
|
|
1634
|
+
sort(): void;
|
|
1635
|
+
entries(): IterableIterator<[key: string, value: string]>;
|
|
1636
|
+
keys(): IterableIterator<string>;
|
|
1637
|
+
values(): IterableIterator<string>;
|
|
1638
|
+
forEach<This = unknown>(
|
|
1639
|
+
callback: (
|
|
1640
|
+
this: This,
|
|
1641
|
+
value: string,
|
|
1642
|
+
key: string,
|
|
1643
|
+
parent: URLSearchParams
|
|
1644
|
+
) => void,
|
|
1645
|
+
thisArg?: This
|
|
1646
|
+
): void;
|
|
1647
|
+
toString(): string;
|
|
1648
|
+
[Symbol.iterator](): IterableIterator<[key: string, value: string]>;
|
|
1567
1649
|
}
|
|
1568
|
-
|
|
1569
1650
|
declare class URLPattern {
|
|
1570
1651
|
constructor(input?: string | URLPatternURLPatternInit, baseURL?: string);
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1652
|
+
get protocol(): string;
|
|
1653
|
+
get username(): string;
|
|
1654
|
+
get password(): string;
|
|
1655
|
+
get hostname(): string;
|
|
1656
|
+
get port(): string;
|
|
1657
|
+
get pathname(): string;
|
|
1658
|
+
get search(): string;
|
|
1659
|
+
get hash(): string;
|
|
1579
1660
|
test(input?: string | URLPatternURLPatternInit, baseURL?: string): boolean;
|
|
1580
1661
|
exec(
|
|
1581
1662
|
input?: string | URLPatternURLPatternInit,
|
|
1582
1663
|
baseURL?: string
|
|
1583
1664
|
): URLPatternURLPatternResult | null;
|
|
1584
1665
|
}
|
|
1585
|
-
|
|
1586
|
-
interface URLPatternURLPatternComponentResult {
|
|
1587
|
-
input: string;
|
|
1588
|
-
groups: Record<string, string>;
|
|
1589
|
-
}
|
|
1590
|
-
|
|
1591
|
-
interface URLPatternURLPatternInit {
|
|
1666
|
+
declare interface URLPatternURLPatternInit {
|
|
1592
1667
|
protocol?: string;
|
|
1593
1668
|
username?: string;
|
|
1594
1669
|
password?: string;
|
|
@@ -1599,8 +1674,11 @@ interface URLPatternURLPatternInit {
|
|
|
1599
1674
|
hash?: string;
|
|
1600
1675
|
baseURL?: string;
|
|
1601
1676
|
}
|
|
1602
|
-
|
|
1603
|
-
|
|
1677
|
+
declare interface URLPatternURLPatternComponentResult {
|
|
1678
|
+
input: string;
|
|
1679
|
+
groups: Record<string, string>;
|
|
1680
|
+
}
|
|
1681
|
+
declare interface URLPatternURLPatternResult {
|
|
1604
1682
|
inputs: (string | URLPatternURLPatternInit)[];
|
|
1605
1683
|
protocol: URLPatternURLPatternComponentResult;
|
|
1606
1684
|
username: URLPatternURLPatternComponentResult;
|
|
@@ -1611,203 +1689,75 @@ interface URLPatternURLPatternResult {
|
|
|
1611
1689
|
search: URLPatternURLPatternComponentResult;
|
|
1612
1690
|
hash: URLPatternURLPatternComponentResult;
|
|
1613
1691
|
}
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
set(name: string, value: string): void;
|
|
1623
|
-
sort(): void;
|
|
1624
|
-
entries(): IterableIterator<[key: string, value: string]>;
|
|
1625
|
-
keys(): IterableIterator<string>;
|
|
1626
|
-
values(): IterableIterator<string>;
|
|
1627
|
-
forEach<This = unknown>(
|
|
1628
|
-
callback: (
|
|
1629
|
-
this: This,
|
|
1630
|
-
value: string,
|
|
1631
|
-
key: string,
|
|
1632
|
-
parent: URLSearchParams
|
|
1633
|
-
) => void,
|
|
1634
|
-
thisArg?: This
|
|
1635
|
-
): void;
|
|
1636
|
-
[Symbol.iterator](): IterableIterator<[key: string, value: string]>;
|
|
1637
|
-
toString(): string;
|
|
1692
|
+
declare class CloseEvent extends Event {
|
|
1693
|
+
constructor(type: string, initializer: CloseEventInit);
|
|
1694
|
+
/** Returns the WebSocket connection close code provided by the server. */
|
|
1695
|
+
readonly code: number;
|
|
1696
|
+
/** Returns the WebSocket connection close reason provided by the server. */
|
|
1697
|
+
readonly reason: string;
|
|
1698
|
+
/** Returns true if the connection closed cleanly; false otherwise. */
|
|
1699
|
+
readonly wasClean: boolean;
|
|
1638
1700
|
}
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
| Record<string, string>
|
|
1644
|
-
| [key: string, value: string][];
|
|
1645
|
-
|
|
1646
|
-
/**
|
|
1647
|
-
* Back compat for code migrating to older definitions.
|
|
1648
|
-
* This technically isn't part of a standard either way, but the naming
|
|
1649
|
-
* is more consistent.
|
|
1650
|
-
* @deprecated Use URLSearchParamsInit instead.
|
|
1651
|
-
*/
|
|
1652
|
-
declare type URLSearchParamsInitializer = URLSearchParamsInit;
|
|
1653
|
-
|
|
1654
|
-
interface UnderlyingSink {
|
|
1655
|
-
type?: string;
|
|
1656
|
-
start?(controller: WritableStreamDefaultController): any;
|
|
1657
|
-
write?(chunk: any, controller: WritableStreamDefaultController): any;
|
|
1658
|
-
abort?(reason: any): any;
|
|
1659
|
-
close?(): any;
|
|
1701
|
+
declare interface CloseEventInit {
|
|
1702
|
+
code?: number;
|
|
1703
|
+
reason?: string;
|
|
1704
|
+
wasClean?: boolean;
|
|
1660
1705
|
}
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
autoAllocateChunkSize?: number;
|
|
1665
|
-
start?(
|
|
1666
|
-
controller: ReadableStreamDefaultController | ReadableByteStreamController
|
|
1667
|
-
): any;
|
|
1668
|
-
pull?(
|
|
1669
|
-
controller: ReadableStreamDefaultController | ReadableByteStreamController
|
|
1670
|
-
): any;
|
|
1671
|
-
cancel?(reason?: any): any;
|
|
1706
|
+
declare class MessageEvent extends Event {
|
|
1707
|
+
constructor(type: string, initializer: MessageEventInit);
|
|
1708
|
+
readonly data: ArrayBuffer | string;
|
|
1672
1709
|
}
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
fromTrace(arg4: TraceItem): TraceMetrics;
|
|
1710
|
+
declare interface MessageEventInit {
|
|
1711
|
+
data: ArrayBuffer | string;
|
|
1676
1712
|
}
|
|
1677
|
-
|
|
1713
|
+
/** Events providing information related to errors in scripts or in files. */
|
|
1714
|
+
declare interface ErrorEvent extends Event {
|
|
1715
|
+
readonly filename: string;
|
|
1716
|
+
readonly message: string;
|
|
1717
|
+
readonly lineno: number;
|
|
1718
|
+
readonly colno: number;
|
|
1719
|
+
readonly error: any;
|
|
1720
|
+
}
|
|
1721
|
+
declare type WebSocketEventMap = {
|
|
1722
|
+
close: CloseEvent;
|
|
1723
|
+
message: MessageEvent;
|
|
1724
|
+
open: Event;
|
|
1725
|
+
error: ErrorEvent;
|
|
1726
|
+
};
|
|
1678
1727
|
declare class WebSocket extends EventTarget<WebSocketEventMap> {
|
|
1679
1728
|
constructor(url: string, protocols?: string[] | string);
|
|
1680
1729
|
accept(): void;
|
|
1681
|
-
send(message: ArrayBuffer | ArrayBufferView | string): void;
|
|
1730
|
+
send(message: (ArrayBuffer | ArrayBufferView) | string): void;
|
|
1682
1731
|
close(code?: number, reason?: string): void;
|
|
1683
1732
|
static readonly READY_STATE_CONNECTING: number;
|
|
1684
1733
|
static readonly READY_STATE_OPEN: number;
|
|
1685
1734
|
static readonly READY_STATE_CLOSING: number;
|
|
1686
1735
|
static readonly READY_STATE_CLOSED: number;
|
|
1736
|
+
/** Returns the state of the WebSocket object's connection. It can have the values described below. */
|
|
1687
1737
|
readonly readyState: number;
|
|
1738
|
+
/** Returns the URL that was used to establish the WebSocket connection. */
|
|
1688
1739
|
readonly url: string | null;
|
|
1740
|
+
/** 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. */
|
|
1689
1741
|
readonly protocol: string | null;
|
|
1742
|
+
/** Returns the extensions selected by the server, if any. */
|
|
1690
1743
|
readonly extensions: string | null;
|
|
1691
1744
|
}
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
error: ErrorEvent;
|
|
1698
|
-
};
|
|
1699
|
-
|
|
1700
|
-
declare const WebSocketPair: { new (): { 0: WebSocket; 1: WebSocket } };
|
|
1701
|
-
|
|
1702
|
-
declare abstract class WorkerGlobalScope extends EventTarget<WorkerGlobalScopeEventMap> {}
|
|
1703
|
-
|
|
1704
|
-
declare type WorkerGlobalScopeEventMap = {
|
|
1705
|
-
fetch: FetchEvent;
|
|
1706
|
-
scheduled: ScheduledEvent;
|
|
1707
|
-
unhandledrejection: PromiseRejectionEvent;
|
|
1708
|
-
rejectionhandled: PromiseRejectionEvent;
|
|
1745
|
+
declare const WebSocketPair: {
|
|
1746
|
+
new (): {
|
|
1747
|
+
0: WebSocket;
|
|
1748
|
+
1: WebSocket;
|
|
1749
|
+
};
|
|
1709
1750
|
};
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
underlyingSink?: UnderlyingSink,
|
|
1714
|
-
queuingStrategy?: StreamQueuingStrategy
|
|
1715
|
-
);
|
|
1716
|
-
readonly locked: boolean;
|
|
1717
|
-
abort(reason: any): Promise<void>;
|
|
1718
|
-
close(): Promise<void>;
|
|
1719
|
-
getWriter(): WritableStreamDefaultWriter;
|
|
1720
|
-
}
|
|
1721
|
-
|
|
1722
|
-
declare abstract class WritableStreamDefaultController {
|
|
1723
|
-
readonly signal: AbortSignal;
|
|
1724
|
-
error(reason?: any): void;
|
|
1725
|
-
}
|
|
1726
|
-
|
|
1727
|
-
declare class WritableStreamDefaultWriter {
|
|
1728
|
-
constructor(stream: WritableStream);
|
|
1751
|
+
declare interface Socket {
|
|
1752
|
+
readonly readable: ReadableStream;
|
|
1753
|
+
readonly writable: WritableStream;
|
|
1729
1754
|
readonly closed: Promise<void>;
|
|
1730
|
-
readonly ready: Promise<void>;
|
|
1731
|
-
readonly desiredSize: number | null;
|
|
1732
|
-
abort(reason: any): Promise<void>;
|
|
1733
1755
|
close(): Promise<void>;
|
|
1734
|
-
write(chunk: any): Promise<void>;
|
|
1735
|
-
releaseLock(): void;
|
|
1736
1756
|
}
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
*/
|
|
1742
|
-
declare type WritableStreamWritableStreamDefaultWriter =
|
|
1743
|
-
WritableStreamDefaultWriter;
|
|
1744
|
-
|
|
1745
|
-
declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(
|
|
1746
|
-
type: Type,
|
|
1747
|
-
handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>,
|
|
1748
|
-
options?: EventTargetAddEventListenerOptions | boolean
|
|
1749
|
-
): void;
|
|
1750
|
-
|
|
1751
|
-
declare function atob(data: string): string;
|
|
1752
|
-
|
|
1753
|
-
declare function btoa(data: string): string;
|
|
1754
|
-
|
|
1755
|
-
declare const caches: CacheStorage;
|
|
1756
|
-
|
|
1757
|
-
declare function clearInterval(timeoutId: number | null): void;
|
|
1758
|
-
|
|
1759
|
-
declare function clearTimeout(timeoutId: number | null): void;
|
|
1760
|
-
|
|
1761
|
-
declare const console: Console;
|
|
1762
|
-
|
|
1763
|
-
declare const crypto: Crypto;
|
|
1764
|
-
|
|
1765
|
-
declare function dispatchEvent(
|
|
1766
|
-
event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap]
|
|
1767
|
-
): boolean;
|
|
1768
|
-
|
|
1769
|
-
declare function fetch(
|
|
1770
|
-
request: Request | string,
|
|
1771
|
-
requestInitr?: RequestInit | Request
|
|
1772
|
-
): Promise<Response>;
|
|
1773
|
-
|
|
1774
|
-
declare const navigator: Navigator;
|
|
1775
|
-
|
|
1776
|
-
declare const origin: void;
|
|
1777
|
-
|
|
1778
|
-
declare function queueMicrotask(task: Function): void;
|
|
1779
|
-
|
|
1780
|
-
declare function removeEventListener<
|
|
1781
|
-
Type extends keyof WorkerGlobalScopeEventMap
|
|
1782
|
-
>(
|
|
1783
|
-
type: Type,
|
|
1784
|
-
handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>,
|
|
1785
|
-
options?: EventTargetEventListenerOptions | boolean
|
|
1786
|
-
): void;
|
|
1787
|
-
|
|
1788
|
-
declare const scheduler: Scheduler;
|
|
1789
|
-
|
|
1790
|
-
declare const self: ServiceWorkerGlobalScope;
|
|
1791
|
-
|
|
1792
|
-
declare function setInterval<Args extends any[]>(
|
|
1793
|
-
callback: (...args: Args) => void,
|
|
1794
|
-
msDelay?: number,
|
|
1795
|
-
...args: Args
|
|
1796
|
-
): number;
|
|
1797
|
-
|
|
1798
|
-
declare function setTimeout<Args extends any[]>(
|
|
1799
|
-
callback: (...args: Args) => void,
|
|
1800
|
-
msDelay?: number,
|
|
1801
|
-
...args: Args
|
|
1802
|
-
): number;
|
|
1803
|
-
|
|
1804
|
-
declare function structuredClone(
|
|
1805
|
-
value: any,
|
|
1806
|
-
options?: ServiceWorkerGlobalScopeStructuredCloneOptions
|
|
1807
|
-
): any;
|
|
1808
|
-
|
|
1809
|
-
/*** Injected cf.d.ts ***/
|
|
1810
|
-
interface BasicImageTransformations {
|
|
1757
|
+
declare interface SocketOptions {
|
|
1758
|
+
tsl: boolean;
|
|
1759
|
+
}
|
|
1760
|
+
declare interface BasicImageTransformations {
|
|
1811
1761
|
/**
|
|
1812
1762
|
* Maximum width in image pixels. The value must be an integer.
|
|
1813
1763
|
*/
|
|
@@ -1873,12 +1823,10 @@ interface BasicImageTransformations {
|
|
|
1873
1823
|
*/
|
|
1874
1824
|
rotate?: 0 | 90 | 180 | 270 | 360;
|
|
1875
1825
|
}
|
|
1876
|
-
|
|
1877
|
-
interface BasicImageTransformationsGravityCoordinates {
|
|
1826
|
+
declare interface BasicImageTransformationsGravityCoordinates {
|
|
1878
1827
|
x: number;
|
|
1879
1828
|
y: number;
|
|
1880
1829
|
}
|
|
1881
|
-
|
|
1882
1830
|
/**
|
|
1883
1831
|
* In addition to the properties you can set in the RequestInit dict
|
|
1884
1832
|
* that you pass as an argument to the Request constructor, you can
|
|
@@ -1888,7 +1836,7 @@ interface BasicImageTransformationsGravityCoordinates {
|
|
|
1888
1836
|
* Note: Currently, these properties cannot be tested in the
|
|
1889
1837
|
* playground.
|
|
1890
1838
|
*/
|
|
1891
|
-
interface RequestInitCfProperties {
|
|
1839
|
+
declare interface RequestInitCfProperties {
|
|
1892
1840
|
cacheEverything?: boolean;
|
|
1893
1841
|
/**
|
|
1894
1842
|
* A request's cache key is what determines if two requests are
|
|
@@ -1938,8 +1886,8 @@ interface RequestInitCfProperties {
|
|
|
1938
1886
|
*/
|
|
1939
1887
|
resolveOverride?: string;
|
|
1940
1888
|
}
|
|
1941
|
-
|
|
1942
|
-
|
|
1889
|
+
declare interface RequestInitCfPropertiesImageDraw
|
|
1890
|
+
extends BasicImageTransformations {
|
|
1943
1891
|
/**
|
|
1944
1892
|
* Absolute URL of the image file to use for the drawing. It can be any of
|
|
1945
1893
|
* the supported file formats. For drawing of watermarks or non-rectangular
|
|
@@ -1976,8 +1924,8 @@ interface RequestInitCfPropertiesImageDraw extends BasicImageTransformations {
|
|
|
1976
1924
|
bottom?: number;
|
|
1977
1925
|
right?: number;
|
|
1978
1926
|
}
|
|
1979
|
-
|
|
1980
|
-
|
|
1927
|
+
declare interface RequestInitCfPropertiesImage
|
|
1928
|
+
extends BasicImageTransformations {
|
|
1981
1929
|
/**
|
|
1982
1930
|
* Device Pixel Ratio. Default 1. Multiplier for width/height that makes it
|
|
1983
1931
|
* easier to specify higher-DPI sizes in <img srcset>.
|
|
@@ -2059,24 +2007,21 @@ interface RequestInitCfPropertiesImage extends BasicImageTransformations {
|
|
|
2059
2007
|
*/
|
|
2060
2008
|
"origin-auth"?: "share-publicly";
|
|
2061
2009
|
}
|
|
2062
|
-
|
|
2063
|
-
interface RequestInitCfPropertiesImageMinify {
|
|
2010
|
+
declare interface RequestInitCfPropertiesImageMinify {
|
|
2064
2011
|
javascript?: boolean;
|
|
2065
2012
|
css?: boolean;
|
|
2066
2013
|
html?: boolean;
|
|
2067
2014
|
}
|
|
2068
|
-
|
|
2069
2015
|
/**
|
|
2070
2016
|
* Request metadata provided by Cloudflare's edge.
|
|
2071
2017
|
*/
|
|
2072
|
-
type IncomingRequestCfProperties<HostMetadata = unknown> =
|
|
2018
|
+
declare type IncomingRequestCfProperties<HostMetadata = unknown> =
|
|
2073
2019
|
IncomingRequestCfPropertiesBase &
|
|
2074
2020
|
IncomingRequestCfPropertiesBotManagementEnterprise &
|
|
2075
2021
|
IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> &
|
|
2076
2022
|
IncomingRequestCfPropertiesGeographicInformation &
|
|
2077
2023
|
IncomingRequestCfPropertiesCloudflareAccessOrApiShield;
|
|
2078
|
-
|
|
2079
|
-
interface IncomingRequestCfPropertiesBase {
|
|
2024
|
+
declare interface IncomingRequestCfPropertiesBase {
|
|
2080
2025
|
/**
|
|
2081
2026
|
* [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request.
|
|
2082
2027
|
*
|
|
@@ -2154,8 +2099,7 @@ interface IncomingRequestCfPropertiesBase {
|
|
|
2154
2099
|
*/
|
|
2155
2100
|
tlsExportedAuthenticator?: IncomingRequestCfPropertiesExportedAuthenticatorMetadata;
|
|
2156
2101
|
}
|
|
2157
|
-
|
|
2158
|
-
interface IncomingRequestCfPropertiesBotManagementBase {
|
|
2102
|
+
declare interface IncomingRequestCfPropertiesBotManagementBase {
|
|
2159
2103
|
/**
|
|
2160
2104
|
* Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot,
|
|
2161
2105
|
* represented as an integer percentage between `1` (almost certainly human)
|
|
@@ -2179,8 +2123,7 @@ interface IncomingRequestCfPropertiesBotManagementBase {
|
|
|
2179
2123
|
*/
|
|
2180
2124
|
staticResource: boolean;
|
|
2181
2125
|
}
|
|
2182
|
-
|
|
2183
|
-
interface IncomingRequestCfPropertiesBotManagement {
|
|
2126
|
+
declare interface IncomingRequestCfPropertiesBotManagement {
|
|
2184
2127
|
/**
|
|
2185
2128
|
* Results of Cloudflare's Bot Management analysis
|
|
2186
2129
|
*/
|
|
@@ -2192,8 +2135,7 @@ interface IncomingRequestCfPropertiesBotManagement {
|
|
|
2192
2135
|
*/
|
|
2193
2136
|
clientTrustScore: number;
|
|
2194
2137
|
}
|
|
2195
|
-
|
|
2196
|
-
interface IncomingRequestCfPropertiesBotManagementEnterprise
|
|
2138
|
+
declare interface IncomingRequestCfPropertiesBotManagementEnterprise
|
|
2197
2139
|
extends IncomingRequestCfPropertiesBotManagement {
|
|
2198
2140
|
/**
|
|
2199
2141
|
* Results of Cloudflare's Bot Management analysis
|
|
@@ -2206,8 +2148,9 @@ interface IncomingRequestCfPropertiesBotManagementEnterprise
|
|
|
2206
2148
|
ja3Hash: string;
|
|
2207
2149
|
};
|
|
2208
2150
|
}
|
|
2209
|
-
|
|
2210
|
-
|
|
2151
|
+
declare interface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<
|
|
2152
|
+
HostMetadata
|
|
2153
|
+
> {
|
|
2211
2154
|
/**
|
|
2212
2155
|
* Custom metadata set per-host in [Cloudflare for SaaS](https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/).
|
|
2213
2156
|
*
|
|
@@ -2216,8 +2159,7 @@ interface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> {
|
|
|
2216
2159
|
*/
|
|
2217
2160
|
hostMetadata: HostMetadata;
|
|
2218
2161
|
}
|
|
2219
|
-
|
|
2220
|
-
interface IncomingRequestCfPropertiesCloudflareAccessOrApiShield {
|
|
2162
|
+
declare interface IncomingRequestCfPropertiesCloudflareAccessOrApiShield {
|
|
2221
2163
|
/**
|
|
2222
2164
|
* Information about the client certificate presented to Cloudflare.
|
|
2223
2165
|
*
|
|
@@ -2236,11 +2178,10 @@ interface IncomingRequestCfPropertiesCloudflareAccessOrApiShield {
|
|
|
2236
2178
|
| IncomingRequestCfPropertiesTLSClientAuth
|
|
2237
2179
|
| IncomingRequestCfPropertiesTLSClientAuthPlaceholder;
|
|
2238
2180
|
}
|
|
2239
|
-
|
|
2240
2181
|
/**
|
|
2241
2182
|
* Metadata about the request's TLS handshake
|
|
2242
2183
|
*/
|
|
2243
|
-
interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata {
|
|
2184
|
+
declare interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata {
|
|
2244
2185
|
/**
|
|
2245
2186
|
* The client's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal
|
|
2246
2187
|
*
|
|
@@ -2266,14 +2207,11 @@ interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata {
|
|
|
2266
2207
|
*/
|
|
2267
2208
|
serverFinished: string;
|
|
2268
2209
|
}
|
|
2269
|
-
|
|
2270
2210
|
/**
|
|
2271
2211
|
* Geographic data about the request's origin.
|
|
2272
2212
|
*/
|
|
2273
|
-
type IncomingRequestCfPropertiesGeographicInformation =
|
|
2274
|
-
| {
|
|
2275
|
-
/* No geographic data was found for the incoming request. */
|
|
2276
|
-
}
|
|
2213
|
+
declare type IncomingRequestCfPropertiesGeographicInformation =
|
|
2214
|
+
| {}
|
|
2277
2215
|
| {
|
|
2278
2216
|
/** The country code `"T1"` is used for requests originating on TOR */
|
|
2279
2217
|
country: "T1";
|
|
@@ -2352,9 +2290,8 @@ type IncomingRequestCfPropertiesGeographicInformation =
|
|
|
2352
2290
|
*/
|
|
2353
2291
|
metroCode?: string;
|
|
2354
2292
|
};
|
|
2355
|
-
|
|
2356
2293
|
/** Data about the incoming request's TLS certificate */
|
|
2357
|
-
interface IncomingRequestCfPropertiesTLSClientAuth {
|
|
2294
|
+
declare interface IncomingRequestCfPropertiesTLSClientAuth {
|
|
2358
2295
|
/** Always `"1"`, indicating that the certificate was presented */
|
|
2359
2296
|
certPresented: "1";
|
|
2360
2297
|
/**
|
|
@@ -2446,9 +2383,8 @@ interface IncomingRequestCfPropertiesTLSClientAuth {
|
|
|
2446
2383
|
*/
|
|
2447
2384
|
certNotAfter: string;
|
|
2448
2385
|
}
|
|
2449
|
-
|
|
2450
2386
|
/** Placeholder values for TLS Client Authorization */
|
|
2451
|
-
interface IncomingRequestCfPropertiesTLSClientAuthPlaceholder {
|
|
2387
|
+
declare interface IncomingRequestCfPropertiesTLSClientAuthPlaceholder {
|
|
2452
2388
|
certPresented: "0";
|
|
2453
2389
|
certVerified: "NONE";
|
|
2454
2390
|
certRevoked: "0";
|
|
@@ -2467,7 +2403,6 @@ interface IncomingRequestCfPropertiesTLSClientAuthPlaceholder {
|
|
|
2467
2403
|
certNotBefore: "";
|
|
2468
2404
|
certNotAfter: "";
|
|
2469
2405
|
}
|
|
2470
|
-
|
|
2471
2406
|
/** Possible outcomes of TLS verification */
|
|
2472
2407
|
declare type CertVerificationStatus =
|
|
2473
2408
|
/** Authentication succeeded */
|
|
@@ -2484,7 +2419,6 @@ declare type CertVerificationStatus =
|
|
|
2484
2419
|
| "FAILED:certificate has expired"
|
|
2485
2420
|
/** Failed for another unspecified reason */
|
|
2486
2421
|
| "FAILED";
|
|
2487
|
-
|
|
2488
2422
|
/**
|
|
2489
2423
|
* An upstream endpoint's response to a TCP `keepalive` message from Cloudflare.
|
|
2490
2424
|
*/
|
|
@@ -2495,7 +2429,6 @@ declare type IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus =
|
|
|
2495
2429
|
| 3 /** no connection re-use, keepalive accepted and saved */
|
|
2496
2430
|
| 4 /** connection re-use, refused by the origin server (`TCP FIN`) */
|
|
2497
2431
|
| 5; /** connection re-use, accepted by the origin server */
|
|
2498
|
-
|
|
2499
2432
|
/** ISO 3166-1 Alpha-2 codes */
|
|
2500
2433
|
declare type Iso3166Alpha2Code =
|
|
2501
2434
|
| "AD"
|
|
@@ -2747,39 +2680,62 @@ declare type Iso3166Alpha2Code =
|
|
|
2747
2680
|
| "ZA"
|
|
2748
2681
|
| "ZM"
|
|
2749
2682
|
| "ZW";
|
|
2750
|
-
|
|
2751
2683
|
/** The 2-letter continent codes Cloudflare uses */
|
|
2752
2684
|
declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2685
|
+
declare interface D1Result<T = unknown> {
|
|
2686
|
+
results?: T[];
|
|
2687
|
+
success: boolean;
|
|
2688
|
+
error?: string;
|
|
2689
|
+
meta: any;
|
|
2690
|
+
}
|
|
2691
|
+
declare abstract class D1Database {
|
|
2692
|
+
prepare(query: string): D1PreparedStatement;
|
|
2693
|
+
dump(): Promise<ArrayBuffer>;
|
|
2694
|
+
batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;
|
|
2695
|
+
exec<T = unknown>(query: string): Promise<D1Result<T>>;
|
|
2696
|
+
}
|
|
2697
|
+
declare abstract class D1PreparedStatement {
|
|
2698
|
+
bind(...values: any[]): D1PreparedStatement;
|
|
2699
|
+
first<T = unknown>(colName?: string): Promise<T>;
|
|
2700
|
+
run<T = unknown>(): Promise<D1Result<T>>;
|
|
2701
|
+
all<T = unknown>(): Promise<D1Result<T>>;
|
|
2702
|
+
raw<T = unknown>(): Promise<T[]>;
|
|
2703
|
+
}
|
|
2704
|
+
declare type Params<P extends string = any> = Record<P, string | string[]>;
|
|
2705
|
+
declare type EventContext<Env, P extends string, Data> = {
|
|
2757
2706
|
request: Request;
|
|
2758
2707
|
functionPath: string;
|
|
2759
2708
|
waitUntil: (promise: Promise<any>) => void;
|
|
2709
|
+
passThroughOnException: () => void;
|
|
2760
2710
|
next: (input?: Request | string, init?: RequestInit) => Promise<Response>;
|
|
2761
|
-
env: Env & {
|
|
2711
|
+
env: Env & {
|
|
2712
|
+
ASSETS: {
|
|
2713
|
+
fetch: typeof fetch;
|
|
2714
|
+
};
|
|
2715
|
+
};
|
|
2762
2716
|
params: Params<P>;
|
|
2763
2717
|
data: Data;
|
|
2764
2718
|
};
|
|
2765
|
-
|
|
2766
2719
|
declare type PagesFunction<
|
|
2767
2720
|
Env = unknown,
|
|
2768
2721
|
Params extends string = any,
|
|
2769
2722
|
Data extends Record<string, unknown> = Record<string, unknown>
|
|
2770
2723
|
> = (context: EventContext<Env, Params, Data>) => Response | Promise<Response>;
|
|
2771
|
-
|
|
2772
|
-
type EventPluginContext<Env, P extends string, Data, PluginArgs> = {
|
|
2724
|
+
declare type EventPluginContext<Env, P extends string, Data, PluginArgs> = {
|
|
2773
2725
|
request: Request;
|
|
2774
2726
|
functionPath: string;
|
|
2775
2727
|
waitUntil: (promise: Promise<any>) => void;
|
|
2728
|
+
passThroughOnException: () => void;
|
|
2776
2729
|
next: (input?: Request | string, init?: RequestInit) => Promise<Response>;
|
|
2777
|
-
env: Env & {
|
|
2730
|
+
env: Env & {
|
|
2731
|
+
ASSETS: {
|
|
2732
|
+
fetch: typeof fetch;
|
|
2733
|
+
};
|
|
2734
|
+
};
|
|
2778
2735
|
params: Params<P>;
|
|
2779
2736
|
data: Data;
|
|
2780
2737
|
pluginArgs: PluginArgs;
|
|
2781
2738
|
};
|
|
2782
|
-
|
|
2783
2739
|
declare type PagesPluginFunction<
|
|
2784
2740
|
Env = unknown,
|
|
2785
2741
|
Params extends string = any,
|
|
@@ -2788,7 +2744,51 @@ declare type PagesPluginFunction<
|
|
|
2788
2744
|
> = (
|
|
2789
2745
|
context: EventPluginContext<Env, Params, Data, PluginArgs>
|
|
2790
2746
|
) => Response | Promise<Response>;
|
|
2791
|
-
|
|
2792
2747
|
declare module "assets:*" {
|
|
2793
2748
|
export const onRequest: PagesFunction;
|
|
2794
2749
|
}
|
|
2750
|
+
/**
|
|
2751
|
+
* A message that is sent to a consumer Worker.
|
|
2752
|
+
*/
|
|
2753
|
+
declare interface Message<Body = unknown> {
|
|
2754
|
+
/**
|
|
2755
|
+
* A unique, system-generated ID for the message.
|
|
2756
|
+
*/
|
|
2757
|
+
readonly id: string;
|
|
2758
|
+
/**
|
|
2759
|
+
* A timestamp when the message was sent.
|
|
2760
|
+
*/
|
|
2761
|
+
readonly timestamp: Date;
|
|
2762
|
+
/**
|
|
2763
|
+
* The body of the message.
|
|
2764
|
+
*/
|
|
2765
|
+
readonly body: Body;
|
|
2766
|
+
}
|
|
2767
|
+
/**
|
|
2768
|
+
* A batch of messages that are sent to a consumer Worker.
|
|
2769
|
+
*/
|
|
2770
|
+
declare interface MessageBatch<Body = unknown> {
|
|
2771
|
+
/**
|
|
2772
|
+
* The name of the Queue that belongs to this batch.
|
|
2773
|
+
*/
|
|
2774
|
+
readonly queue: string;
|
|
2775
|
+
/**
|
|
2776
|
+
* An array of messages in the batch. Ordering of messages is not guaranteed.
|
|
2777
|
+
*/
|
|
2778
|
+
readonly messages: readonly Message<Body>[];
|
|
2779
|
+
/**
|
|
2780
|
+
* Marks every message to be retried in the next batch.
|
|
2781
|
+
*/
|
|
2782
|
+
retryAll(): void;
|
|
2783
|
+
}
|
|
2784
|
+
/**
|
|
2785
|
+
* A binding that allows a producer to send messages to a Queue.
|
|
2786
|
+
*/
|
|
2787
|
+
declare interface Queue<Body = any> {
|
|
2788
|
+
/**
|
|
2789
|
+
* Sends a message to the Queue.
|
|
2790
|
+
* @param message The message can be any type supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types), as long as its size is less than 128 KB.
|
|
2791
|
+
* @returns A promise that resolves when the message is confirmed to be written to disk.
|
|
2792
|
+
*/
|
|
2793
|
+
send(message: Body): Promise<void>;
|
|
2794
|
+
}
|