@emailcheck/email-validator-js
Version:
Advanced email validation with MX records, SMTP verification, disposable email detection, batch processing, and caching. Production-ready with TypeScript support.
38 lines (37 loc) • 1.36 kB
TypeScript
/**
* Express-shaped request. We only consume the fields the Functions Framework
* guarantees: method, path (the URL path inside the function), query, body,
* and the lowercase headers map.
*/
export interface GcpRequest {
method: string;
path?: string;
url?: string;
query?: Record<string, string | string[] | undefined>;
body?: unknown;
headers?: Record<string, string | string[] | undefined>;
}
export interface GcpResponse {
status(code: number): GcpResponse;
set(headers: Record<string, string>): GcpResponse;
json(body: unknown): GcpResponse;
send(body?: unknown): GcpResponse;
}
/**
* Routed Cloud Functions handler. Wire it as the function entry point:
*
* import { gcpHandler } from '@emailcheck/email-validator-js/serverless/gcp';
* export const validateEmail = gcpHandler;
*/
export declare function gcpHandler(req: GcpRequest, res: GcpResponse): Promise<void>;
/**
* Single-route convenience handler — infers single-vs-batch from the body
* and ignores the request path. Use this when the function's URL itself
* is the entry point and you don't need internal routing.
*/
export declare function gcpFunction(req: GcpRequest, res: GcpResponse): Promise<void>;
declare const _default: {
gcpHandler: typeof gcpHandler;
gcpFunction: typeof gcpFunction;
};
export default _default;