Skip to content

Latest commit

 

History

History
220 lines (185 loc) · 6.59 KB

File metadata and controls

220 lines (185 loc) · 6.59 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 { IndexedFieldWithPossiblyUndefined } from 'lodash';
import { KeyValueType } from '@dapr/dapr/types/KeyValue.type';
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';
import { StateQueryResponseType } from '@dapr/dapr/types/state/StateQueryResponse.type';

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",
    State = "state"
}

// @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;
    static IsStateComponent(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: object): any;
}

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

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

// @public
export interface OpenFunctionContext {
    inputs?: Record<string, OpenFunctionComponent>;
    name: string;
    outputs?: Record<string, OpenFunctionComponent>;
    pluginsTracing?: TraceConfig;
    port?: string;
    postPlugins?: string[];
    prePlugins?: string[];
    runtime: `${RuntimeType}` | `${Capitalize<RuntimeType>}` | `${Uppercase<RuntimeType>}`;
    states?: Record<string, OpenFunctionComponent>;
    version: string;
}

// @public
export abstract class OpenFunctionRuntime {
    constructor(context: OpenFunctionContext);
    protected readonly context: OpenFunctionContext;
    error?: Error;
    getPlugin(name: string): Plugin_2;
    readonly locals: Record<string, any>;
    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;
        GRPC: string;
    };
    // Warning: (ae-forgotten-export) The symbol "StateOperations" needs to be exported by the entry point index.d.ts
    abstract get state(): StateOperations;
    // Warning: (ae-forgotten-export) The symbol "OpenFunctionTrigger" needs to be exported by the entry point index.d.ts
    protected trigger?: OpenFunctionTrigger;
    static WrapUserFunction(userFunction: OpenFunction, context: OpenFunctionContext | OpenFunctionRuntime): (data: any) => Promise<void>;
}

// @public
class Plugin_2 {
    constructor(name: string, version?: string);
    execPostHook(ctx: OpenFunctionRuntime | null, plugins: Record<string, Plugin_2>): Promise<void>;
    execPreHook(ctx: OpenFunctionRuntime | null, plugins: Record<string, Plugin_2>): Promise<void>;
    get(prop: string): string extends infer T ? T extends string ? T extends keyof this ? this[T] : T extends `${infer FieldKey}[${infer IndexKey}]` ? FieldKey extends keyof this ? IndexedFieldWithPossiblyUndefined<this[FieldKey], IndexKey> : undefined : undefined : never : never;
    readonly name: string;
    readonly version: string;
}
export { Plugin_2 as Plugin }

// @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"
}

// @public
export interface TraceConfig {
    baggage?: Record<string, string>;
    enabled: boolean;
    provider: TraceProvider;
    tags?: Record<string, string> & {
        func?: string;
    };
}

// @public
export interface TraceProvider {
    name: `${TraceProviderType}` | `${Capitalize<TraceProviderType>}` | `${Uppercase<TraceProviderType>}`;
    oapServer: string;
}

// @public
export enum TraceProviderType {
    OpenTelemetry = "opentelemetry",
    SkyWalking = "skywalking"
}

// (No @packageDocumentation comment for this package)