@konplit-services/common 1.24.1 → 1.24.2

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.
@@ -1,4 +1,7 @@
1
- import { Model, PopulateOptions } from "mongoose";
1
+ import { Model, PopulateOptions, Cursor } from "mongoose";
2
+ type Lean<T> = T & {
3
+ [key: string]: any;
4
+ };
2
5
  export interface PaginationOptions {
3
6
  page?: number;
4
7
  limit?: number;
@@ -18,15 +21,7 @@ export interface PaginationResult<T> {
18
21
  results: T[];
19
22
  }
20
23
  export declare function paginate<T>(model: Model<T>, options?: PaginationOptions): Promise<PaginationResult<T>>;
21
- export declare function paginateV2Cursor<T>(model: Model<T>, options?: PaginationOptions): import("mongoose").Cursor<import("mongoose").FlattenMaps<unknown> & Required<{
22
- _id: unknown;
23
- }> & {
24
- __v: number;
25
- }, import("mongoose").QueryOptions<T>, (import("mongoose").FlattenMaps<unknown> & Required<{
26
- _id: unknown;
27
- }> & {
28
- __v: number;
29
- }) | null>;
24
+ export declare function paginateV2Cursor<T>(model: Model<T>, options?: PaginationOptions): Cursor<Lean<T>>;
30
25
  export interface FilterOptions {
31
26
  search?: string;
32
27
  status?: string;
@@ -75,3 +70,4 @@ export interface DefaultFilterOptions {
75
70
  min_amount?: string;
76
71
  max_amount?: string;
77
72
  }
73
+ export {};
@@ -71,9 +71,8 @@ function paginateV2Cursor(model, options = {}) {
71
71
  if (populate) {
72
72
  queryBuilder.populate(populate);
73
73
  }
74
- return queryBuilder
75
- .lean()
76
- .cursor({ batchSize: 50 });
74
+ // @ts-ignore
75
+ return queryBuilder.lean().cursor({ batchSize: 50 });
77
76
  }
78
77
  const generateQueryObject = (filters, searchesFieldNames = [], select = "", populate = []) => {
79
78
  const { status, limit, page, sort_by = "createdAt", order = "desc", merchantId, accountId, dateField, amountField, } = filters;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@konplit-services/common",
3
- "version": "1.24.1",
3
+ "version": "1.24.2",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",