@konplit-services/common 1.24.1 → 1.25.0

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.
@@ -0,0 +1,12 @@
1
+ import { PaymentOptions } from "../../../helper";
2
+ import { Subjects } from "../../subjects";
3
+ export interface AdminPaymentOptionSettingsCreatedEvent {
4
+ subject: Subjects.AdminPaymentOptionSettingsCreated;
5
+ data: {
6
+ id: string;
7
+ name: typeof PaymentOptions;
8
+ isEnabled: boolean;
9
+ description?: string;
10
+ version: number;
11
+ };
12
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,14 @@
1
+ import { PaymentOptions } from "../../../helper";
2
+ import { StreamEvent, StreamName, Subjects } from "../../subjects";
3
+ export interface AdminPaymentOptionUpdatedEvent {
4
+ subject: Subjects.AdminPaymentOptionSettingsUpdated;
5
+ streamName: StreamName.name;
6
+ streamEvents: StreamEvent.Event;
7
+ data: {
8
+ id: string;
9
+ name: typeof PaymentOptions;
10
+ isEnabled: boolean;
11
+ description?: string;
12
+ version: number;
13
+ };
14
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export * from "./admin-paymentOption-settings-updated.interface";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./admin-paymentOption-settings-updated.interface"), exports);
@@ -109,6 +109,8 @@ export declare enum Subjects {
109
109
  DefaultChargeCreated = "events.default.charge.created",
110
110
  SettingCreated = "events.setting.created",
111
111
  SettingUpdated = "events.setting.updated",
112
+ AdminPaymentOptionSettingsUpdated = "events.admin.paymentoption.updated",
113
+ AdminPaymentOptionSettingsCreated = "events.admin.paymentoption.settings.created",
112
114
  TransactionCompleted = "events.transaction.completed",
113
115
  TransactionAborted = "events.transaction.aborted",
114
116
  TransactionFailed = "events.transaction.failed",
@@ -134,6 +134,8 @@ var Subjects;
134
134
  //Settings
135
135
  Subjects["SettingCreated"] = "events.setting.created";
136
136
  Subjects["SettingUpdated"] = "events.setting.updated";
137
+ Subjects["AdminPaymentOptionSettingsUpdated"] = "events.admin.paymentoption.updated";
138
+ Subjects["AdminPaymentOptionSettingsCreated"] = "events.admin.paymentoption.settings.created";
137
139
  //Transactions
138
140
  Subjects["TransactionCompleted"] = "events.transaction.completed";
139
141
  Subjects["TransactionAborted"] = "events.transaction.aborted";
@@ -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.25.0",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",