ia-common 1.1.1-beta.2 → 1.1.1-beta.21
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/build/src/@enum.d.ts +9 -7
- package/build/src/@enum.js +9 -7
- package/build/src/enum/corporate-actions/corporate-actions-type.enum.js +0 -1
- package/build/src/enum/error.key.enum.d.ts +3 -0
- package/build/src/enum/error.key.enum.js +7 -0
- package/build/src/enum/permission-actions.enum.d.ts +7 -0
- package/build/src/enum/permission-actions.enum.js +11 -0
- package/build/src/enum/user/user-role.enum.d.ts +7 -0
- package/build/src/enum/user/user-role.enum.js +15 -0
- package/build/src/interface/api/bank-details-create-dto..interface.d.ts +3 -3
- package/build/src/interface/api/bank-details-update.dto.interface.d.ts +3 -4
- package/build/src/interface/api/corporate-actions-create.dto.d.ts +1 -1
- package/build/src/interface/api/create-user-dto.interface.d.ts +1 -2
- package/build/src/interface/api/get-corporate-actions.interface.d.ts +1 -1
- package/build/src/interface/api/get-corporate-actions.interface.js +1 -1
- package/build/src/interface/api/index.d.ts +12 -2
- package/build/src/interface/api/index.js +12 -2
- package/build/src/interface/api/login.interface.d.ts +0 -1
- package/build/src/interface/api/permission.create.dto.interface.d.ts +6 -0
- package/build/src/interface/api/permission.create.dto.interface.js +2 -0
- package/build/src/interface/api/permission.update.dto.interface.d.ts +7 -0
- package/build/src/interface/api/permission.update.dto.interface.js +2 -0
- package/build/src/interface/api/pricing-plan-create.dto.interface.d.ts +2 -2
- package/build/src/interface/api/pricing-plan-update-dto.interface.d.ts +2 -2
- package/build/src/interface/api/role-create-dto.interface.d.ts +3 -0
- package/build/src/interface/api/role-create-dto.interface.js +2 -0
- package/build/src/interface/api/role-update-dto.interface.d.ts +3 -0
- package/build/src/interface/api/role-update-dto.interface.js +2 -0
- package/build/src/interface/api/role-user-mapping-create-dto.interface.d.ts +7 -0
- package/build/src/interface/api/role-user-mapping-create-dto.interface.js +2 -0
- package/build/src/interface/api/role-user-mapping-delete-dto.interface.d.ts +3 -0
- package/build/src/interface/api/role-user-mapping-delete-dto.interface.js +2 -0
- package/build/src/interface/api/role.permission.mapping.create.dto.interface.d.ts +5 -0
- package/build/src/interface/api/role.permission.mapping.create.dto.interface.js +2 -0
- package/build/src/interface/api/role.permission.mapping.delete.dto.interface.d.ts +3 -0
- package/build/src/interface/api/role.permission.mapping.delete.dto.interface.js +2 -0
- package/build/src/interface/api/role.permission.mapping.response.d.ts +5 -0
- package/build/src/interface/api/role.permission.mapping.response.js +2 -0
- package/build/src/interface/api/role.permission.mapping.update.dto.interface.d.ts +3 -0
- package/build/src/interface/api/role.permission.mapping.update.dto.interface.js +2 -0
- package/build/src/interface/api/update-pricing-plan-by-id.interface.d.ts +2 -2
- package/build/src/interface/corporate-actions/base-corporate-actions.interface.d.ts +2 -1
- package/build/src/interface/entity/bank-details-entity.interface.d.ts +1 -1
- package/build/src/interface/entity/entity-utils.interface.d.ts +16 -5
- package/build/src/interface/entity/entity-utils.interface.js +5 -1
- package/build/src/interface/entity/index.d.ts +4 -0
- package/build/src/interface/entity/index.js +4 -0
- package/build/src/interface/entity/permission.entity.interface.d.ts +11 -0
- package/build/src/interface/entity/permission.entity.interface.js +2 -0
- package/build/src/interface/entity/role-user-mapping-entity.interface.d.ts +8 -0
- package/build/src/interface/entity/role-user-mapping-entity.interface.js +2 -0
- package/build/src/interface/entity/role.entity.interface.d.ts +8 -0
- package/build/src/interface/entity/role.entity.interface.js +2 -0
- package/build/src/interface/entity/role.permission.mapping.entity.interface.d.ts +8 -0
- package/build/src/interface/entity/role.permission.mapping.entity.interface.js +2 -0
- package/build/src/interface/entity/user-entity.interface.d.ts +1 -2
- package/build/src/model/corporate-actions/bonus-corporate-action-model.d.ts +2 -1
- package/build/src/model/corporate-actions/bonus-corporate-action-model.js +2 -2
- package/build/src/model/corporate-actions/buy-back-corporate-action-model.d.ts +3 -1
- package/build/src/model/corporate-actions/buy-back-corporate-action-model.js +2 -2
- package/build/src/model/corporate-actions/corporate-action-model.d.ts +2 -1
- package/build/src/model/corporate-actions/corporate-action-model.js +4 -3
- package/build/src/model/corporate-actions/delisting-corporate-action-model.d.ts +2 -1
- package/build/src/model/corporate-actions/delisting-corporate-action-model.js +2 -2
- package/build/src/model/corporate-actions/dividend-corporate-action-model.d.ts +2 -1
- package/build/src/model/corporate-actions/dividend-corporate-action-model.js +2 -2
- package/build/src/model/corporate-actions/fpo-corporate-action-model.d.ts +2 -1
- package/build/src/model/corporate-actions/fpo-corporate-action-model.js +2 -2
- package/build/src/model/corporate-actions/ipo-corporate-action-model.d.ts +3 -1
- package/build/src/model/corporate-actions/ipo-corporate-action-model.js +2 -2
- package/build/src/model/corporate-actions/ofs-corporate-action-model.d.ts +2 -1
- package/build/src/model/corporate-actions/ofs-corporate-action-model.js +2 -2
- package/build/src/model/corporate-actions/open-offer-corporate-action-model.d.ts +2 -1
- package/build/src/model/corporate-actions/open-offer-corporate-action-model.js +2 -2
- package/build/src/model/corporate-actions/right-issue-corporate-action-model.d.ts +2 -1
- package/build/src/model/corporate-actions/right-issue-corporate-action-model.js +2 -2
- package/build/src/model/corporate-actions/split-bonus-corporate-action-model.d.ts +3 -1
- package/build/src/model/corporate-actions/split-corporate-action-model.d.ts +2 -1
- package/build/src/model/corporate-actions/split-corporate-action-model.js +2 -2
- package/build/src/model/equity-advice-entity-model.js +46 -46
- package/build/src/model/index.d.ts +14 -10
- package/build/src/model/index.js +14 -10
- package/build/src/model/interface/entity.model.interface.js +12 -0
- package/build/src/model/interface/pricing-plan-model.interface.d.ts +2 -2
- package/build/src/model/organization-entity-model.d.ts +0 -1
- package/build/src/model/organization-entity-model.js +13 -13
- package/build/src/model/permission-entity-model.d.ts +20 -0
- package/build/src/model/permission-entity-model.js +32 -0
- package/build/src/model/pricing-plan-entity-model.d.ts +1 -1
- package/build/src/model/pricing-plan-entity-model.js +4 -4
- package/build/src/model/pricing-plan-model.d.ts +2 -2
- package/build/src/model/pricing-plan-model.js +4 -4
- package/build/src/model/role-entity-model.d.ts +14 -0
- package/build/src/model/role-entity-model.js +26 -0
- package/build/src/model/role-permission-entity-model.d.ts +15 -0
- package/build/src/model/role-permission-entity-model.js +26 -0
- package/build/src/model/role-user-mapping-entity-model.d.ts +15 -0
- package/build/src/model/role-user-mapping-entity-model.js +26 -0
- package/build/src/model/user-entity-model.d.ts +2 -3
- package/build/src/model/user-entity-model.js +2 -13
- package/build/src/red-black-tree/js-cols.d.ts +2 -0
- package/build/src/red-black-tree/js-cols.js +12 -0
- package/build/src/utils/helper.fn.utils.d.ts +33 -1
- package/build/src/utils/helper.fn.utils.js +103 -1
- package/build/src/utils/validate-utils.d.ts +1 -1
- package/package.json +4 -4
- package/build/src/enum/user/user-type.enum.d.ts +0 -9
- package/build/src/enum/user/user-type.enum.js +0 -13
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { PermissionActionGroup } from "../@enum";
|
|
2
|
+
import { EntityEnum, IPermissionEntity } from "../@type";
|
|
3
|
+
import { BaseEntityModel } from "./base.entity.model";
|
|
4
|
+
export declare class PermissionEntityModel extends BaseEntityModel<EntityEnum.PERMISSION> implements IPermissionEntity {
|
|
5
|
+
id: number;
|
|
6
|
+
name: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
group: PermissionActionGroup;
|
|
9
|
+
priority: number;
|
|
10
|
+
createdOn: number;
|
|
11
|
+
updatedOn: number;
|
|
12
|
+
createdBy: number;
|
|
13
|
+
updatedBy: number;
|
|
14
|
+
constructor();
|
|
15
|
+
static fromEntity(entity: IPermissionEntity): PermissionEntityModel;
|
|
16
|
+
/**
|
|
17
|
+
* Return relation configs (if any)
|
|
18
|
+
*/
|
|
19
|
+
getRelationConfigs(): any;
|
|
20
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PermissionEntityModel = void 0;
|
|
4
|
+
const _enum_1 = require("../@enum");
|
|
5
|
+
const _type_1 = require("../@type");
|
|
6
|
+
const base_entity_model_1 = require("./base.entity.model");
|
|
7
|
+
class PermissionEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(_type_1.EntityEnum.PERMISSION);
|
|
10
|
+
this.id = 0;
|
|
11
|
+
this.name = "";
|
|
12
|
+
this.description = "";
|
|
13
|
+
this.group = _enum_1.PermissionActionGroup.READ;
|
|
14
|
+
this.priority = 0;
|
|
15
|
+
this.createdOn = 0;
|
|
16
|
+
this.updatedOn = 0;
|
|
17
|
+
this.createdBy = 0;
|
|
18
|
+
this.updatedBy = 0;
|
|
19
|
+
}
|
|
20
|
+
static fromEntity(entity) {
|
|
21
|
+
const result = new PermissionEntityModel();
|
|
22
|
+
Object.assign(result, entity);
|
|
23
|
+
return result;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Return relation configs (if any)
|
|
27
|
+
*/
|
|
28
|
+
getRelationConfigs() {
|
|
29
|
+
return this.constructor.prototype.constructor.relationConfigs;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.PermissionEntityModel = PermissionEntityModel;
|
|
@@ -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
|
-
|
|
24
|
-
|
|
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.
|
|
40
|
-
responseObj.
|
|
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
|
-
|
|
6
|
-
|
|
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.
|
|
13
|
-
this.
|
|
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
|
-
//
|
|
79
|
-
//
|
|
78
|
+
// effectiveFrom: number;
|
|
79
|
+
// effectiveTo: number;
|
|
80
80
|
// basePrice: number;
|
|
81
81
|
// billingCycle: {
|
|
82
82
|
// [key: string]: IBillingCycleObj;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { EntityEnum } from "../@type";
|
|
2
|
+
import { IRoleEntity } from "../interface/entity/role.entity.interface";
|
|
3
|
+
import { BaseEntityModel } from "./base.entity.model";
|
|
4
|
+
export declare class RoleEntityModel extends BaseEntityModel<EntityEnum.ROLE> implements IRoleEntity {
|
|
5
|
+
id: number;
|
|
6
|
+
name: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
createdOn: number;
|
|
9
|
+
updatedOn: number;
|
|
10
|
+
createdBy: number;
|
|
11
|
+
updatedBy: number;
|
|
12
|
+
getRelationConfigs(): any;
|
|
13
|
+
static fromEntity(entity: IRoleEntity): RoleEntityModel;
|
|
14
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RoleEntityModel = void 0;
|
|
4
|
+
const _type_1 = require("../@type");
|
|
5
|
+
const base_entity_model_1 = require("./base.entity.model");
|
|
6
|
+
class RoleEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.id = 0;
|
|
10
|
+
this.name = "";
|
|
11
|
+
this.description = "";
|
|
12
|
+
this.createdOn = 0;
|
|
13
|
+
this.updatedOn = 0;
|
|
14
|
+
this.createdBy = 0;
|
|
15
|
+
this.updatedBy = 0;
|
|
16
|
+
}
|
|
17
|
+
getRelationConfigs() {
|
|
18
|
+
return this.constructor.prototype.constructor.relationConfigs;
|
|
19
|
+
}
|
|
20
|
+
static fromEntity(entity) {
|
|
21
|
+
const result = new RoleEntityModel(_type_1.EntityEnum.ROLE);
|
|
22
|
+
Object.assign(result, entity);
|
|
23
|
+
return result;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.RoleEntityModel = RoleEntityModel;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { EntityEnum } from "../@type";
|
|
2
|
+
import { IRolePermissionMappingEntity } from "../interface/entity/role.permission.mapping.entity.interface";
|
|
3
|
+
import { BaseEntityModel } from "./base.entity.model";
|
|
4
|
+
export declare class RolePermissionMappingEntityModel extends BaseEntityModel<EntityEnum.ROLE_PERMISSION_MAPPING> implements IRolePermissionMappingEntity {
|
|
5
|
+
id: number;
|
|
6
|
+
roleId: number;
|
|
7
|
+
permissionId: number;
|
|
8
|
+
createdOn: number;
|
|
9
|
+
updatedOn: number;
|
|
10
|
+
createdBy: number;
|
|
11
|
+
updatedBy: number;
|
|
12
|
+
constructor();
|
|
13
|
+
static fromEntity(entity: IRolePermissionMappingEntity): RolePermissionMappingEntityModel;
|
|
14
|
+
getRelationConfigs(): any;
|
|
15
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RolePermissionMappingEntityModel = void 0;
|
|
4
|
+
const _type_1 = require("../@type");
|
|
5
|
+
const base_entity_model_1 = require("./base.entity.model");
|
|
6
|
+
class RolePermissionMappingEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(_type_1.EntityEnum.ROLE_PERMISSION_MAPPING);
|
|
9
|
+
this.id = 0;
|
|
10
|
+
this.roleId = 0;
|
|
11
|
+
this.permissionId = 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 RolePermissionMappingEntityModel();
|
|
19
|
+
Object.assign(result, entity);
|
|
20
|
+
return result;
|
|
21
|
+
}
|
|
22
|
+
getRelationConfigs() {
|
|
23
|
+
return this.constructor.prototype.constructor.relationConfigs;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.RolePermissionMappingEntityModel = RolePermissionMappingEntityModel;
|
|
@@ -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 { UserStatus
|
|
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,11 +12,11 @@ export declare class UserEntityModel extends BaseEntityModel<EntityEnum.USER> im
|
|
|
12
12
|
isMobileVerified: boolean;
|
|
13
13
|
isAccountVerified: boolean;
|
|
14
14
|
requireNewPassword: boolean;
|
|
15
|
-
type: UserType;
|
|
16
15
|
registrationId: number;
|
|
17
16
|
organizationId: number;
|
|
18
17
|
imageUrl: string | null;
|
|
19
18
|
documentUrls: string | null;
|
|
19
|
+
permissions?: string[];
|
|
20
20
|
createdOn: number;
|
|
21
21
|
updatedOn: number;
|
|
22
22
|
createdBy: number;
|
|
@@ -27,5 +27,4 @@ export declare class UserEntityModel extends BaseEntityModel<EntityEnum.USER> im
|
|
|
27
27
|
static filterByOrganizationId(userEntities: IUserEntity[], organizationId: number): IUserEntity[];
|
|
28
28
|
static getUserEntityInstanceFromRegistrationEntityOrganizationEntity(registrationEntity: IRegistrationEntity, organizationEntity: IOrganizationEntity, hashedPassword: string): IUserEntity;
|
|
29
29
|
getRelationConfigs(): any;
|
|
30
|
-
validateUserTypeSuperAdmin(): void;
|
|
31
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
|
-
|
|
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.
|
|
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
|
-
validateUserTypeSuperAdmin() {
|
|
66
|
-
if (this.type !== _enum_1.UserType.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 {
|
|
@@ -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.
|
|
@@ -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
|
*/
|
|
@@ -82,3 +82,35 @@ export declare function toDateFromEpoch(epoch: number): Date;
|
|
|
82
82
|
* `{...old, ...new}` which only performs shallow merge.
|
|
83
83
|
*/
|
|
84
84
|
export declare function deepMerge(existing: any, incoming: any): any;
|
|
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
|
+
export declare function getConsoleLog<T extends Record<string, any>>(entity: T, propertyName: keyof T): void;
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deepMerge = exports.toDateFromEpoch = exports.groupByFunction = exports.transformDate = exports.getStringValues = exports.getTodayISTEpoch = void 0;
|
|
12
|
+
exports.getConsoleLog = exports.getDuplicates = exports.getPropertyFilterByPermissionFn = exports.groupByOneToOneFunction = exports.deepMerge = exports.toDateFromEpoch = exports.groupByFunction = exports.transformDate = exports.getStringValues = exports.getTodayISTEpoch = void 0;
|
|
13
|
+
const _type_1 = require("../@type");
|
|
4
14
|
/**
|
|
5
15
|
* Returns epoch time (ms) for today's date at the given local time (IST).
|
|
6
16
|
*/
|
|
@@ -124,3 +134,95 @@ function deepMerge(existing, incoming) {
|
|
|
124
134
|
return existing;
|
|
125
135
|
}
|
|
126
136
|
exports.deepMerge = deepMerge;
|
|
137
|
+
function groupByOneToOneFunction(list, keyGetter) {
|
|
138
|
+
const map = new Map();
|
|
139
|
+
list.forEach((item) => {
|
|
140
|
+
const key = keyGetter(item);
|
|
141
|
+
map.set(key, item);
|
|
142
|
+
});
|
|
143
|
+
return map;
|
|
144
|
+
}
|
|
145
|
+
exports.groupByOneToOneFunction = groupByOneToOneFunction;
|
|
146
|
+
function getPropertyFilterByPermissionFn(permissionFilterConfig, propertyNames, userPermission, filterDto, emptyValue = []) {
|
|
147
|
+
var _a, _b;
|
|
148
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
149
|
+
const permissionFilterData = yield permissionFilterConfig[userPermission]();
|
|
150
|
+
const result = {
|
|
151
|
+
name: filterDto.name,
|
|
152
|
+
include: {},
|
|
153
|
+
};
|
|
154
|
+
for (const propertyName of propertyNames) {
|
|
155
|
+
const dtoInclude = (_a = filterDto.include) !== null && _a !== void 0 ? _a : {};
|
|
156
|
+
const dtoFilter = dtoInclude[propertyName];
|
|
157
|
+
const permissionInclude = (_b = permissionFilterData.include) !== null && _b !== void 0 ? _b : {};
|
|
158
|
+
const permissionFilter = permissionInclude[propertyName];
|
|
159
|
+
const isDtoPresent = Array.isArray(dtoFilter) && dtoFilter.length > 0;
|
|
160
|
+
const isPermissionPresent = Array.isArray(permissionFilter) && permissionFilter.length > 0;
|
|
161
|
+
// --------- CASE 1: Permission says allow all ([]) ----------
|
|
162
|
+
if (Array.isArray(permissionFilter) && permissionFilter.length === 0) {
|
|
163
|
+
result.include[propertyName] = dtoFilter !== null && dtoFilter !== void 0 ? dtoFilter : []; // allow everything
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
// --------- CASE 2: Permission has restriction ----------
|
|
167
|
+
if (isPermissionPresent) {
|
|
168
|
+
if (isDtoPresent) {
|
|
169
|
+
const intersection = (0, _type_1.arrayIntersection)(permissionFilter, dtoFilter);
|
|
170
|
+
result.include[propertyName] =
|
|
171
|
+
intersection.length > 0 ? intersection : emptyValue;
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
// no dto filter → use full permission filter
|
|
175
|
+
result.include[propertyName] = permissionFilter;
|
|
176
|
+
}
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
// --------- CASE 3: No permission restriction → use dto filter ----------
|
|
180
|
+
result.include[propertyName] = dtoFilter;
|
|
181
|
+
}
|
|
182
|
+
return result;
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
exports.getPropertyFilterByPermissionFn = getPropertyFilterByPermissionFn;
|
|
186
|
+
/**
|
|
187
|
+
* Returns the list of duplicate values from an array.
|
|
188
|
+
*
|
|
189
|
+
* @template T - The type of elements in the array.
|
|
190
|
+
*
|
|
191
|
+
* @param {T[]} arr - The array to check for duplicates.
|
|
192
|
+
*
|
|
193
|
+
* @returns {T[]} An array containing the values that appear more than once.
|
|
194
|
+
* Each duplicate value is included only once.
|
|
195
|
+
*
|
|
196
|
+
* @description
|
|
197
|
+
* This function scans the array and counts occurrences of each value using a Map.
|
|
198
|
+
* Any value with a count greater than 1 is considered a duplicate.
|
|
199
|
+
*
|
|
200
|
+
* @example
|
|
201
|
+
* getDuplicates([1, 2, 2, 3, 3, 3]);
|
|
202
|
+
* // Returns: [2, 3]
|
|
203
|
+
*
|
|
204
|
+
* @example
|
|
205
|
+
* getDuplicates(['a', 'b', 'b', 'c']);
|
|
206
|
+
* // Returns: ['b']
|
|
207
|
+
*
|
|
208
|
+
* @remarks
|
|
209
|
+
* - Works with all primitive types: number, string, boolean, undefined, null.
|
|
210
|
+
* - For objects, duplicates are based on **reference equality**, not deep equality.
|
|
211
|
+
*/
|
|
212
|
+
function getDuplicates(arr) {
|
|
213
|
+
const countMap = new Map();
|
|
214
|
+
for (const item of arr) {
|
|
215
|
+
countMap.set(item, (countMap.get(item) || 0) + 1);
|
|
216
|
+
}
|
|
217
|
+
const duplicates = [];
|
|
218
|
+
for (const [value, count] of countMap.entries()) {
|
|
219
|
+
if (count > 1)
|
|
220
|
+
duplicates.push(value);
|
|
221
|
+
}
|
|
222
|
+
return duplicates;
|
|
223
|
+
}
|
|
224
|
+
exports.getDuplicates = getDuplicates;
|
|
225
|
+
function getConsoleLog(entity, propertyName) {
|
|
226
|
+
console.log(propertyName, entity[propertyName]);
|
|
227
|
+
}
|
|
228
|
+
exports.getConsoleLog = getConsoleLog;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CorporateActionsType } from "
|
|
1
|
+
import { CorporateActionsType } from "../enum/corporate-actions/corporate-actions-type.enum";
|
|
2
2
|
export declare class ValidateUtils {
|
|
3
3
|
static validateCorporateActionType(corporateActionType: CorporateActionsType, expectedType: CorporateActionsType): void;
|
|
4
4
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ia-common",
|
|
3
|
-
"version": "1.1.1-beta.
|
|
3
|
+
"version": "1.1.1-beta.21",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
"scripts": {
|
|
11
11
|
"clean": "rm -rf build",
|
|
12
12
|
"build": "npm run clean && tsc",
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
13
|
+
"publish:beta": "npm version prerelease --preid beta && git push && npm run build && npm publish --tag beta",
|
|
14
|
+
"publish:patch": "npm version patch && git push && npm run build && npm publish",
|
|
15
|
+
"publish:minor": "npm version minor && git push && npm run build && npm publish",
|
|
16
16
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
17
17
|
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" 2>&1| tee eslint.log",
|
|
18
18
|
"lint:fix": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UserType = void 0;
|
|
4
|
-
var UserType;
|
|
5
|
-
(function (UserType) {
|
|
6
|
-
UserType["USER"] = "user";
|
|
7
|
-
UserType["ADVISOR"] = "advisor";
|
|
8
|
-
UserType["SUPERADMIN"] = "superadmin";
|
|
9
|
-
UserType["BOT_USER"] = "bot_user";
|
|
10
|
-
UserType["PUBLIC_USER"] = "public_user";
|
|
11
|
-
UserType["ADVISOR_CLIENT"] = "advisor_client";
|
|
12
|
-
UserType["STAFF"] = "staff";
|
|
13
|
-
})(UserType || (exports.UserType = UserType = {}));
|