UNPKG

@mridang/nestjs-auth

Version:

A comprehensive Auth.js integration for NestJS applications with TypeScript support, framework-agnostic HTTP adapters, and role-based access control

33 lines (32 loc) 1.28 kB
import type { Session as CoreSession } from '@auth/core/types'; import type { Session, AuthUser } from './types.js'; /** * Concrete runtime object that implements the public `Session` shape. * It encapsulates mapping from the underlying core session into the * public surface while preserving any app-augmented fields placed on * the core session by callbacks. */ export declare class AuthSession implements Session { /** The authenticated user, or null/undefined when absent. */ user?: AuthUser | null; /** ISO-8601 timestamp indicating when the session expires. */ expires?: string; /** * Factory: build from a core session. Returns null when no session. */ static fromCore(core: CoreSession | null | undefined): AuthSession | null; /** * Construct from a core session or a partial public session. Copies * base fields and safely preserves any extra fields present on the * source object (e.g., tokens added by app callbacks). */ constructor(src: CoreSession | Partial<Session>); /** * Return a plain JSON object conforming to the public `Session`. */ toJSON(): Session; /** * Shallow merge in additional fields and return `this`. */ with(patch: Partial<Session>): AuthSession; }