ia-common 1.1.1-beta.3 → 1.1.1-beta.30

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 (130) hide show
  1. package/build/src/@enum.d.ts +1 -33
  2. package/build/src/@enum.js +1 -33
  3. package/build/src/enum/corporate-actions/corporate-actions-type.enum.js +0 -1
  4. package/build/src/enum/error.key.enum.d.ts +3 -1
  5. package/build/src/enum/error.key.enum.js +2 -0
  6. package/build/src/enum/index.d.ts +34 -0
  7. package/build/src/enum/index.js +50 -0
  8. package/build/src/enum/permission-actions.enum.d.ts +7 -0
  9. package/build/src/enum/permission-actions.enum.js +11 -0
  10. package/build/src/enum/user/user-role.enum.d.ts +2 -4
  11. package/build/src/enum/user/user-role.enum.js +6 -4
  12. package/build/src/interface/api/bank-details-create-dto..interface.d.ts +4 -3
  13. package/build/src/interface/api/bank-details-update.dto.interface.d.ts +1 -3
  14. package/build/src/interface/api/configuration-update-dto.interface.d.ts +1 -1
  15. package/build/src/interface/api/corporate-actions-create.dto.d.ts +1 -1
  16. package/build/src/interface/api/create-corporate-action-advice.interface.d.ts +5 -6
  17. package/build/src/interface/api/create-user-dto.interface.d.ts +1 -2
  18. package/build/src/interface/api/equity-advice-create-dto.interface.d.ts +1 -1
  19. package/build/src/interface/api/equity-advice-update-dto..d.ts +1 -1
  20. package/build/src/interface/api/get-corporate-actions.interface.d.ts +1 -1
  21. package/build/src/interface/api/get-corporate-actions.interface.js +1 -1
  22. package/build/src/interface/api/get-cron-job-by-date-range.interface.d.ts +1 -1
  23. package/build/src/interface/api/get-staff-members.interface.d.ts +1 -1
  24. package/build/src/interface/api/index.d.ts +2 -0
  25. package/build/src/interface/api/index.js +2 -0
  26. package/build/src/interface/api/login.interface.d.ts +0 -1
  27. package/build/src/interface/api/manual-trigger-cron-job.interface.d.ts +1 -1
  28. package/build/src/interface/api/mutual-fund-advice-create-dto.interface.d.ts +1 -1
  29. package/build/src/interface/api/mutual-funds-create-dto.interface.d.ts +1 -1
  30. package/build/src/interface/api/nfo-advice-update-dto.interface.d.ts +1 -1
  31. package/build/src/interface/api/organization-update-dto.interface.d.ts +1 -1
  32. package/build/src/interface/api/permission.create.dto.interface.d.ts +4 -1
  33. package/build/src/interface/api/permission.update.dto.interface.d.ts +5 -1
  34. package/build/src/interface/api/pricing-plan-create.dto.interface.d.ts +3 -8
  35. package/build/src/interface/api/pricing-plan-update-dto.interface.d.ts +2 -2
  36. package/build/src/interface/api/role-user-mapping-create-dto.interface.d.ts +7 -0
  37. package/build/src/interface/api/role-user-mapping-create-dto.interface.js +2 -0
  38. package/build/src/interface/api/role-user-mapping-delete-dto.interface.d.ts +3 -0
  39. package/build/src/interface/api/role-user-mapping-delete-dto.interface.js +2 -0
  40. package/build/src/interface/api/subscription-create.dto.interface.d.ts +7 -1
  41. package/build/src/interface/api/subscription-update.dto.interface.d.ts +4 -7
  42. package/build/src/interface/api/update-corporate-action-advice.interface.d.ts +4 -7
  43. package/build/src/interface/api/update-corporate-action.interface.d.ts +1 -1
  44. package/build/src/interface/api/update-pricing-plan-by-id.interface.d.ts +2 -2
  45. package/build/src/interface/corporate-actions/base-corporate-actions.interface.d.ts +2 -1
  46. package/build/src/interface/corporate-actions/buy-back-corporate-actions.interface.d.ts +1 -1
  47. package/build/src/interface/corporate-actions/ipo-corporate-action.interface.d.ts +1 -1
  48. package/build/src/interface/corporate-actions/split-bonus-corporate-action.interface.d.ts +1 -1
  49. package/build/src/interface/entity/advice-entity.interface.d.ts +1 -1
  50. package/build/src/interface/entity/advisor-user-mapping-entity.interface.d.ts +1 -1
  51. package/build/src/interface/entity/bank-details-entity.interface.d.ts +2 -2
  52. package/build/src/interface/entity/configurations-entity.interface.d.ts +1 -1
  53. package/build/src/interface/entity/corporate-action-advice-entity.interface.d.ts +4 -4
  54. package/build/src/interface/entity/cron-job-entity.interface.d.ts +1 -1
  55. package/build/src/interface/entity/entity-utils.interface.d.ts +6 -3
  56. package/build/src/interface/entity/entity-utils.interface.js +1 -0
  57. package/build/src/interface/entity/equity-advice-in-process-entity.interface.d.ts +1 -1
  58. package/build/src/interface/entity/index.d.ts +1 -0
  59. package/build/src/interface/entity/index.js +1 -0
  60. package/build/src/interface/entity/mutual-fund-advice-entity.interface.d.ts +1 -1
  61. package/build/src/interface/entity/mutual-funds-entity.interface.d.ts +1 -1
  62. package/build/src/interface/entity/nfo-advice-entity.interface.d.ts +1 -1
  63. package/build/src/interface/entity/nfo-entity.interface.d.ts +1 -1
  64. package/build/src/interface/entity/permission.entity.interface.d.ts +2 -1
  65. package/build/src/interface/entity/pricing-plan-entity.interface.d.ts +1 -1
  66. package/build/src/interface/entity/relation-config.interface.d.ts +1 -1
  67. package/build/src/interface/entity/role-user-mapping-entity.interface.d.ts +8 -0
  68. package/build/src/interface/entity/role-user-mapping-entity.interface.js +2 -0
  69. package/build/src/interface/entity/role.entity.interface.d.ts +0 -1
  70. package/build/src/interface/entity/subscription-entity.interface.d.ts +1 -1
  71. package/build/src/interface/entity/user-entity.interface.d.ts +0 -2
  72. package/build/src/model/bank-details-entity-model.d.ts +2 -2
  73. package/build/src/model/bank-details-entity-model.js +3 -3
  74. package/build/src/model/corporate-actions/bonus-corporate-action-model.d.ts +2 -1
  75. package/build/src/model/corporate-actions/bonus-corporate-action-model.js +2 -2
  76. package/build/src/model/corporate-actions/buy-back-corporate-action-model.d.ts +3 -1
  77. package/build/src/model/corporate-actions/buy-back-corporate-action-model.js +2 -2
  78. package/build/src/model/corporate-actions/corporate-action-model.d.ts +2 -1
  79. package/build/src/model/corporate-actions/corporate-action-model.js +4 -3
  80. package/build/src/model/corporate-actions/corporate-actions-advice-model.d.ts +4 -4
  81. package/build/src/model/corporate-actions/corporate-actions-advice-model.js +3 -3
  82. package/build/src/model/corporate-actions/delisting-corporate-action-model.d.ts +2 -1
  83. package/build/src/model/corporate-actions/delisting-corporate-action-model.js +2 -2
  84. package/build/src/model/corporate-actions/dividend-corporate-action-model.d.ts +2 -1
  85. package/build/src/model/corporate-actions/dividend-corporate-action-model.js +2 -2
  86. package/build/src/model/corporate-actions/fpo-corporate-action-model.d.ts +2 -1
  87. package/build/src/model/corporate-actions/fpo-corporate-action-model.js +2 -2
  88. package/build/src/model/corporate-actions/ipo-corporate-action-model.d.ts +3 -1
  89. package/build/src/model/corporate-actions/ipo-corporate-action-model.js +2 -2
  90. package/build/src/model/corporate-actions/ofs-corporate-action-model.d.ts +2 -1
  91. package/build/src/model/corporate-actions/ofs-corporate-action-model.js +2 -2
  92. package/build/src/model/corporate-actions/open-offer-corporate-action-model.d.ts +2 -1
  93. package/build/src/model/corporate-actions/open-offer-corporate-action-model.js +2 -2
  94. package/build/src/model/corporate-actions/right-issue-corporate-action-model.d.ts +2 -1
  95. package/build/src/model/corporate-actions/right-issue-corporate-action-model.js +2 -2
  96. package/build/src/model/corporate-actions/split-bonus-corporate-action-model.d.ts +3 -1
  97. package/build/src/model/corporate-actions/split-corporate-action-model.d.ts +2 -1
  98. package/build/src/model/corporate-actions/split-corporate-action-model.js +2 -2
  99. package/build/src/model/index.d.ts +1 -0
  100. package/build/src/model/index.js +1 -0
  101. package/build/src/model/interface/entity.model.interface.js +3 -0
  102. package/build/src/model/interface/pricing-plan-model.interface.d.ts +2 -2
  103. package/build/src/model/mutual-funds-entity.model.d.ts +1 -1
  104. package/build/src/model/mutual-funds-entity.model.js +2 -2
  105. package/build/src/model/nfo-advice-entity.model.d.ts +1 -1
  106. package/build/src/model/nfo-advice-entity.model.js +3 -3
  107. package/build/src/model/nfo-entity.model.d.ts +1 -1
  108. package/build/src/model/nfo-entity.model.js +2 -2
  109. package/build/src/model/organization-entity-model.d.ts +0 -1
  110. package/build/src/model/organization-entity-model.js +13 -13
  111. package/build/src/model/permission-entity-model.d.ts +3 -1
  112. package/build/src/model/permission-entity-model.js +3 -1
  113. package/build/src/model/pricing-plan-entity-model.d.ts +1 -1
  114. package/build/src/model/pricing-plan-entity-model.js +4 -4
  115. package/build/src/model/pricing-plan-model.d.ts +2 -2
  116. package/build/src/model/pricing-plan-model.js +4 -4
  117. package/build/src/model/role-entity-model.d.ts +0 -1
  118. package/build/src/model/role-entity-model.js +0 -1
  119. package/build/src/model/role-user-mapping-entity-model.d.ts +15 -0
  120. package/build/src/model/role-user-mapping-entity-model.js +26 -0
  121. package/build/src/model/user-entity-model.d.ts +1 -3
  122. package/build/src/model/user-entity-model.js +2 -13
  123. package/build/src/red-black-tree/js-cols.d.ts +2 -0
  124. package/build/src/red-black-tree/js-cols.js +12 -0
  125. package/build/src/utils/date-util.d.ts +1 -0
  126. package/build/src/utils/date-util.js +44 -0
  127. package/build/src/utils/helper.fn.utils.d.ts +47 -1
  128. package/build/src/utils/helper.fn.utils.js +150 -1
  129. package/build/src/utils/validate-utils.d.ts +1 -1
  130. package/package.json +6 -5
