law-common 10.19.1-beta.9 → 10.21.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.
Files changed (43) hide show
  1. package/dist/src/api/index.d.ts +0 -1
  2. package/dist/src/api/index.js +0 -1
  3. package/dist/src/api/interface/billing.transaction.create.dto.interface.d.ts +2 -7
  4. package/dist/src/api/interface/billing.transaction.entity.response.d.ts +1 -11
  5. package/dist/src/api/interface/billing.transaction.update.dto.interface.d.ts +2 -12
  6. package/dist/src/entities/func/convert-to-common-entity.func.js +2 -8
  7. package/dist/src/entities/index.d.ts +0 -5
  8. package/dist/src/entities/index.js +0 -5
  9. package/dist/src/entities/interface/billing.entity.interface.d.ts +0 -1
  10. package/dist/src/entities/interface/billing_transaction.entity.interface.d.ts +0 -7
  11. package/dist/src/entities/interface/entity.utils.interface.d.ts +4 -13
  12. package/dist/src/entities/interface/entity.utils.interface.js +0 -1
  13. package/dist/src/entities/model/base.entity.model.d.ts +2 -8
  14. package/dist/src/entities/model/base.entity.model.js +35 -43
  15. package/dist/src/entities/model/billing.entity.model.d.ts +1 -4
  16. package/dist/src/entities/model/billing.entity.model.js +0 -9
  17. package/dist/src/entities/model/entity.model.interface.d.ts +2 -12
  18. package/dist/src/entities/model/entity.model.interface.js +18 -61
  19. package/dist/src/entities/model/holiday.entity.model.d.ts +1 -14
  20. package/dist/src/entities/model/holiday.entity.model.js +42 -25
  21. package/dist/src/entities/model/leave.entity.model.d.ts +3 -50
  22. package/dist/src/entities/model/leave.entity.model.js +21 -154
  23. package/dist/src/utils/helper.fn.util.d.ts +1 -37
  24. package/dist/src/utils/helper.fn.util.js +0 -53
  25. package/dist/src/utils/index.d.ts +0 -2
  26. package/dist/src/utils/index.js +0 -2
  27. package/dist/src/utils/string.util.d.ts +0 -1
  28. package/dist/src/utils/string.util.js +0 -14
  29. package/package.json +35 -35
  30. package/dist/src/api/interface/billing-transaction-history.api.d.ts +0 -3
  31. package/dist/src/api/interface/billing-transaction-history.api.js +0 -2
  32. package/dist/src/entities/enums/billing-transaction-action.enum.d.ts +0 -11
  33. package/dist/src/entities/enums/billing-transaction-action.enum.js +0 -15
  34. package/dist/src/entities/enums/billing-transaction-status.enum.d.ts +0 -6
  35. package/dist/src/entities/enums/billing-transaction-status.enum.js +0 -10
  36. package/dist/src/entities/interface/billing-transaction-history.entity.d.ts +0 -7
  37. package/dist/src/entities/interface/billing-transaction-history.entity.js +0 -2
  38. package/dist/src/entities/model/billing-transaction.model.d.ts +0 -24
  39. package/dist/src/entities/model/billing-transaction.model.js +0 -56
  40. package/dist/src/entities/model/leave_count.entity.model.d.ts +0 -19
  41. package/dist/src/entities/model/leave_count.entity.model.js +0 -60
  42. package/dist/src/utils/entity.flow.util.d.ts +0 -32
  43. package/dist/src/utils/entity.flow.util.js +0 -83
@@ -3,12 +3,7 @@ import { DateCodeModel, Weekday } from "../../utils";
3
3
  import { DurationTypeEnum } from "../enums/duration-type.enum";
4
4
  import { LeaveTypeEnum } from "../enums/leave-type.enum";
5
5
  import { LeaveStatusEnum } from "../enums/leave.status.enum";
