gemcap-be-common 1.4.120 → 1.4.122

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.
@@ -2,6 +2,7 @@ export declare const AiExchange: "ai.exchange";
2
2
  export declare const AiRoutingKeys: {
3
3
  readonly compliance: {
4
4
  readonly findMatch: "AI.COMPLIANCE.FIND_MATCH";
5
+ readonly summary: "AI.COMPLIANCE.SUMMARY";
5
6
  };
6
7
  };
7
8
  export declare const AiQueues: {
@@ -5,6 +5,7 @@ exports.AiExchange = 'ai.exchange';
5
5
  exports.AiRoutingKeys = {
6
6
  compliance: {
7
7
  findMatch: 'AI.COMPLIANCE.FIND_MATCH',
8
+ summary: 'AI.COMPLIANCE.SUMMARY',
8
9
  },
9
10
  };
10
11
  exports.AiQueues = {
@@ -3,6 +3,7 @@ export const AiExchange = 'ai.exchange' as const;
3
3
  export const AiRoutingKeys = {
4
4
  compliance: {
5
5
  findMatch: 'AI.COMPLIANCE.FIND_MATCH',
6
+ summary: 'AI.COMPLIANCE.SUMMARY',
6
7
  },
7
8
  } as const;
8
9
 
@@ -51,6 +51,7 @@ export declare const AccountSchema: {
51
51
  accountId1: {
52
52
  type: typeof Schema.Types.Mixed;
53
53
  required: false;
54
+ set: (value: unknown) => mongoose.Types.ObjectId | 'BANK' | null;
54
55
  validate: {
55
56
  validator: (value: mongoose.Types.ObjectId | 'BANK' | null) => boolean;
56
57
  message: (props: any) => string;
@@ -59,6 +60,7 @@ export declare const AccountSchema: {
59
60
  accountId2: {
60
61
  type: typeof Schema.Types.Mixed;
61
62
  required: false;
63
+ set: (value: unknown) => mongoose.Types.ObjectId | 'BANK' | null;
62
64
  validate: {
63
65
  validator: (value: mongoose.Types.ObjectId | 'BANK' | null) => boolean;
64
66
  message: (props: any) => string;
@@ -68,6 +70,7 @@ export declare const AccountSchema: {
68
70
  accountId1: {
69
71
  type: typeof Schema.Types.Mixed;
70
72
  required: false;
73
+ set: (value: unknown) => mongoose.Types.ObjectId | 'BANK' | null;
71
74
  validate: {
72
75
  validator: (value: mongoose.Types.ObjectId | 'BANK' | null) => boolean;
73
76
  message: (props: any) => string;
@@ -76,6 +79,7 @@ export declare const AccountSchema: {
76
79
  accountId2: {
77
80
  type: typeof Schema.Types.Mixed;
78
81
  required: false;
82
+ set: (value: unknown) => mongoose.Types.ObjectId | 'BANK' | null;
79
83
  validate: {
80
84
  validator: (value: mongoose.Types.ObjectId | 'BANK' | null) => boolean;
81
85
  message: (props: any) => string;
@@ -85,6 +89,7 @@ export declare const AccountSchema: {
85
89
  accountId1: {
86
90
  type: typeof Schema.Types.Mixed;
87
91
  required: false;
92
+ set: (value: unknown) => mongoose.Types.ObjectId | 'BANK' | null;
88
93
  validate: {
89
94
  validator: (value: mongoose.Types.ObjectId | 'BANK' | null) => boolean;
90
95
  message: (props: any) => string;
@@ -93,6 +98,7 @@ export declare const AccountSchema: {
93
98
  accountId2: {
94
99
  type: typeof Schema.Types.Mixed;
95
100
  required: false;
101
+ set: (value: unknown) => mongoose.Types.ObjectId | 'BANK' | null;
96
102
  validate: {
97
103
  validator: (value: mongoose.Types.ObjectId | 'BANK' | null) => boolean;
98
104
  message: (props: any) => string;
@@ -26,12 +26,28 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.CashAllocationProduct = exports.CashAllocationProductSchema = exports.AccountSchema = void 0;
27
27
  const mongoose_1 = __importStar(require("mongoose"));
28
28
  const _models_1 = require("./_models");
29
+ const normalizeAccountValue = (value) => {
30
+ if (value === null || value === undefined || value === '') {
31
+ return null;
32
+ }
33
+ if (value === 'BANK') {
34
+ return 'BANK';
35
+ }
36
+ if (typeof value === 'string' && mongoose_1.default.isValidObjectId(value)) {
37
+ return new mongoose_1.default.Types.ObjectId(value);
38
+ }
39
+ if (value instanceof mongoose_1.default.Types.ObjectId) {
40
+ return value;
41
+ }
42
+ return null;
43
+ };
29
44
  exports.AccountSchema = {
30
45
  type: Map,
31
46
  of: new mongoose_1.Schema({
32
47
  accountId1: {
33
48
  type: mongoose_1.Schema.Types.Mixed,
34
49
  required: false,
50
+ set: normalizeAccountValue,
35
51
  validate: {
36
52
  validator: function (value) {
37
53
  return (value === null ||
@@ -44,6 +60,7 @@ exports.AccountSchema = {
44
60
  accountId2: {
45
61
  type: mongoose_1.Schema.Types.Mixed,
46
62
  required: false,
63
+ set: normalizeAccountValue,
47
64
  validate: {
48
65
  validator: function (value) {
49
66
  return (value === null ||
@@ -27,14 +27,37 @@ export type ICashAllocationProductStringified = {
27
27
 
28
28
  type CashAllocationProductModel = Model<ICashAllocationProduct>;
29
29
 
30
+ const normalizeAccountValue = (
31
+ value: unknown,
32
+ ): mongoose.Types.ObjectId | 'BANK' | null => {
33
+ if (value === null || value === undefined || value === '') {
34
+ return null;
35
+ }
36
+
37
+ if (value === 'BANK') {
38
+ return 'BANK';
39
+ }
40
+
41
+ if (typeof value === 'string' && mongoose.isValidObjectId(value)) {
42
+ return new mongoose.Types.ObjectId(value);
43
+ }
44
+
45
+ if (value instanceof mongoose.Types.ObjectId) {
46
+ return value;
47
+ }
48
+
49
+ return null;
50
+ };
51
+
30
52
  export const AccountSchema = {
31
53
  type: Map,
32
54
  of: new Schema({
33
55
  accountId1: {
34
56
  type: Schema.Types.Mixed,
35
57
  required: false,
58
+ set: normalizeAccountValue,
36
59
  validate: {
37
- validator: function (value: mongoose.Types.ObjectId | 'BANK' | null) {
60
+ validator: function(value: mongoose.Types.ObjectId | 'BANK' | null) {
38
61
  return (
39
62
  value === null ||
40
63
  mongoose.isValidObjectId(value) ||
@@ -48,8 +71,9 @@ export const AccountSchema = {
48
71
  accountId2: {
49
72
  type: Schema.Types.Mixed,
50
73
  required: false,
74
+ set: normalizeAccountValue,
51
75
  validate: {
52
- validator: function (value: mongoose.Types.ObjectId | 'BANK' | null) {
76
+ validator: function(value: mongoose.Types.ObjectId | 'BANK' | null) {
53
77
  return (
54
78
  value === null ||
55
79
  mongoose.isValidObjectId(value) ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gemcap-be-common",
3
- "version": "1.4.120",
3
+ "version": "1.4.122",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -84,10 +84,10 @@ export declare class BorrowerService {
84
84
  getBorrowerCodesMap(): Promise<Map<string, string>>;
85
85
  getBorrowerStatementDetails(borrowers: IBorrowerDoc[]): Promise<{
86
86
  [x: string]: {
87
+ LAST_MONTH?: boolean;
88
+ CURRENT_MONTH?: boolean;
87
89
  ENTIRE_LOAN?: boolean;
88
90
  SELECTED_PERIOD?: boolean;
89
- CURRENT_MONTH?: boolean;
90
- LAST_MONTH?: boolean;
91
91
  TERM_LOAN?: boolean;
92
92
  };
93
93
  }>;