law-common 10.26.0 → 10.26.1-beta.1
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/dist/src/api/index.d.ts +0 -1
- package/dist/src/api/index.js +0 -1
- package/dist/src/api/interface/billing.entity.response.d.ts +1 -2
- package/dist/src/api/interface/billing.transaction.entity.response.d.ts +2 -3
- package/dist/src/entities/interface/billing.entity.interface.d.ts +2 -2
- package/dist/src/entities/model/billing.entity.model.d.ts +6 -5
- package/dist/src/entities/model/billing.entity.model.js +6 -6
- package/dist/src/entities/model/entity.model.interface.js +1 -1
- package/dist/src/utils/helper.fn.util.d.ts +31 -0
- package/dist/src/utils/helper.fn.util.js +34 -0
- package/package.json +35 -35
- package/dist/src/api/interface/billing.entity.api.d.ts +0 -3
- package/dist/src/api/interface/billing.entity.api.js +0 -2
package/dist/src/api/index.d.ts
CHANGED
|
@@ -20,7 +20,6 @@ export * from "./interface/billing.entity.response";
|
|
|
20
20
|
export * from "./interface/office.location.create.dto.interface";
|
|
21
21
|
export * from "./interface/office.Location.update.dto.interface";
|
|
22
22
|
export * from "./interface/office.location.entity.response";
|
|
23
|
-
export * from "./interface/billing.entity.api";
|
|
24
23
|
export * from "./interface/billing.update.dto.interface";
|
|
25
24
|
export * from "./interface/bank.create.dto.interface";
|
|
26
25
|
export * from "./interface/bank.update.dto.interface";
|
package/dist/src/api/index.js
CHANGED
|
@@ -36,7 +36,6 @@ __exportStar(require("./interface/billing.entity.response"), exports);
|
|
|
36
36
|
__exportStar(require("./interface/office.location.create.dto.interface"), exports);
|
|
37
37
|
__exportStar(require("./interface/office.Location.update.dto.interface"), exports);
|
|
38
38
|
__exportStar(require("./interface/office.location.entity.response"), exports);
|
|
39
|
-
__exportStar(require("./interface/billing.entity.api"), exports);
|
|
40
39
|
__exportStar(require("./interface/billing.update.dto.interface"), exports);
|
|
41
40
|
__exportStar(require("./interface/bank.create.dto.interface"), exports);
|
|
42
41
|
__exportStar(require("./interface/bank.update.dto.interface"), exports);
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { BillingActionsEnum, BillingStatusEnum, IBillingEntity, IBillingTimesheetEntity, IProjectEntity, IUserEntity } from "../../entities";
|
|
2
2
|
import { IBillingReimbursementExpenseApiEntity } from "./billing-reimbursement-expense.api";
|
|
3
|
-
import { IBillingApiEntity } from "./billing.entity.api";
|
|
4
3
|
import { IUpdateBillingDto } from "./billing.update.dto.interface";
|
|
5
4
|
export type IBillingEntityResponse = {
|
|
6
|
-
billing:
|
|
5
|
+
billing: IBillingEntity;
|
|
7
6
|
billingTimesheets?: IBillingTimesheetEntity[];
|
|
8
7
|
billingReimbursementExpenses?: IBillingReimbursementExpenseApiEntity[];
|
|
9
8
|
};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { IApiEntity, IBillingTransactionEntity } from "../../entities";
|
|
2
|
-
import { IBillingApiEntity } from "./billing.entity.api";
|
|
1
|
+
import { IApiEntity, IBillingEntity, IBillingTransactionEntity } from "../../entities";
|
|
3
2
|
export type IBillingTransactionApiEntity = IApiEntity<IBillingTransactionEntity>;
|
|
4
3
|
export type IBillingTransactionApiEntityArray = IBillingTransactionApiEntity[];
|
|
5
4
|
export type IBillingTransactionEntityGet = {
|
|
6
5
|
billingTransaction: IBillingTransactionApiEntity;
|
|
7
|
-
billing:
|
|
6
|
+
billing: IBillingEntity;
|
|
8
7
|
};
|
|
@@ -3,9 +3,9 @@ import { BillingTypeEnum } from "../enums/billing-type.enum";
|
|
|
3
3
|
import { BillingStatusEnum } from "../enums/billing.status.enum";
|
|
4
4
|
import { BillingInvoiceTypeEnum } from "../enums/billing_invoice_type.enum";
|
|
5
5
|
import { PaymentStatusEnum } from "../enums/payment_status.enum";
|
|
6
|
-
import {
|
|
6
|
+
import { IEntityAuditColumn } from "./entity-audit-columns.interface";
|
|
7
7
|
import { EntityEnum, IEntityFilterData } from "./entity.utils.interface";
|
|
8
|
-
export interface IBillingEntity extends
|
|
8
|
+
export interface IBillingEntity extends IEntityAuditColumn {
|
|
9
9
|
id: number;
|
|
10
10
|
startDate: string;
|
|
11
11
|
endDate: string;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IBillingFlowConfig } from "../../api";
|
|
2
2
|
import { CurrencyEnum } from "../../enums";
|
|
3
3
|
import { BillingTypeEnum } from "../enums/billing-type.enum";
|
|
4
4
|
import { BillingActionsEnum } from "../enums/billing.action.enum";
|
|
5
5
|
import { BillingStatusEnum } from "../enums/billing.status.enum";
|
|
6
6
|
import { BillingInvoiceTypeEnum } from "../enums/billing_invoice_type.enum";
|
|
7
7
|
import { PaymentStatusEnum } from "../enums/payment_status.enum";
|
|
8
|
+
import { IBillingEntity } from "../interface/billing.entity.interface";
|
|
8
9
|
import { EntityEnum, EnumEntityType } from "../interface/entity.utils.interface";
|
|
9
10
|
import { RelationConfigs } from "../interface/relation-config.interface";
|
|
10
11
|
import { BankEntityModel } from "./bank.entity.model";
|
|
@@ -24,7 +25,7 @@ export declare enum BillingStatusCategoryEnumForUI {
|
|
|
24
25
|
CLIENT_REVIEW_STATUS = "CLIENT_REVIEW_STATUS",
|
|
25
26
|
PAYMENT_STATUS = "PAYMENT_STATUS"
|
|
26
27
|
}
|
|
27
|
-
export declare class BillingEntityModel extends BaseEntityModel<EntityEnum.BILLING> implements
|
|
28
|
+
export declare class BillingEntityModel extends BaseEntityModel<EntityEnum.BILLING> implements IBillingEntity {
|
|
28
29
|
id: number;
|
|
29
30
|
startDate: string;
|
|
30
31
|
endDate: string;
|
|
@@ -48,8 +49,8 @@ export declare class BillingEntityModel extends BaseEntityModel<EntityEnum.BILLI
|
|
|
48
49
|
currency: CurrencyEnum;
|
|
49
50
|
createdBy: number;
|
|
50
51
|
updatedBy: number;
|
|
51
|
-
createdOn:
|
|
52
|
-
updatedOn:
|
|
52
|
+
createdOn: number;
|
|
53
|
+
updatedOn: number;
|
|
53
54
|
type: BillingTypeEnum;
|
|
54
55
|
project?: ProjectEntityModel;
|
|
55
56
|
client?: ClientEntityModel;
|
|
@@ -68,7 +69,7 @@ export declare class BillingEntityModel extends BaseEntityModel<EntityEnum.BILLI
|
|
|
68
69
|
EntityEnum.BILLING_TIMESHEET,
|
|
69
70
|
EntityEnum.BANK
|
|
70
71
|
], EnumEntityType<EntityEnum.BILLING>>;
|
|
71
|
-
static
|
|
72
|
+
static fromEntity(entity: IBillingEntity): BillingEntityModel;
|
|
72
73
|
getStatusCategory(): BillingStatusCategoryEnumForUI;
|
|
73
74
|
getStatusLabel(): string;
|
|
74
75
|
getTotalAmountInINR(): number;
|
|
@@ -39,14 +39,14 @@ class BillingEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
39
39
|
this.currency = enums_1.CurrencyEnum.INR;
|
|
40
40
|
this.createdBy = 0;
|
|
41
41
|
this.updatedBy = 0;
|
|
42
|
-
this.createdOn =
|
|
43
|
-
this.updatedOn =
|
|
42
|
+
this.createdOn = 0;
|
|
43
|
+
this.updatedOn = 0;
|
|
44
44
|
this.type = billing_type_enum_1.BillingTypeEnum.INVOICE;
|
|
45
45
|
}
|
|
46
|
-
static
|
|
47
|
-
const
|
|
48
|
-
Object.assign(
|
|
49
|
-
return
|
|
46
|
+
static fromEntity(entity) {
|
|
47
|
+
const result = new BillingEntityModel(entity_utils_interface_1.EntityEnum.BILLING);
|
|
48
|
+
Object.assign(result, entity);
|
|
49
|
+
return result;
|
|
50
50
|
}
|
|
51
51
|
getStatusCategory() {
|
|
52
52
|
return this.mapStatusCategory(this.status);
|
|
@@ -52,7 +52,7 @@ function parseEntities(json, baseEntity, entityMap) {
|
|
|
52
52
|
const entityFromJsonMappings = {
|
|
53
53
|
[entity_utils_interface_1.EntityEnum.PROJECT]: project_entity_model_1.ProjectEntityModel.fromEntity,
|
|
54
54
|
[entity_utils_interface_1.EntityEnum.CLIENT]: client_entity_model_1.ClientEntityModel.fromEntity,
|
|
55
|
-
[entity_utils_interface_1.EntityEnum.BILLING]: billing_entity_model_1.BillingEntityModel.
|
|
55
|
+
[entity_utils_interface_1.EntityEnum.BILLING]: billing_entity_model_1.BillingEntityModel.fromEntity,
|
|
56
56
|
[entity_utils_interface_1.EntityEnum.USER]: user_entity_model_1.UserEntityModel.fromEntity,
|
|
57
57
|
[entity_utils_interface_1.EntityEnum.PROJECT_USER_MAPPING]: project_user_mapping_entity_model_1.ProjectUserMappingEntityModel.fromEntity,
|
|
58
58
|
[entity_utils_interface_1.EntityEnum.REIMBURSEMENT]: reimbursement_entity_model_1.ReimbursementEntityModel.fromApiEntity,
|
|
@@ -269,5 +269,36 @@ export declare function hasProperty<T extends object>(obj: T | null | undefined,
|
|
|
269
269
|
* convertToNumberType("abc"); // throws Error("Invalid number: abc")
|
|
270
270
|
*/
|
|
271
271
|
export declare function convertToNumberType<T extends string | number>(value: T): number;
|
|
272
|
+
/**
|
|
273
|
+
* Converts an epoch timestamp (in seconds) into a formatted date-time string.
|
|
274
|
+
*
|
|
275
|
+
* @param {number} epoch - The epoch timestamp in seconds (number of seconds since 1970-01-01 00:00:00 UTC).
|
|
276
|
+
*
|
|
277
|
+
* @returns {string} The formatted date-time string in "yyyy-MM-dd HH:mm:ss" format.
|
|
278
|
+
*
|
|
279
|
+
* @example
|
|
280
|
+
* epochToDateTime(1759211965);
|
|
281
|
+
* // Returns: "2025-09-30 11:19:25"
|
|
282
|
+
*
|
|
283
|
+
* @example
|
|
284
|
+
* epochToDateTime(0);
|
|
285
|
+
* // Returns: "1970-01-01 05:30:00" // if your system timezone is IST (UTC+5:30)
|
|
286
|
+
*/
|
|
272
287
|
export declare function epochToDateTime(epoch: number): string;
|
|
288
|
+
/**
|
|
289
|
+
* Converts a JavaScript Date object into epoch seconds (UNIX timestamp).
|
|
290
|
+
*
|
|
291
|
+
* @param {Date} date - A JavaScript Date instance.
|
|
292
|
+
*
|
|
293
|
+
* @returns {number} The corresponding epoch time in seconds (number of seconds since 1970-01-01 00:00:00 UTC).
|
|
294
|
+
*
|
|
295
|
+
* @example
|
|
296
|
+
* toEpochSeconds(new Date("2025-09-30 11:19:25"));
|
|
297
|
+
* // Returns: 1759211965
|
|
298
|
+
*
|
|
299
|
+
* @example
|
|
300
|
+
* toEpochSeconds(new Date());
|
|
301
|
+
* // Returns: current epoch time in seconds
|
|
302
|
+
*/
|
|
303
|
+
export declare function toEpochSeconds(date: Date): number;
|
|
273
304
|
export declare function dateTimeToEpoch(dateInput: string | Date): number;
|
|
@@ -40,6 +40,7 @@ exports.getDecimalNumberFromString = getDecimalNumberFromString;
|
|
|
40
40
|
exports.hasProperty = hasProperty;
|
|
41
41
|
exports.convertToNumberType = convertToNumberType;
|
|
42
42
|
exports.epochToDateTime = epochToDateTime;
|
|
43
|
+
exports.toEpochSeconds = toEpochSeconds;
|
|
43
44
|
exports.dateTimeToEpoch = dateTimeToEpoch;
|
|
44
45
|
const date_fns_1 = require("date-fns");
|
|
45
46
|
const util_constants_1 = require("../constants/util.constants");
|
|
@@ -567,10 +568,43 @@ function convertToNumberType(value) {
|
|
|
567
568
|
}
|
|
568
569
|
return num;
|
|
569
570
|
}
|
|
571
|
+
/**
|
|
572
|
+
* Converts an epoch timestamp (in seconds) into a formatted date-time string.
|
|
573
|
+
*
|
|
574
|
+
* @param {number} epoch - The epoch timestamp in seconds (number of seconds since 1970-01-01 00:00:00 UTC).
|
|
575
|
+
*
|
|
576
|
+
* @returns {string} The formatted date-time string in "yyyy-MM-dd HH:mm:ss" format.
|
|
577
|
+
*
|
|
578
|
+
* @example
|
|
579
|
+
* epochToDateTime(1759211965);
|
|
580
|
+
* // Returns: "2025-09-30 11:19:25"
|
|
581
|
+
*
|
|
582
|
+
* @example
|
|
583
|
+
* epochToDateTime(0);
|
|
584
|
+
* // Returns: "1970-01-01 05:30:00" // if your system timezone is IST (UTC+5:30)
|
|
585
|
+
*/
|
|
570
586
|
function epochToDateTime(epoch) {
|
|
571
587
|
const date = new Date(epoch * 1000); // JS Date expects milliseconds
|
|
572
588
|
return (0, date_fns_1.format)(date, "yyyy-MM-dd HH:mm:ss");
|
|
573
589
|
}
|
|
590
|
+
/**
|
|
591
|
+
* Converts a JavaScript Date object into epoch seconds (UNIX timestamp).
|
|
592
|
+
*
|
|
593
|
+
* @param {Date} date - A JavaScript Date instance.
|
|
594
|
+
*
|
|
595
|
+
* @returns {number} The corresponding epoch time in seconds (number of seconds since 1970-01-01 00:00:00 UTC).
|
|
596
|
+
*
|
|
597
|
+
* @example
|
|
598
|
+
* toEpochSeconds(new Date("2025-09-30 11:19:25"));
|
|
599
|
+
* // Returns: 1759211965
|
|
600
|
+
*
|
|
601
|
+
* @example
|
|
602
|
+
* toEpochSeconds(new Date());
|
|
603
|
+
* // Returns: current epoch time in seconds
|
|
604
|
+
*/
|
|
605
|
+
function toEpochSeconds(date) {
|
|
606
|
+
return Math.floor(date.getTime() / 1000);
|
|
607
|
+
}
|
|
574
608
|
function dateTimeToEpoch(dateInput) {
|
|
575
609
|
const date = typeof dateInput === "string" ? new Date(dateInput) : dateInput;
|
|
576
610
|
return Math.floor(date.getTime() / 1000);
|
package/package.json
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "law-common",
|
|
3
|
-
"version": "10.26.
|
|
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.26.1-beta.1",
|
|
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
|
+
}
|