Skip to content

Latest commit

 

History

History
177 lines (145 loc) · 4.66 KB

File metadata and controls

177 lines (145 loc) · 4.66 KB

API Report File for "@openfunction/functions-framework"

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

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

import { CloudEventV1 as CloudEvent } from 'cloudevents';
import { ParamsDictionary } from 'express-serve-static-core';
import { ParsedQs } from 'qs';
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>) => 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 enum ComponentType {
    Binding = "bindings",
    PubSub = "pubsub"
}

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

// @public
export class ContextUtils {
    static IsAsyncRuntime(context: OpenFunctionContext): boolean;
    static IsBindingComponent(component: OpenFunctionComponent): boolean;
    static IsKnativeRuntime(context: OpenFunctionContext): boolean;
    static IsPubSubComponent(component: OpenFunctionComponent): boolean;
}

// @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> = OpenFunction | HttpFunction | EventFunction | EventFunctionWithCallback | CloudEventFunction<T> | CloudEventFunctionWithCallback<T>;

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

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

// @public
export interface HttpFunctionResponse {
    body?: any;
    code?: number;
    headers?: Record<string, string>;
}

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

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

// @public
export interface OpenFunction {
    // (undocumented)
    (ctx: OpenFunctionRuntime, data: {}): any;
}

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

// @public
export interface OpenFunctionBinding {
    [key: string]: OpenFunctionComponent;
}

// @public
export interface OpenFunctionComponent {
    componentName: string;
    componentType: `${ComponentType}.${string}`;
    metadata?: Record<string, string>;
    operation?: string;
    uri?: string;
}

// @public
export interface OpenFunctionContext {
    inputs?: OpenFunctionBinding;
    name: string;
    outputs?: OpenFunctionBinding;
    port?: string;
    runtime: `${RuntimeType}` | `${Capitalize<RuntimeType>}` | `${Uppercase<RuntimeType>}`;
    version: string;
}

// @public
export abstract class OpenFunctionRuntime {
    constructor(context: OpenFunctionContext);
    protected readonly context: OpenFunctionContext;
    static Parse(context: OpenFunctionContext): OpenFunctionRuntime;
    static ProxyContext(context: OpenFunctionContext): OpenFunctionRuntime;
    get req(): Request_3<ParamsDictionary, any, any, ParsedQs, Record<string, any>> | undefined;
    get res(): Response_2<any, Record<string, any>> | undefined;
    abstract send(data: object, output?: string): Promise<object>;
    setTrigger(req: Request_3, res?: Response_2): void;
    get sidecarPort(): {
        HTTP: string;
        GRRC: string;
    };
    // Warning: (ae-forgotten-export) The symbol "OpenFunctionTrigger" needs to be exported by the entry point index.d.ts
    protected trigger?: OpenFunctionTrigger;
}

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

export { Response_2 as Response }

// @public
export enum RuntimeType {
    Async = "async",
    Knative = "knative"
}

// (No @packageDocumentation comment for this package)