Documentation
    Preparing search index...

    Backend adapter implementation bridging Quatrain's DataObjects to an external REST API. Maps CRUD operations to standard HTTP methods (POST, GET, PATCH, DELETE).

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _alias: string = ''
    _middlewares: BM[] = []
    _params: BackendParameters = {}
    allowedMethods: BackendAction[]
    authProvider?: AuthProvider
    baseUrl: string
    endpointMap: Record<string, string>
    querySerializer?: QuerySerializer
    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.

    • Parameters

      • collectionName: string
      • Optionaluid: string

      Returns string

    • Parameters

      Returns void

    • Performs an HTTP POST request to create a new resource on the remote API.

      Parameters

      • dataObject: DataObjectClass<any>

        The DataObject payload to serialize and transmit.

      • OptionaldesiredUid: string

        Ignored by REST (usually assigned by the remote API).

      Returns Promise<DataObjectClass<any>>

      A promise resolving to the data object populated with the API response UID.

    • Executes a DELETE request targeting an entire collection endpoint.

      Parameters

      • collection: string

        The collection name mapping to the target API endpoint.

      Returns Promise<void>

      A promise resolving upon successful deletion.

      If the DELETE action is not permitted.

    • 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.

    • Performs an HTTP GET request to query a collection endpoint. Serializes filters and pagination into URL query parameters.

      Parameters

      • dataObject: DataObjectClass<any>

        The template DataObject defining the collection.

      • filters: Filter[] | Filters | undefined

        Active search filters.

      • pagination: SortAndLimit | undefined

        Limits and batch offsets.

      • parent: any

        Optional parent context for nested endpoints.

      Returns Promise<QueryResultType<any>>

      A promise resolving to an array of populated DataObjects and metadata.

    • Generates raw SQL for creating a table.

      Parameters

      • collection: string
      • properties: any[]

      Returns { downSql: string; upSql: string }

      Always throws because REST APIs do not support local schema generation.

    • Generates raw SQL for altering a table schema.

      Parameters

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

      Always throws because REST APIs do not support local schema deltas.

    • Returns ApiClient

    • 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>

    • Parameters

      Returns Record<string, 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