import type { Document } from "mongodb"; import { AfterStarCaller, BeforeAfterCallbackArgsAndReturn, BeforeStarCaller, ExtractEventDefinitions, NoReturns } from "./helpersTypes.js"; import { ErrorT, ResultOrError, Result } from "./commentedTypes.js"; import { HookedCollectionInterface } from "./hookedCollectionInterface.js"; import { HookedFindCursorInterface } from "./hookedFindCursorInterface.js"; import { HookedAggregationCursorInterface } from "./hookedAggregationCursorInterface.js"; import { BeforeAfterErrorCollectionEventDefinitions } from "./collectionEvents.js"; import { BeforeAfterErrorFindOnlyCursorEventDefinitions } from "./findCursorEvents.js"; import { BeforeAfterErrorAggregationOnlyCursorEventDefinitions } from "./aggregationCursorEvents.js"; export type BeforeAfterErrorSharedEventDefinitions = { "*": { before: NoReturns & BeforeStarCaller>; success: NoReturns & AfterStarCaller, Result>>; after: NoReturns & AfterStarCaller, ResultOrError>>; error: NoReturns & AfterStarCaller, ErrorT>; caller: AllCommon["caller"]; }; }; type SharedBeforeEventDefinitions = ExtractEventDefinitions, "before", "before">; type SharedAfterSuccessEventDefinitions = ExtractEventDefinitions, "after", "success", "success">; type SharedAfterErrorEventDefinitions = ExtractEventDefinitions, "after", "error", "error">; type SharedAfterEventDefinitions = ExtractEventDefinitions, "after", "after">; export type AllSharedEventDefinitions = SharedBeforeEventDefinitions & SharedAfterErrorEventDefinitions & SharedAfterSuccessEventDefinitions & SharedAfterEventDefinitions; type AllCommon = { args: readonly any[]; thisArg: HookedCollectionInterface | HookedAggregationCursorInterface | HookedFindCursorInterface; isPromise: true; caller: string; result?: any; custom: { operation: keyof BeforeAfterErrorCollectionEventDefinitions | keyof BeforeAfterErrorAggregationOnlyCursorEventDefinitions | keyof BeforeAfterErrorFindOnlyCursorEventDefinitions; }; }; export type SharedCallbackArgsAndReturn = BeforeAfterCallbackArgsAndReturn>; export {};