@declaro/data 2.0.0-beta.62 → 2.0.0-beta.63

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.
@@ -121495,13 +121495,7 @@ class MockMemoryRepository {
121495
121495
  }
121496
121496
  async search(input, options) {
121497
121497
  const pagination = options?.pagination || { page: 1, pageSize: 25 };
121498
- let items = Array.from(this.data.values()).filter((item) => {
121499
- if (typeof this.args.filter === "function") {
121500
- return this.args.filter(item, input);
121501
- } else {
121502
- return true;
121503
- }
121504
- });
121498
+ let items = this.applyFilters(input);
121505
121499
  if (options?.sort && Array.isArray(options.sort)) {
121506
121500
  items = items.sort((a, b10) => {
121507
121501
  for (const sortField of options.sort) {
@@ -121592,6 +121586,19 @@ class MockMemoryRepository {
121592
121586
  this.data.set(primaryKeyValue, updatedItem);
121593
121587
  return updatedItem;
121594
121588
  }
121589
+ async count(search, options) {
121590
+ const filteredItems = this.applyFilters(search);
121591
+ return filteredItems.length;
121592
+ }
121593
+ applyFilters(input) {
121594
+ return Array.from(this.data.values()).filter((item) => {
121595
+ if (typeof this.args.filter === "function") {
121596
+ return this.args.filter(item, input);
121597
+ } else {
121598
+ return true;
121599
+ }
121600
+ });
121601
+ }
121595
121602
  async generatePrimaryKey() {
121596
121603
  const lookupModel = this.args.schema.definition.lookup;
121597
121604
  const lookupMeta = await lookupModel.toJSONSchema();
@@ -121607,5 +121614,5 @@ class MockMemoryRepository {
121607
121614
  }
121608
121615
  }
121609
121616
 
121610
- //# debugId=F80C18D46CB4EA1564756E2164756E21
121617
+ //# debugId=7897827112435D4B64756E2164756E21
121611
121618
  //# sourceMappingURL=index.cjs.map