Removes all collections and all data stored within the adapter instance. Use with caution, especially during testing.
A promise that resolves when all data is cleared.
Removes all items from a specific collection within the in-memory store.
The name of the collection to clear.
A promise that resolves when the collection is cleared.
Deletes an item from a specified collection using its ID. If the collection or item does not exist, the operation completes silently.
The name of the collection.
The unique ID of the item to delete.
A promise that resolves when the deletion attempt is complete.
Retrieves a single item (as a deep copy) from a specified collection by its ID.
The expected type of the retrieved item.
The name of the data collection (e.g., 'messages', 'observations').
The unique ID of the item within the collection.
A promise resolving to a deep copy of the item if found, or null otherwise.
Initializes the adapter. This is a no-op for the in-memory adapter and is provided for interface compatibility.
Optional_config: anyOptional configuration (ignored by this adapter).
A promise that resolves immediately.
Queries items within a collection based on provided filter options. Note: This in-memory implementation provides basic filtering capabilities:
filterOptions.filter.filterOptions.limit.filterOptions.sort), skipping (filterOptions.skip), complex operators (like $gt, $in), or nested property filtering.The expected type of the items in the collection.
The name of the collection to query.
Options for filtering and limiting the results.
A promise resolving to an array of deep copies of the matching items.
Saves (creates or updates) an item in a specified collection. Stores a deep copy of the provided data to prevent external mutations.
The type of the data being saved.
The name of the collection.
The unique ID for the item.
The data object to save.
A promise that resolves when the data is saved in memory.
An in-memory implementation of the
StorageAdapterinterface. Stores all data in JavaScript Maps within the current process memory. Data is not persisted and will be lost when the application session ends.Useful for:
It provides a simple key-value store for various data types used within the ART framework, such as conversation history, agent state, and observations.
See
StorageAdapter for the interface definition.