UNPKG

@bitblit/ratchet-epsilon-common

Version:

Tiny adapter to simplify building API gateway Lambda APIS

30 lines (29 loc) 1.67 kB
import { Context, ProxyResult } from 'aws-lambda'; import { EpsilonInstance } from '../epsilon-instance.js'; import { InternalBackgroundEntry } from '../background/internal-background-entry.js'; import { InterApiEntry } from '../inter-api/inter-api-entry.js'; export declare class ContextUtil { static readonly CONTEXT_DATA_GLOBAL_NAME = "EpsilonGlobalContextData"; private constructor(); private static fetchContextData; static initContext(epsilon: EpsilonInstance, evt: any, ctx: Context, processLabel: string): void; static clearContext(): void; static setOverrideTrace(traceId: string, traceDepth: number): void; static setOverrideTraceFromInternalBackgroundEntry(entry: InternalBackgroundEntry<any>): void; static setOverrideTraceFromInterApiEntry(interApiEntry: InterApiEntry<any>): void; static addHeadersToRecord(input: Record<string, any>, depthOffset?: number): void; static addTraceToProxyResult(pr: ProxyResult): void; static addTraceToHttpRequestInit(ri: RequestInit): void; static setProcessLabel(processLabel: string): void; static currentRequestId(): string; static defaultedCurrentRequestId(defaultValueIfMissing?: string): string; static remainingTimeMS(): number; static currentProcessLabel(): string; private static traceHeaderName; private static traceDepthHeaderName; static currentTraceId(): string; static currentTraceDepth(): number; static addLogVariable(name: string, val: string | number | boolean): void; static fetchLogVariable(name: string): string | number | boolean; static fetchLogVariables(): Record<string, string | number | boolean>; }