@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.
- package/dist/browser/index.js +2 -2
- package/dist/browser/index.js.map +3 -3
- package/dist/node/index.cjs +15 -8
- package/dist/node/index.cjs.map +3 -3
- package/dist/node/index.js +15 -8
- package/dist/node/index.js.map +3 -3
- package/dist/ts/domain/interfaces/repository.d.ts +7 -0
- package/dist/ts/domain/interfaces/repository.d.ts.map +1 -1
- package/dist/ts/test/mock/repositories/mock-memory-repository.d.ts +7 -0
- package/dist/ts/test/mock/repositories/mock-memory-repository.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/domain/interfaces/repository.ts +8 -0
- package/src/test/mock/repositories/mock-memory-repository.test.ts +87 -0
- package/src/test/mock/repositories/mock-memory-repository.ts +22 -8
package/dist/node/index.js
CHANGED
|
@@ -121456,13 +121456,7 @@ class MockMemoryRepository {
|
|
|
121456
121456
|
}
|
|
121457
121457
|
async search(input, options) {
|
|
121458
121458
|
const pagination = options?.pagination || { page: 1, pageSize: 25 };
|
|
121459
|
-
let items =
|
|
121460
|
-
if (typeof this.args.filter === "function") {
|
|
121461
|
-
return this.args.filter(item, input);
|
|
121462
|
-
} else {
|
|
121463
|
-
return true;
|
|
121464
|
-
}
|
|
121465
|
-
});
|
|
121459
|
+
let items = this.applyFilters(input);
|
|
121466
121460
|
if (options?.sort && Array.isArray(options.sort)) {
|
|
121467
121461
|
items = items.sort((a, b10) => {
|
|
121468
121462
|
for (const sortField of options.sort) {
|
|
@@ -121553,6 +121547,19 @@ class MockMemoryRepository {
|
|
|
121553
121547
|
this.data.set(primaryKeyValue, updatedItem);
|
|
121554
121548
|
return updatedItem;
|
|
121555
121549
|
}
|
|
121550
|
+
async count(search, options) {
|
|
121551
|
+
const filteredItems = this.applyFilters(search);
|
|
121552
|
+
return filteredItems.length;
|
|
121553
|
+
}
|
|
121554
|
+
applyFilters(input) {
|
|
121555
|
+
return Array.from(this.data.values()).filter((item) => {
|
|
121556
|
+
if (typeof this.args.filter === "function") {
|
|
121557
|
+
return this.args.filter(item, input);
|
|
121558
|
+
} else {
|
|
121559
|
+
return true;
|
|
121560
|
+
}
|
|
121561
|
+
});
|
|
121562
|
+
}
|
|
121556
121563
|
async generatePrimaryKey() {
|
|
121557
121564
|
const lookupModel = this.args.schema.definition.lookup;
|
|
121558
121565
|
const lookupMeta = await lookupModel.toJSONSchema();
|
|
@@ -121586,5 +121593,5 @@ export {
|
|
|
121586
121593
|
BaseModelService
|
|
121587
121594
|
};
|
|
121588
121595
|
|
|
121589
|
-
//# debugId=
|
|
121596
|
+
//# debugId=BA89790D23A6530164756E2164756E21
|
|
121590
121597
|
//# sourceMappingURL=index.js.map
|