rez_core 2.2.158 → 2.2.161
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/module/auth/strategies/google.strategy.js +6 -1
- package/dist/module/auth/strategies/google.strategy.js.map +1 -1
- package/dist/module/auth/strategies/jwt.strategy.js +1 -1
- package/dist/module/auth/strategies/jwt.strategy.js.map +1 -1
- package/dist/module/communication/communication.module.js +13 -2
- package/dist/module/communication/communication.module.js.map +1 -1
- package/dist/module/communication/controller/communication.controller.js.map +1 -1
- package/dist/module/communication/dto/create-config.dto.js +11 -1
- package/dist/module/communication/dto/create-config.dto.js.map +1 -1
- package/dist/module/communication/entity/communication-config.entity.js.map +1 -1
- package/dist/module/communication/entity/communication-hub.entity.js +11 -1
- package/dist/module/communication/entity/communication-hub.entity.js.map +1 -1
- package/dist/module/communication/examples/usage.example.js +9 -9
- package/dist/module/communication/examples/usage.example.js.map +1 -1
- package/dist/module/communication/factories/communication.factory.js +4 -4
- package/dist/module/communication/factories/communication.factory.js.map +1 -1
- package/dist/module/communication/factories/email.factory.js +1 -1
- package/dist/module/communication/factories/email.factory.js.map +1 -1
- package/dist/module/communication/factories/sms.factory.js +1 -1
- package/dist/module/communication/factories/sms.factory.js.map +1 -1
- package/dist/module/communication/factories/telephone.factory.js +2 -4
- package/dist/module/communication/factories/telephone.factory.js.map +1 -1
- package/dist/module/communication/factories/whatsapp.factory.js +2 -4
- package/dist/module/communication/factories/whatsapp.factory.js.map +1 -1
- package/dist/module/communication/service/communication-queue.service.d.ts +40 -0
- package/dist/module/communication/service/communication-queue.service.js +147 -0
- package/dist/module/communication/service/communication-queue.service.js.map +1 -0
- package/dist/module/communication/service/communication.service.d.ts +34 -2
- package/dist/module/communication/service/communication.service.js +149 -36
- package/dist/module/communication/service/communication.service.js.map +1 -1
- package/dist/module/communication/service/oauth.service.js +25 -20
- package/dist/module/communication/service/oauth.service.js.map +1 -1
- package/dist/module/communication/strategies/communication.strategy.d.ts +1 -0
- package/dist/module/communication/strategies/email/gmail-api.strategy.js +16 -7
- package/dist/module/communication/strategies/email/gmail-api.strategy.js.map +1 -1
- package/dist/module/communication/strategies/gmail-smtp.strategy.js +2 -3
- package/dist/module/communication/strategies/gmail-smtp.strategy.js.map +1 -1
- package/dist/module/communication/strategies/gmail.strategy.js +20 -1
- package/dist/module/communication/strategies/gmail.strategy.js.map +1 -1
- package/dist/module/communication/strategies/knowlarity.strategy.js +20 -14
- package/dist/module/communication/strategies/knowlarity.strategy.js.map +1 -1
- package/dist/module/communication/strategies/outlook-smtp.strategy.js +2 -3
- package/dist/module/communication/strategies/outlook-smtp.strategy.js.map +1 -1
- package/dist/module/communication/strategies/outlook.strategy.js +1 -1
- package/dist/module/communication/strategies/outlook.strategy.js.map +1 -1
- package/dist/module/communication/strategies/sms.strategy.js +1 -3
- package/dist/module/communication/strategies/sms.strategy.js.map +1 -1
- package/dist/module/communication/strategies/whatsapp.strategy.js +1 -2
- package/dist/module/communication/strategies/whatsapp.strategy.js.map +1 -1
- package/dist/module/dashboard/dashboard.module.js +1 -1
- package/dist/module/dashboard/repository/dashboard.repository.js.map +1 -1
- package/dist/module/dashboard/service/dashboard.service.js +3 -3
- package/dist/module/dashboard/service/dashboard.service.js.map +1 -1
- package/dist/module/enterprise/repository/organization.repository.js.map +1 -1
- package/dist/module/filter/entity/saved-filter-master.entity.d.ts +1 -1
- package/dist/module/filter/service/filter.service.js +3 -3
- package/dist/module/filter/service/filter.service.js.map +1 -1
- package/dist/module/filter/service/saved-filter.service.js.map +1 -1
- package/dist/module/layout/controller/layout.controller.js +1 -1
- package/dist/module/layout/controller/layout.controller.js.map +1 -1
- package/dist/module/layout/repository/header-section.repository.js.map +1 -1
- package/dist/module/layout/service/header-section.service.js +2 -2
- package/dist/module/layout/service/header-section.service.js.map +1 -1
- package/dist/module/layout_preference/repository/layout_preference.repository.js +1 -1
- package/dist/module/layout_preference/service/layout_preference.service.js +1 -1
- package/dist/module/layout_preference/service/layout_preference.service.js.map +1 -1
- package/dist/module/listmaster/controller/list-master.controller.js +1 -1
- package/dist/module/listmaster/controller/list-master.controller.js.map +1 -1
- package/dist/module/listmaster/repository/list-master.repository.js.map +1 -1
- package/dist/module/listmaster/service/list-master.service.js +2 -2
- package/dist/module/listmaster/service/list-master.service.js.map +1 -1
- package/dist/module/master/controller/master.controller.js +2 -2
- package/dist/module/master/controller/master.controller.js.map +1 -1
- package/dist/module/master/service/master.service.js +1 -1
- package/dist/module/master/service/master.service.js.map +1 -1
- package/dist/module/meta/controller/attribute-master.controller.js +3 -3
- package/dist/module/meta/controller/attribute-master.controller.js.map +1 -1
- package/dist/module/meta/controller/entity-dynamic.controller.js +1 -1
- package/dist/module/meta/controller/entity-dynamic.controller.js.map +1 -1
- package/dist/module/meta/controller/entity.controller.js +2 -2
- package/dist/module/meta/controller/entity.controller.js.map +1 -1
- package/dist/module/meta/controller/media.controller.js +1 -1
- package/dist/module/meta/controller/media.controller.js.map +1 -1
- package/dist/module/meta/controller/meta.controller.js +1 -1
- package/dist/module/meta/controller/meta.controller.js.map +1 -1
- package/dist/module/meta/dto/entity-table.dto.js.map +1 -1
- package/dist/module/meta/entity/entity-master.entity.d.ts +1 -0
- package/dist/module/meta/entity/entity-master.entity.js +4 -0
- package/dist/module/meta/entity/entity-master.entity.js.map +1 -1
- package/dist/module/meta/entity/entity-table.entity.js.map +1 -1
- package/dist/module/meta/service/entity-dynamic.service.js +1 -1
- package/dist/module/meta/service/entity-dynamic.service.js.map +1 -1
- package/dist/module/meta/service/entity-list.service.js +11 -11
- package/dist/module/meta/service/entity-list.service.js.map +1 -1
- package/dist/module/meta/service/entity-service-impl.service.js +2 -2
- package/dist/module/meta/service/entity-service-impl.service.js.map +1 -1
- package/dist/module/meta/service/entity-table-column.service.js +3 -3
- package/dist/module/meta/service/entity-table-column.service.js.map +1 -1
- package/dist/module/meta/service/entity-table.service.js +2 -2
- package/dist/module/meta/service/entity-table.service.js.map +1 -1
- package/dist/module/meta/service/media-data.service.js +3 -3
- package/dist/module/meta/service/media-data.service.js.map +1 -1
- package/dist/module/meta/service/update-form-json.service.d.ts +3 -3
- package/dist/module/meta/service/update-form-json.service.js +1 -1
- package/dist/module/meta/service/update-form-json.service.js.map +1 -1
- package/dist/module/module/controller/menu.controller.js.map +1 -1
- package/dist/module/module/controller/module-access.controller.js +1 -1
- package/dist/module/module/controller/module-access.controller.js.map +1 -1
- package/dist/module/module/entity/module-access.entity.js.map +1 -1
- package/dist/module/module/entity/module.entity.js.map +1 -1
- package/dist/module/module/service/module-access.service.d.ts +1 -1
- package/dist/module/module/service/module-access.service.js +1 -1
- package/dist/module/module/service/module-access.service.js.map +1 -1
- package/dist/module/notification/controller/otp.controller.js +3 -3
- package/dist/module/notification/controller/otp.controller.js.map +1 -1
- package/dist/module/notification/service/email.service.js +2 -2
- package/dist/module/notification/service/email.service.js.map +1 -1
- package/dist/module/notification/service/otp.service.js +1 -1
- package/dist/module/notification/service/otp.service.js.map +1 -1
- package/dist/module/user/controller/login.controller.js +4 -2
- package/dist/module/user/controller/login.controller.js.map +1 -1
- package/dist/module/user/service/login.service.js +3 -3
- package/dist/module/user/service/login.service.js.map +1 -1
- package/dist/module/user/service/role.service.js +1 -1
- package/dist/module/user/service/role.service.js.map +1 -1
- package/dist/module/user/service/user.service.js +5 -5
- package/dist/module/user/service/user.service.js.map +1 -1
- package/dist/module/workflow/controller/workflow-meta.controller.d.ts +1 -1
- package/dist/module/workflow/controller/workflow-meta.controller.js +7 -5
- package/dist/module/workflow/controller/workflow-meta.controller.js.map +1 -1
- package/dist/module/workflow/service/action.service.js +3 -3
- package/dist/module/workflow/service/action.service.js.map +1 -1
- package/dist/module/workflow/service/stage-group.service.js +1 -1
- package/dist/module/workflow/service/stage-group.service.js.map +1 -1
- package/dist/module/workflow/service/task.service.js +1 -0
- package/dist/module/workflow/service/task.service.js.map +1 -1
- package/dist/module/workflow/service/workflow-meta.service.d.ts +1 -1
- package/dist/module/workflow/service/workflow-meta.service.js +14 -14
- package/dist/module/workflow/service/workflow-meta.service.js.map +1 -1
- package/dist/resources/properties.module.js +2 -2
- package/dist/resources/properties.module.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utils/service/base64util.service.js.map +1 -1
- package/dist/utils/service/clockIDGenUtil.service.js.map +1 -1
- package/dist/utils/service/dateUtil.service.js +1 -1
- package/dist/utils/service/dateUtil.service.js.map +1 -1
- package/dist/utils/service/encryptUtil.service.js +4 -4
- package/dist/utils/service/encryptUtil.service.js.map +1 -1
- package/dist/utils/service/excel-helper.service.js +4 -1
- package/dist/utils/service/excel-helper.service.js.map +1 -1
- package/dist/utils/service/json-util.service.js.map +1 -1
- package/dist/utils/service/loggingUtil.service.js +3 -3
- package/dist/utils/service/loggingUtil.service.js.map +1 -1
- package/package.json +1 -1
- package/src/decorators/roles.decorator.ts +1 -1
- package/src/module/auth/strategies/google.strategy.ts +6 -1
- package/src/module/auth/strategies/jwt.strategy.ts +1 -1
- package/src/module/communication/communication.module.ts +13 -2
- package/src/module/communication/controller/communication.controller.ts +21 -18
- package/src/module/communication/dto/create-config.dto.ts +32 -13
- package/src/module/communication/entity/communication-config.entity.ts +15 -9
- package/src/module/communication/entity/communication-hub.entity.ts +29 -3
- package/src/module/communication/examples/usage.example.ts +18 -17
- package/src/module/communication/factories/communication.factory.ts +36 -18
- package/src/module/communication/factories/email.factory.ts +8 -5
- package/src/module/communication/factories/sms.factory.ts +8 -5
- package/src/module/communication/factories/telephone.factory.ts +9 -8
- package/src/module/communication/factories/whatsapp.factory.ts +9 -8
- package/src/module/communication/service/communication-queue.service.ts +214 -0
- package/src/module/communication/service/communication.service.ts +381 -112
- package/src/module/communication/service/oauth.service.ts +67 -46
- package/src/module/communication/strategies/communication.strategy.ts +1 -0
- package/src/module/communication/strategies/email/gmail-api.strategy.ts +44 -24
- package/src/module/communication/strategies/gmail-smtp.strategy.ts +15 -11
- package/src/module/communication/strategies/gmail.strategy.ts +42 -7
- package/src/module/communication/strategies/knowlarity.strategy.ts +67 -33
- package/src/module/communication/strategies/outlook-smtp.strategy.ts +15 -11
- package/src/module/communication/strategies/outlook.strategy.ts +12 -5
- package/src/module/communication/strategies/sms.strategy.ts +13 -10
- package/src/module/communication/strategies/whatsapp.strategy.ts +13 -9
- package/src/module/dashboard/dashboard.module.ts +1 -1
- package/src/module/dashboard/repository/dashboard.repository.ts +4 -2
- package/src/module/dashboard/service/dashboard.service.ts +16 -12
- package/src/module/enterprise/repository/organization.repository.ts +3 -1
- package/src/module/enterprise/service/enterprise.service.ts +2 -2
- package/src/module/filter/entity/saved-filter-master.entity.ts +3 -3
- package/src/module/filter/service/filter.service.ts +3 -3
- package/src/module/filter/service/saved-filter.service.ts +1 -1
- package/src/module/layout/controller/layout.controller.ts +1 -1
- package/src/module/layout/repository/header-section.repository.ts +2 -2
- package/src/module/layout/service/header-section.service.ts +2 -3
- package/src/module/layout_preference/repository/layout_preference.repository.ts +2 -2
- package/src/module/layout_preference/service/layout_preference.service.ts +1 -1
- package/src/module/listmaster/controller/list-master.controller.ts +1 -1
- package/src/module/listmaster/repository/list-master.repository.ts +2 -2
- package/src/module/listmaster/service/list-master.service.ts +2 -2
- package/src/module/master/controller/master.controller.ts +2 -2
- package/src/module/master/service/master.service.ts +1 -1
- package/src/module/meta/controller/attribute-master.controller.ts +3 -3
- package/src/module/meta/controller/entity-dynamic.controller.ts +1 -1
- package/src/module/meta/controller/entity.controller.ts +2 -2
- package/src/module/meta/controller/media.controller.ts +1 -1
- package/src/module/meta/controller/meta.controller.ts +1 -1
- package/src/module/meta/dto/entity-tab.dto.ts +4 -4
- package/src/module/meta/dto/entity-table.dto.ts +5 -6
- package/src/module/meta/entity/entity-master.entity.ts +3 -0
- package/src/module/meta/entity/entity-table.entity.ts +1 -2
- package/src/module/meta/service/entity-dynamic.service.ts +1 -1
- package/src/module/meta/service/entity-list.service.ts +18 -14
- package/src/module/meta/service/entity-service-impl.service.ts +2 -2
- package/src/module/meta/service/entity-table-column.service.ts +3 -3
- package/src/module/meta/service/entity-table.service.ts +2 -2
- package/src/module/meta/service/entity.service.ts +1 -1
- package/src/module/meta/service/media-data.service.ts +3 -3
- package/src/module/meta/service/update-form-json.service.ts +17 -26
- package/src/module/module/controller/menu.controller.ts +0 -1
- package/src/module/module/controller/module-access.controller.ts +2 -3
- package/src/module/module/entity/menu.entity.ts +1 -1
- package/src/module/module/entity/module-access.entity.ts +6 -6
- package/src/module/module/entity/module-action.entity.ts +2 -2
- package/src/module/module/entity/module.entity.ts +0 -1
- package/src/module/module/service/module-access.service.ts +7 -8
- package/src/module/notification/controller/otp.controller.ts +10 -4
- package/src/module/notification/repository/otp.repository.ts +1 -1
- package/src/module/notification/service/email.service.ts +2 -2
- package/src/module/notification/service/otp.service.ts +8 -3
- package/src/module/third-party-module/third-party.module.ts +1 -1
- package/src/module/user/controller/login.controller.ts +27 -12
- package/src/module/user/service/login.service.ts +27 -27
- package/src/module/user/service/role.service.ts +1 -1
- package/src/module/user/service/user.service.ts +5 -5
- package/src/module/workflow/controller/workflow-meta.controller.ts +5 -1
- package/src/module/workflow/service/action.service.ts +3 -3
- package/src/module/workflow/service/stage-group.service.ts +1 -1
- package/src/module/workflow/service/task.service.ts +1 -0
- package/src/module/workflow/service/workflow-meta.service.ts +19 -18
- package/src/resources/properties.module.ts +10 -10
- package/src/utils/dto/excel-data.dto.ts +2 -2
- package/src/utils/dto/excelsheet-data.dto.ts +3 -3
- package/src/utils/service/base64util.service.ts +16 -17
- package/src/utils/service/clockIDGenUtil.service.ts +15 -13
- package/src/utils/service/dateUtil.service.ts +6 -6
- package/src/utils/service/encryptUtil.service.ts +4 -4
- package/src/utils/service/excel-helper.service.ts +4 -1
- package/src/utils/service/file-util.service.ts +2 -2
- package/src/utils/service/json-util.service.ts +19 -19
- package/src/utils/service/loggingUtil.service.ts +4 -4
|
@@ -133,7 +133,7 @@ export class ActionService extends EntityServiceImpl {
|
|
|
133
133
|
};
|
|
134
134
|
|
|
135
135
|
// Pass only actionData (without template) to super.updateEntity
|
|
136
|
-
|
|
136
|
+
const action = await super.updateEntity({ ...actionData }, loggedInUser);
|
|
137
137
|
|
|
138
138
|
if (!action) {
|
|
139
139
|
throw new Error('Action not found or could not be updated');
|
|
@@ -145,14 +145,14 @@ export class ActionService extends EntityServiceImpl {
|
|
|
145
145
|
);
|
|
146
146
|
|
|
147
147
|
// stage mapping
|
|
148
|
-
|
|
148
|
+
const stageActionMapping = {
|
|
149
149
|
action_id: action.id,
|
|
150
150
|
stage_id: stage_id,
|
|
151
151
|
entity_type: 'WFSA',
|
|
152
152
|
id: stageMapID.length > 0 ? stageMapID[0].id : null,
|
|
153
153
|
} as any;
|
|
154
154
|
|
|
155
|
-
|
|
155
|
+
const stageActionMappingData = await super.updateEntity(
|
|
156
156
|
stageActionMapping,
|
|
157
157
|
loggedInUser,
|
|
158
158
|
);
|
|
@@ -216,7 +216,7 @@ export class StageGroupService extends EntityServiceImpl {
|
|
|
216
216
|
|
|
217
217
|
if (user.length === 0) return null;
|
|
218
218
|
|
|
219
|
-
|
|
219
|
+
const profileImageId = user[0].profile_image;
|
|
220
220
|
let profile: any = null;
|
|
221
221
|
|
|
222
222
|
if (profileImageId) {
|
|
@@ -56,7 +56,7 @@ export class WorkflowMetaService extends EntityServiceImpl {
|
|
|
56
56
|
loggedInUser: UserData,
|
|
57
57
|
): Promise<any | null> {
|
|
58
58
|
// Try to find the current stage movement entry
|
|
59
|
-
|
|
59
|
+
const currentStage = await this.stageMovementRepo.findOne({
|
|
60
60
|
where: {
|
|
61
61
|
mapped_entity_type,
|
|
62
62
|
mapped_entity_id,
|
|
@@ -114,6 +114,8 @@ export class WorkflowMetaService extends EntityServiceImpl {
|
|
|
114
114
|
mapped_entity_type: string,
|
|
115
115
|
mapped_entity_id: number,
|
|
116
116
|
loggedInUser: UserData,
|
|
117
|
+
reason_code?: string,
|
|
118
|
+
remark?: string,
|
|
117
119
|
): Promise<string> {
|
|
118
120
|
const now = new Date();
|
|
119
121
|
let currentStage = await this.getCurrentStage(
|
|
@@ -153,19 +155,6 @@ export class WorkflowMetaService extends EntityServiceImpl {
|
|
|
153
155
|
mapped_entity_id,
|
|
154
156
|
mapped_entity_type,
|
|
155
157
|
);
|
|
156
|
-
|
|
157
|
-
await this.taskService.createSystemNote(
|
|
158
|
-
{
|
|
159
|
-
reason_code: firstStage.reason_code,
|
|
160
|
-
remark: firstStage.remark,
|
|
161
|
-
mapped_entity_id,
|
|
162
|
-
stage_id: firstStage.id,
|
|
163
|
-
action_id: firstStage.id,
|
|
164
|
-
stage_group_id: stageGroup.id,
|
|
165
|
-
},
|
|
166
|
-
loggedInUser,
|
|
167
|
-
);
|
|
168
|
-
|
|
169
158
|
return `Initialized workflow with first stage (Stage ID: ${firstStage.id}).`;
|
|
170
159
|
}
|
|
171
160
|
|
|
@@ -255,6 +244,18 @@ export class WorkflowMetaService extends EntityServiceImpl {
|
|
|
255
244
|
currentStage.is_current = 'N';
|
|
256
245
|
await this.stageMovementRepo.save(currentStage);
|
|
257
246
|
|
|
247
|
+
await this.taskService.createSystemNote(
|
|
248
|
+
{
|
|
249
|
+
reason_code: reason_code || '',
|
|
250
|
+
remark: remark || '',
|
|
251
|
+
mapped_entity_id,
|
|
252
|
+
stage_id: currentStage.stage_id,
|
|
253
|
+
action_id: currentStage.action_id,
|
|
254
|
+
stage_group_id: currentStage.stage_group_id,
|
|
255
|
+
},
|
|
256
|
+
loggedInUser,
|
|
257
|
+
);
|
|
258
|
+
|
|
258
259
|
return 'Workflow completed. No next stage available.';
|
|
259
260
|
}
|
|
260
261
|
|
|
@@ -274,11 +275,11 @@ export class WorkflowMetaService extends EntityServiceImpl {
|
|
|
274
275
|
|
|
275
276
|
// check whether first action's action_category is owner_assignment and assignment_type is AUTO_ASSIGN
|
|
276
277
|
const firstAction = actions[0];
|
|
277
|
-
|
|
278
|
+
const actionCategory = await this.dataSource.query(
|
|
278
279
|
`SELECT code FROM cr_wf_action_category WHERE id = ${Number(firstAction.action_category)}`,
|
|
279
280
|
);
|
|
280
281
|
|
|
281
|
-
|
|
282
|
+
const assignmentType = await this.dataSource.query(
|
|
282
283
|
`SELECT value FROM cr_list_master_items WHERE id = ${Number(firstAction.assignment_type)}`,
|
|
283
284
|
);
|
|
284
285
|
|
|
@@ -314,8 +315,8 @@ export class WorkflowMetaService extends EntityServiceImpl {
|
|
|
314
315
|
}
|
|
315
316
|
|
|
316
317
|
async updateLeadOwner(entityData, loggedInUser) {
|
|
317
|
-
|
|
318
|
-
|
|
318
|
+
const { lead_id, lead_owner, stage_id, entity_type } = entityData;
|
|
319
|
+
const updatedData = {
|
|
319
320
|
id: lead_id,
|
|
320
321
|
lead_owner: lead_owner,
|
|
321
322
|
entity_type: entity_type,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Module } from
|
|
2
|
-
import { ConfigModule } from
|
|
3
|
-
import propertiesYaml from
|
|
1
|
+
import { Module } from '@nestjs/common';
|
|
2
|
+
import { ConfigModule } from '@nestjs/config';
|
|
3
|
+
import propertiesYaml from './properties.yaml';
|
|
4
4
|
@Module({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
imports: [
|
|
6
|
+
ConfigModule.forRoot({
|
|
7
|
+
load: [propertiesYaml],
|
|
8
|
+
isGlobal: true,
|
|
9
|
+
}),
|
|
10
|
+
],
|
|
11
11
|
})
|
|
12
|
-
export default class Properties {
|
|
12
|
+
export default class Properties {}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExcelsheetData } from './excelsheet-data.dto';
|
|
2
2
|
|
|
3
|
-
export class ExcelData{
|
|
3
|
+
export class ExcelData {
|
|
4
4
|
filePath: string;
|
|
5
5
|
sheetList: ExcelsheetData[] = [];
|
|
6
6
|
|
|
@@ -11,4 +11,4 @@ export class ExcelData{
|
|
|
11
11
|
addSheetAt(sheetData: ExcelsheetData, position: number) {
|
|
12
12
|
this.sheetList.splice(position, 0, sheetData);
|
|
13
13
|
}
|
|
14
|
-
}
|
|
14
|
+
}
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
export class Base64Util{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export class Base64Util {
|
|
2
|
+
static encode(byteArray: Uint8Array): string {
|
|
3
|
+
return Buffer.from(byteArray).toString('base64');
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
static decode(base64String: string): Uint8Array {
|
|
7
|
+
if (typeof Buffer !== 'undefined') {
|
|
8
|
+
return Uint8Array.from(Buffer.from(base64String, 'base64'));
|
|
5
9
|
}
|
|
6
10
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
byteArray[i] = binaryString.charCodeAt(i);
|
|
16
|
-
}
|
|
17
|
-
return byteArray;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
11
|
+
const binaryString = atob(base64String);
|
|
12
|
+
const byteArray = new Uint8Array(binaryString.length);
|
|
13
|
+
for (let i = 0; i < binaryString.length; i++) {
|
|
14
|
+
byteArray[i] = binaryString.charCodeAt(i);
|
|
15
|
+
}
|
|
16
|
+
return byteArray;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -2,18 +2,20 @@ import { Injectable } from '@nestjs/common';
|
|
|
2
2
|
|
|
3
3
|
@Injectable()
|
|
4
4
|
export class ClockIDGenService {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
private _counter = 0n;
|
|
6
|
+
private timestampBits = 42;
|
|
7
|
+
private timestampMask = BigInt(
|
|
8
|
+
Math.floor(Math.pow(2, this.timestampBits)) - 1,
|
|
9
|
+
);
|
|
10
|
+
private counterBits = 10;
|
|
11
|
+
private counterMask = BigInt(Math.floor(Math.pow(2, this.counterBits)) - 1);
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
idGenerator(prefix?: string): string {
|
|
14
|
+
const timestamp = BigInt(Date.now()) & this.timestampMask;
|
|
15
|
+
const counter = BigInt(this._counter++) & this.counterMask;
|
|
16
|
+
let now = timestamp << BigInt(this.counterBits);
|
|
17
|
+
now = now | counter;
|
|
18
|
+
const id = now.toString(36).toUpperCase();
|
|
19
|
+
return prefix ? prefix + id : id;
|
|
20
|
+
}
|
|
19
21
|
}
|
|
@@ -4,12 +4,12 @@ import { Injectable } from '@nestjs/common';
|
|
|
4
4
|
export class DateUtil {
|
|
5
5
|
static formatDate(date: Date, format: string): string {
|
|
6
6
|
const map: { [key: string]: string } = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
dd: String(date.getDate()).padStart(2, '0'),
|
|
8
|
+
MM: String(date.getMonth() + 1).padStart(2, '0'),
|
|
9
|
+
yyyy: String(date.getFullYear()),
|
|
10
|
+
HH: String(date.getHours()).padStart(2, '0'),
|
|
11
|
+
mm: String(date.getMinutes()).padStart(2, '0'),
|
|
12
|
+
ss: String(date.getSeconds()).padStart(2, '0'),
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
return format.replace(/dd|MM|yyyy|HH|mm|ss/g, (matched) => map[matched]);
|
|
@@ -11,7 +11,7 @@ export class EncryptUtilService {
|
|
|
11
11
|
static encryptGCM(data: any, Datakey: string, Dataiv: string) {
|
|
12
12
|
try {
|
|
13
13
|
const cipher = crypto.createCipheriv('aes-256-gcm', Datakey, Dataiv);
|
|
14
|
-
|
|
14
|
+
const encrypted = Buffer.concat([
|
|
15
15
|
cipher.update(data, 'utf8'),
|
|
16
16
|
cipher.final(),
|
|
17
17
|
]);
|
|
@@ -29,7 +29,7 @@ export class EncryptUtilService {
|
|
|
29
29
|
const tag = data.slice(data.length - 16);
|
|
30
30
|
decipher.setAuthTag(tag);
|
|
31
31
|
data = data.slice(0, data.length - 16);
|
|
32
|
-
|
|
32
|
+
const decrypted = decipher.update(data, 'utf8') + decipher.final('utf8');
|
|
33
33
|
return decrypted;
|
|
34
34
|
} catch (error) {
|
|
35
35
|
throw new InternalServerErrorException('Decryption process failed');
|
|
@@ -39,7 +39,7 @@ export class EncryptUtilService {
|
|
|
39
39
|
static encryptCBC(data: any, Datakey: any, Dataiv: any) {
|
|
40
40
|
let encryptedRequest;
|
|
41
41
|
try {
|
|
42
|
-
|
|
42
|
+
const cipher = CryptoJS.AES.encrypt(data, Datakey, {
|
|
43
43
|
iv: Dataiv,
|
|
44
44
|
mode: CryptoJS.mode.CBC,
|
|
45
45
|
});
|
|
@@ -54,7 +54,7 @@ export class EncryptUtilService {
|
|
|
54
54
|
static decryptCBC(data: any, Datakey: any, Dataiv: any) {
|
|
55
55
|
let decryptRequest;
|
|
56
56
|
try {
|
|
57
|
-
|
|
57
|
+
const cipher = CryptoJS.AES.decrypt(data, Datakey, {
|
|
58
58
|
iv: Dataiv,
|
|
59
59
|
mode: CryptoJS.mode.CBC,
|
|
60
60
|
});
|
|
@@ -60,7 +60,10 @@ export class ExcelHelper {
|
|
|
60
60
|
const wb = XLSX.utils.book_new();
|
|
61
61
|
|
|
62
62
|
for (const sheetData of excelData.sheetList) {
|
|
63
|
-
const ws = XLSX.utils.aoa_to_sheet([
|
|
63
|
+
const ws = XLSX.utils.aoa_to_sheet([
|
|
64
|
+
sheetData.headers,
|
|
65
|
+
...sheetData.rowList,
|
|
66
|
+
]);
|
|
64
67
|
XLSX.utils.book_append_sheet(wb, ws, sheetData.sheetName || 'Sheet1');
|
|
65
68
|
}
|
|
66
69
|
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
export class JsonUtil{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const mergedNode: any = {};
|
|
1
|
+
export class JsonUtil {
|
|
2
|
+
static merge(mainNode: any, updatedNode: any): any {
|
|
3
|
+
if (typeof mainNode !== 'object' || typeof updatedNode !== 'object') {
|
|
4
|
+
return updatedNode;
|
|
5
|
+
}
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
if (updatedNode.hasOwnProperty(key)) {
|
|
11
|
-
mergedNode[key] = this.merge(mainNode[key], updatedNode[key]);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
7
|
+
const mergedNode: any = {};
|
|
14
8
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
9
|
+
for (const key in updatedNode) {
|
|
10
|
+
if (updatedNode.hasOwnProperty(key)) {
|
|
11
|
+
mergedNode[key] = this.merge(mainNode[key], updatedNode[key]);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
20
14
|
|
|
21
|
-
|
|
15
|
+
for (const key in mainNode) {
|
|
16
|
+
if (mainNode.hasOwnProperty(key) && !updatedNode.hasOwnProperty(key)) {
|
|
17
|
+
mergedNode[key] = mainNode[key];
|
|
18
|
+
}
|
|
22
19
|
}
|
|
23
|
-
|
|
20
|
+
|
|
21
|
+
return mergedNode;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -16,8 +16,8 @@ export class LoggingService {
|
|
|
16
16
|
parameters?: unknown[],
|
|
17
17
|
debuginfo?: unknown[],
|
|
18
18
|
) {
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
const levelInfo = level.toLowerCase().trim();
|
|
20
|
+
const logger = new Logger(serviceName);
|
|
21
21
|
|
|
22
22
|
const fileConfiguration = {
|
|
23
23
|
format: winston.format.combine(
|
|
@@ -39,7 +39,7 @@ export class LoggingService {
|
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
const filelogger = winston.createLogger(fileConfiguration);
|
|
42
|
-
|
|
42
|
+
const data = `${message} -- Parameters: ${JSON.stringify(parameters)}`;
|
|
43
43
|
|
|
44
44
|
if (levelInfo == 'debug' || levelInfo == 'info') {
|
|
45
45
|
logger.debug(
|
|
@@ -53,4 +53,4 @@ export class LoggingService {
|
|
|
53
53
|
filelogger.on('finish', () => {});
|
|
54
54
|
filelogger.end();
|
|
55
55
|
}
|
|
56
|
-
}
|
|
56
|
+
}
|