UNPKG

@techsio/storefront-data

Version:

Medusa-first storefront data layer built on TanStack Query.

33 lines • 1.64 kB
export type QueryKey = readonly unknown[]; export type QueryNamespace = string | readonly string[]; export type NormalizeQueryKeyParamsOptions = { omitKeys?: readonly string[]; }; /** * Normalizes object-like query params before putting them into query keys. * * - Removes `undefined` values recursively * - Removes keys listed in `omitKeys` (for non-cache-affecting flags like `enabled`) * - Sorts object keys for stable hashing */ export declare function normalizeQueryKeyParams<TParams extends Record<string, unknown>>(params: TParams, options?: NormalizeQueryKeyParamsOptions): Record<string, unknown>; /** * Safe normalization for query-key parts used by hook factories. * * - Plain objects are normalized via `normalizeQueryKeyParams` * - `undefined` maps to `{}` for stable optional key parts * - Other values are passed through the stable serializer */ export declare function normalizeQueryKeyPart(value: unknown, options?: NormalizeQueryKeyParamsOptions): unknown; export declare function createQueryKey(namespace: QueryNamespace, ...parts: readonly unknown[]): QueryKey; export declare function appendQueryKey(base: QueryKey, ...parts: readonly unknown[]): QueryKey; export declare function createDomainQueryKeys<TListParams, TDetailParams>(namespace: QueryNamespace, domain: string): { all: () => QueryKey; list: (params: TListParams) => QueryKey; detail: (params: TDetailParams) => QueryKey; }; export declare function createQueryKeyFactory(namespace: QueryNamespace): { scope: readonly string[]; key: (...parts: readonly unknown[]) => QueryKey; }; //# sourceMappingURL=query-keys.d.ts.map