export interface SimpleRequest { pathName: string; pathParts: string[]; headers: { [name: string]: string }; } export interface QueryRequest extends SimpleRequest { query: TQuery; } export interface Request extends QueryRequest { body: TRequestBody; } export interface Response { status?: number; headers?: { // Note: CORS Must be set in Azure Functions Manually 'Access-Control-Allow-Origin'?: string, 'Content-Type'?: string, [key: string]: string, }; body: ResponseBody; } export interface ResponseBodyBase { ok: boolean; data?: any; errors?: string[]; } export interface ResponseBody extends ResponseBodyBase { data?: TResponseData; } export interface Context { log(...text: any[]): void; done(err?: any, response?: Response): void; } export interface RawContext { log(...text: any[]): void; done(err?: any, response?: any): void; } export type MainEntryPoint = (context: Context, request: Request) => Promise<{}>; export type MainEntryPoint_Sync = (context: Context, request: Request) => void; export interface Timer { isPastDue: boolean; }; export interface TimerContext { log(...text: any[]): void; done(): void; } export type MainEntryPoint_Timer = (context: TimerContext, timer: Timer) => Promise<{}>; export type MainEntryPoint_Timer_Sync = (context: TimerContext, timer: Timer) => void;