Skip to content

Latest commit

 

History

History
139 lines (111 loc) · 3.69 KB

api.md.api.md

File metadata and controls

139 lines (111 loc) · 3.69 KB

API Report File for "@google-cloud/functions-framework"

Do not edit this file. It is a report generated by API Extractor.

/// <reference types="node" />

import { CloudEventV1 as CloudEvent } from 'cloudevents';
import { Request as Request_3 } from 'express';
import { Response as Response_2 } from 'express';

export { CloudEvent }

// @public
export const cloudEvent: <T = unknown>(functionName: string, handler: CloudEventFunction<T> | CloudEventFunctionWithCallback<T>) => void;

// @public
export interface CloudEventFunction<T = unknown> {
    // (undocumented)
    (cloudEvent: CloudEvent<T>): any;
}

// @public
export interface CloudEventFunctionWithCallback<T = unknown> {
    // (undocumented)
    (cloudEvent: CloudEvent<T>, callback: Function): any;
}

// @public
export interface CloudFunctionsContext {
    eventId?: string;
    eventType?: string;
    resource?: string | {
        [key: string]: string;
    };
    timestamp?: string;
}

// @public
export type Context = CloudFunctionsContext | CloudEvent<unknown>;

// @public
export interface Data {
    // (undocumented)
    data: object;
}

// @public
export interface EventFunction {
    // (undocumented)
    (data: {}, context: Context): any;
}

// @public
export interface EventFunctionWithCallback {
    // (undocumented)
    (data: {}, context: Context, callback: Function): any;
}

// @public
export type HandlerFunction<T = unknown, U = unknown> = HttpFunction | EventFunction | EventFunctionWithCallback | CloudEventFunction<T> | CloudEventFunctionWithCallback<T> | TypedFunction<T, U>;

// @public
export const http: (functionName: string, handler: HttpFunction) => void;

// @public
export interface HttpFunction {
    // (undocumented)
    (req: Request_2, res: Response_2): any;
}

// @public
export interface InvocationFormat<T, U> {
    deserializeRequest(request: InvocationRequest): T | Promise<T>;
    serializeResponse(responseWriter: InvocationResponse, response: U): void | Promise<void>;
}

// @public
export interface InvocationRequest {
    body(): string | Buffer;
    header(header: string): string | undefined;
}

// @public
export interface InvocationResponse {
    end(data: string | Buffer): void;
    setHeader(key: string, value: string): void;
    write(data: string | Buffer): void;
}

// @public
export class JsonInvocationFormat<T, U> implements InvocationFormat<T, U> {
    // (undocumented)
    deserializeRequest(request: InvocationRequest): T;
    // (undocumented)
    serializeResponse(responseWriter: InvocationResponse, response: U): void;
}

// @public
export type LegacyCloudFunctionsContext = CloudFunctionsContext | Data;

// @public
export interface LegacyEvent {
    // (undocumented)
    context: CloudFunctionsContext;
    // (undocumented)
    data: {
        [key: string]: any;
    };
}

// @public (undocumented)
interface Request_2 extends Request_3 {
    abortController?: AbortController;
    executionId?: string;
    rawBody?: Buffer;
    spanId?: string;
}
export { Request_2 as Request }

export { Response_2 as Response }

// Warning: (ae-internal-missing-underscore) The name "typed" should be prefixed with an underscore because the declaration is marked as @internal
//
// @internal
export const typed: <T, U>(functionName: string, handler: TypedFunction<T, U> | ((req: T) => U | Promise<U>)) => void;

// @public
export interface TypedFunction<T = unknown, U = unknown> {
    // (undocumented)
    format: InvocationFormat<T, U>;
    // (undocumented)
    handler: (req: T) => U | Promise<U>;
}

// (No @packageDocumentation comment for this package)