import { CookieParseOptions, CookieSerializeOptions, SessionStorage, } from "@remix-run/server-runtime"; import { z } from "zod"; export interface TypedSession { /** * Marks a session as a typed session. */ readonly isTyped: boolean; /** * A unique identifier for this session. * * Note: This will be the empty string for newly created sessions and * sessions that are not backed by a database (i.e. cookie-based sessions). */ readonly id: string; /** * The raw data contained in this session. * * This is useful mostly for SessionStorage internally to access the raw * session data to persist. */ readonly data: z.infer; /** * Returns `true` if the session has a value for the given `name`, `false` * otherwise. */ has>(name: Key): boolean; /** * Returns the value for the given `name` in this session. */ get>(key: Key): z.infer[Key] | null; /** * Sets a value in the session for the given `name`. */ set>( name: Key, value: z.infer[Key] ): void; /** * Sets a value in the session that is only valid until the next `get()`. * This can be useful for temporary values, like error messages. */ flash>( name: Key, value: z.infer[Key] ): void; /** * Removes a value from the session. */ unset>(name: Key): void; } export interface TypedSessionStorage { getSession( cookieHeader?: string | null | undefined, options?: CookieParseOptions | undefined ): Promise>; commitSession( session: TypedSession, options?: CookieSerializeOptions | undefined ): Promise; destroySession( session: TypedSession, options?: CookieSerializeOptions | undefined ): Promise; } export declare function createTypedSessionStorage< Schema extends z.AnyZodObject >({ sessionStorage, schema, }: { sessionStorage: SessionStorage; schema: Schema; }): TypedSessionStorage; /** * ReReturns true if an object is a Remix Utils typed session. * * @see https://github.com/sergiodxa/remix-utils#typed-session */ export declare function isTypedSession( value: unknown ): value is TypedSession;