Skip to content

Library for interaction with component api and functionalities.

Component

new(ref) : Component method

create new reference to the component by name, tag or uuid


find(payload Filters) : Pagination method

find the models inside the component using the filters


get(uuid) : Model method

get component model by uuid


update(uuid, data) : any method


create(data) : any method

create new component model with provided data


delete(uuid) : any method

delete component model by uuid


aggregate(payload) : any method

use aggregation pipeline syntax to get aggregated results


settings() : Settings method

get current settings of the component


saveSettings(data Settings) method

save current component settings


workflow(event, input) method

trigger custom event in the components workflow and provide custom input


Types

Pagination

{
    items: [],
    total: 0,
    pages: 0,
    page: 1
}

Filters

{
    currentPage: 1,
    perPage: 50,
    sortDesc: 1 || -1,
    filterOn: [],
    filter '',
    dateFrom: '2022-06-22',
    dateTo: '2023-06-22',
    dateField: 'created_at'
    $adv: Query
    $aggregate: Pipeline
}

Query

Standard filter operators for use with $adv — supports comparison, logical, array, and element operators. See the filters documentation for usage examples.

Date Comparisons

When comparing date fields (e.g. created_at, updated_at, or custom date fields), $adv and $aggregate handle dates differently.

$adv

Both plain date strings and $date casting are supported. Plain date strings are automatically detected and converted to proper dates.

{
    "$adv": [{ "updated_at": { "$lt": "2025-01-01" } }]
}
{
    "$adv": [{ "updated_at": { "$lt": { "$date": "2025-01-01" } } }]
}

Supported date formats: ISO 8601 (2025-01-01T00:00:00Z), date-only (2025-01-01), datetime (2025-01-01 00:00:00).

$aggregate

In aggregation pipelines, you must use $date to cast date values. Plain date strings will be treated as strings and comparisons will not work correctly.

{
    "$aggregate": [
        { "$match": { "updated_at": { "$gte": { "$date": "2025-01-01T00:00:00Z" } } } }
    ]
}

Warning

When using $aggregate, always wrap date values with $date. Without it, dates are compared as strings and will produce incorrect results. Without $date, date comparisons will behave as string comparisons and may return unexpected results.