import { NodeOptions } from '@highlight-run/node';
import { ExecutionContext } from '@cloudflare/workers-types';
import { NextRequest, NextFetchEvent } from 'next/server';

type HighlightEnv = NodeOptions;

type EdgeHandler = (request: NextRequest, event: NextFetchEvent) => Promise<Response>;
type ExtendedExecutionContext = ExecutionContext & {
    __waitUntilTimer?: ReturnType<typeof setInterval>;
    __waitUntilPromises?: Promise<void>[];
    waitUntilFinished?: () => Promise<void>;
};

export { EdgeHandler as E, HighlightEnv as H, ExtendedExecutionContext as a };
