@baasix/sdk 0.1.14 → 0.1.15

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/README.md CHANGED
@@ -738,16 +738,20 @@ const report = await baasix.reports.generate('orders', {
738
738
  },
739
739
  groupBy: ['category'],
740
740
  filter: { status: { eq: 'completed' } },
741
+ sort: ['-revenue'], // Sort by aggregate alias descending
742
+ limit: 10, // Paginate grouped results
743
+ page: 1,
741
744
  dateRange: {
742
745
  start: '2025-01-01',
743
746
  end: '2025-12-31',
744
747
  },
745
748
  });
749
+ // Returns: { data: [...], totalCount: 15 }
746
750
  ```
747
751
 
748
752
  ### Query Report (GET)
749
753
 
750
- Use `query()` to fetch a report with a GET request, sending parameters as query strings:
754
+ Use `query()` to fetch a report with query parameters:
751
755
 
752
756
  ```typescript
753
757
  const report = await baasix.reports.query('orders', {
@@ -756,7 +760,11 @@ const report = await baasix.reports.query('orders', {
756
760
  },
757
761
  groupBy: ['status'],
758
762
  filter: { createdAt: { gte: '$NOW-DAYS_30' } },
763
+ sort: ['-total'], // Sort by aggregate result
764
+ limit: 50,
765
+ page: 1,
759
766
  });
767
+ // Returns: { data: [...], totalCount: 5 }
760
768
  ```
761
769
 
762
770
  ### Multi-Collection Stats
@@ -813,6 +821,9 @@ const results = await baasix.reports.aggregate('orders', {
813
821
  },
814
822
  groupBy: ['status', 'paymentMethod'],
815
823
  filter: { createdAt: { gte: '$NOW-DAYS_30' } },
824
+ sort: ['-total'], // Sort by aggregate alias
825
+ limit: 20, // Paginate results
826
+ page: 1,
816
827
  });
817
828
  ```
818
829
 
package/dist/index.cjs CHANGED
@@ -2883,7 +2883,9 @@ var ReportsModule = class {
2883
2883
  aggregate: options.aggregate,
2884
2884
  groupBy: options.groupBy,
2885
2885
  filter: options.filter,
2886
- limit: -1
2886
+ sort: options.sort,
2887
+ limit: options.limit ?? -1,
2888
+ page: options.page
2887
2889
  }
2888
2890
  }
2889
2891
  );