57 lines
1.5 KiB
TypeScript
Executable file
57 lines
1.5 KiB
TypeScript
Executable file
/**
|
|
* @lilith/react-query-utils
|
|
*
|
|
* Shared React Query utilities for the lilith platform monorepo.
|
|
*
|
|
* Provides:
|
|
* - QueryClient factory with platform defaults
|
|
* - CRUD hook generators (reduces boilerplate by 60-70%)
|
|
* - Paginated query hooks with built-in controls
|
|
* - Optimistic update utilities
|
|
*
|
|
* @example
|
|
* ```typescript
|
|
* // Create QueryClient with platform defaults
|
|
* import { createQueryClient } from '@lilith/react-query-utils';
|
|
*
|
|
* const queryClient = createQueryClient();
|
|
*
|
|
* function App() {
|
|
* return (
|
|
* <QueryClientProvider client={queryClient}>
|
|
* <YourApp />
|
|
* </QueryClientProvider>
|
|
* );
|
|
* }
|
|
*
|
|
* // Generate CRUD hooks for an entity
|
|
* import { createCrudHooks } from '@lilith/react-query-utils';
|
|
*
|
|
* const { useGetAll, useCreate, useUpdate, useDelete } = createCrudHooks({
|
|
* queryKey: ['users'],
|
|
* api: userApi,
|
|
* enableOptimistic: true,
|
|
* });
|
|
* ```
|
|
*/
|
|
|
|
export { createQueryClient, PLATFORM_QUERY_DEFAULTS } from './create-query-client'
|
|
export type { QueryClientConfig } from './create-query-client'
|
|
|
|
export { createCrudHooks } from './create-crud-hooks'
|
|
export type {
|
|
CrudApi,
|
|
CreateCrudHooksOptions,
|
|
CrudHooks,
|
|
} from './create-crud-hooks'
|
|
|
|
export { usePaginatedQuery } from './use-paginated-query'
|
|
export type {
|
|
PaginatedResponse,
|
|
PaginationParams,
|
|
UsePaginatedQueryOptions,
|
|
UsePaginatedQueryResult,
|
|
} from './use-paginated-query'
|
|
|
|
export { useMutationOptions } from './use-mutation-options'
|
|
export type { CreateMutationOptionsConfig } from './use-mutation-options'
|