@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 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.get(
2901
- `/items/${collection}`,
2905
+ const response = await this.client.post(
2906
+ `/reports/${collection}`,
2902
2907
  {
2903
- params: {
2904
- filter,
2905
- fields: [field],
2906
- groupBy: [field],
2907
- limit: -1
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]);