import { SnapshotInterface } from './SnapshotInterface.js'; import type { FetchFunction } from './types.js'; import { ResolveType } from './utility.js'; import { Schema } from '../interface.js'; import { Normalize } from '../types.js'; /** Defines a networking endpoint */ export interface EndpointInterface extends EndpointExtraOptions { (...args: Parameters): ReturnType; key(...args: Parameters): string; readonly sideEffect?: M; readonly schema?: S; } export interface EndpointExtraOptions { /** Default data expiry length, will fall back to NetworkManager default if not defined */ readonly dataExpiryLength?: number; /** Default error expiry length, will fall back to NetworkManager default if not defined */ readonly errorExpiryLength?: number; /** Poll with at least this frequency in miliseconds */ readonly pollFrequency?: number; /** Marks cached resources as invalid if they are stale */ readonly invalidIfStale?: boolean; /** Enables optimistic updates for this request - uses return value as assumed network response */ getOptimisticResponse?(snap: SnapshotInterface, ...args: Parameters): ResolveType; /** Determines whether to throw or fallback to */ errorPolicy?(error: any): 'hard' | 'soft' | undefined; /** User-land extra data to send */ readonly extra?: any; } export type OptimisticUpdateParams> = [ Dest, Parameters[0], UpdateFunction> ]; export type UpdateFunction = (sourceResults: Normalize, destResults: Normalize | undefined) => Normalize; /** To change values on the server */ export interface MutateEndpoint extends EndpointInterface { sideEffect: true; } /** For retrieval requests */ export type ReadEndpoint = EndpointInterface; //# sourceMappingURL=EndpointInterface.d.ts.map