aem-headless-client-js
aem-headless-client-js copied to clipboard
Expose RunQuery with QueryBuilder
runPaginatedQuery
can be used with simple config object ({model, fields}).
Internally it use queryBuilder and data filter to return only list of results.
This is very useful behaviour for other query types.
Expected Behaviour
Expose runPaginatedQuery
functionality for other query types (List, ByPath).
Actual Behaviour
Reproduce Scenario (including but not limited to)
Steps to Reproduce
Platform and Version
Sample Code that illustrates the problem
Eg: queryByPath using model name and fields object config:
async fetchByPath(_path) {
const { query, type } = sdk.buildQuery(modelName, modelFields, {}, { _path });
const response = await sdk.runQuery(query);
const { data } = sdk.__filterData(modelName, type, response.data);
}
It require next sdk methods
- buildQuery
- runQuery
- __filterData
It can be simplified to
const { data } = await sdk.runModelQuery(modelName, modelFields, {}, { _path })
Since this already exist and it's used in runPaginatedQuery
.