@baasix/sdk 0.1.11 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +12 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +12 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2894,18 +2894,22 @@ var ReportsModule = class {
|
|
|
2894
2894
|
* @example
|
|
2895
2895
|
* ```typescript
|
|
2896
2896
|
* const categories = await baasix.reports.distinct('products', 'category');
|
|
2897
|
+
*
|
|
2898
|
+
* // With a filter
|
|
2899
|
+
* const folders = await baasix.reports.distinct('baasix_File', 'folder', {
|
|
2900
|
+
* userId: { eq: '$CURRENT_USER' },
|
|
2901
|
+
* });
|
|
2897
2902
|
* ```
|
|
2898
2903
|
*/
|
|
2899
2904
|
async distinct(collection, field, filter) {
|
|
2900
|
-
const response = await this.client.
|
|
2901
|
-
`/
|
|
2905
|
+
const response = await this.client.post(
|
|
2906
|
+
`/reports/${collection}`,
|
|
2902
2907
|
{
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
}
|
|
2908
|
+
fields: [field],
|
|
2909
|
+
groupBy: [field],
|
|
2910
|
+
aggregate: { _count: { function: "distinct", field } },
|
|
2911
|
+
filter,
|
|
2912
|
+
limit: -1
|
|
2909
2913
|
}
|
|
2910
2914
|
);
|
|
2911
2915
|
return response.data.map((item) => item[field]);
|