Base class for session services. The service provides a set of methods for managing sessions and events.

Hierarchy (view full)

Constructors

Methods

  • Creates a new session.

    Parameters

    • appName: string

      The name of the app.

    • userId: string

      The id of the user.

    • Optionalstate: Record<string, any>

      The initial state of the session.

    • OptionalsessionId: string

      The client-provided id of the session. If not provided, a generated ID will be used.

    Returns Promise<Session>

    The newly created session instance.

  • Deletes a session.

    Parameters

    • appName: string

      The name of the app.

    • userId: string

      The id of the user.

    • sessionId: string

      The id of the session.

    Returns Promise<void>

  • Ends a session and returns its final state. This is typically called when a session is complete and should be stored in long-term memory before potential cleanup.

    Parameters

    • appName: string

      The name of the app.

    • userId: string

      The id of the user.

    • sessionId: string

      The id of the session.

    Returns Promise<Session>

    The session with its final state, or undefined if not found.