6
- import { RelationType } from "../enums/relation-type.enum";
7
- import { EntityEnum, VirtualEntityEnum } from "../interface/entity.utils.interface";
8
- import { BaseEntityModel } from "./base.entity.model";
9
- import { LeaveCountVirtualEntityModel } from "./leave_count.entity.model";
10
- import { UserEntityModel } from "./user.entity.model";
11
- export declare class LeaveEntityModel extends BaseEntityModel<EntityEnum.LEAVE> implements ILeaveApiEntity {
6
+ export declare class LeaveEntityModel implements ILeaveApiEntity {
12
7
  id: number;
13
8
  employeeId: number;
14
9
  fromDate: string;
@@ -22,55 +17,13 @@ export declare class LeaveEntityModel extends BaseEntityModel<EntityEnum.LEAVE>
22
17
  updatedOn: string;
23
18
  createdBy: number;
24
19
  updatedBy: number;
25
- leaveCount?: LeaveCountVirtualEntityModel;
26
- createdByUser?: UserEntityModel;
27
- updatedByUser?: UserEntityModel;
28
- user?: UserEntityModel;
20
+ private constructor();
29
21
  static fromEntity(data: ILeaveApiEntity): LeaveEntityModel;
22
+ isMoreThanOneDayLeave(): boolean;
30
23
  getLeaveDuration(excludeWeekdays?: Weekday[], excludeDates?: DateCodeModel[]): number;
31
24
  static getLeaveDuration(leaves: LeaveEntityModel[], excludeWeekdays?: Weekday[], excludeDates?: DateCodeModel[], leaveStatusEnum?: LeaveStatusEnum[]): number;
32
25
  getDateCodeModels(dateCodeIncludePredicates?: ((dateModel: DateCodeModel) => boolean)[], dateCodeExcludePredicates?: ((dateModel: DateCodeModel) => boolean)[]): DateCodeModel[];
33
26
  static getLeaveApprovePredicate(): (leave: LeaveEntityModel) => boolean;
34
27
  static getLeavePendingPredicate(): (leave: LeaveEntityModel) => boolean;
35
28
  static getLeavesByPredicates(leaves: LeaveEntityModel[], includePredicates?: ((leave: LeaveEntityModel) => boolean)[], excludePredicates?: ((leave: LeaveEntityModel) => boolean)[]): LeaveEntityModel[];
36
- static orderByFromDateAsc(leaves: LeaveEntityModel[]): LeaveEntityModel[];
37
- isWeekendSucceeds(): boolean;
38
- isWeekendPrecedes(): boolean;
39
- isHolidaySucceeds(holidays: DateCodeModel[]): boolean;
40
- isHolidayPrecedes(holidays: DateCodeModel[]): boolean;
41
- getRelationConfigs(): any[];
42
- static relationConfigs: ({
43
- name: VirtualEntityEnum;
44
- relation: RelationType;
45
- key: string;
46
- mapKeyConfig: {
47
- relationKey: string;
48
- key: string;
49
- };
50
- } | {
51
- name: EntityEnum;
52
- relation: RelationType;
53
- key: string;
54
- mapKeyConfig: {
55
- relationKey: string;
56
- key: string;
57
- };
58
- })[];
59
- static fromApiEntity(apiEntity: ILeaveApiEntity): LeaveEntityModel;
60
- static getPendingApprovalStatuses(): LeaveStatusEnum[];
61
- getStatusLabel(): string;
62
- getTypeLabel(): string;
63
- getLeaveCount(): number;
64
- static getLeaveCount(leaveEntities: LeaveEntityModel[]): number;
65
- isMoreThanOneDayLeave(): boolean;
66
- getFromDateLabel(): string;
67
- getToDateLabel(): string;
68
- getDateDurationLabel(): string;
69
- static getLeaveStatusPriority(): {
70
- pending_approval: number;
71
- edit_approval: number;
72
- delete_approval: number;
73
- approved: number;
74
- rejected: number;
75
- };
76
29
  }
@@ -2,33 +2,33 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LeaveEntityModel = void 0;
4
4
  const utils_1 = require("../../utils");
5
- const string_util_1 = require("../../utils/string.util");
6
5
  const duration_type_enum_1 = require("../enums/duration-type.enum");
7
- const leave_type_enum_1 = require("../enums/leave-type.enum");
8
6
  const leave_status_enum_1 = require("../enums/leave.status.enum");
9
- const relation_type_enum_1 = require("../enums/relation-type.enum");
10
- const entity_utils_interface_1 = require("../interface/entity.utils.interface");
11
- const base_entity_model_1 = require("./base.entity.model");
12
- class LeaveEntityModel extends base_entity_model_1.BaseEntityModel {
13
- constructor() {
14
- super(...arguments);
15
- this.id = 0;
16
- this.employeeId = 0;
17
- this.fromDate = "";
18
- this.toDate = "";
19
- this.reason = "";
20
- this.durationType = duration_type_enum_1.DurationTypeEnum.FULL;
21
- this.status = leave_status_enum_1.LeaveStatusEnum.DELETED;
22
- this.type = leave_type_enum_1.LeaveTypeEnum.SICK;
7
+ class LeaveEntityModel {
8
+ constructor(data) {
23
9
  this.createdOn = "";
24
10
  this.updatedOn = "";
25
- this.createdBy = 0;
26
- this.updatedBy = 0;
11
+ this.id = data.id;
12
+ this.employeeId = data.employeeId;
13
+ this.fromDate = data.fromDate;
14
+ this.toDate = data.toDate;
15
+ this.reason = data.reason;
16
+ this.durationType = data.durationType;
17
+ this.status = data.status;
18
+ this.remark = data.remark;
19
+ this.type = data.type;
20
+ this.createdOn = data.createdOn;
21
+ this.updatedOn = data.updatedOn;
22
+ this.createdBy = data.createdBy;
23
+ this.updatedBy = data.updatedBy;
27
24
  }
28
25
  static fromEntity(data) {
29
- const entity = new LeaveEntityModel(entity_utils_interface_1.EntityEnum.LEAVE);
30
- Object.assign(entity, data);
31
- return entity;
26
+ return new LeaveEntityModel(data);
27
+ }
28
+ isMoreThanOneDayLeave() {
29
+ const fromDate = new utils_1.DateCodeModel(this.fromDate);
30
+ const toDate = new utils_1.DateCodeModel(this.toDate);
31
+ return fromDate.diffInDays(toDate) > 1;
32
32
  }
33
33
  getLeaveDuration(excludeWeekdays = [], excludeDates = []) {
34
34
  if (!this.isMoreThanOneDayLeave()) {
@@ -80,138 +80,5 @@ class LeaveEntityModel extends base_entity_model_1.BaseEntityModel {
80
80
  return leaves.filter((leave) => includePredicates.every((predicate) => predicate(leave)) &&
81
81
  excludePredicates.every((predicate) => !predicate(leave)));
82
82
  }
83
- static orderByFromDateAsc(leaves) {
84
- return leaves.sort((a, b) => {
85
- const dateA = new Date(a.fromDate);
86
- const dateB = new Date(b.fromDate);
87
- return dateA.getTime() - dateB.getTime();
88
- });
89
- }
90
- isWeekendSucceeds() {
91
- const toDate = new utils_1.DateCodeModel(this.toDate);
92
- const nextDate = toDate.getByOffset(1);
93
- return nextDate.isDayPresent([utils_1.Weekday.Saturday, utils_1.Weekday.Sunday]);
94
- }
95
- isWeekendPrecedes() {
96
- const fromDate = new utils_1.DateCodeModel(this.fromDate);
97
- const prevDate = fromDate.getByOffset(-1);
98
- return prevDate.isDayPresent([utils_1.Weekday.Saturday, utils_1.Weekday.Sunday]);
99
- }
100
- isHolidaySucceeds(holidays) {
101
- const toDate = new utils_1.DateCodeModel(this.toDate);
102
- const nextDate = toDate.getByOffset(1);
103
- return holidays.some((holiday) => holiday.isSame(nextDate));
104
- }
105
- isHolidayPrecedes(holidays) {
106
- const fromDate = new utils_1.DateCodeModel(this.fromDate);
107
- const prevDate = fromDate.getByOffset(-1);
108
- return holidays.some((holiday) => holiday.isSame(prevDate));
109
- }
110
- getRelationConfigs() {
111
- return this.constructor.prototype.constructor.relationConfigs;
112
- }
113
- static fromApiEntity(apiEntity) {
114
- return LeaveEntityModel.fromEntity(apiEntity);
115
- }
116
- static getPendingApprovalStatuses() {
117
- return [
118
- leave_status_enum_1.LeaveStatusEnum.PENDING_APPROVAL,
119
- leave_status_enum_1.LeaveStatusEnum.DELETE_APPROVAL,
120
- leave_status_enum_1.LeaveStatusEnum.EDIT_APPROVAL,
121
- ];
122
- }
123
- getStatusLabel() {
124
- const pendingStatuses = LeaveEntityModel.getPendingApprovalStatuses();
125
- let statusLabel = '';
126
- if (pendingStatuses.includes(this.status)) {
127
- statusLabel = 'PENDING_APPROVAL';
128
- }
129
- else if (this.status === leave_status_enum_1.LeaveStatusEnum.RESOLVE_REJECTED) {
130
- statusLabel = 'CHANGES_REJECTED';
131
- }
132
- else {
133
- statusLabel = this.status.toString();
134
- }
135
- return (0, string_util_1.formatString)(statusLabel);
136
- }
137
- getTypeLabel() {
138
- return (0, string_util_1.formatString)(this.type.toString());
139
- }
140
- getLeaveCount() {
141
- var _a;
142
- return ((_a = this.leaveCount) === null || _a === void 0 ? void 0 : _a.count) || 0;
143
- }
144
- static getLeaveCount(leaveEntities) {
145
- return leaveEntities.reduce((acc, leave) => acc + leave.getLeaveCount(), 0);
146
- }
147
- isMoreThanOneDayLeave() {
148
- const fromDate = new utils_1.DateCodeModel(this.fromDate);
149
- const toDate = new utils_1.DateCodeModel(this.toDate);
150
- return fromDate.diffInDays(toDate) > 1;
151
- }
152
- getFromDateLabel() {
153
- const statues = [duration_type_enum_1.DurationTypeEnum.SECOND, duration_type_enum_1.DurationTypeEnum.SECOND_FULL, duration_type_enum_1.DurationTypeEnum.SECOND_FIRST];
154
- if (statues.includes(this.durationType)) {
155
- return 'Second Half';
156
- }
157
- return 'Full Day';
158
- }
159
- getToDateLabel() {
160
- const statues = [duration_type_enum_1.DurationTypeEnum.FIRST, duration_type_enum_1.DurationTypeEnum.FULL_FIRST, duration_type_enum_1.DurationTypeEnum.SECOND_FIRST];
161
- if (statues.includes(this.durationType)) {
162
- return 'First Half';
163
- }
164
- return 'Full Day';
165
- }
166
- getDateDurationLabel() {
167
- if (!this.isMoreThanOneDayLeave()) {
168
- return `${new utils_1.DateCodeModel(this.fromDate).getFormattedDateWithMonthName()} ${this.durationType === duration_type_enum_1.DurationTypeEnum.FULL ? '(Full Day)' : this.durationType === duration_type_enum_1.DurationTypeEnum.FIRST ? '(First Half)' : '(Second Half)'}`;
169
- }
170
- return `${new utils_1.DateCodeModel(this.fromDate).getFormattedDateWithMonthName()} (${this.getFromDateLabel()}) - ${new utils_1.DateCodeModel(this.toDate).getFormattedDateWithMonthName()} (${this.getToDateLabel()})`;
171
- }
172
- static getLeaveStatusPriority() {
173
- return {
174
- [leave_status_enum_1.LeaveStatusEnum.PENDING_APPROVAL]: 1,
175
- [leave_status_enum_1.LeaveStatusEnum.EDIT_APPROVAL]: 2,
176
- [leave_status_enum_1.LeaveStatusEnum.DELETE_APPROVAL]: 3,
177
- [leave_status_enum_1.LeaveStatusEnum.APPROVED]: 4,
178
- [leave_status_enum_1.LeaveStatusEnum.REJECTED]: 5,
179
- };
180
- }
181
83
  }
182
84
  exports.LeaveEntityModel = LeaveEntityModel;
183
- LeaveEntityModel.relationConfigs = [
184
- {
185
- name: entity_utils_interface_1.VirtualEntityEnum.LEAVE_COUNT,
186
- relation: relation_type_enum_1.RelationType.ONE,
187
- key: 'leaveCount',
188
- mapKeyConfig: {
189
- relationKey: 'leaveId',
190
- key: 'id',
191
- },
192
- }, {
193
- name: entity_utils_interface_1.EntityEnum.USER,
194
- relation: relation_type_enum_1.RelationType.ONE,
195
- key: 'createdByUser',
196
- mapKeyConfig: {
197
- relationKey: 'id',
198
- key: 'createdBy',
199
- },
200
- }, {
201
- name: entity_utils_interface_1.EntityEnum.USER,
202
- relation: relation_type_enum_1.RelationType.ONE,
203
- key: 'updatedByUser',
204
- mapKeyConfig: {
205
- relationKey: 'id',
206
- key: 'updatedBy',
207
- },
208
- }, {
209
- name: entity_utils_interface_1.EntityEnum.USER,
210
- relation: relation_type_enum_1.RelationType.ONE,
211
- key: 'user',
212
- mapKeyConfig: {
213
- relationKey: 'id',
214
- key: 'employeeId',
215
- },
216
- }
217
- ];
@@ -1,4 +1,4 @@
1
- import { EntityEnum, EnumEntityType, IBaseEntityServiceResponse, IEntityFilterData, IEntityServiceResponse } from "../entities";
1
+ import { EntityEnum, EnumEntityType, IBaseEntityServiceResponse, IEntityFilterData } from "../entities";
2
2
  import { Modify } from "../misc";
3
3
  export declare function groupByFunction<T, K>(list: T[], keyGetter: (input: T) => K): Map<K, T[]>;
4
4
  export declare function groupByOneToOneFunction<T, K>(list: T[], keyGetter: (input: T) => K): Map<K, T>;
@@ -176,42 +176,6 @@ export declare function transformDate<T extends {
176
176
  export declare function capitalizeFirstWord(str: string): string;
177
177
  export declare function getEntitiesFromSearchV2Response<E extends EntityEnum, // Enum key like EntityEnum.USER, EntityEnum.PROJECT, etc.
178
178
  T extends EnumEntityType<E>>(searchResponseV2: IBaseEntityServiceResponse<EnumEntityType<EntityEnum>>, entityEnumKey: E, EntityClass: new () => T): T[];
179
- /**
180
- * Recursively searches for entities of a specific type within a nested `relatedEntities` structure.
181
- *
182
- * This function traverses the `relatedEntities` tree, looking for a target entity key.
183
- * When found, it collects all `baseEntities` for that key and instantiates them
184
- * as instances of the provided `EntityClass`. The function continues to traverse
185
- * all nested `relatedEntities` recursively, accumulating all matches.
186
- *
187
- * @template E - The enum type representing the target entity key (`EntityEnum`).
188
- * @template T - The corresponding entity type for the target key (`EnumEntityType<E>`).
189
- *
190
- * @param relatedEntities - The nested `relatedEntities` structure, typically from a
191
- * `IBaseEntityServiceResponse`. Can be undefined, in which case an empty array is returned.
192
- * @param targetKey - The entity key (`EntityEnum`) to search for in the nested structure.
193
- * @param EntityClass - A constructor function for the entity type `T`. Used to
194
- * instantiate new objects from the raw base entity data.
195
- *
196
- * @returns An array of entities of type `T` found at any level of the nested structure.
197
- * If no entities are found, an empty array is returned.
198
- *
199
- * @example
200
- * ```ts
201
- * const billingEntities = findEntitiesAtAnyLevel(
202
- * projectUserMappingsOfCurrentUser.relatedEntities,
203
- * EntityEnum.BILLING,
204
- * BillingEntity
205
- * );
206
- *
207
- * console.log(billingEntities); // [BillingEntity {...}, BillingEntity {...}]
208
- * ```
209
- *
210
- * @note
211
- * - This function preserves the type of entities by mapping the raw objects to the provided `EntityClass`.
212
- * - It can handle deeply nested `relatedEntities` structures.
213
- */
214
- export declare function findEntitiesFromSearchV2RelatedEntities<E extends EntityEnum, T extends EnumEntityType<E>>(relatedEntities: IEntityServiceResponse | undefined, targetKey: EntityEnum, EntityClass: new () => T): T[];
215
179
  /**
216
180
  * Checks if two decimal numbers are approximately equal within a given tolerance.
217
181
  *
@@ -33,7 +33,6 @@ exports.createKeyLabelMap = createKeyLabelMap;
33
33
  exports.transformDate = transformDate;
34
34
  exports.capitalizeFirstWord = capitalizeFirstWord;
35
35
  exports.getEntitiesFromSearchV2Response = getEntitiesFromSearchV2Response;
36
- exports.findEntitiesFromSearchV2RelatedEntities = findEntitiesFromSearchV2RelatedEntities;
37
36
  exports.areDecimalNumbersEqual = areDecimalNumbersEqual;
38
37
  exports.formatIndianNumber = formatIndianNumber;
39
38
  exports.findDuplicateIds = findDuplicateIds;
@@ -400,58 +399,6 @@ function getEntitiesFromSearchV2Response(searchResponseV2, entityEnumKey, Entity
400
399
  }
401
400
  return (((_a = searchResponseV2.relatedEntities[entityEnumKey]) === null || _a === void 0 ? void 0 : _a.baseEntities) || []).map((entity) => Object.assign(new EntityClass(), entity));
402
401
  }
403
- /**
404
- * Recursively searches for entities of a specific type within a nested `relatedEntities` structure.
405
- *
406
- * This function traverses the `relatedEntities` tree, looking for a target entity key.
407
- * When found, it collects all `baseEntities` for that key and instantiates them
408
- * as instances of the provided `EntityClass`. The function continues to traverse
409
- * all nested `relatedEntities` recursively, accumulating all matches.
410
- *
411
- * @template E - The enum type representing the target entity key (`EntityEnum`).
412
- * @template T - The corresponding entity type for the target key (`EnumEntityType<E>`).
413
- *
414
- * @param relatedEntities - The nested `relatedEntities` structure, typically from a
415
- * `IBaseEntityServiceResponse`. Can be undefined, in which case an empty array is returned.
416
- * @param targetKey - The entity key (`EntityEnum`) to search for in the nested structure.
417
- * @param EntityClass - A constructor function for the entity type `T`. Used to
418
- * instantiate new objects from the raw base entity data.
419
- *
420
- * @returns An array of entities of type `T` found at any level of the nested structure.
421
- * If no entities are found, an empty array is returned.
422
- *
423
- * @example
424
- * ```ts
425
- * const billingEntities = findEntitiesAtAnyLevel(
426
- * projectUserMappingsOfCurrentUser.relatedEntities,
427
- * EntityEnum.BILLING,
428
- * BillingEntity
429
- * );
430
- *
431
- * console.log(billingEntities); // [BillingEntity {...}, BillingEntity {...}]
432
- * ```
433
- *
434
- * @note
435
- * - This function preserves the type of entities by mapping the raw objects to the provided `EntityClass`.
436
- * - It can handle deeply nested `relatedEntities` structures.
437
- */
438
- function findEntitiesFromSearchV2RelatedEntities(relatedEntities, targetKey, EntityClass) {
439
- if (!relatedEntities)
440
- return [];
441
- let result = [];
442
- for (const key of Object.keys(relatedEntities)) {
443
- const value = relatedEntities[key];
444
- // If this key is the target and has baseEntities
445
- if (key === targetKey && (value === null || value === void 0 ? void 0 : value.baseEntities)) {
446
- result.push(...value.baseEntities.map((entity) => Object.assign(new EntityClass(), entity)));
447
- }
448
- // If value has relatedEntities, recurse
449
- if (value === null || value === void 0 ? void 0 : value.relatedEntities) {
450
- result.push(...findEntitiesFromSearchV2RelatedEntities(value.relatedEntities, targetKey, EntityClass));
451
- }
452
- }
453
- return result;
454
- }
455
402
  /**
456
403
  * Checks if two decimal numbers are approximately equal within a given tolerance.
457
404
  *
@@ -1,5 +1,3 @@
1
1
  export * from "./date.util";
2
2
  export * from "./helper.fn.util";
3
3
  export * from "./models/date-code.model.util";
4
- export * from "./string.util";
5
- export * from "./entity.flow.util";
@@ -17,5 +17,3 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./date.util"), exports);
18
18
  __exportStar(require("./helper.fn.util"), exports);
19
19
  __exportStar(require("./models/date-code.model.util"), exports);
20
- __exportStar(require("./string.util"), exports);
21
- __exportStar(require("./entity.flow.util"), exports);
@@ -1 +0,0 @@
1
- export declare function formatString(input: string): string;
@@ -1,15 +1 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formatString = formatString;
4
- function formatString(input) {
5
- if (input.includes('_')) {
6
- return input
7
- .split('_')
8
- .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
9
- .join(' ');
10
- }
11
- else {
12
- // For single-word strings, capitalize the first letter
13
- return input.charAt(0).toUpperCase() + input.slice(1).toLowerCase();
14
- }
15
- }
package/package.json CHANGED
@@ -1,35 +1,35 @@
1
- {
2
- "name": "law-common",
3
- "version": "10.19.1-beta.9",
4
- "description": "",
5
- "main": "dist/index.js",
6
- "files": [
7
- "dist/**/*"
8
- ],
9
- "scripts": {
10
- "clean": "rm -rf dist",
11
- "build": "npm run clean && tsc",
12
- "publish:beta": "npm version prerelease --preid beta && git push && npm run build && npm publish --tag beta",
13
- "publish:patch": "npm version patch && git push && npm run build && npm publish",
14
- "publish:minor": "npm version minor && git push && npm run build && npm publish",
15
- "publish:major": "npm version major && git push && npm run build && npm publish",
16
- "link": "npm run build && npm link",
17
- "test": "jest"
18
- },
19
- "keywords": [],
20
- "author": "",
21
- "license": "ISC",
22
- "devDependencies": {
23
- "@types/jest": "^29.5.13",
24
- "@types/node": "^22.6.1",
25
- "jest": "^29.7.0",
26
- "ts-jest": "^29.2.5",
27
- "ts-node": "^10.9.2",
28
- "typescript": "^5.6.2"
29
- },
30
- "dependencies": {
31
- "@types/express": "^5.0.0",
32
- "@types/multer": "^1.4.12",
33
- "date-fns": "^4.1.0"
34
- }
35
- }
1
+ {
2
+ "name": "law-common",
3
+ "version": "10.21.0",
4
+ "description": "",
5
+ "main": "dist/index.js",
6
+ "files": [
7
+ "dist/**/*"
8
+ ],
9
+ "scripts": {
10
+ "clean": "rm -rf dist",
11
+ "build": "npm run clean && tsc",
12
+ "publish:beta": "npm version prerelease --preid beta && git push && npm run build && npm publish --tag beta",
13
+ "publish:patch": "npm version patch && git push && npm run build && npm publish",
14
+ "publish:minor": "npm version minor && git push && npm run build && npm publish",
15
+ "publish:major": "npm version major && git push && npm run build && npm publish",
16
+ "link": "npm run build && npm link",
17
+ "test": "jest"
18
+ },
19
+ "keywords": [],
20
+ "author": "",
21
+ "license": "ISC",
22
+ "devDependencies": {
23
+ "@types/jest": "^29.5.13",
24
+ "@types/node": "^22.6.1",
25
+ "jest": "^29.7.0",
26
+ "ts-jest": "^29.2.5",
27
+ "ts-node": "^10.9.2",
28
+ "typescript": "^5.6.2"
29
+ },
30
+ "dependencies": {
31
+ "@types/express": "^5.0.0",
32
+ "@types/multer": "^1.4.12",
33
+ "date-fns": "^4.1.0"
34
+ }
35
+ }
@@ -1,3 +0,0 @@
1
- import { IApiEntity, IBillingTransactionHistoryEntity } from "../../entities";
2
- export type IBillingTransactionHistoryApiEntity = IApiEntity<IBillingTransactionHistoryEntity>;
3
- export type IBillingTransactionHistoryApiEntityArray = IBillingTransactionHistoryApiEntity[];
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,11 +0,0 @@
1
- export declare enum BillingTransactionActionEnum {
2
- UPDATE_PAYMENT = "updatePayment",
3
- WRITE_OFF = "writeOff",
4
- CREDIT_NOTE = "creditNote",
5
- TDS = "tds",
6
- WRITE_OFF_APPROVAL = "writeOffApproval",
7
- CREDIT_NOTE_APPROVAL = "creditNoteApproval",
8
- APPROVE = "approve",
9
- REJECT = "reject",
10
- EDIT = "edit"
11
- }
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BillingTransactionActionEnum = void 0;
4
- var BillingTransactionActionEnum;
5
- (function (BillingTransactionActionEnum) {
6
- BillingTransactionActionEnum["UPDATE_PAYMENT"] = "updatePayment";
7
- BillingTransactionActionEnum["WRITE_OFF"] = "writeOff";
8
- BillingTransactionActionEnum["CREDIT_NOTE"] = "creditNote";
9
- BillingTransactionActionEnum["TDS"] = "tds";
10
- BillingTransactionActionEnum["WRITE_OFF_APPROVAL"] = "writeOffApproval";
11
- BillingTransactionActionEnum["CREDIT_NOTE_APPROVAL"] = "creditNoteApproval";
12
- BillingTransactionActionEnum["APPROVE"] = "approve";
13
- BillingTransactionActionEnum["REJECT"] = "reject";
14
- BillingTransactionActionEnum["EDIT"] = "edit";
15
- })(BillingTransactionActionEnum || (exports.BillingTransactionActionEnum = BillingTransactionActionEnum = {}));
@@ -1,6 +0,0 @@
1
- export declare enum BillingTransactionStatusEnum {
2
- APPROVED = "approved",
3
- REJECTED = "rejected",
4
- WRITEOFF_APPROVAL_PENDING = "writeoff_approval_pending",
5
- CREDITNOTE_APPROVAL_PENDING = "creditnote_approval_pending"
6
- }
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BillingTransactionStatusEnum = void 0;
4
- var BillingTransactionStatusEnum;
5
- (function (BillingTransactionStatusEnum) {
6
- BillingTransactionStatusEnum["APPROVED"] = "approved";
7
- BillingTransactionStatusEnum["REJECTED"] = "rejected";
8
- BillingTransactionStatusEnum["WRITEOFF_APPROVAL_PENDING"] = "writeoff_approval_pending";
9
- BillingTransactionStatusEnum["CREDITNOTE_APPROVAL_PENDING"] = "creditnote_approval_pending";
10
- })(BillingTransactionStatusEnum || (exports.BillingTransactionStatusEnum = BillingTransactionStatusEnum = {}));
@@ -1,7 +0,0 @@
1
- import { IBaseHistoryEntity, IEntityCreateDto, IEntityFilterData } from "./entity.utils.interface";
2
- export interface IBillingTransactionHistoryEntity extends IBaseHistoryEntity {
3
- }
4
- export interface IBillingTransactionHistoryCreateDto extends IEntityCreateDto<IBillingTransactionHistoryEntity> {
5
- }
6
- export interface IBillingTransactionHistorySearchDto extends IEntityFilterData<IBillingTransactionHistoryEntity> {
7
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,24 +0,0 @@
1
- import { IBillingTransactionApiEntity } from "../../api";
2
- import { BillingTransactionStatusEnum } from "../enums/billing-transaction-status.enum";
3
- import { BillingTransactionType } from "../enums/billing.transaction.enum";
4
- import { EntityEnum } from "../interface/entity.utils.interface";
5
- import { BaseEntityModel } from "./base.entity.model";
6
- export declare class BillingTransactionEntityModel extends BaseEntityModel<EntityEnum.BILLING_TRANSACTION> implements IBillingTransactionApiEntity {
7
- id: number;
8
- billingId: number;
9
- type: BillingTransactionType;
10
- amount: number;
11
- details: string;
12
- bankCharges?: number;
13
- bankId?: number;
14
- paymentDate?: string;
15
- referenceNo?: string;
16
- supportingDocsUrls?: string;
17
- status: BillingTransactionStatusEnum;
18
- createdOn: string;
19
- updatedOn: string;
20
- createdBy: number;
21
- updatedBy: number;
22
- getRelationConfigs(): any;
23
- static fromApiEntity(apiEntity: IBillingTransactionApiEntity): BillingTransactionEntityModel;
24
- }
@@ -1,56 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BillingTransactionEntityModel = void 0;
4
- const billing_transaction_status_enum_1 = require("../enums/billing-transaction-status.enum");
5
- const billing_transaction_enum_1 = require("../enums/billing.transaction.enum");
6
- const entity_utils_interface_1 = require("../interface/entity.utils.interface");
7
- const base_entity_model_1 = require("./base.entity.model");
8
- class BillingTransactionEntityModel extends base_entity_model_1.BaseEntityModel {
9
- constructor() {
10
- super(...arguments);
11
- this.id = 0;
12
- this.billingId = 0;
13
- this.type = billing_transaction_enum_1.BillingTransactionType.PAYMENT;
14
- this.amount = 0;
15
- this.details = "";
16
- this.status = billing_transaction_status_enum_1.BillingTransactionStatusEnum.APPROVED;
17
- this.createdOn = "";
18
- this.updatedOn = "";
19
- this.createdBy = 0;
20
- this.updatedBy = 0;
21
- }
22
- // billing?: BillingEntityModel;
23
- // bank?: BankEntityModel;
24
- getRelationConfigs() {
25
- return this.constructor.prototype.constructor.relationConfigs;
26
- }
27
- // static relationConfigs: RelationConfigs<
28
- // [EntityEnum.BILLING, EntityEnum.BANK],
29
- // EnumEntityType<EntityEnum.BILLING_TRANSACTION>
30
- // > = [
31
- // {
32
- // name: EntityEnum.BILLING,
33
- // relation: RelationType.ONE,
34
- // key: "billing",
35
- // mapKeyConfig: {
36
- // relationKey: "id", // billing.id
37
- // key: "billingId", // billingTransaction.billingId
38
- // },
39
- // },
40
- // {
41
- // name: EntityEnum.BANK,
42
- // relation: RelationType.ONE,
43
- // key: "bank",
44
- // mapKeyConfig: {
45
- // relationKey: "id", // bank.id
46
- // key: "bankId", // billingTransaction.bankId
47
- // },
48
- // },
49
- // ];
50
- static fromApiEntity(apiEntity) {
51
- const entity = new BillingTransactionEntityModel(entity_utils_interface_1.EntityEnum.BILLING_TRANSACTION);
52
- Object.assign(entity, apiEntity);
53
- return entity;
54
- }
55
- }
56
- exports.BillingTransactionEntityModel = BillingTransactionEntityModel;