UNPKG

@senacor/azure-function-middleware

Version:

Middleware for azure functions to handle authentication, authorization, error handling and logging

15 lines (14 loc) 930 B
import { FunctionHandler, HttpHandler } from '@azure/functions'; import { ActivityHandler } from 'durable-functions'; import { BeforeExecutionFunction, PostExecutionFunction } from '../middleware'; type FinalizeAppInsightWithCurriedConfiguration<S = FunctionHandler> = (logBodyBehavior: LogBehavior, bodySanitizer: LogDataSanitizer) => PostExecutionFunction<S>; type LogBehavior = 'always' | 'on_error' | 'on_success' | 'never'; type LogDataSanitizer = (data: unknown) => unknown; type AppInsightsObject<S = FunctionHandler> = { setup: BeforeExecutionFunction<S>; finalize: PostExecutionFunction<S>; finalizeWithConfig: FinalizeAppInsightWithCurriedConfiguration<S>; }; declare const AppInsightForHttpTrigger: AppInsightsObject<HttpHandler>; declare const AppInsightForNoNHttpTrigger: AppInsightsObject<ActivityHandler>; export { AppInsightForHttpTrigger, AppInsightForNoNHttpTrigger, LogBehavior, LogDataSanitizer };