/** * mizan - Django Server Functions Client * * Frontend client for Django server functions. * Server functions are the core primitive - accessed via React hooks. * * Two-layer architecture: * * 1. Library layer (this package) - Generic name-based API * Used by libraries like Allauth that need to call functions by name. * * import { useMizan, useMizanContext, useMizanCall } from 'mizan' * const user = useMizanContext('current_user') * const call = useMizanCall('update_profile') * * 2. Generated layer (@/api) - Typed project-specific API * Used by product code for type-safe hooks. * * import { useCurrentUser, useUpdateProfile } from '@/api' * const user = useCurrentUser() * const updateProfile = useUpdateProfile() * * The generated code wraps MizanProvider and adds type-safe hooks. */ // ============================================================================ // React Context & Hooks (primary API) // ============================================================================ export { // Provider MizanProvider, type MizanProviderProps, type MizanHydration, // Hooks (generic name-based API for libraries) useMizan, useMizanContext, useMizanCall, useMizanStatus, usePush, // Types type MizanContextValue, type ConnectionStatus, type PushMessage, type PushListener, type ContextStore, type Transport, // Legacy aliases (deprecated, for migration) DjangoContext, useDjango, useDjangoStatus, useServerFunction, type DjangoContextValue, type DjangoContextProps, } from './context' // ============================================================================ // HTTP Client (for SSR or non-React usage) // ============================================================================ export { httpFunctionCall, createDjangoCSRClient, createDjangoSSRClient, ensureDjangoSession, Auth, type DjangoHTTPClient, type CSRClientConfig, type JWTClientConfig, type SSRClientConfig, } from './client/' // ============================================================================ // Errors // ============================================================================ export { DjangoError, type FunctionErrorResponse, type ErrorCode, } from './errors' // ============================================================================ // Forms (typed form hooks core) // ============================================================================ export { // Single form useMizanFormCore, // Legacy alias useMizanFormCore as useDjangoFormCore, type DjangoFormState, type FormSchema, type FormErrors, type FormOptions, type FormSubmitResult, type FormCoreConfig, // Formset useMizanFormsetCore, // Legacy alias useMizanFormsetCore as useDjangoFormsetCore, type DjangoFormsetState, type FormsetSchema, type FormsetErrors, type FormsetCoreConfig, type FormsetSubmitResult, // Shared types type FieldSchema, type FieldChoice, type FieldError, type FormMeta, } from './forms'