adobe / adobe/aem-headless-client-js

Expose RunQuery with QueryBuilder

Open
#59 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
34
Forks
13
Avg merge
8h 14m
Merged PRs (30d)
2

Description

`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

1. buildQuery
2. runQuery
3. __filterData

It can be simplified to

```
const { data } = await sdk.runModelQuery(modelName, modelFields, {}, { _path })
```

Since this already exist and it's used in `runPaginatedQuery`.

#### Logs taken while reproducing problem

Contributor guide

Open the contributing guide

Research direction

Trace runPaginatedQuery and the existing buildQuery, runQuery, and __filterData entry points to understand how model and field configuration flows through the SDK. Compare the List and ByPath query cases described in the issue. Done means equivalent simplified functionality is available for those query types without callers assembling the individual steps.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.