-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcloudflare-env.d.ts
More file actions
38 lines (33 loc) · 884 Bytes
/
Copy pathcloudflare-env.d.ts
File metadata and controls
38 lines (33 loc) · 884 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
interface Fetcher {
fetch(request: Request): Promise<Response>;
}
interface D1Result<T = unknown> {
results?: T[];
success: boolean;
meta: {
last_row_id?: number;
[key: string]: unknown;
};
}
interface D1PreparedStatement {
bind(...values: unknown[]): D1PreparedStatement;
all<T = Record<string, unknown>>(): Promise<D1Result<T>>;
first<T = Record<string, unknown>>(): Promise<T | null>;
run<T = Record<string, unknown>>(): Promise<D1Result<T>>;
}
interface D1Database {
prepare(query: string): D1PreparedStatement;
batch<T = Record<string, unknown>>(
statements: D1PreparedStatement[],
): Promise<D1Result<T>[]>;
}
interface ExecutionContext {
waitUntil(promise: Promise<unknown>): void;
passThroughOnException(): void;
}
declare module "cloudflare:workers" {
export const env: {
DB?: D1Database;
[key: string]: unknown;
};
}