Documentation
    Preparing search index...

    In-memory mock adapter used strictly for testing and validation. Intercepts database calls and reads/writes to a static local fixture dictionary. Does not support SQL operations.

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Properties

    _alias: string = ''
    _middlewares: BM[] = []
    _params: BackendParameters = {}
    _fixtures: any = {}
    PKEY_IDENTIFIER: any = 'id'

    The string identifier for primary keys, mapped to 'id' by default.

    Accessors

    • get alias(): string

      Returns string

    • set alias(alias: string): void

      Parameters

      • alias: string

      Returns void

    Methods

    • Resolves the canonical database path for a record, respecting standard collection structures and hierarchical subcollection configurations.

      Parameters

      Returns string

    • Processes raw data entries to convert relational reference objects into native database foreign key IDs if the adapter has been configured with useNativeForeignKeys = true.

      Parameters

      • data: any[]

      Returns any[]

    • Attaches a new middleware to the adapter's execution pipeline. Middlewares are triggered before or after database actions.

      Parameters

      • middleware: BM

        The instantiated middleware to attach.

      Returns void

      If a middleware with the same class name is already attached.

    • Executes an aggregation operation (sum, avg, distinct, min, max, count) on a query. The default implementation fetches all matching records and performs in-memory aggregation. Specific database adapters should override this to perform native query aggregation.

      Parameters

      • query: Query<any>

        The Query instance defining the collection and filters.

      • operation: "sum" | "avg" | "distinct" | "min" | "max" | "count"

        The aggregate operation.

      • Optionalproperty: string

        The name of the property to aggregate.

      Returns Promise<any>

      A promise resolving to the aggregated result.

    • Mocks the deleteCollection action by looping through all fixtures and deleting matches.

      Parameters

      • collection: string

        The collection name prefix.

      • OptionalbatchSize: number

        Unused in Mock adapter.

      Returns Promise<void>

      A promise resolving on completion.

    • Removes a middleware from the pipeline by its class name.

      Parameters

      • middlewareClassName: string

        The exact name of the middleware class to remove.

      Returns void

    • Orchestrates the sequential execution of all attached middlewares for a given action.

      Parameters

      • dataObject: DataObjectClass<any>

        The payload traversing the middlewares.

      • action: BackendAction

        The context (READ, CREATE, UPDATE, DELETE).

      • timing: "before" | "after" = 'before'

        Whether to run the before or after pipeline.

      • Optionalparams: MiddlewareParams

        Optional parameters passed down to the middlewares.

      Returns Promise<DataObjectClass<any>>

      A promise resolving to the potentially mutated DataObject.

    • Unsupported stub for creating tables.

      Parameters

      • collection: string
      • properties: any[]

      Returns { downSql: string; upSql: string }

      Empty strings.

    • Unsupported stub for altering schemas.

      Parameters

      • collection: string
      • delta: any

      Returns { downSql: string[]; upSql: string[] }

      Empty arrays.

    • Helper method to extract the destination collection name from a DataObject.

      Parameters

      Returns string | undefined

      The resolved collection string.

    • Retrieves a specific configuration parameter.

      Parameters

      • key: BackendParametersKeys

        The parameter key to fetch.

      Returns any

      The value associated with the key, or undefined.

    • Returns true if a given middleware is attached

      Parameters

      • className: string

      Returns boolean

      boolean

    • Outputs an adapter-level diagnostic message to the console if debug mode is enabled.

      Parameters

      • message: string

        The textual content to log.

      Returns void

      Use Backend.debug() or Backend.log() (which itself is deprecated in favor of specific levels) instead.

    • Executes a raw query on the backend. Only supported by SQL adapters.

      Parameters

      • sql: string
      • Optionalparams: any[]

      Returns Promise<any>

    • Overrides or adds a backend configuration parameter dynamically.

      Parameters

      • key: BackendParametersKeys

        The parameter key to modify.

      • value: any

        The new value to assign.

      Returns void

    • Helper translating DataObjects references to backend string URIs.

      Parameters

      Returns Promise<any>

      A promise resolving to the processed object.

    • Retrieves a single fixture by its collection URI.

      Parameters

      • key: string

        The URI key.

      Returns any

      The raw object fixture.

    • Returns the complete dictionary of injected fixtures.

      Returns any[]

      The fixture store object.

    • Inject fixtures data to backend adapter

      Parameters

      Returns void