ART Framework API Docs
    Preparing search index...

    Interface StorageAdapter

    Interface for a storage adapter, providing a generic persistence layer.

    interface StorageAdapter {
        clearAll(): Promise<void>;
        clearCollection(collection: string): Promise<void>;
        delete(collection: string, id: string): Promise<void>;
        get<T>(collection: string, id: string): Promise<null | T>;
        init(config?: any): Promise<void>;
        query<T>(collection: string, filterOptions: FilterOptions): Promise<T[]>;
        set<T>(collection: string, id: string, data: T): Promise<void>;
    }

    Implemented by

    Index

    Methods

    • Optional: Clears all data managed by the adapter. Use with caution!

      Returns Promise<void>

    • Optional: Clears all items from a specific collection.

      Parameters

      • collection: string

      Returns Promise<void>

    • Deletes an item from a collection by its ID.

      Parameters

      • collection: string

        The name of the collection.

      • id: string

        The unique ID of the item.

      Returns Promise<void>

    • Retrieves a single item from a collection by its ID.

      Type Parameters

      • T

      Parameters

      • collection: string

        The name of the data collection (e.g., 'conversations', 'observations').

      • id: string

        The unique ID of the item.

      Returns Promise<null | T>

      The item or null if not found.

    • Optional initialization method (e.g., connecting to DB).

      Parameters

      • Optionalconfig: any

      Returns Promise<void>

    • Queries items in a collection based on filter options.

      Type Parameters

      • T

      Parameters

      • collection: string

        The name of the collection.

      • filterOptions: FilterOptions

        Filtering, sorting, and pagination options.

      Returns Promise<T[]>

      An array of matching items.

    • Saves (creates or updates) an item in a collection.

      Type Parameters

      • T

      Parameters

      • collection: string

        The name of the collection.

      • id: string

        The unique ID of the item.

      • data: T

        The data to save.

      Returns Promise<void>