Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/adonisjs/session
/ functions
Functions
192 in github.com/adonisjs/session
⨍
Functions
192
◇
Types & classes
42
↓ 24 callers
Method
set
* Sets a key/value pair in the store * * @param key - The key or key path to set * @param value - The value to set * * @example * st
src/values_store.ts:167
↓ 23 callers
Method
get
* Gets the value of a key from the session datastore. * You can specify a default value to use when key does not exist or has undefined value. *
src/session.ts:325
↓ 20 callers
Method
create
* Creates an instance of the session middleware
factories/session_middleware_factory.ts:65
↓ 15 callers
Method
destroy
* Removes session data for a given session ID from the persistence store * * @param sessionId - Unique identifier for the session to remove
src/types.ts:94
↓ 15 callers
Method
merge
* Merges session data with existing values * * @param values - Session data to merge * * @example * client.merge({ userId: 123, theme:
src/client.ts:69
↓ 13 callers
Method
read
* Reads session data for a given session ID from the persistence store * * @param sessionId - Unique identifier for the session
src/types.ts:79
↓ 13 callers
Method
write
* Writes session data for a given session ID to the persistence store * * @param sessionId - Unique identifier for the session * @param data
src/types.ts:87
↓ 11 callers
Method
all
* Gets everything from the session store * * @example * const allData = session.all() * console.log(allData) // { username: 'john', theme:
src/session.ts:336
↓ 11 callers
Method
has
* Checks if a key exists inside the datastore * * @param key - The key to check for existence * * @example * if (session.has('username'
src/session.ts:310
↓ 10 callers
Method
flash
(key: string | SessionData, value?: AllowedSessionValues)
src/session.ts:419
↓ 9 callers
Method
#getValuesStore
* Returns the store instance for a given mode * * @param mode - Access mode ('write' or 'read')
src/session.ts:213
↓ 8 callers
Method
#getFlashStore
* Returns the flash messages store for a given mode * * @param mode - Access mode ('write' or 'read')
src/session.ts:164
↓ 8 callers
Method
commit
* Commits session changes. No more mutations will be allowed after commit. * * @example * await session.commit() // Save all changes to the s
src/session.ts:713
↓ 8 callers
Function
defineConfig
( config: ConfigInput<KnownStores> )
src/define_config.ts:72
↓ 8 callers
Method
put
* Puts a key-value pair to the session data store * * @param key - The key to store the value under * @param value - The value to store *
src/session.ts:296
↓ 8 callers
Method
touch
* Updates the lifetime/expiry of a session without modifying the session data * * @param sessionId - Unique identifier for the session to touch
src/types.ts:101
↓ 7 callers
Method
tag
* Associates a session with a user ID (tag). * This allows querying all sessions for a specific user.
src/types.ts:127
↓ 7 callers
Method
update
* Overwrites existing store data with new values * * @param values - New values to replace existing data * * @example * store.update({
src/values_store.ts:249
↓ 6 callers
Method
boot
* Adding edge tags (if edge is installed)
providers/session_provider.ts:82
↓ 6 callers
Method
clear
* Empties the session store * * @example * session.clear() // Removes all session data
src/session.ts:403
↓ 6 callers
Method
initiate
* Initiates the session store. The method results in a noop when called multiple times. * * @param readonly - Whether to initiate the session in
src/session.ts:234
↓ 5 callers
Method
#getTagKey
* Returns the Redis key for a user's tag set. * The tag set stores all session IDs associated with a user. * * @param userId - User identifie
src/stores/redis.ts:130
↓ 5 callers
Method
pull
* Reads value for a key from the session datastore and removes it simultaneously * * @param key - The key to pull * @param defaultValue - Def
src/session.ts:363
↓ 5 callers
Method
tagged
* Returns all sessions associated with a given user ID (tag). * Only returns non-expired sessions.
src/types.ts:138
↓ 5 callers
Method
untag
* Dissociate a session from the user ID (tag).
src/types.ts:132
↓ 4 callers
Method
#getFilePath
* Returns the absolute file path for a session ID. * Session files are stored with .txt extension in the configured location. * * @param sess
src/stores/file.ts:64
↓ 4 callers
Method
get
* Gets value for a given key * * @param key - The key or key path to retrieve * @param defaultValue - Default value if key doesn't exist *
src/values_store.ts:55
↓ 4 callers
Method
shouldFlashValue
* Determines whether a value should be stored in flash messages. * Objects can opt out by setting a STORE_IN_FLASH symbol property to false. *
src/session.ts:182
↓ 3 callers
Method
all
* Gets all values from the store * * @example * const allData = store.all()
src/values_store.ts:90
↓ 3 callers
Method
increment
* Increments the value of a key inside the session store. * A new key will be defined if it doesn't exist already with value 1. * * @param ke
src/session.ts:378
↓ 3 callers
Method
load
* Loads session data from the session store * * @param sessionId - Optional session ID to load (defaults to current session) * * @example
src/client.ts:127
↓ 3 callers
Method
setIntendedUrl
* Store a URL as the intended redirect destination. The URL is * validated using `isValidRedirectUrl` before storing. Invalid * URLs are silentl
src/session.ts:667
↓ 3 callers
Method
toJSON
* Returns the store values as JSON-serializable data * * @example * const json = store.toJSON()
src/values_store.ts:110
↓ 3 callers
Method
toString
* Returns string representation of the store * * @example * const str = store.toString()
src/values_store.ts:120
↓ 3 callers
Method
unset
* Removes a key from the store * * @param key - The key or key path to remove * * @example * store.unset('temp_data') * store.unset(
src/values_store.ts:181
↓ 2 callers
Method
#getApp
()
factories/session_middleware_factory.ts:33
↓ 2 callers
Method
#parseSessionData
* Verifies and parses session data from string format. * Returns null if the contents is not valid JSON or verification fails. * * @param con
src/stores/redis.ts:141
↓ 2 callers
Method
#parseSessionData
* Parses and verifies session data from string format. * Returns null if the data is corrupted or verification fails. * * @param contents - S
src/stores/database.ts:125
↓ 2 callers
Method
cleanupFlashData
* Filters flash data to only include values that should be flashed. * Removes values that have opted out of flash storage. * * @param data -
src/session.ts:195
↓ 2 callers
Function
createTestStore
(config: ResolvedSessionConfig)
src/plugins/japa/store.ts:23
↓ 2 callers
Method
decrement
* Decrements the value of a key inside the session store. * A new key will be defined if it doesn't exist already with value -1. * * @param k
src/session.ts:393
↓ 2 callers
Method
flashErrors
* Flashes errors to the errorsBag. You can read these errors via the "@error" tag. * Appends new messages to the existing collection. * * @pa
src/session.ts:441
↓ 2 callers
Method
flashExcept
* Flashes form input data (except some keys) to the flash messages store * * @param keys - Array of keys to exclude from flashing * * @exa
src/session.ts:546
↓ 2 callers
Method
flashMessages
* Get flash messages from the HTTP response
src/plugins/japa/api_client.ts:52
↓ 2 callers
Method
flashValidationErrors
* Flashes validation error messages. Make sure the error is an instance of VineJS ValidationException. * Overrides existing inputErrors. * *
src/session.ts:486
↓ 2 callers
Method
forget
* Removes a key from the session datastore * * @param key - The key to remove * * @example * session.forget('temp_data') * session.f
src/session.ts:349
↓ 2 callers
Method
getIntendedUrl
* Returns the intended URL without consuming it, or `null` * if no intended URL is stored.
src/session.ts:678
↓ 2 callers
Method
initiateSession
* Initiate session. The session id cookie will be defined * if missing
src/plugins/japa/browser_client.ts:30
↓ 2 callers
Method
pullIntendedUrl
* Returns the intended URL and removes it from the session, * or `null` if no intended URL is stored.
src/session.ts:686
↓ 2 callers
Function
runJapaTest
(app: ApplicationService, callback: Parameters<Test['run']>[0])
tests_helpers/index.ts:40
↓ 2 callers
Method
session
* Get session data from the HTTP response
src/plugins/japa/api_client.ts:47
↓ 2 callers
Method
supportsTagging
* Checks if the current store supports session tagging. * Only Memory, Redis, and Database stores support tagging. * * @example * const co
src/session_collection.ts:69
↓ 2 callers
Method
supportsTagging
* Checks if the current store supports session tagging. * Only Memory, Redis, and Database stores support tagging. * * @example * if (sess
src/session.ts:621
↓ 1 callers
Method
#cleanupInvalidSessions
* Removes invalid session IDs from the user's tag set. * Cleans up expired or corrupted session references. * * @param userId - User identifi
src/stores/redis.ts:118
↓ 1 callers
Method
#collectGarbage
* Runs garbage collection to delete expired sessions from the database. * Executes probabilistically based on gcProbability setting after writing s
src/stores/database.ts:105
↓ 1 callers
Method
#fetchSessionContents
* Fetches session contents for multiple session IDs using a Redis pipeline. * Optimizes performance by batching multiple GET commands into a single
src/stores/redis.ts:103
↓ 1 callers
Method
#getEmitter
()
factories/session_middleware_factory.ts:37
↓ 1 callers
Method
#outputFile
* Writes file contents to the given path. * Creates parent directories recursively if they don't exist. * * @param path - File path to write
src/stores/file.ts:105
↓ 1 callers
Method
#pathExists
* Checks if a file or directory exists at the given path. * Returns true if accessible, false otherwise. * * @param path - File or directory
src/stores/file.ts:74
↓ 1 callers
Method
#processSessionResult
* Processes a single session result from the pipeline. * Parses session data and determines validity. * * @param options - Session ID and con
src/stores/redis.ts:85
↓ 1 callers
Method
#resolveConfig
* Resolves the session config from the config provider
providers/session_provider.ts:51
↓ 1 callers
Method
#rowToTaggedSession
* Converts a database row to a TaggedSession object. * Parses the session data and returns null if parsing fails. * * @param row - Database r
src/stores/database.ts:157
↓ 1 callers
Method
#serializeSessionData
* Encrypts or signs the session data for the session id * * @param values - Session data to serialize * @param sessionId - Session identifier
src/stores/redis.ts:158
↓ 1 callers
Method
#serializeSessionData
* Encrypts or signs the session data for the session id * * @param values - Session data to serialize * @param sessionId - Session identifier
src/stores/database.ts:142
↓ 1 callers
Method
#stats
* Returns file statistics for the given path. * Returns null if the file doesn't exist or is inaccessible. * * @param path - File path to get
src/stores/file.ts:89
↓ 1 callers
Method
assertDoesNotHaveValidationError
* Assert flash messages does not have validation errors * for the given field
src/plugins/japa/api_client.ts:89
↓ 1 callers
Method
assertFlashMessage
* Assert flash message key-value pair exists
src/plugins/japa/api_client.ts:72
↓ 1 callers
Method
assertFlashMissing
* Assert key is missing flash messages store
src/plugins/japa/api_client.ts:77
↓ 1 callers
Method
assertSession
* Assert session key-value pair exists
src/plugins/japa/api_client.ts:62
↓ 1 callers
Method
assertSessionMissing
* Assert key is missing in session store
src/plugins/japa/api_client.ts:67
↓ 1 callers
Method
assertValidationError
* Assert error message for a given field
src/plugins/japa/api_client.ts:94
↓ 1 callers
Method
assertValidationErrors
* Assert all error messages for a given field
src/plugins/japa/api_client.ts:99
↓ 1 callers
Method
clearIntendedUrl
* Removes the intended URL from the session.
src/session.ts:693
↓ 1 callers
Function
configure
(command: Configure)
configure.ts:29
↓ 1 callers
Function
createConfigureCommand
* Creates the configure command for the package inside a * minimal application scaffolded on the filesystem
tests/configure.spec.ts:22
↓ 1 callers
Function
createDatabase
()
tests/stores/database_store.spec.ts:53
↓ 1 callers
Function
createFakeConfig
(store: SessionStoreContract)
tests/session_collection.spec.ts:16
↓ 1 callers
Function
createStore
()
src/plugins/japa/store.ts:24
↓ 1 callers
Method
destroy
* Removes session data from the database * * @param sessionId - Session identifier to remove * * @example * await store.destroy('sess_a
src/stores/database.ts:241
↓ 1 callers
Method
flashAll
* Flashes all form input data to the flash messages store * * @example * session.flashAll() // Flashes all request input for next request
src/session.ts:533
↓ 1 callers
Method
flashInputErrors
* Flashes error messages for form fields to the inputErrorsBag, the same * bag "flashValidationErrors" fills. The "@inputError" tag and the Inertia
src/session.ts:456
↓ 1 callers
Method
flashMessage
* Get flash messages for a specific key from the HTTP response
src/plugins/japa/api_client.ts:57
↓ 1 callers
Method
flashOnly
* Flashes form input data (only some keys) to the flash messages store * * @param keys - Array of keys to include in flashing * * @example
src/session.ts:566
↓ 1 callers
Function
getExpiry
( client: DynamoDBClient, tableName: string, key: string, sessionId: string )
tests_helpers/index.ts:107
↓ 1 callers
Method
getFlashMessages
* Returns data from the session store
src/plugins/japa/browser_client.ts:40
↓ 1 callers
Function
getSession
( client: DynamoDBClient, tableName: string, key: string, sessionId: string )
tests_helpers/index.ts:83
↓ 1 callers
Method
getSession
* Returns data from the session store
src/plugins/japa/browser_client.ts:35
↓ 1 callers
Function
getSessionCookieOptions
* Transforms AdonisJS session config to playwright cookie options * * @param config - Session configuration * @param cookieOptions - Optional cooki
src/plugins/japa/browser_client.ts:83
↓ 1 callers
Method
handle
* Handles the HTTP request by initializing session and committing changes * * @param ctx - HTTP context * @param next - Next middleware funct
src/session_middleware.ts:155
↓ 1 callers
Method
pull
* Pulls value from the store. Same as calling store.get then store.unset. * * @param key - The key or key path to pull * @param defaultValue
src/values_store.ts:196
↓ 1 callers
Method
read
* Reads session value from the encrypted cookie * * @param sessionId - Session identifier used as cookie name * * @example * const data
src/stores/cookie.ts:58
↓ 1 callers
Method
reflash
* Reflashes messages from the last request in the current response * * @example * session.reflash() // Keep all flash messages for another re
src/session.ts:584
↓ 1 callers
Method
reflashExcept
* Reflashes messages (except some keys) from the last request in the current response * * @param keys - Array of keys to exclude from reflashing
src/session.ts:608
↓ 1 callers
Method
reflashOnly
* Reflashes messages (only some keys) from the last request in the current response * * @param keys - Array of keys to reflash * * @exampl
src/session.ts:596
↓ 1 callers
Method
regenerate
* Re-generates the session id and migrates data to it * * @example * session.regenerate() // Generates new session ID for security
src/session.ts:703
↓ 1 callers
Method
register
* Registering bindings
providers/session_provider.ts:66
↓ 1 callers
Method
registerEdgePlugin
* Registers edge plugin when edge is installed * in the user application.
providers/session_provider.ts:40
↓ 1 callers
Function
requestHandler
* Re-usable request handler that creates different session scanerios * based upon the request URL.
tests/concurrent_session.spec.ts:59
↓ 1 callers
Function
sessionApiClient
(app: ApplicationService)
src/plugins/japa/api_client.ts:124
↓ 1 callers
Function
sessionBrowserClient
(app: ApplicationService)
src/plugins/japa/browser_client.ts:112
next →
1–100 of 192, ranked by callers