law-common 10.13.1-beta.4 → 10.14.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.
@@ -11,4 +11,3 @@ export declare const usersToExcludeFromSearchResponse: string[];
11
11
  export declare const systemUsers: string[];
12
12
  export declare const reimbursementExpenseProjectUserInactiveBuffer: number;
13
13
  export declare const annualPaidLeaves = 24;
14
- export declare const noOfDaysInMonth = 30;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.noOfDaysInMonth = exports.annualPaidLeaves = exports.reimbursementExpenseProjectUserInactiveBuffer = exports.systemUsers = exports.usersToExcludeFromSearchResponse = exports.freezeTimesheetAfterBillingStatus = exports.leaveImplicitDays = exports.reimbursementPaymentProcessorPermissionName = exports.toDoListMinimumEstimatedDuration = exports.timesheetMinimumTotalDuration = exports.timesheetEnterThreshold = exports.timesheetThreshold = exports.timesheetViewThreshold = void 0;
3
+ exports.annualPaidLeaves = exports.reimbursementExpenseProjectUserInactiveBuffer = exports.systemUsers = exports.usersToExcludeFromSearchResponse = exports.freezeTimesheetAfterBillingStatus = exports.leaveImplicitDays = exports.reimbursementPaymentProcessorPermissionName = exports.toDoListMinimumEstimatedDuration = exports.timesheetMinimumTotalDuration = exports.timesheetEnterThreshold = exports.timesheetThreshold = exports.timesheetViewThreshold = void 0;
4
4
  const entities_1 = require("../entities");
5
5
  exports.timesheetViewThreshold = "timesheetViewThreshold";
6
6
  exports.timesheetThreshold = "timesheetThreshold";
@@ -14,4 +14,3 @@ exports.usersToExcludeFromSearchResponse = ["DB migration"];
14
14
  exports.systemUsers = ["DB migration"];
15
15
  exports.reimbursementExpenseProjectUserInactiveBuffer = 24 * 60;
16
16
  exports.annualPaidLeaves = 24;
17
- exports.noOfDaysInMonth = 30;
@@ -24,7 +24,6 @@ export interface IBillingEntity extends IAuditColumnEntity {
24
24
  invoicePdfUrl?: string | null;
25
25
  invoiceContactName: string;
26
26
  bankId: number;
27
- conversionRate?: number;
28
27
  }
29
28
  export interface IBillingEntityFilterDto extends IEntityFilterData<IBillingEntity> {
30
29
  }
@@ -36,19 +36,17 @@ export interface IProjectHourlyRate {
36
36
  rate: number;
37
37
  unit: TimeUnitEnum.HOUR;
38
38
  }
39
- export interface IProjectFixedTypeRate {
39
+ export interface IProjectFixedMonthlyRate {
40
40
  rate: number;
41
- unit: TimeUnitEnum;
41
+ unit: TimeUnitEnum.MONTH;
42
42
  maxEstimatedHours: number;
43
- extraHoursRate: number;
44
43
  }
45
44
  export interface IProjectAdhocRate {
46
45
  rate: number;
47
46
  maxEstimatedHours: number;
48
- extraHoursRate: number;
49
47
  }
50
48
  export interface IProjectCreateDtoExtra {
51
- projectBillingRate: IProjectHourlyRate[] | IProjectFixedTypeRate | IProjectAdhocRate;
49
+ projectBillingRate: IProjectHourlyRate[] | IProjectFixedMonthlyRate | IProjectAdhocRate;
52
50
  }
53
51
  export interface IProjectEntityCreateDto extends Omit<IEntityCreateDto<IProjectEntity>, IProjectExclude>, IProjectEntityDependent, IProjectCreateDtoExtra {
54
52
  }
@@ -5,7 +5,6 @@ export declare enum TimeUnitEnum {
5
5
  DAY = "DAY",
6
6
  WEEK = "WEEK",
7
7
  MONTH = "MONTH",
8
- QUARTER = "QUARTER",
9
8
  YEAR = "YEAR"
10
9
  }
11
10
  export declare namespace TimeUnitEnum {
@@ -11,7 +11,6 @@ var TimeUnitEnum;
11
11
  TimeUnitEnum["DAY"] = "DAY";
12
12
  TimeUnitEnum["WEEK"] = "WEEK";
13
13
  TimeUnitEnum["MONTH"] = "MONTH";
14
- TimeUnitEnum["QUARTER"] = "QUARTER";
15
14
  TimeUnitEnum["YEAR"] = "YEAR";
16
15
  })(TimeUnitEnum || (exports.TimeUnitEnum = TimeUnitEnum = {}));
17
16
  (function (TimeUnitEnum) {
@@ -29,8 +28,6 @@ var TimeUnitEnum;
29
28
  return 60 * 24 * 7;
30
29
  case TimeUnitEnum.MONTH:
31
30
  return 60 * 24 * 30;
32
- case TimeUnitEnum.QUARTER:
33
- return 60 * 24 * 30 * 3;
34
31
  case TimeUnitEnum.YEAR:
35
32
  return 60 * 24 * 365;
36
33
  }
@@ -58,16 +55,15 @@ var TimeUnitEnum;
58
55
  return TimeUnitEnum.YEAR;
59
56
  default:
60
57
  throw new exceptions_1.AppBadRequestException({
61
- message: [
62
- `Invalid time unit: ${value}. Valid values are: ${TimeUnitEnum.getNames().join(", ")}`,
63
- ],
58
+ message: [`Invalid time unit: ${value}. Valid values are: ${TimeUnitEnum.getNames().join(", ")}`],
64
59
  key: error_key_enum_1.ErrorKeyEnum.TIME_UNIT,
65
60
  });
66
61
  }
