gemcap-be-common 1.4.112 → 1.4.114
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/constants/ai.constants.d.ts +11 -0
- package/constants/ai.constants.js +14 -0
- package/constants/ai.constants.ts +13 -0
- package/models/FinancialSpreadingAlias.model.d.ts +5 -1
- package/models/FinancialSpreadingAlias.model.js +33 -5
- package/models/FinancialSpreadingAlias.model.ts +39 -5
- package/package.json +1 -1
- package/services/bank-uploaded-transactions.service.js +3 -3
- package/services/bank-uploaded-transactions.service.ts +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- /package/constants/{date-formats.contsants.d.ts → date-formats.constants.d.ts} +0 -0
- /package/constants/{date-formats.contsants.js → date-formats.constants.js} +0 -0
- /package/constants/{date-formats.contsants.ts → date-formats.constants.ts} +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const AiExchange: "ai.exchange";
|
|
2
|
+
export declare const AiRoutingKeys: {
|
|
3
|
+
readonly compliance: {
|
|
4
|
+
readonly findMatch: "AI.COMPLIANCE.FIND_MATCH";
|
|
5
|
+
};
|
|
6
|
+
};
|
|
7
|
+
export declare const AiQueues: {
|
|
8
|
+
readonly compliance: {
|
|
9
|
+
readonly main: "ai.compliance.queue";
|
|
10
|
+
};
|
|
11
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AiQueues = exports.AiRoutingKeys = exports.AiExchange = void 0;
|
|
4
|
+
exports.AiExchange = 'ai.exchange';
|
|
5
|
+
exports.AiRoutingKeys = {
|
|
6
|
+
compliance: {
|
|
7
|
+
findMatch: 'AI.COMPLIANCE.FIND_MATCH',
|
|
8
|
+
},
|
|
9
|
+
};
|
|
10
|
+
exports.AiQueues = {
|
|
11
|
+
compliance: {
|
|
12
|
+
main: 'ai.compliance.queue',
|
|
13
|
+
},
|
|
14
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const AiExchange = 'ai.exchange' as const;
|
|
2
|
+
|
|
3
|
+
export const AiRoutingKeys = {
|
|
4
|
+
compliance: {
|
|
5
|
+
findMatch: 'AI.COMPLIANCE.FIND_MATCH',
|
|
6
|
+
},
|
|
7
|
+
} as const;
|
|
8
|
+
|
|
9
|
+
export const AiQueues = {
|
|
10
|
+
compliance: {
|
|
11
|
+
main: 'ai.compliance.queue',
|
|
12
|
+
},
|
|
13
|
+
} as const;
|
|
@@ -25,7 +25,10 @@
|
|
|
25
25
|
import mongoose, { Model } from 'mongoose';
|
|
26
26
|
export interface IFinancialSpreadingAlias {
|
|
27
27
|
sheetId: mongoose.Types.ObjectId;
|
|
28
|
-
aliases:
|
|
28
|
+
aliases: {
|
|
29
|
+
original: string;
|
|
30
|
+
normalized: string;
|
|
31
|
+
}[];
|
|
29
32
|
}
|
|
30
33
|
export interface IFinancialSpreadingAliasDoc extends IFinancialSpreadingAlias, Document {
|
|
31
34
|
_id: mongoose.Types.ObjectId;
|
|
@@ -48,3 +51,4 @@ export declare const FinancialSpreadingAliasSchema: mongoose.Schema<IFinancialSp
|
|
|
48
51
|
_id: mongoose.Types.ObjectId;
|
|
49
52
|
}>;
|
|
50
53
|
export declare const FinancialSpreadingAlias: TFinancialSpreadingAliasModel;
|
|
54
|
+
export declare function normalizeAlias(input: string): string;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.FinancialSpreadingAlias = exports.FinancialSpreadingAliasSchema = void 0;
|
|
6
|
+
exports.normalizeAlias = exports.FinancialSpreadingAlias = exports.FinancialSpreadingAliasSchema = void 0;
|
|
7
7
|
const mongoose_1 = __importDefault(require("mongoose"));
|
|
8
8
|
const _models_1 = require("./_models");
|
|
9
9
|
exports.FinancialSpreadingAliasSchema = new mongoose_1.default.Schema({
|
|
@@ -13,12 +13,40 @@ exports.FinancialSpreadingAliasSchema = new mongoose_1.default.Schema({
|
|
|
13
13
|
required: true,
|
|
14
14
|
},
|
|
15
15
|
aliases: [{
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
original: {
|
|
17
|
+
type: String,
|
|
18
|
+
required: false,
|
|
19
|
+
trim: true,
|
|
20
|
+
},
|
|
21
|
+
normalized: {
|
|
22
|
+
type: String,
|
|
23
|
+
required: false,
|
|
24
|
+
trim: true,
|
|
25
|
+
},
|
|
20
26
|
}],
|
|
21
27
|
}, {
|
|
22
28
|
timestamps: { createdAt: true, updatedAt: true },
|
|
23
29
|
});
|
|
24
30
|
exports.FinancialSpreadingAlias = mongoose_1.default.model(_models_1.MODEL_NAMES.financialSpreadingAlias, exports.FinancialSpreadingAliasSchema);
|
|
31
|
+
exports.FinancialSpreadingAliasSchema.index({
|
|
32
|
+
'aliases.normalized': 1
|
|
33
|
+
});
|
|
34
|
+
exports.FinancialSpreadingAliasSchema.pre('validate', function (next) {
|
|
35
|
+
this.aliases = this.aliases
|
|
36
|
+
.filter(a => a.original?.trim())
|
|
37
|
+
.map(a => ({
|
|
38
|
+
original: a.original.trim(),
|
|
39
|
+
normalized: normalizeAlias(a.original),
|
|
40
|
+
}));
|
|
41
|
+
next();
|
|
42
|
+
});
|
|
43
|
+
function normalizeAlias(input) {
|
|
44
|
+
return input
|
|
45
|
+
.toLowerCase()
|
|
46
|
+
.trim()
|
|
47
|
+
.replace(/\s+/g, ' ')
|
|
48
|
+
.replace(/[–—−]/g, '-')
|
|
49
|
+
.replace(/[_]/g, ' ')
|
|
50
|
+
.replace(/[^\p{L}\p{N}\s-]/gu, '');
|
|
51
|
+
}
|
|
52
|
+
exports.normalizeAlias = normalizeAlias;
|
|
@@ -4,7 +4,10 @@ import { MODEL_NAMES } from './_models';
|
|
|
4
4
|
|
|
5
5
|
export interface IFinancialSpreadingAlias {
|
|
6
6
|
sheetId: mongoose.Types.ObjectId;
|
|
7
|
-
aliases:
|
|
7
|
+
aliases: {
|
|
8
|
+
original: string;
|
|
9
|
+
normalized: string;
|
|
10
|
+
}[];
|
|
8
11
|
}
|
|
9
12
|
|
|
10
13
|
export interface IFinancialSpreadingAliasDoc extends IFinancialSpreadingAlias, Document {
|
|
@@ -36,10 +39,16 @@ export const FinancialSpreadingAliasSchema = new mongoose.Schema<IFinancialSprea
|
|
|
36
39
|
required: true,
|
|
37
40
|
},
|
|
38
41
|
aliases: [{
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
original: {
|
|
43
|
+
type: String,
|
|
44
|
+
required: false,
|
|
45
|
+
trim: true,
|
|
46
|
+
},
|
|
47
|
+
normalized: {
|
|
48
|
+
type: String,
|
|
49
|
+
required: false,
|
|
50
|
+
trim: true,
|
|
51
|
+
},
|
|
43
52
|
}],
|
|
44
53
|
},
|
|
45
54
|
{
|
|
@@ -48,3 +57,28 @@ export const FinancialSpreadingAliasSchema = new mongoose.Schema<IFinancialSprea
|
|
|
48
57
|
);
|
|
49
58
|
|
|
50
59
|
export const FinancialSpreadingAlias = mongoose.model<IFinancialSpreadingAlias, TFinancialSpreadingAliasModel>(MODEL_NAMES.financialSpreadingAlias, FinancialSpreadingAliasSchema);
|
|
60
|
+
|
|
61
|
+
FinancialSpreadingAliasSchema.index({
|
|
62
|
+
'aliases.normalized': 1
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
FinancialSpreadingAliasSchema.pre('validate', function(next) {
|
|
66
|
+
this.aliases = this.aliases
|
|
67
|
+
.filter(a => a.original?.trim())
|
|
68
|
+
.map(a => ({
|
|
69
|
+
original: a.original.trim(),
|
|
70
|
+
normalized: normalizeAlias(a.original),
|
|
71
|
+
}));
|
|
72
|
+
|
|
73
|
+
next();
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
export function normalizeAlias(input: string): string {
|
|
77
|
+
return input
|
|
78
|
+
.toLowerCase()
|
|
79
|
+
.trim()
|
|
80
|
+
.replace(/\s+/g, ' ')
|
|
81
|
+
.replace(/[–—−]/g, '-')
|
|
82
|
+
.replace(/[_]/g, ' ')
|
|
83
|
+
.replace(/[^\p{L}\p{N}\s-]/gu, '');
|
|
84
|
+
}
|
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@ const CashAllocationReference_model_1 = require("../models/CashAllocationReferen
|
|
|
16
16
|
const CashAllocationProduct_model_1 = require("../models/CashAllocationProduct.model");
|
|
17
17
|
const AllocatedBankTransaction_model_1 = require("../models/AllocatedBankTransaction.model");
|
|
18
18
|
const AllocatedData_model_1 = require("../models/AllocatedData.model");
|
|
19
|
-
const
|
|
19
|
+
const date_formats_constants_1 = require("../constants/date-formats.constants");
|
|
20
20
|
const useExternalUploader = false; // TODO keep only external upload
|
|
21
21
|
const createCashAllocationReferencesOnUpload = false;
|
|
22
22
|
class BankUploadedTransactionsService {
|
|
@@ -273,7 +273,7 @@ class BankUploadedTransactionsService {
|
|
|
273
273
|
}
|
|
274
274
|
async createAllocatedBankTransactions(date) {
|
|
275
275
|
const cashAllocations = await this.getAllocatedTransactions(date);
|
|
276
|
-
const allocatedData = await AllocatedData_model_1.AllocatedData.findOne({ date: (0, dayjs_1.default)(date).format(
|
|
276
|
+
const allocatedData = await AllocatedData_model_1.AllocatedData.findOne({ date: (0, dayjs_1.default)(date).format(date_formats_constants_1.MAIN_DATE_FORMAT) });
|
|
277
277
|
if (cashAllocations.length > 0 && (allocatedData && allocatedData.isLocked)) {
|
|
278
278
|
return;
|
|
279
279
|
}
|
|
@@ -456,7 +456,7 @@ class BankUploadedTransactionsService {
|
|
|
456
456
|
}
|
|
457
457
|
async updateLockStatus(date, isLocked) {
|
|
458
458
|
const normalizedDate = (0, dayjs_1.default)(date).utcOffset(0).startOf('day');
|
|
459
|
-
await AllocatedData_model_1.AllocatedData.updateOne({ date: normalizedDate.format(
|
|
459
|
+
await AllocatedData_model_1.AllocatedData.updateOne({ date: normalizedDate.format(date_formats_constants_1.MAIN_DATE_FORMAT) }, { isLocked }, { upsert: true });
|
|
460
460
|
}
|
|
461
461
|
}
|
|
462
462
|
exports.BankUploadedTransactionsService = BankUploadedTransactionsService;
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
PreSplitUploadedBankTransactionWithInfo,
|
|
28
28
|
} from '../models/AllocatedBankTransaction.model';
|
|
29
29
|
import { AllocatedData } from '../models/AllocatedData.model';
|
|
30
|
-
import { MAIN_DATE_FORMAT } from '../constants/date-formats.
|
|
30
|
+
import { MAIN_DATE_FORMAT } from '../constants/date-formats.constants';
|
|
31
31
|
import { LoanTransactionsService } from './loan-transactions.service';
|
|
32
32
|
import { CashAllocationService } from './cash-allocation.service';
|
|
33
33
|
import { LoanStatementStatusService } from './loan-statement-status.service';
|