Skip to content

Library for interaction with component api and functionalities.

Component

v2(ref) : ComponentV2 method

get v2 library interface ex: component.v2('users')


ComponentV2

new(ref) : ComponentV2 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


concurrentUpdate(uuid, version, data) : any method

concurrently update model. This will throw an error if something else updated the model in the meantime.


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 MongoDB syntax for aggregation pipeline to get aggregated results


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

Pipeline