test: add 'cloudflare:test' module to export same typings as 'cloudflare:workers'
This commit is contained in:
47
worker-configuration.d.ts
vendored
47
worker-configuration.d.ts
vendored
@@ -22,12 +22,12 @@ declare namespace Cloudflare {
|
||||
NEW_EPISODE: Queue;
|
||||
}
|
||||
}
|
||||
interface Env extends Cloudflare.Env {}
|
||||
interface Env extends Cloudflare.Env { }
|
||||
type StringifyValues<EnvType extends Record<string, unknown>> = {
|
||||
[Binding in keyof EnvType]: EnvType[Binding] extends string ? EnvType[Binding] : string;
|
||||
};
|
||||
declare namespace NodeJS {
|
||||
interface ProcessEnv extends StringifyValues<Pick<Cloudflare.Env, "ADMIN_SDK_JSON" | "CLOUDFLARE_TOKEN" | "CLOUDFLARE_D1_TOKEN" | "CLOUDFLARE_ACCOUNT_ID" | "CLOUDFLARE_DATABASE_ID" | "PROXY_URL" | "USE_MOCK_DATA" | "LOG_DB_QUERIES">> {}
|
||||
interface ProcessEnv extends StringifyValues<Pick<Cloudflare.Env, "ADMIN_SDK_JSON" | "CLOUDFLARE_TOKEN" | "CLOUDFLARE_D1_TOKEN" | "CLOUDFLARE_ACCOUNT_ID" | "CLOUDFLARE_DATABASE_ID" | "PROXY_URL" | "USE_MOCK_DATA" | "LOG_DB_QUERIES">> { }
|
||||
}
|
||||
|
||||
// Begin runtime types
|
||||
@@ -1644,7 +1644,7 @@ declare abstract class Body {
|
||||
*/
|
||||
declare var Response: {
|
||||
prototype: Response;
|
||||
new (body?: BodyInit | null, init?: ResponseInit): Response;
|
||||
new(body?: BodyInit | null, init?: ResponseInit): Response;
|
||||
error(): Response;
|
||||
redirect(url: string, status?: number): Response;
|
||||
json(any: any, maybeInit?: (ResponseInit | Response)): Response;
|
||||
@@ -2192,7 +2192,7 @@ interface ReadableStream<R = any> {
|
||||
*/
|
||||
declare const ReadableStream: {
|
||||
prototype: ReadableStream;
|
||||
new (underlyingSource: UnderlyingByteSource, strategy?: QueuingStrategy<Uint8Array>): ReadableStream<Uint8Array>;
|
||||
new(underlyingSource: UnderlyingByteSource, strategy?: QueuingStrategy<Uint8Array>): ReadableStream<Uint8Array>;
|
||||
new <R = any>(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;
|
||||
};
|
||||
/**
|
||||
@@ -3034,7 +3034,7 @@ type WebSocketEventMap = {
|
||||
*/
|
||||
declare var WebSocket: {
|
||||
prototype: WebSocket;
|
||||
new (url: string, protocols?: (string[] | string)): WebSocket;
|
||||
new(url: string, protocols?: (string[] | string)): WebSocket;
|
||||
readonly READY_STATE_CONNECTING: number;
|
||||
readonly CONNECTING: number;
|
||||
readonly READY_STATE_OPEN: number;
|
||||
@@ -3091,7 +3091,7 @@ interface WebSocket extends EventTarget<WebSocketEventMap> {
|
||||
extensions: string | null;
|
||||
}
|
||||
declare const WebSocketPair: {
|
||||
new (): {
|
||||
new(): {
|
||||
0: WebSocket;
|
||||
1: WebSocket;
|
||||
};
|
||||
@@ -9414,19 +9414,19 @@ interface IncomingRequestCfPropertiesTLSClientAuthPlaceholder {
|
||||
}
|
||||
/** Possible outcomes of TLS verification */
|
||||
declare type CertVerificationStatus =
|
||||
/** Authentication succeeded */
|
||||
"SUCCESS"
|
||||
/** No certificate was presented */
|
||||
/** Authentication succeeded */
|
||||
"SUCCESS"
|
||||
/** No certificate was presented */
|
||||
| "NONE"
|
||||
/** Failed because the certificate was self-signed */
|
||||
/** Failed because the certificate was self-signed */
|
||||
| "FAILED:self signed certificate"
|
||||
/** Failed because the certificate failed a trust chain check */
|
||||
/** Failed because the certificate failed a trust chain check */
|
||||
| "FAILED:unable to verify the first certificate"
|
||||
/** Failed because the certificate not yet valid */
|
||||
/** Failed because the certificate not yet valid */
|
||||
| "FAILED:certificate is not yet valid"
|
||||
/** Failed because the certificate is expired */
|
||||
/** Failed because the certificate is expired */
|
||||
| "FAILED:certificate has expired"
|
||||
/** Failed for another unspecified reason */
|
||||
/** Failed for another unspecified reason */
|
||||
| "FAILED";
|
||||
/**
|
||||
* An upstream endpoint's response to a TCP `keepalive` message from Cloudflare.
|
||||
@@ -9478,13 +9478,13 @@ interface D1ExecResult {
|
||||
duration: number;
|
||||
}
|
||||
type D1SessionConstraint =
|
||||
// Indicates that the first query should go to the primary, and the rest queries
|
||||
// using the same D1DatabaseSession will go to any replica that is consistent with
|
||||
// the bookmark maintained by the session (returned by the first query).
|
||||
'first-primary'
|
||||
// Indicates that the first query can go anywhere (primary or replica), and the rest queries
|
||||
// using the same D1DatabaseSession will go to any replica that is consistent with
|
||||
// the bookmark maintained by the session (returned by the first query).
|
||||
// Indicates that the first query should go to the primary, and the rest queries
|
||||
// using the same D1DatabaseSession will go to any replica that is consistent with
|
||||
// the bookmark maintained by the session (returned by the first query).
|
||||
'first-primary'
|
||||
// Indicates that the first query can go anywhere (primary or replica), and the rest queries
|
||||
// using the same D1DatabaseSession will go to any replica that is consistent with
|
||||
// the bookmark maintained by the session (returned by the first query).
|
||||
| 'first-unconstrained';
|
||||
type D1SessionBookmark = string;
|
||||
declare abstract class D1Database {
|
||||
@@ -9599,7 +9599,7 @@ declare type EmailExportedHandler<Env = unknown> = (message: ForwardableEmailMes
|
||||
declare module "cloudflare:email" {
|
||||
let _EmailMessage: {
|
||||
prototype: EmailMessage;
|
||||
new (from: string, to: string, raw: ReadableStream | string): EmailMessage;
|
||||
new(from: string, to: string, raw: ReadableStream | string): EmailMessage;
|
||||
};
|
||||
export { _EmailMessage as EmailMessage };
|
||||
}
|
||||
@@ -10251,6 +10251,9 @@ declare namespace CloudflareWorkersModule {
|
||||
export const env: Cloudflare.Env;
|
||||
export const exports: Cloudflare.Exports;
|
||||
}
|
||||
declare module 'cloudflare:test' {
|
||||
export = CloudflareWorkersModule;
|
||||
}
|
||||
declare module 'cloudflare:workers' {
|
||||
export = CloudflareWorkersModule;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user