@@ -31,3 +31,4 @@ export * from "./configurations-entity-model";
31
31
  export * from "./permission-entity-model";
32
32
  export * from "./role-entity-model";
33
33
  export * from "./role-permission-entity-model";
34
+ export * from "./role-user-mapping-entity-model";
@@ -51,3 +51,4 @@ __exportStar(require("./configurations-entity-model"), exports);
51
51
  __exportStar(require("./permission-entity-model"), exports);
52
52
  __exportStar(require("./role-entity-model"), exports);
53
53
  __exportStar(require("./role-permission-entity-model"), exports);
54
+ __exportStar(require("./role-user-mapping-entity-model"), exports);
@@ -20,6 +20,7 @@ const pricing_plan_entity_model_1 = require("../pricing-plan-entity-model");
20
20
  const registration_entity_model_1 = require("../registration-entity-model");
21
21
  const role_entity_model_1 = require("../role-entity-model");
22
22
  const role_permission_entity_model_1 = require("../role-permission-entity-model");
23
+ const role_user_mapping_entity_model_1 = require("../role-user-mapping-entity-model");
23
24
  const subscription_entity_model_1 = require("../subscription-entity-model");
24
25
  const user_entity_model_1 = require("../user-entity-model");
25
26
  function mapToIndex(entityMap) {
@@ -76,6 +77,7 @@ function parseEntities(json, baseEntity, entityModelMap) {
76
77
  [_type_1.EntityEnum.ROLE]: role_entity_model_1.RoleEntityModel.fromEntity,
77
78
  [_type_1.EntityEnum.PERMISSION]: permission_entity_model_1.PermissionEntityModel.fromEntity,
78
79
  [_type_1.EntityEnum.ROLE_PERMISSION_MAPPING]: role_permission_entity_model_1.RolePermissionMappingEntityModel.fromEntity,
80
+ [_type_1.EntityEnum.ROLE_USER_MAPPING]: role_user_mapping_entity_model_1.RoleUserMappingEntityModel.fromEntity,
79
81
  };
80
82
  if (!(baseEntity in entityFromJsonMappings)) {
81
83
  throw new Error(`Unknown entity: ${baseEntity}`);
@@ -114,6 +116,7 @@ exports.entityEnumToEntityModel = {
114
116
  [_type_1.EntityEnum.ROLE]: role_entity_model_1.RoleEntityModel.fromEntity,
115
117
  [_type_1.EntityEnum.PERMISSION]: permission_entity_model_1.PermissionEntityModel.fromEntity,
116
118
  [_type_1.EntityEnum.ROLE_PERMISSION_MAPPING]: role_permission_entity_model_1.RolePermissionMappingEntityModel.fromEntity,
119
+ [_type_1.EntityEnum.ROLE_USER_MAPPING]: role_user_mapping_entity_model_1.RoleUserMappingEntityModel.fromEntity,
117
120
  };
118
121
  function parseEntitiesWithoutModels(json, baseEntity, entityMap = {}) {
119
122
  var _a;
@@ -1,8 +1,8 @@
1
1
  import { IBillingCycleObj } from "../../interface/selected-billing-cycle.interface";
2
2
  export interface IPricingPlanModel {
3
3
  id: number;
4
- effectiveFromDate: number;
5
- effectiveToDate: number;
4
+ effectiveFrom: number;
5
+ effectiveTo: number;
6
6
  basePrice: number;
7
7
  billingCycle: {
8
8
  [key: string]: IBillingCycleObj;
@@ -1,5 +1,5 @@
1
- import { MutualFundsType } from "../../@enum";
2
1
  import { EntityEnum, IMutualFundsEntity } from "../../@type";
2
+ import { MutualFundsType } from "../enum";
3
3
  import { BaseEntityModel } from "./base.entity.model";
4
4
  export declare class MutualFundEntityModel extends BaseEntityModel<EntityEnum.MUTUAL_FUNDS> implements IMutualFundsEntity {
5
5
  id: number;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MutualFundEntityModel = void 0;
4
- const _enum_1 = require("../../@enum");
5
4
  const _type_1 = require("../../@type");
5
+ const enum_1 = require("../enum");
6
6
  const base_entity_model_1 = require("./base.entity.model");
7
7
  class MutualFundEntityModel extends base_entity_model_1.BaseEntityModel {
8
8
  constructor() {
@@ -19,7 +19,7 @@ class MutualFundEntityModel extends base_entity_model_1.BaseEntityModel {
19
19
  this.fiveYearReturnRegular = 0;
20
20
  this.fiveYearReturnDirect = 0;
21
21
  this.dailyAUM = 0;
22
- this.type = _enum_1.MutualFundsType.DEBT;
22
+ this.type = enum_1.MutualFundsType.DEBT;
23
23
  this.createdOn = 0;
24
24
  this.updatedOn = 0;
25
25
  this.createdBy = 0;
@@ -1,5 +1,5 @@
1
- import { NFOAdviceStatus, NFOAdviceTransactionType } from "../../@enum";
2
1
  import { EntityEnum, INFOAdviceEntity } from "../../@type";
2
+ import { NFOAdviceStatus, NFOAdviceTransactionType } from "../enum";
3
3
  import { BaseEntityModel } from "./base.entity.model";
4
4
  export declare class NFOAdviceEntityModel extends BaseEntityModel<EntityEnum.NFO_ADVICE> implements INFOAdviceEntity {
5
5
  id: number;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NFOAdviceEntityModel = void 0;
4
- const _enum_1 = require("../../@enum");
5
4
  const _type_1 = require("../../@type");
5
+ const enum_1 = require("../enum");
6
6
  const base_entity_model_1 = require("./base.entity.model");
7
7
  class NFOAdviceEntityModel extends base_entity_model_1.BaseEntityModel {
8
8
  constructor() {
@@ -11,12 +11,12 @@ class NFOAdviceEntityModel extends base_entity_model_1.BaseEntityModel {
11
11
  this.nfoId = 0;
12
12
  this.mutualFundName = "";
13
13
  this.advisorOrgId = 0;
14
- this.transactionType = _enum_1.NFOAdviceTransactionType.AVOID;
14
+ this.transactionType = enum_1.NFOAdviceTransactionType.AVOID;
15
15
  this.rationale = "";
16
16
  this.noteDocumentUrl = null;
17
17
  this.videoUrl = null;
18
18
  this.voiceUrl = null;
19
- this.status = _enum_1.NFOAdviceStatus.ACTIVE;
19
+ this.status = enum_1.NFOAdviceStatus.ACTIVE;
20
20
  this.createdOn = 0;
21
21
  this.updatedOn = 0;
22
22
  this.createdBy = 0;
@@ -1,5 +1,5 @@
1
- import { MutualFundsType } from "../../@enum";
2
1
  import { EntityEnum, INFOEntity } from "../../@type";
2
+ import { MutualFundsType } from "../enum";
3
3
  import { BaseEntityModel } from "./base.entity.model";
4
4
  export declare class NFOEntityModel extends BaseEntityModel<EntityEnum.NFO> implements INFOEntity {
5
5
  id: number;
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NFOEntityModel = void 0;
4
- const _enum_1 = require("../../@enum");
5
4
  const _type_1 = require("../../@type");
5
+ const enum_1 = require("../enum");
6
6
  const base_entity_model_1 = require("./base.entity.model");
7
7
  class NFOEntityModel extends base_entity_model_1.BaseEntityModel {
8
8
  constructor() {
9
9
  super(_type_1.EntityEnum.NFO);
10
10
  this.id = 0;
11
11
  this.mutualFundName = "";
12
- this.type = _enum_1.MutualFundsType.EQUITY;
12
+ this.type = enum_1.MutualFundsType.EQUITY;
13
13
  this.startDateCode = 0;
14
14
  this.endDateCode = 0;
15
15
  this.risk = "";
@@ -54,7 +54,6 @@ export declare class OrganizationEntityModel extends BaseEntityModel<EntityEnum.
54
54
  * Find organization by registrationId
55
55
  */
56
56
  static findByRegistrationId(organizationEntities: IOrganizationEntity[], registrationId: number): IOrganizationEntity | undefined;
57
- validateOwnersCountByOrganizationType(): void;
58
57
  getUsersModels(): UserEntityModel[];
59
58
  static relationConfigs: RelationConfigs<[
60
59
  EntityEnum.USER
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.OrganizationEntityModel = void 0;
4
4
  const _enum_1 = require("../@enum");
5
5
  const relation_type_enum_1 = require("../enum/relation-type.enum");
6
- const _model_1 = require("../@model");
7
6
  const _type_1 = require("../@type");
8
7
  const base_entity_model_1 = require("./base.entity.model");
9
8
  class OrganizationEntityModel extends base_entity_model_1.BaseEntityModel {
@@ -144,18 +143,19 @@ class OrganizationEntityModel extends base_entity_model_1.BaseEntityModel {
144
143
  // ): IOrganizationEntity {
145
144
  // return OrganizationEntityModel.fromRegistrationModel(registrationEntity);
146
145
  // }
147
- validateOwnersCountByOrganizationType() {
148
- var _a;
149
- const noOfOwners = (_a = this.users) === null || _a === void 0 ? void 0 : _a.filter((user) => user.role === _enum_1.UserRoleEnum.ADVISOR).length;
150
- if (this.type === _enum_1.OrganizationType.PARTNERSHIP && noOfOwners <= 1) {
151
- throw new _model_1.AppBadRequestException({
152
- key: "organizationType",
153
- message: [
154
- "If the organization is a partnership, it must have a minimum of two owners.",
155
- ],
156
- });
157
- }
158
- }
146
+ // validateOwnersCountByOrganizationType(): void {
147
+ // const noOfOwners = this.users?.filter(
148
+ // (user) => user.role === UserRoleEnum.ADVISOR
149
+ // ).length;
150
+ // if (this.type === OrganizationType.PARTNERSHIP && noOfOwners <= 1) {
151
+ // throw new AppBadRequestException({
152
+ // key: "organizationType",
153
+ // message: [
154
+ // "If the organization is a partnership, it must have a minimum of two owners.",
155
+ // ],
156
+ // });
157
+ // }
158
+ // }
159
159
  getUsersModels() {
160
160
  return this.users;
161
161
  }
@@ -1,10 +1,12 @@
1
+ import { PermissionActionGroup } from "../@enum";
1
2
  import { EntityEnum, IPermissionEntity } from "../@type";
2
3
  import { BaseEntityModel } from "./base.entity.model";
3
4
  export declare class PermissionEntityModel extends BaseEntityModel<EntityEnum.PERMISSION> implements IPermissionEntity {
4
5
  id: number;
5
6
  name: string;
6
7
  description?: string;
7
- organizationId: number;
8
+ group: PermissionActionGroup;
9
+ priority: number;
8
10
  createdOn: number;
9
11
  updatedOn: number;
10
12
  createdBy: number;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PermissionEntityModel = void 0;
4
+ const _enum_1 = require("../@enum");
4
5
  const _type_1 = require("../@type");
5
6
  const base_entity_model_1 = require("./base.entity.model");
6
7
  class PermissionEntityModel extends base_entity_model_1.BaseEntityModel {
@@ -9,7 +10,8 @@ class PermissionEntityModel extends base_entity_model_1.BaseEntityModel {
9
10
  this.id = 0;
10
11
  this.name = "";
11
12
  this.description = "";
12
- this.organizationId = 0;
13
+ this.group = _enum_1.PermissionActionGroup.READ;
14
+ this.priority = 0;
13
15
  this.createdOn = 0;
14
16
  this.updatedOn = 0;
15
17
  this.createdBy = 0;
@@ -2,8 +2,8 @@ import { PricingPlanStatus } from "../@enum";
2
2
  import { EntityEnum, IBillingCycle, IGetPricingPlanByDateResponse, IPricingPlanEntity } from "../@type";
3
3
  import { BaseEntityModel } from "./base.entity.model";
4
4
  export declare class PricingPlanEntityModel extends BaseEntityModel<EntityEnum.PRICING_PLAN> implements IPricingPlanEntity {
5
- id: number;
6
5
  effectiveFrom: number;
6
+ id: number;
7
7
  effectiveTo: number;
8
8
  status: PricingPlanStatus;
9
9
  createdBy: number;
@@ -20,8 +20,8 @@ class PricingPlanEntityModel extends base_entity_model_1.BaseEntityModel {
20
20
  toObject() {
21
21
  const responseObj = {
22
22
  id: this.id,
23
- effectiveFromDate: 0,
24
- effectiveToDate: 0,
23
+ effectiveFrom: 0,
24
+ effectiveTo: 0,
25
25
  basePrice: 0,
26
26
  billingCycle: {},
27
27
  };
@@ -36,8 +36,8 @@ class PricingPlanEntityModel extends base_entity_model_1.BaseEntityModel {
36
36
  key: billingArray.slice(3).join("-").toLowerCase().replace(/ /g, "-"),
37
37
  };
38
38
  });
39
- responseObj.effectiveFromDate = this.effectiveFrom;
40
- responseObj.effectiveToDate = this.effectiveTo;
39
+ responseObj.effectiveFrom = this.effectiveFrom;
40
+ responseObj.effectiveTo = this.effectiveTo;
41
41
  responseObj.basePrice = this.basePrice;
42
42
  return responseObj;
43
43
  }
@@ -2,8 +2,8 @@ import { IGetPricingPlanByDateResponse, IPricingPlanModel, IBillingCycleObj, IPr
2
2
  import { BaseEntityModel } from "./base.entity.model";
3
3
  export declare class PricingPlanModel extends BaseEntityModel<EntityEnum.PRICING_PLAN> implements IPricingPlanModel {
4
4
  id: number;
5
- effectiveFromDate: number;
6
- effectiveToDate: number;
5
+ effectiveFrom: number;
6
+ effectiveTo: number;
7
7
  basePrice: number;
8
8
  billingCycle: {
9
9
  [key: string]: IBillingCycleObj;
@@ -9,8 +9,8 @@ class PricingPlanModel extends base_entity_model_1.BaseEntityModel {
9
9
  constructor(data) {
10
10
  super(_type_1.EntityEnum.PRICING_PLAN);
11
11
  this.id = 0;
12
- this.effectiveFromDate = 0;
13
- this.effectiveToDate = 0;
12
+ this.effectiveFrom = 0;
13
+ this.effectiveTo = 0;
14
14
  this.basePrice = 0;
15
15
  this.billingCycle = {};
16
16
  if (data)
@@ -75,8 +75,8 @@ class PricingPlanModel extends base_entity_model_1.BaseEntityModel {
75
75
  exports.PricingPlanModel = PricingPlanModel;
76
76
  // export class PricingPlanModel implements IPricingPlanModel {
77
77
  // id: number;
78
- // effectiveFromDate: number;
79
- // effectiveToDate: number;
78
+ // effectiveFrom: number;
79
+ // effectiveTo: number;
80
80
  // basePrice: number;
81
81
  // billingCycle: {
82
82
  // [key: string]: IBillingCycleObj;
@@ -5,7 +5,6 @@ export declare class RoleEntityModel extends BaseEntityModel<EntityEnum.ROLE> im
5
5
  id: number;
6
6
  name: string;
7
7
  description?: string;
8
- organizationId: number;
9
8
  createdOn: number;
10
9
  updatedOn: number;
11
10
  createdBy: number;
@@ -9,7 +9,6 @@ class RoleEntityModel extends base_entity_model_1.BaseEntityModel {
9
9
  this.id = 0;
10
10
  this.name = "";
11
11
  this.description = "";
12
- this.organizationId = 0;
13
12
  this.createdOn = 0;
14
13
  this.updatedOn = 0;
15
14
  this.createdBy = 0;
@@ -0,0 +1,15 @@
1
+ import { EntityEnum } from "../@type";
2
+ import { IRoleUserMappingEntity } from "../interface/entity/role-user-mapping-entity.interface";
3
+ import { BaseEntityModel } from "./base.entity.model";
4
+ export declare class RoleUserMappingEntityModel extends BaseEntityModel<EntityEnum.ROLE_USER_MAPPING> implements IRoleUserMappingEntity {
5
+ id: number;
6
+ roleId: number;
7
+ userId: number;
8
+ createdOn: number;
9
+ updatedOn: number;
10
+ createdBy: number;
11
+ updatedBy: number;
12
+ constructor();
13
+ static fromEntity(entity: IRoleUserMappingEntity): RoleUserMappingEntityModel;
14
+ getRelationConfigs(): any;
15
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RoleUserMappingEntityModel = void 0;
4
+ const _type_1 = require("../@type");
5
+ const base_entity_model_1 = require("./base.entity.model");
6
+ class RoleUserMappingEntityModel extends base_entity_model_1.BaseEntityModel {
7
+ constructor() {
8
+ super(_type_1.EntityEnum.ROLE_USER_MAPPING);
9
+ this.id = 0;
10
+ this.roleId = 0;
11
+ this.userId = 0;
12
+ this.createdOn = 0;
13
+ this.updatedOn = 0;
14
+ this.createdBy = 0;
15
+ this.updatedBy = 0;
16
+ }
17
+ static fromEntity(entity) {
18
+ const result = new RoleUserMappingEntityModel();
19
+ Object.assign(result, entity);
20
+ return result;
21
+ }
22
+ getRelationConfigs() {
23
+ return this.constructor.prototype.constructor.relationConfigs;
24
+ }
25
+ }
26
+ exports.RoleUserMappingEntityModel = RoleUserMappingEntityModel;
@@ -1,4 +1,4 @@
1
- import { UserRoleEnum, UserStatus } from "../@enum";
1
+ import { UserStatus } from "../@enum";
2
2
  import { EntityEnum, IOrganizationEntity, IRegistrationEntity, IUserEntity } from "../@type";
3
3
  import { BaseEntityModel } from "./base.entity.model";
4
4
  export declare class UserEntityModel extends BaseEntityModel<EntityEnum.USER> implements IUserEntity {
@@ -12,7 +12,6 @@ export declare class UserEntityModel extends BaseEntityModel<EntityEnum.USER> im
12
12
  isMobileVerified: boolean;
13
13
  isAccountVerified: boolean;
14
14
  requireNewPassword: boolean;
15
- role: UserRoleEnum;
16
15
  registrationId: number;
17
16
  organizationId: number;
18
17
  imageUrl: string | null;
@@ -28,5 +27,4 @@ export declare class UserEntityModel extends BaseEntityModel<EntityEnum.USER> im
28
27
  static filterByOrganizationId(userEntities: IUserEntity[], organizationId: number): IUserEntity[];
29
28
  static getUserEntityInstanceFromRegistrationEntityOrganizationEntity(registrationEntity: IRegistrationEntity, organizationEntity: IOrganizationEntity, hashedPassword: string): IUserEntity;
30
29
  getRelationConfigs(): any;
31
- validateUserRoleSuperAdmin(): void;
32
30
  }
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.UserEntityModel = void 0;
4
4
  const _enum_1 = require("../@enum");
5
- const _model_1 = require("../@model");
6
5
  const _type_1 = require("../@type");
7
6
  const base_entity_model_1 = require("./base.entity.model");
8
7
  class UserEntityModel extends base_entity_model_1.BaseEntityModel {
@@ -18,7 +17,7 @@ class UserEntityModel extends base_entity_model_1.BaseEntityModel {
18
17
  this.isMobileVerified = false;
19
18
  this.isAccountVerified = false;
20
19
  this.requireNewPassword = false;
21
- this.role = _enum_1.UserRoleEnum.ADVISOR;
20
+ // role: UserRoleEnum = UserRoleEnum.ADVISOR;
22
21
  this.registrationId = 0;
23
22
  this.organizationId = 0;
24
23
  this.imageUrl = null;
@@ -44,7 +43,7 @@ class UserEntityModel extends base_entity_model_1.BaseEntityModel {
44
43
  userEntity.isEmailVerified = false;
45
44
  userEntity.isMobileVerified = false;
46
45
  userEntity.status = _enum_1.UserStatus.REGISTRATION_APPROVED;
47
- userEntity.role = _enum_1.UserRoleEnum.ADVISOR;
46
+ // userEntity.role = UserRoleEnum.OWNER;
48
47
  userEntity.createdBy = registrationEntity.createdBy;
49
48
  userEntity.updatedBy = registrationEntity.createdBy;
50
49
  userEntity.updatedOn = Date.now();
@@ -62,16 +61,6 @@ class UserEntityModel extends base_entity_model_1.BaseEntityModel {
62
61
  getRelationConfigs() {
63
62
  return this.constructor.prototype.constructor.relationConfigs;
64
63
  }
65
- validateUserRoleSuperAdmin() {
66
- if (this.role !== _enum_1.UserRoleEnum.SUPERADMIN) {
67
- throw new _model_1.AppBadRequestException({
68
- key: "status",
69
- message: [
70
- `Only the SuperAdmin can update the status of ${_enum_1.OrganizationStatus.ACTIVE} and ${_enum_1.OrganizationStatus.ACCOUNT_SUSPENDED}.`,
71
- ],
72
- });
73
- }
74
- }
75
64
  }
76
65
  exports.UserEntityModel = UserEntityModel;
77
66
  // export class UserEntityModel implements IUserEntity {
@@ -0,0 +1,2 @@
1
+ declare var __js_cols_global: any;
2
+ declare var js_cols: any;
@@ -1,4 +1,16 @@
1
1
  // @ts-nocheck
2
+ // create a safe global reference
3
+ var __js_cols_global = typeof globalThis !== "undefined"
4
+ ? globalThis
5
+ : typeof window !== "undefined"
6
+ ? window
7
+ : typeof global !== "undefined"
8
+ ? global
9
+ : this;
10
+ // reuse an existing global js_cols if present, otherwise create it
11
+ var js_cols = __js_cols_global.js_cols || {};
12
+ // Optionally set back the global for scripts that expect it
13
+ __js_cols_global.js_cols = js_cols;
2
14
  //Copyright 2010 Thomas Stjernegaard Jeppesen. All Rights Reserved.
3
15
  //Licensed under the Apache License, Version 2.0 (the "License");
4
16
  //you may not use this file except in compliance with the License.
@@ -19,5 +19,6 @@ export declare class DateUtil {
19
19
  };
20
20
  dateCodeFormatter(dateCode: string, formatter: string): string;
21
21
  epochToDate(timestamp: number): Date;
22
+ getClosestEntityByDateCode<T extends Record<string, any>>(entities: T[], dateProperty: keyof T, targetDateCode: string): T | null;
22
23
  }
23
24
  export declare const dateUtil: DateUtil;
@@ -2,6 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.dateUtil = exports.DateUtil = void 0;
4
4
  const date_fns_1 = require("date-fns");
5
+ const _enum_1 = require("../@enum");
6
+ const model_1 = require("../model");
5
7
  class DateUtil {
6
8
  constructor() {
7
9
  this.convertMonthsToNumber = (months) => {
@@ -89,6 +91,48 @@ class DateUtil {
89
91
  epochToDate(timestamp) {
90
92
  return new Date(timestamp);
91
93
  }
94
+ getClosestEntityByDateCode(entities, dateProperty, targetDateCode) {
95
+ // validate target date first
96
+ if (!DateUtil.isValidDate(targetDateCode)) {
97
+ throw new model_1.AppBadRequestException({
98
+ key: _enum_1.ErrorKeyEnum.DATE_CODE,
99
+ message: [`Invalid targetDateCode: ${targetDateCode}`],
100
+ });
101
+ }
102
+ if (!(entities === null || entities === void 0 ? void 0 : entities.length))
103
+ return null;
104
+ let closestPast = null;
105
+ let closestFuture = null;
106
+ for (const entity of entities) {
107
+ const rawDateCode = entity[dateProperty];
108
+ if (rawDateCode == null)
109
+ continue;
110
+ const entityDateCode = String(rawDateCode);
111
+ // validate entity date code
112
+ if (!DateUtil.isValidDate(entityDateCode)) {
113
+ continue;
114
+ }
115
+ // exact match
116
+ if (entityDateCode === targetDateCode) {
117
+ return entity;
118
+ }
119
+ // past date
120
+ if (entityDateCode < targetDateCode) {
121
+ if (!closestPast ||
122
+ entityDateCode > String(closestPast[dateProperty])) {
123
+ closestPast = entity;
124
+ }
125
+ }
126
+ // future date
127
+ if (entityDateCode > targetDateCode) {
128
+ if (!closestFuture ||
129
+ entityDateCode < String(closestFuture[dateProperty])) {
130
+ closestFuture = entity;
131
+ }
132
+ }
133
+ }
134
+ return closestPast !== null && closestPast !== void 0 ? closestPast : closestFuture;
135
+ }
92
136
  }
93
137
  exports.DateUtil = DateUtil;
94
138
  exports.dateUtil = new DateUtil();
@@ -1,4 +1,4 @@
1
- import { Modify } from "../@type";
1
+ import { EntityEnum, IEntitySearch, Modify } from "../@type";
2
2
  /**
3
3
  * Returns epoch time (ms) for today's date at the given local time (IST).
4
4
  */
@@ -83,3 +83,49 @@ export declare function toDateFromEpoch(epoch: number): Date;
83
83
  */
84
84
  export declare function deepMerge(existing: any, incoming: any): any;
85
85
  export declare function groupByOneToOneFunction<T, K>(list: T[], keyGetter: (input: T) => K): Map<K, T>;
86
+ export declare function getPropertyFilterByPermissionFn<T extends EntityEnum>(permissionFilterConfig: {
87
+ [key: string]: () => Promise<IEntitySearch<T>>;
88
+ }, propertyNames: string[], userPermission: string, filterDto: IEntitySearch<T>, emptyValue?: any): Promise<IEntitySearch<T>>;
89
+ /**
90
+ * Returns the list of duplicate values from an array.
91
+ *
92
+ * @template T - The type of elements in the array.
93
+ *
94
+ * @param {T[]} arr - The array to check for duplicates.
95
+ *
96
+ * @returns {T[]} An array containing the values that appear more than once.
97
+ * Each duplicate value is included only once.
98
+ *
99
+ * @description
100
+ * This function scans the array and counts occurrences of each value using a Map.
101
+ * Any value with a count greater than 1 is considered a duplicate.
102
+ *
103
+ * @example
104
+ * getDuplicates([1, 2, 2, 3, 3, 3]);
105
+ * // Returns: [2, 3]
106
+ *
107
+ * @example
108
+ * getDuplicates(['a', 'b', 'b', 'c']);
109
+ * // Returns: ['b']
110
+ *
111
+ * @remarks
112
+ * - Works with all primitive types: number, string, boolean, undefined, null.
113
+ * - For objects, duplicates are based on **reference equality**, not deep equality.
114
+ */
115
+ export declare function getDuplicates<T>(arr: T[]): T[];
116
+ /**
117
+ * Derives permission group from permission name.
118
+ *
119
+ * Rules:
120
+ * - Entity is resolved using EntityEnum (longest prefix match)
121
+ * - Action is the part immediately after the entity name
122
+ * - Scope (ORG / SELF / BULK / etc.) is ignored
123
+ * - Group format: <entity>_<action> (lowercase)
124
+ *
125
+ * Examples:
126
+ * CORPORATE_ACTIONS_CREATE_ORG → corporate_actions_create
127
+ * CORPORATE_ACTIONS_ADVICE_CREATE_ORG → corporate_actions_advice_create
128
+ * USER_EXPORT_EXCEL → user_export
129
+ * USER_NAV → user_nav
130
+ */
131
+ export declare function derivePermissionGroup(permissionName: string): string;