67
62
  }
68
63
  TimeUnitEnum.parse = parse;
69
64
  function getNames() {
70
- return Object.values(TimeUnitEnum).filter((value) => typeof value === "string");
65
+ return Object.values(TimeUnitEnum).filter(value => typeof value === 'string');
66
+ ;
71
67
  }
72
68
  TimeUnitEnum.getNames = getNames;
73
69
  })(TimeUnitEnum || (exports.TimeUnitEnum = TimeUnitEnum = {}));
@@ -173,19 +173,3 @@ export declare function transformDate<T extends {
173
173
  }>(obj: T): Modify<T, {
174
174
  date: string;
175
175
  }>;
176
- /**
177
- * Checks if two decimal numbers are approximately equal within a given tolerance.
178
- *
179
- * @param {number} firstValue - The first number to compare.
180
- * @param {number} secondValue - The second number to compare.
181
- * @param {number} allowedDifference - The maximum difference allowed for the numbers
182
- * to be considered equal.
183
- *
184
- * @returns {boolean} Returns `true` if the numbers are within the allowed difference;
185
- * otherwise, returns `false`.
186
- *
187
- * @example
188
- * areDecimalNumbersEqual(5483.86, 5483.87, 0.5); // true
189
- * areDecimalNumbersEqual(5483.86, 5484.5, 0.5); // false
190
- */
191
- export declare function areDecimalNumbersEqual(firstValue: number, secondValue: number, allowedDifference?: number): boolean;
@@ -31,7 +31,6 @@ exports.numberToWordsIndian = numberToWordsIndian;
31
31
  exports.minutesToHoursMinutes = minutesToHoursMinutes;
32
32
  exports.createKeyLabelMap = createKeyLabelMap;
33
33
  exports.transformDate = transformDate;
34
- exports.areDecimalNumbersEqual = areDecimalNumbersEqual;
35
34
  const util_constants_1 = require("../constants/util.constants");
36
35
  function groupByFunction(list, keyGetter) {
37
36
  const map = new Map();
@@ -375,24 +374,3 @@ function createKeyLabelMap() {
375
374
  function transformDate(obj) {
376
375
  return Object.assign(Object.assign({}, obj), { date: obj.date.toISOString() });
377
376
  }
378
- /**
379
- * Checks if two decimal numbers are approximately equal within a given tolerance.
380
- *
381
- * @param {number} firstValue - The first number to compare.
382
- * @param {number} secondValue - The second number to compare.
383
- * @param {number} allowedDifference - The maximum difference allowed for the numbers
384
- * to be considered equal.
385
- *
386
- * @returns {boolean} Returns `true` if the numbers are within the allowed difference;
387
- * otherwise, returns `false`.
388
- *
389
- * @example
390
- * areDecimalNumbersEqual(5483.86, 5483.87, 0.5); // true
391
- * areDecimalNumbersEqual(5483.86, 5484.5, 0.5); // false
392
- */
393
- function areDecimalNumbersEqual(firstValue, secondValue, allowedDifference = 0.5) {
394
- // Calculate the absolute difference between both values
395
- const actualDifference = Math.abs(firstValue - secondValue);
396
- // Return true if the actual difference is less than or equal to the allowed difference
397
- return actualDifference <= allowedDifference;
398
- }
@@ -34,5 +34,4 @@ export declare class DateCodeModel {
34
34
  isSame(dateCodeModel: DateCodeModel): boolean;
35
35
  getWeekday(): Weekday;
36
36
  getDateInIST(): Date;
37
- static getDaysInCurrentMonth(): number;
38
37
  }
@@ -98,8 +98,8 @@ class DateCodeModel {
98
98
  }
99
99
  const dateRange = startModel.getRange(endModel);
100
100
  const excludeDayPredicates = (dateModel) => !dateModel.isDayPresent(excludeDays);
101
- const excludeDatePredicates = (dateModel) => !excludeDateCodes.some((d) => d.isSame(dateModel));
102
- return dateRange.filter((dateModel) => excludeDayPredicates(dateModel) && excludeDatePredicates(dateModel)).length;
101
+ const excludeDatePredicates = (dateModel) => !excludeDateCodes.some(d => d.isSame(dateModel));
102
+ return dateRange.filter((dateModel => excludeDayPredicates(dateModel) && excludeDatePredicates(dateModel))).length;
103
103
  }
104
104
  static getByPredicates(models, includePredicates, excludePredicates) {
105
105
  return models.filter((model) => includePredicates.every((predicate) => predicate(model)) &&
@@ -209,10 +209,5 @@ class DateCodeModel {
209
209
  billDateIST.setHours(nowIST.getHours(), nowIST.getMinutes(), nowIST.getSeconds(), nowIST.getMilliseconds());
210
210
  return billDateIST;
211
211
  }
212
- static getDaysInCurrentMonth() {
213
- const today = new Date();
214
- const lastDay = (0, date_fns_1.lastDayOfMonth)(today); // Gives last day of current month
215
- return lastDay.getDate(); // Number of days in that month
216
- }
217
212
  }
218
213
  exports.DateCodeModel = DateCodeModel;
package/package.json CHANGED
@@ -1,35 +1,35 @@
1
- {
2
- "name": "law-common",
3
- "version": "10.13.1-beta.4",
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.14.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
+ }