import { CheckResult } from "./check.mjs"; import { Arguments } from "./util.mjs"; import { ReadDataResult } from "./read.mjs"; import { StoreLayer } from "./optimisticProxy.mjs"; import { IsographEnvironment, StoreLink, StoreRecord } from "./IsographEnvironment.mjs"; import { FragmentReference, Variables } from "./FragmentReference.mjs"; import { EncounteredIds, NetworkResponseObject } from "./cache.mjs"; import { IsographEntrypoint, NormalizationAstNodes, RefetchQueryNormalizationArtifact } from "./entrypoint.mjs"; import { CleanupFn } from "@isograph/disposable-types"; //#region src/core/logging.d.ts /** * Note: these types are unstable. We will add and remove items from this enum * and add and remove fields. Please do not rely on the specifics here (for now). * * Goals include: * - convenient debugging for Isograph developers * - eventual support for the Isograph devtools * * In some cases (e.g. in `AfterNormalization`), we include large objects and thus * prevent them from getting garbage collected (if the log message is printed). * Especially in cases like that, we intend to remove those! */ type LogMessage = { kind: 'AboutToNormalize'; normalizationAst: NormalizationAstNodes; networkResponse: NetworkResponseObject; variables: Variables; } | { kind: 'AfterNormalization'; store: StoreLayer; encounteredIds: EncounteredIds; } | { kind: 'DeepEqualityCheck'; fragmentReference: FragmentReference; old: object; new: object; deeplyEqual: boolean; } | { kind: 'ComponentRerendered'; componentName: string; rootLink: StoreLink; } | { kind: 'MakeNetworkRequest'; artifact: RefetchQueryNormalizationArtifact | IsographEntrypoint; variables: Variables; networkRequestId: string; } | { kind: 'ReceivedNetworkResponse'; networkResponse: any; networkRequestId: string; } | { kind: 'ReceivedNetworkError'; error: any; networkRequestId: string; } | { kind: 'MissingFieldHandlerCalled'; root: StoreLink; storeRecord: StoreRecord; fieldName: string; arguments: Arguments | null; variables: Variables; } | { kind: 'DoneReading'; response: ReadDataResult; fieldName: string; root: StoreLink; } | { kind: 'NonEntrypointReceived'; entrypoint: any; } | { kind: 'EnvironmentCheck'; result: CheckResult; } | { kind: 'EnvironmentCreated'; } | { kind: 'StartUpdateError'; error: any; } | { kind: 'StartUpdateComplete'; updatedIds: EncounteredIds; } | { kind: 'ErrorEncounteredInWithErrorHandling'; error: any; }; type LogFunction = (logMessage: LogMessage) => void; type WrappedLogFunction = { log: LogFunction; }; declare function logMessage(environment: IsographEnvironment, getMessage: () => LogMessage): void; declare function registerLogger(environment: IsographEnvironment, log: LogFunction): CleanupFn; //#endregion export { LogFunction, LogMessage, WrappedLogFunction, logMessage, registerLogger }; //# sourceMappingURL=logging.d.mts.map