///
import { CacheGetter } from "@dweb-browser/helper/cacheGetter.ts";
import { type $Binary } from "@dweb-browser/helper/fun/binaryHelper.ts";
import { IpcHeaders } from "../helper/IpcHeaders.js";
import { PURE_METHOD } from "../helper/PureMethod.js";
import type { $IpcRequestInit, Ipc } from "../ipc.js";
import { PureChannel } from "./channel/PureChannel.js";
import { IPC_MESSAGE_TYPE } from "./internal/IpcMessage.js";
import type { IpcBody } from "./stream/IpcBody.js";
import type { MetaBody } from "./stream/MetaBody.js";
export type $IpcRawRequest = ReturnType;
export declare const IpcRawRequest: (reqId: number, method: PURE_METHOD, url: string, headers: Record, metaBody: MetaBody) => {
readonly reqId: number;
readonly method: PURE_METHOD;
readonly url: string;
readonly headers: Record;
readonly metaBody: MetaBody;
readonly type: IPC_MESSAGE_TYPE.REQUEST;
};
export declare abstract class IpcRequest {
readonly reqId: number;
readonly url: string;
readonly method: PURE_METHOD;
readonly headers: IpcHeaders;
readonly body: IpcBody;
readonly ipc: Ipc;
readonly type = IPC_MESSAGE_TYPE.REQUEST;
constructor(reqId: number, url: string, method: PURE_METHOD, headers: IpcHeaders, body: IpcBody, ipc: Ipc);
private _parsed_url?;
get parsed_url(): any;
/**
* 判断是否是双工协议
*
* 比如目前双工协议可以由 WebSocket 来提供支持
*/
get hasDuplex(): boolean;
private lazyDuplexIpcId;
get duplexIpcId(): any;
protected abstract channel: CacheGetter;
getChannel(): any;
toSerializable(): {
readonly reqId: number;
readonly method: PURE_METHOD;
readonly url: string;
readonly headers: Record;
readonly metaBody: MetaBody;
readonly type: IPC_MESSAGE_TYPE.REQUEST;
};
toJSON(): {
readonly reqId: number;
readonly method: PURE_METHOD;
readonly url: string;
readonly headers: Record;
readonly metaBody: MetaBody;
readonly type: IPC_MESSAGE_TYPE.REQUEST;
};
}
export declare class IpcClientRequest extends IpcRequest {
private server?;
toServer(serverIpc: Ipc): IpcServerRequest;
static fromText(reqId: number, url: string, method: PURE_METHOD | undefined, headers: IpcHeaders | undefined, text: string, ipc: Ipc): IpcClientRequest;
static fromBinary(reqId: number, url: string, method: PURE_METHOD | undefined, headers: IpcHeaders | undefined, binary: $Binary, ipc: Ipc): IpcClientRequest;
static fromStream(reqId: number, url: string, method: PURE_METHOD | undefined, headers: IpcHeaders | undefined, stream: ReadableStream, ipc: Ipc): IpcClientRequest;
static fromRequest(reqId: number, ipc: Ipc, url: string, init?: $IpcRequestInit): Promise;
private pureChannel?;
protected channel: any;
}
export declare class IpcServerRequest extends IpcRequest {
readonly client: IpcClientRequest;
constructor(client: IpcClientRequest, ipc: Ipc);
protected channel: any;
toPureClientRequest(): PureRequest;
}
export declare class PureRequest extends Request implements Body {
stream?: BodyInit | null;
constructor(input: URL | RequestInfo, init?: RequestInit | undefined);
get body(): ReadableStream | null;
get bodyUsed(): boolean;
arrayBuffer(): Promise;
blob(): Promise;
formData(): Promise;
json(): Promise;
text(): Promise;
}
//# sourceMappingURL=IpcRequest.d.ts.map