/** * React context provider for server-side configuration in Next.js applications. * Provides a way to access configuration values in server components. */ import React, { type ReactNode } from 'react'; /** * Configuration context type */ interface ConfigContextValue { config: T; } /** * Props for the ConfigProvider component */ interface ConfigProviderProps { children: ReactNode; config: T; } /** * Creates a typed configuration provider and hook for accessing configuration * in React server components. * * @example * ```typescript * import { createConfigProvider, getConfig } from '@dyanet/nextjs-config-aws'; * import { z } from 'zod'; * * const schema = z.object({ * DATABASE_URL: z.string(), * API_KEY: z.string(), * }); * * type AppConfig = z.infer; * * // Create the provider and hook * const { ConfigProvider, useConfig } = createConfigProvider(); * * // In your layout.tsx (Server Component) * export default async function RootLayout({ children }) { * const config = await getConfig({ schema }); * * return ( * * * * {children} * * * * ); * } * * // In a child component * function MyComponent() { * const config = useConfig(); * return
API Key: {config.API_KEY}
; * } * ``` * * @returns An object containing the ConfigProvider component and useConfig hook */ export declare function createConfigProvider>(): { ConfigProvider: React.FC>; useConfig: () => T; ConfigContext: React.Context | null>; }; /** * Default ConfigProvider for untyped configuration */ export declare const ConfigProvider: React.FC>>; /** * Default useConfig hook for untyped configuration */ export declare const useConfig: () => Record; /** * Default ConfigContext for untyped configuration */ export declare const ConfigContext: React.Context> | null>; export {}; //# sourceMappingURL=config-provider.d.ts.map