import type { ErrorTypes } from './ErrorTypes.js'; import type { EndpointInterface, Queryable } from './interface.js'; import type { DenormalizeNullable, SchemaArgs } from './normal.js'; export interface SnapshotInterface { readonly fetchedAt: number; readonly abort: Error; /** * Gets the (globally referentially stable) response for a given endpoint/args pair from state given. * @see https://dataclient.io/docs/api/Snapshot#getResponse */ getResponse( endpoint: E, ...args: readonly [null] ): { data: DenormalizeNullable; expiryStatus: ExpiryStatusInterface; expiresAt: number; }; getResponse( endpoint: E, ...args: readonly [...Parameters] ): { data: DenormalizeNullable; expiryStatus: ExpiryStatusInterface; expiresAt: number; }; getResponse< E extends Pick, >( endpoint: E, ...args: readonly [...Parameters] | readonly [null] ): { data: DenormalizeNullable; expiryStatus: ExpiryStatusInterface; expiresAt: number; }; /** * Gets the (globally referentially stable) response for a given endpoint/args pair from state given. * @see https://dataclient.io/docs/api/Snapshot#getResponseMeta */ getResponseMeta( endpoint: E, ...args: readonly [null] ): { data: DenormalizeNullable; expiryStatus: ExpiryStatusInterface; expiresAt: number; }; getResponseMeta( endpoint: E, ...args: readonly [...Parameters] ): { data: DenormalizeNullable; expiryStatus: ExpiryStatusInterface; expiresAt: number; }; getResponseMeta< E extends Pick, >( endpoint: E, ...args: readonly [...Parameters] | readonly [null] ): { data: DenormalizeNullable; expiryStatus: ExpiryStatusInterface; expiresAt: number; }; /** @see https://dataclient.io/docs/api/Snapshot#getError */ getError( endpoint: E, ...args: readonly [...Parameters] | readonly [null] ): ErrorTypes | undefined; getError>( endpoint: E, ...args: readonly [...Parameters] | readonly [null] ): ErrorTypes | undefined; /** * Retrieved memoized value for any Querable schema * @see https://dataclient.io/docs/api/Snapshot#get */ get( schema: S, ...args: SchemaArgs ): DenormalizeNullable | undefined; } // looser version to allow for cross-package version compatibility export type ExpiryStatusInterface = 1 | 2 | 3;