law-common 10.25.1-beta.4 → 10.26.1-beta.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.
@@ -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";
@@ -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: IBillingApiEntity;
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: IBillingApiEntity;
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 { IAuditColumnEntity } from "./audit-column.entity.interface";
6
+ import { IEntityAuditColumn } from "./entity-audit-columns.interface";
7
7
  import { EntityEnum, IEntityFilterData } from "./entity.utils.interface";
8
- export interface IBillingEntity extends IAuditColumnEntity {
8
+ export interface IBillingEntity extends IEntityAuditColumn {
9
9
  id: number;
10
10
  startDate: string;
11
11
  endDate: string;
@@ -1,10 +1,11 @@
1
- import { IBillingApiEntity, IBillingFlowConfig } from "../../api";
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 IBillingApiEntity {
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: string;
52
- updatedOn: string;
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 fromApiEntity(apiEntity: IBillingApiEntity): BillingEntityModel;
72
+ static fromApiEntity(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 fromApiEntity(apiEntity) {
47
- const entity = new BillingEntityModel(entity_utils_interface_1.EntityEnum.BILLING);
48
- Object.assign(entity, apiEntity);
49
- return entity;
46
+ static fromApiEntity(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);
@@ -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,6 +1,6 @@
1
1
  {
2
2
  "name": "law-common",
3
- "version": "10.25.1-beta.4",
3
+ "version": "10.26.1-beta.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -1,3 +0,0 @@
1
- import { IApiEntity, IBillingEntity } from "../../entities";
2
- export type IBillingApiEntity = IApiEntity<IBillingEntity>;
3
- export type IBillingApiEntityArray = IBillingApiEntity[];
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });