补充提示
This commit is contained in:
31
global-types/globals.d.ts
vendored
31
global-types/globals.d.ts
vendored
@@ -8,12 +8,14 @@ declare global {
|
|||||||
TypeBinaryMessage: number;
|
TypeBinaryMessage: number;
|
||||||
|
|
||||||
readText(): Promise<string>;
|
readText(): Promise<string>;
|
||||||
|
|
||||||
read(): Promise<{
|
read(): Promise<{
|
||||||
type: number;
|
type: number;
|
||||||
data: Uint8Array;
|
data: Uint8Array;
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
writeText(data: string): Promise<void>;
|
writeText(data: string): Promise<void>;
|
||||||
|
|
||||||
write(mType: number, data: string | Uint8Array): Promise<void>;
|
write(mType: number, data: string | Uint8Array): Promise<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -22,6 +24,7 @@ declare global {
|
|||||||
// Event 相关类型
|
// Event 相关类型
|
||||||
interface EventSystem {
|
interface EventSystem {
|
||||||
load(key: string): Promise<any>;
|
load(key: string): Promise<any>;
|
||||||
|
|
||||||
put(key: string, value: string): Promise<void>;
|
put(key: string, value: string): Promise<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,13 +46,21 @@ declare global {
|
|||||||
headers: Record<string, string>;
|
headers: Record<string, string>;
|
||||||
|
|
||||||
get(key: string): string | null;
|
get(key: string): string | null;
|
||||||
|
|
||||||
getQuery(key: string): string;
|
getQuery(key: string): string;
|
||||||
|
|
||||||
getHeader(name: string): string;
|
getHeader(name: string): string;
|
||||||
|
|
||||||
getHeaderNames(): string[];
|
getHeaderNames(): string[];
|
||||||
|
|
||||||
getHeaders(): Record<string, string>;
|
getHeaders(): Record<string, string>;
|
||||||
|
|
||||||
getRawHeaderNames(): string[];
|
getRawHeaderNames(): string[];
|
||||||
|
|
||||||
hasHeader(name: string): boolean;
|
hasHeader(name: string): boolean;
|
||||||
|
|
||||||
readBody(): Uint8Array;
|
readBody(): Uint8Array;
|
||||||
|
|
||||||
protocol: string;
|
protocol: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,15 +79,21 @@ declare global {
|
|||||||
|
|
||||||
interface ResponseObject {
|
interface ResponseObject {
|
||||||
setHeader(key: string, value: string): void;
|
setHeader(key: string, value: string): void;
|
||||||
|
|
||||||
getHeader(key: string): string;
|
getHeader(key: string): string;
|
||||||
|
|
||||||
removeHeader(key: string): void;
|
removeHeader(key: string): void;
|
||||||
|
|
||||||
hasHeader(key: string): boolean;
|
hasHeader(key: string): boolean;
|
||||||
|
|
||||||
setStatus(statusCode: number): void;
|
setStatus(statusCode: number): void;
|
||||||
|
|
||||||
statusCode(statusCode: number): void;
|
statusCode(statusCode: number): void;
|
||||||
|
|
||||||
write(data: string): void;
|
write(data: string): void;
|
||||||
|
|
||||||
writeHead(statusCode: number, headers?: Record<string, string>): void;
|
writeHead(statusCode: number, headers?: Record<string, string>): void;
|
||||||
|
|
||||||
end(data?: string): void;
|
end(data?: string): void;
|
||||||
|
|
||||||
redirect(location: string, statusCode?: number): void;
|
redirect(location: string, statusCode?: number): void;
|
||||||
@@ -97,15 +114,21 @@ declare global {
|
|||||||
|
|
||||||
interface KVOps {
|
interface KVOps {
|
||||||
get(key: string): string | null;
|
get(key: string): string | null;
|
||||||
set(key: string, value: string): void;
|
|
||||||
|
set(key: string, value: string, ttl?: number): void;
|
||||||
|
|
||||||
delete(key: string): boolean;
|
delete(key: string): boolean;
|
||||||
putIfNotExists(key: string, value: string): boolean;
|
|
||||||
|
putIfNotExists(key: string, value: string, ttl?: number): boolean;
|
||||||
|
|
||||||
compareAndSwap(key: string, oldValue: string, newValue: string): boolean;
|
compareAndSwap(key: string, oldValue: string, newValue: string): boolean;
|
||||||
|
|
||||||
list(limit?: number, cursor?: string): KVListResult;
|
list(limit?: number, cursor?: string): KVListResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface KVSystem {
|
interface KVSystem {
|
||||||
repo(...group: string[]): KVOps;
|
repo(...group: string[]): KVOps;
|
||||||
|
|
||||||
org(...group: string[]): KVOps;
|
org(...group: string[]): KVOps;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,9 +137,13 @@ declare global {
|
|||||||
// Console 相关 (假设通过 require 引入)
|
// Console 相关 (假设通过 require 引入)
|
||||||
interface Console {
|
interface Console {
|
||||||
log(...args: any[]): void;
|
log(...args: any[]): void;
|
||||||
|
|
||||||
warn(...args: any[]): void;
|
warn(...args: any[]): void;
|
||||||
|
|
||||||
error(...args: any[]): void;
|
error(...args: any[]): void;
|
||||||
|
|
||||||
info(...args: any[]): void;
|
info(...args: any[]): void;
|
||||||
|
|
||||||
debug(...args: any[]): void;
|
debug(...args: any[]): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user