rez_core 4.0.200 → 4.0.202
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/.prettierrc +3 -3
- package/README.md +99 -99
- package/dist/config/config.module.js +2 -2
- package/dist/config/config.module.js.map +1 -1
- package/dist/config/database.config.d.ts +1 -1
- package/dist/config/database.config.js +11 -15
- package/dist/config/database.config.js.map +1 -1
- package/dist/core.module.js +3 -0
- package/dist/core.module.js.map +1 -1
- package/dist/module/auth/guards/role.guard.js +3 -3
- package/dist/module/auth/services/auth.service.js +3 -3
- package/dist/module/auth/services/auth.service.js.map +1 -1
- package/dist/module/enterprise/entity/organization.entity.js +1 -1
- package/dist/module/enterprise/repository/school.repository.js +3 -3
- package/dist/module/enterprise/repository/school.repository.js.map +1 -1
- package/dist/module/entity_json/controller/entity_json.controller.d.ts +11 -1
- package/dist/module/entity_json/controller/entity_json.controller.js +14 -0
- package/dist/module/entity_json/controller/entity_json.controller.js.map +1 -1
- package/dist/module/entity_json/entity/entityJson.entity.d.ts +10 -0
- package/dist/module/entity_json/entity/entityJson.entity.js +55 -0
- package/dist/module/entity_json/entity/entityJson.entity.js.map +1 -0
- package/dist/module/entity_json/entity_json.module.js +2 -1
- package/dist/module/entity_json/entity_json.module.js.map +1 -1
- package/dist/module/entity_json/service/entity_json.service.d.ts +11 -3
- package/dist/module/entity_json/service/entity_json.service.js +93 -50
- package/dist/module/entity_json/service/entity_json.service.js.map +1 -1
- package/dist/module/filter/repository/saved-filter.repository.js +4 -4
- package/dist/module/filter/service/filter-evaluator.service.js +3 -3
- package/dist/module/filter/service/filter-evaluator.service.js.map +1 -1
- package/dist/module/filter/service/filter.service.d.ts +1 -4
- package/dist/module/filter/service/filter.service.js +39 -69
- package/dist/module/filter/service/filter.service.js.map +1 -1
- package/dist/module/integration/entity/integration-config.entity.js +6 -6
- package/dist/module/integration/entity/integration-config.entity.js.map +1 -1
- package/dist/module/integration/entity/integration-entity-mapper.entity.js +1 -1
- package/dist/module/integration/entity/integration-entity-mapper.entity.js.map +1 -1
- package/dist/module/integration/entity/integration-source.entity.js +4 -4
- package/dist/module/integration/entity/integration-source.entity.js.map +1 -1
- package/dist/module/integration/entity/user-integration.entity.js +4 -4
- package/dist/module/integration/entity/user-integration.entity.js.map +1 -1
- package/dist/module/integration/examples/usage.example.js +9 -9
- package/dist/module/integration/service/integration.service.js +1 -1
- package/dist/module/integration/service/wrapper.service.js +28 -29
- package/dist/module/integration/service/wrapper.service.js.map +1 -1
- package/dist/module/linked_attributes/entity/linked_attribute.entity.d.ts +1 -0
- package/dist/module/linked_attributes/entity/linked_attribute.entity.js +4 -0
- package/dist/module/linked_attributes/entity/linked_attribute.entity.js.map +1 -1
- package/dist/module/listmaster/entity/list-master-items.entity.js +3 -3
- package/dist/module/listmaster/entity/list-master-items.entity.js.map +1 -1
- package/dist/module/listmaster/entity/list-master.entity.js +4 -4
- package/dist/module/listmaster/entity/list-master.entity.js.map +1 -1
- package/dist/module/listmaster/service/list-master-item.service.js +3 -3
- package/dist/module/listmaster/service/list-master-item.service.js.map +1 -1
- package/dist/module/mapper/entity/field-mapper.entity.js +6 -6
- package/dist/module/mapper/entity/field-mapper.entity.js.map +1 -1
- package/dist/module/mapper/service/field-mapper.service.js +5 -5
- package/dist/module/mapper/service/field-mapper.service.js.map +1 -1
- package/dist/module/mapper/service/mapper.service.js +4 -4
- package/dist/module/mapper/service/mapper.service.js.map +1 -1
- package/dist/module/meta/controller/attribute-master.controller.d.ts +2 -3
- package/dist/module/meta/controller/attribute-master.controller.js +2 -12
- package/dist/module/meta/controller/attribute-master.controller.js.map +1 -1
- package/dist/module/meta/entity/app-master.entity.d.ts +2 -2
- package/dist/module/meta/entity/app-master.entity.js +4 -4
- package/dist/module/meta/entity/attribute-master.entity.d.ts +1 -0
- package/dist/module/meta/entity/attribute-master.entity.js +4 -0
- package/dist/module/meta/entity/attribute-master.entity.js.map +1 -1
- package/dist/module/meta/entity/entity-master.entity.js +1 -1
- package/dist/module/meta/entity/entity-master.entity.js.map +1 -1
- package/dist/module/meta/entity/view-master.entity.js +1 -1
- package/dist/module/meta/entity/view-master.entity.js.map +1 -1
- package/dist/module/meta/repository/attribute-master.repository.js +2 -2
- package/dist/module/meta/repository/attribute-master.repository.js.map +1 -1
- package/dist/module/meta/repository/entity-attribute-update.repository.js +3 -3
- package/dist/module/meta/repository/entity-master.repository.js +2 -2
- package/dist/module/meta/repository/entity-master.repository.js.map +1 -1
- package/dist/module/meta/service/attribute-master.service.js +1 -1
- package/dist/module/meta/service/attribute-master.service.js.map +1 -1
- package/dist/module/meta/service/entity-dynamic.service.js +27 -27
- package/dist/module/meta/service/entity-dynamic.service.js.map +1 -1
- package/dist/module/meta/service/entity-list.service.js +3 -3
- package/dist/module/meta/service/entity-master.service.js +4 -4
- package/dist/module/meta/service/entity-master.service.js.map +1 -1
- package/dist/module/meta/service/entity-relation.service.js +13 -13
- package/dist/module/meta/service/entity-relation.service.js.map +1 -1
- package/dist/module/meta/service/entity-service-impl.service.js +3 -3
- package/dist/module/meta/service/media-data.service.js +9 -9
- package/dist/module/meta/service/media-data.service.js.map +1 -1
- package/dist/module/meta/service/resolver.service.js +17 -17
- package/dist/module/meta/service/resolver.service.js.map +1 -1
- package/dist/module/module/repository/menu.repository.js +12 -12
- package/dist/module/module/service/module-access.service.js +8 -2
- package/dist/module/module/service/module-access.service.js.map +1 -1
- package/dist/module/notification/controller/otp.controller.d.ts +1 -31
- package/dist/module/notification/entity/otp.entity.js +1 -1
- package/dist/module/notification/entity/otp.entity.js.map +1 -1
- package/dist/module/notification/service/notification.service.js +22 -26
- package/dist/module/notification/service/notification.service.js.map +1 -1
- package/dist/module/notification/service/otp.service.d.ts +1 -31
- package/dist/module/notification/service/otp.service.js +1 -0
- package/dist/module/notification/service/otp.service.js.map +1 -1
- package/dist/module/user/controller/login.controller.js +20 -19
- package/dist/module/user/controller/login.controller.js.map +1 -1
- package/dist/module/user/entity/user-role-mapping.entity.js +1 -1
- package/dist/module/user/entity/user-role-mapping.entity.js.map +1 -1
- package/dist/module/user/service/login.service.d.ts +3 -57
- package/dist/module/user/service/login.service.js +13 -3
- package/dist/module/user/service/login.service.js.map +1 -1
- package/dist/module/user/service/role.service.js +4 -4
- package/dist/module/user/service/user-session.service.js +4 -4
- package/dist/module/user/service/user-session.service.js.map +1 -1
- package/dist/module/user/service/user.service.js +1 -1
- package/dist/module/user/service/user.service.js.map +1 -1
- package/dist/module/workflow/entity/action-category.entity.d.ts +1 -1
- package/dist/module/workflow/entity/action-category.entity.js +1 -1
- package/dist/module/workflow/entity/action-data.entity.js +1 -1
- package/dist/module/workflow/entity/action-data.entity.js.map +1 -1
- package/dist/module/workflow/entity/action.entity.js +1 -1
- package/dist/module/workflow/entity/action.entity.js.map +1 -1
- package/dist/module/workflow/entity/comm-template.entity.js +1 -1
- package/dist/module/workflow/entity/comm-template.entity.js.map +1 -1
- package/dist/module/workflow/entity/template-attach-mapper.entity.js +1 -1
- package/dist/module/workflow/entity/template-attach-mapper.entity.js.map +1 -1
- package/dist/module/workflow/repository/action-data.repository.js +4 -4
- package/dist/module/workflow/repository/action-data.repository.js.map +1 -1
- package/dist/module/workflow/repository/action.repository.js +21 -21
- package/dist/module/workflow/repository/action.repository.js.map +1 -1
- package/dist/module/workflow/repository/comm-template.repository.js +7 -7
- package/dist/module/workflow/repository/comm-template.repository.js.map +1 -1
- package/dist/module/workflow/repository/form-master.repository.js +3 -3
- package/dist/module/workflow/repository/form-master.repository.js.map +1 -1
- package/dist/module/workflow/repository/stage-group.repository.js +23 -23
- package/dist/module/workflow/repository/stage-movement.repository.js +17 -17
- package/dist/module/workflow/repository/stage-movement.repository.js.map +1 -1
- package/dist/module/workflow/repository/stage.repository.js +8 -8
- package/dist/module/workflow/repository/task.repository.js +4 -4
- package/dist/module/workflow/repository/task.repository.js.map +1 -1
- package/dist/module/workflow/service/action-template-mapping.service.js +22 -22
- package/dist/module/workflow/service/action.service.js +13 -13
- package/dist/module/workflow/service/action.service.js.map +1 -1
- package/dist/module/workflow/service/entity-modification.service.js +6 -6
- package/dist/module/workflow/service/populate-workflow.service.js +8 -8
- package/dist/module/workflow/service/populate-workflow.service.js.map +1 -1
- package/dist/module/workflow/service/stage-group.service.js +6 -6
- package/dist/module/workflow/service/stage-group.service.js.map +1 -1
- package/dist/module/workflow/service/stage.service.js +4 -4
- package/dist/module/workflow/service/stage.service.js.map +1 -1
- package/dist/module/workflow/service/task.service.js +33 -33
- package/dist/module/workflow/service/task.service.js.map +1 -1
- package/dist/module/workflow/service/workflow-list-master.service.js +16 -16
- package/dist/module/workflow/service/workflow-list-master.service.js.map +1 -1
- package/dist/module/workflow/service/workflow-meta.service.js +31 -31
- package/dist/module/workflow/service/workflow-meta.service.js.map +1 -1
- package/dist/module/workflow/service/workflow.service.js +5 -5
- package/dist/module/workflow/service/workflow.service.js.map +1 -1
- package/dist/module/workflow-automation/entity/workflow-automation-action.entity.d.ts +1 -1
- package/dist/module/workflow-automation/entity/workflow-automation-action.entity.js +1 -1
- package/dist/module/workflow-automation/service/schedule-handler.service.js +14 -14
- package/dist/module/workflow-automation/service/workflow-automation-engine.service.js +1 -1
- package/dist/module/workflow-automation/service/workflow-automation-engine.service.js.map +1 -1
- package/dist/module/workflow-automation/service/workflow-automation.service.js +4 -4
- package/dist/module/workflow-schedule/entities/scheduled-workflow.entity.js +4 -4
- package/dist/module/workflow-schedule/entities/scheduled-workflow.entity.js.map +1 -1
- package/dist/module/workflow-schedule/entities/workflow-execution-log.entity.js +2 -2
- package/dist/module/workflow-schedule/entities/workflow-execution-log.entity.js.map +1 -1
- package/dist/module/workflow-schedule/processors/schedule.processor.js +4 -4
- package/dist/module/workflow-schedule/service/workflow-schedule.service.js +9 -9
- package/dist/table.config.d.ts +2 -1
- package/dist/table.config.js +4 -6
- package/dist/table.config.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utils/service/reflection-helper.service.js +3 -3
- package/dist/utils/service/reflection-helper.service.js.map +1 -1
- package/docs/modules/event-driven-integration-design.md +91 -91
- package/docs/modules/integration.md +250 -250
- package/eslint.config.mjs +34 -34
- package/nest-cli.json +14 -14
- package/package.json +124 -124
- package/src/app.controller.ts +12 -12
- package/src/app.module.ts +66 -66
- package/src/app.service.ts +8 -8
- package/src/config/bull.config.ts +69 -69
- package/src/config/config.module.ts +18 -17
- package/src/config/database.config.ts +23 -48
- package/src/constant/global.constant.ts +67 -67
- package/src/core.module.ts +91 -88
- package/src/decorators/roles.decorator.ts +7 -7
- package/src/dtos/response.dto.ts +6 -6
- package/src/dtos/response.ts +5 -5
- package/src/index.ts +1 -1
- package/src/module/auth/auth.module.ts +49 -49
- package/src/module/auth/controller/auth.controller.ts +28 -28
- package/src/module/auth/guards/google-auth.guard.ts +9 -9
- package/src/module/auth/guards/jwt.guard.ts +22 -22
- package/src/module/auth/guards/role.guard.ts +68 -68
- package/src/module/auth/services/auth.service.ts +50 -50
- package/src/module/auth/services/jwt.service.ts +11 -11
- package/src/module/auth/strategies/google.strategy.ts +54 -54
- package/src/module/auth/strategies/jwt.strategy.ts +58 -58
- package/src/module/auth/strategies/local.strategy.ts +13 -13
- package/src/module/dashboard/controller/dashboard.controller.ts +36 -36
- package/src/module/dashboard/dashboard.module.ts +21 -21
- package/src/module/dashboard/entity/dashboard_page_data.entity.ts +27 -27
- package/src/module/dashboard/entity/widget_master.entity.ts +18 -18
- package/src/module/dashboard/repository/dashboard.repository.ts +42 -42
- package/src/module/dashboard/service/dashboard.service.ts +73 -73
- package/src/module/dev/dev.module.ts +12 -12
- package/src/module/dev/service/dev.service.ts +7 -7
- package/src/module/enterprise/controller/organization.controller.ts +36 -36
- package/src/module/enterprise/enterprise.module.ts +30 -30
- package/src/module/enterprise/entity/enterprise.entity.ts +37 -37
- package/src/module/enterprise/entity/organization-app-mapping.entity.ts +13 -13
- package/src/module/enterprise/entity/organization.entity.ts +92 -92
- package/src/module/enterprise/repository/enterprise.repository.ts +31 -31
- package/src/module/enterprise/repository/organization.repository.ts +26 -26
- package/src/module/enterprise/repository/school.repository.ts +278 -278
- package/src/module/enterprise/service/brand.service.ts +5 -5
- package/src/module/enterprise/service/enterprise.service.ts +16 -16
- package/src/module/enterprise/service/organization-app-mapping.service.ts +4 -4
- package/src/module/enterprise/service/organization.service.ts +145 -145
- package/src/module/entity_json/controller/entity_json.controller.ts +47 -47
- package/src/module/entity_json/entity/entityJson.entity.ts +39 -0
- package/src/module/entity_json/entity_json.module.ts +16 -15
- package/src/module/entity_json/service/entity_json.service.ts +317 -265
- package/src/module/filter/controller/filter.controller.ts +84 -84
- package/src/module/filter/dto/filter-request.dto.ts +38 -38
- package/src/module/filter/entity/saved-filter-detail.entity.ts +41 -41
- package/src/module/filter/entity/saved-filter-master.entity.ts +23 -23
- package/src/module/filter/filter.module.ts +31 -31
- package/src/module/filter/repository/saved-filter.repository.ts +168 -168
- package/src/module/filter/service/filter-evaluator.service.ts +86 -86
- package/src/module/filter/service/filter.service.ts +1005 -1051
- package/src/module/filter/service/saved-filter.service.ts +170 -170
- package/src/module/ics/controller/ics.controller.ts +21 -21
- package/src/module/ics/dto/ics.dto.ts +55 -55
- package/src/module/ics/ics.module.ts +13 -13
- package/src/module/ics/service/ics.service.ts +57 -57
- package/src/module/integration/controller/calender-event.controller.ts +31 -31
- package/src/module/integration/controller/integration.controller.ts +662 -662
- package/src/module/integration/controller/wrapper.controller.ts +37 -37
- package/src/module/integration/dto/create-config.dto.ts +526 -526
- package/src/module/integration/entity/integration-config.entity.ts +112 -112
- package/src/module/integration/entity/integration-entity-mapper.entity.ts +14 -14
- package/src/module/integration/entity/integration-source.entity.ts +17 -17
- package/src/module/integration/entity/user-integration.entity.ts +71 -71
- package/src/module/integration/examples/usage.example.ts +338 -338
- package/src/module/integration/factories/base.factory.ts +7 -7
- package/src/module/integration/factories/email.factory.ts +49 -49
- package/src/module/integration/factories/integration.factory.ts +121 -121
- package/src/module/integration/factories/sms.factory.ts +51 -51
- package/src/module/integration/factories/telephone.factory.ts +41 -41
- package/src/module/integration/factories/whatsapp.factory.ts +56 -56
- package/src/module/integration/integration.module.ts +110 -110
- package/src/module/integration/service/calendar-event.service.ts +118 -118
- package/src/module/integration/service/integration-entity-mapper.service.ts +17 -17
- package/src/module/integration/service/integration-queue.service.ts +229 -229
- package/src/module/integration/service/integration.service.ts +2633 -2633
- package/src/module/integration/service/oauth.service.ts +224 -224
- package/src/module/integration/service/wrapper.service.ts +700 -701
- package/src/module/integration/strategies/email/gmail-api.strategy.ts +280 -280
- package/src/module/integration/strategies/email/outlook-api.strategy.ts +44 -44
- package/src/module/integration/strategies/email/outlook.strategy.ts +64 -64
- package/src/module/integration/strategies/email/sendgrid-api.strategy.ts +260 -260
- package/src/module/integration/strategies/integration.strategy.ts +97 -97
- package/src/module/integration/strategies/sms/gupshup-sms.strategy.ts +146 -146
- package/src/module/integration/strategies/sms/msg91-sms.strategy.ts +164 -164
- package/src/module/integration/strategies/sms/tubelight-sms.strategy.ts +163 -163
- package/src/module/integration/strategies/telephone/ozonetel-voice.strategy.ts +238 -238
- package/src/module/integration/strategies/telephone/tubelight-voice.strategy.ts +210 -210
- package/src/module/integration/strategies/whatsapp/gupshup-whatsapp.strategy.ts +359 -359
- package/src/module/integration/strategies/whatsapp/tubelight-whatsapp.strategy.ts +372 -372
- package/src/module/integration/strategies/whatsapp/whatsapp-cloud.strategy.ts +403 -403
- package/src/module/integration/strategies/whatsapp/whatsapp.strategy.ts +57 -57
- package/src/module/layout/controller/layout.controller.ts +47 -47
- package/src/module/layout/entity/header-items.entity.ts +28 -28
- package/src/module/layout/entity/header-section.entity.ts +19 -19
- package/src/module/layout/layout.module.ts +21 -21
- package/src/module/layout/repository/header-items.repository.ts +18 -18
- package/src/module/layout/repository/header-section.repository.ts +22 -22
- package/src/module/layout/service/header-section.service.ts +25 -25
- package/src/module/layout_preference/controller/layout_preference.controller.ts +73 -73
- package/src/module/layout_preference/entity/layout_preference.entity.ts +28 -28
- package/src/module/layout_preference/layout_preference.module.ts +22 -22
- package/src/module/layout_preference/repository/layout_preference.repository.ts +65 -65
- package/src/module/layout_preference/service/layout_preference.service.ts +191 -191
- package/src/module/lead/controller/lead.controller.ts +30 -30
- package/src/module/lead/lead.module.ts +14 -14
- package/src/module/lead/repository/lead.repository.ts +41 -41
- package/src/module/lead/service/lead.service.ts +54 -54
- package/src/module/linked_attributes/controller/linked_attributes.controller.ts +10 -10
- package/src/module/linked_attributes/entity/linked_attribute.entity.ts +51 -48
- package/src/module/linked_attributes/linked_attributes.module.ts +16 -16
- package/src/module/linked_attributes/repository/linked_attribute.repository.ts +12 -12
- package/src/module/linked_attributes/service/linked_attributes.service.ts +22 -22
- package/src/module/listmaster/controller/list-master.controller.ts +230 -230
- package/src/module/listmaster/entity/list-master-items.entity.ts +43 -43
- package/src/module/listmaster/entity/list-master.entity.ts +33 -33
- package/src/module/listmaster/listmaster.module.ts +46 -46
- package/src/module/listmaster/repository/list-master-items.repository.ts +169 -169
- package/src/module/listmaster/repository/list-master.repository.ts +46 -46
- package/src/module/listmaster/service/list-master-engine.ts +19 -19
- package/src/module/listmaster/service/list-master-extension.interface.ts +4 -4
- package/src/module/listmaster/service/list-master-item.service.ts +292 -292
- package/src/module/listmaster/service/list-master-registry.ts +15 -15
- package/src/module/listmaster/service/list-master.service.ts +535 -535
- package/src/module/mapper/controller/field-mapper.controller.ts +76 -76
- package/src/module/mapper/controller/mapper.controller.ts +20 -20
- package/src/module/mapper/dto/field-mapper.dto.ts +14 -14
- package/src/module/mapper/entity/field-lovs.entity.ts +19 -19
- package/src/module/mapper/entity/field-mapper.entity.ts +53 -53
- package/src/module/mapper/entity/mapper.entity.ts +16 -16
- package/src/module/mapper/mapper.module.ts +34 -34
- package/src/module/mapper/repository/field-lovs.repository.ts +35 -35
- package/src/module/mapper/repository/field-mapper.repository.ts +42 -42
- package/src/module/mapper/repository/mapper.repository.ts +15 -15
- package/src/module/mapper/service/field-mapper.service.ts +271 -271
- package/src/module/mapper/service/mapper.service.ts +79 -79
- package/src/module/master/controller/master.controller.ts +74 -74
- package/src/module/master/service/master.service.ts +483 -483
- package/src/module/meta/controller/app-master.controller.ts +38 -38
- package/src/module/meta/controller/attribute-master.controller.ts +84 -86
- package/src/module/meta/controller/entity-dynamic.controller.ts +125 -125
- package/src/module/meta/controller/entity-master.controller.ts +41 -41
- package/src/module/meta/controller/entity-relation.controller.ts +36 -36
- package/src/module/meta/controller/entity.controller.ts +392 -392
- package/src/module/meta/controller/entity.public.controller.ts +75 -75
- package/src/module/meta/controller/media.controller.ts +107 -107
- package/src/module/meta/controller/meta.controller.ts +96 -96
- package/src/module/meta/controller/view-master.controller.ts +86 -86
- package/src/module/meta/dto/entity-list-data.dto.ts +6 -6
- package/src/module/meta/dto/entity-tab.dto.ts +4 -4
- package/src/module/meta/dto/entity-table.dto.ts +9 -9
- package/src/module/meta/entity/app-master.entity.ts +34 -34
- package/src/module/meta/entity/attribute-master.entity.ts +92 -89
- package/src/module/meta/entity/base-entity.entity.ts +75 -75
- package/src/module/meta/entity/entity-master.entity.ts +85 -85
- package/src/module/meta/entity/entity-relation-data.entity.ts +29 -29
- package/src/module/meta/entity/entity-relation.entity.ts +23 -23
- package/src/module/meta/entity/entity-table-column.entity.ts +61 -61
- package/src/module/meta/entity/entity-table.entity.ts +50 -50
- package/src/module/meta/entity/media-data.entity.ts +32 -32
- package/src/module/meta/entity/preference.entity.ts +62 -62
- package/src/module/meta/entity/view-master.entity.ts +41 -41
- package/src/module/meta/entity.module.ts +166 -166
- package/src/module/meta/repository/app-master.repository.ts +20 -20
- package/src/module/meta/repository/attribute-master.repository.ts +138 -138
- package/src/module/meta/repository/entity-attribute-update.repository.ts +44 -44
- package/src/module/meta/repository/entity-master.repository.ts +99 -99
- package/src/module/meta/repository/entity-table-column.repository.ts +39 -39
- package/src/module/meta/repository/entity-table.repository.ts +53 -53
- package/src/module/meta/repository/media-data.repository.ts +50 -50
- package/src/module/meta/repository/preference.repository.ts +20 -20
- package/src/module/meta/repository/user-app-mapping.repository.ts +28 -28
- package/src/module/meta/repository/view-master.repository.ts +42 -42
- package/src/module/meta/service/app-master.service.ts +37 -37
- package/src/module/meta/service/attribute-master.service.ts +130 -130
- package/src/module/meta/service/common.service.ts +9 -9
- package/src/module/meta/service/entity-attribute-update.service.ts +28 -28
- package/src/module/meta/service/entity-dynamic.service.ts +819 -819
- package/src/module/meta/service/entity-list.service.ts +205 -205
- package/src/module/meta/service/entity-master.service.ts +175 -175
- package/src/module/meta/service/entity-realation-data.service.ts +9 -9
- package/src/module/meta/service/entity-relation.service.ts +69 -69
- package/src/module/meta/service/entity-service-impl.service.ts +525 -525
- package/src/module/meta/service/entity-table-column.service.ts +39 -39
- package/src/module/meta/service/entity-table.service.ts +150 -150
- package/src/module/meta/service/entity-validation.service.ts +187 -187
- package/src/module/meta/service/entity.service.ts +67 -67
- package/src/module/meta/service/field-group.service.ts +103 -103
- package/src/module/meta/service/media-data.service.ts +507 -507
- package/src/module/meta/service/populate-meta.service.ts +193 -193
- package/src/module/meta/service/preference.service.ts +16 -16
- package/src/module/meta/service/resolver.service.ts +267 -267
- package/src/module/meta/service/section-master.service.ts +104 -104
- package/src/module/meta/service/update-form-json.service.ts +22 -22
- package/src/module/meta/service/user-app-mapping.service.ts +17 -17
- package/src/module/meta/service/view-master.service.ts +127 -127
- package/src/module/microservice-client/microservice-clients.module.ts +13 -13
- package/src/module/microservice-client/service/microservice-client-factory.ts +37 -37
- package/src/module/microservice-client/service/microservice-clients.ts +4 -4
- package/src/module/module/controller/menu.controller.ts +15 -15
- package/src/module/module/controller/module-access.controller.ts +134 -134
- package/src/module/module/entity/menu.entity.ts +43 -43
- package/src/module/module/entity/module-access.entity.ts +25 -25
- package/src/module/module/entity/module-action.entity.ts +17 -17
- package/src/module/module/entity/module.entity.ts +52 -52
- package/src/module/module/module.module.ts +42 -42
- package/src/module/module/repository/menu.repository.ts +184 -184
- package/src/module/module/repository/module-access.repository.ts +344 -344
- package/src/module/module/service/menu.service.ts +82 -82
- package/src/module/module/service/module-access.service.ts +209 -194
- package/src/module/notification/controller/notification.controller.ts +58 -58
- package/src/module/notification/controller/otp.controller.ts +117 -117
- package/src/module/notification/entity/notification.entity.ts +26 -26
- package/src/module/notification/entity/otp.entity.ts +28 -28
- package/src/module/notification/firebase-admin.config.ts +22 -22
- package/src/module/notification/notification.module.ts +69 -69
- package/src/module/notification/repository/otp.repository.ts +27 -27
- package/src/module/notification/service/email.service.ts +127 -127
- package/src/module/notification/service/notification.service.ts +163 -160
- package/src/module/notification/service/otp.service.ts +133 -132
- package/src/module/third-party-module/entity/third-party-api-registry.entity.ts +52 -52
- package/src/module/third-party-module/repository/third-party-api-registry.repository.ts +20 -20
- package/src/module/third-party-module/service/api-registry.service.ts +13 -13
- package/src/module/third-party-module/third-party.module.ts +12 -12
- package/src/module/user/controller/login.controller.ts +198 -197
- package/src/module/user/controller/user.controller.ts +40 -40
- package/src/module/user/dto/create-user.dto.ts +62 -62
- package/src/module/user/dto/update-user.dto.ts +4 -4
- package/src/module/user/entity/role.entity.ts +33 -33
- package/src/module/user/entity/user-role-mapping.entity.ts +38 -38
- package/src/module/user/entity/user-session.entity.ts +73 -73
- package/src/module/user/entity/user.entity.ts +59 -59
- package/src/module/user/repository/role.repository.ts +96 -96
- package/src/module/user/repository/user-role-mapping.repository.ts +126 -126
- package/src/module/user/repository/user.repository.ts +50 -50
- package/src/module/user/repository/userSession.repository.ts +33 -33
- package/src/module/user/service/login.service.ts +326 -304
- package/src/module/user/service/role.service.ts +189 -189
- package/src/module/user/service/user-role-mapping.service.ts +98 -98
- package/src/module/user/service/user-session.service.ts +168 -168
- package/src/module/user/service/user.service.ts +368 -365
- package/src/module/user/user.module.ts +65 -65
- package/src/module/workflow/controller/action-category.controller.ts +54 -54
- package/src/module/workflow/controller/action-resource-mapping.controller.ts +23 -23
- package/src/module/workflow/controller/action-template-mapping.controller.ts +35 -35
- package/src/module/workflow/controller/action.controller.ts +111 -111
- package/src/module/workflow/controller/activity-log.controller.ts +55 -55
- package/src/module/workflow/controller/comm-template.controller.ts +43 -43
- package/src/module/workflow/controller/entity-modification.controller.ts +35 -35
- package/src/module/workflow/controller/form-master.controller.ts +43 -43
- package/src/module/workflow/controller/stage-group.controller.ts +48 -48
- package/src/module/workflow/controller/stage.controller.ts +50 -50
- package/src/module/workflow/controller/task.controller.ts +77 -77
- package/src/module/workflow/controller/workflow-list-master.controller.ts +44 -44
- package/src/module/workflow/controller/workflow-meta.controller.ts +80 -80
- package/src/module/workflow/controller/workflow.controller.ts +67 -67
- package/src/module/workflow/entity/action-category.entity.ts +38 -38
- package/src/module/workflow/entity/action-data.entity.ts +55 -55
- package/src/module/workflow/entity/action-resources-mapping.entity.ts +29 -29
- package/src/module/workflow/entity/action-template-mapping.entity.ts +17 -17
- package/src/module/workflow/entity/action.entity.ts +53 -53
- package/src/module/workflow/entity/activity-log.entity.ts +43 -43
- package/src/module/workflow/entity/comm-template.entity.ts +43 -43
- package/src/module/workflow/entity/entity-modification.entity.ts +38 -38
- package/src/module/workflow/entity/form.entity.ts +25 -25
- package/src/module/workflow/entity/stage-action-mapping.entity.ts +17 -17
- package/src/module/workflow/entity/stage-group.entity.ts +23 -23
- package/src/module/workflow/entity/stage-movement-data.entity.ts +38 -38
- package/src/module/workflow/entity/stage.entity.ts +20 -20
- package/src/module/workflow/entity/task-data.entity.ts +88 -88
- package/src/module/workflow/entity/template-attach-mapper.entity.ts +30 -30
- package/src/module/workflow/entity/workflow-data.entity.ts +11 -11
- package/src/module/workflow/entity/workflow-level-mapping.entity.ts +18 -18
- package/src/module/workflow/entity/workflow.entity.ts +20 -20
- package/src/module/workflow/repository/action-category.repository.ts +79 -79
- package/src/module/workflow/repository/action-data.repository.ts +334 -334
- package/src/module/workflow/repository/action.repository.ts +323 -323
- package/src/module/workflow/repository/activity-log.repository.ts +148 -148
- package/src/module/workflow/repository/comm-template.repository.ts +149 -149
- package/src/module/workflow/repository/form-master.repository.ts +59 -59
- package/src/module/workflow/repository/stage-group.repository.ts +176 -176
- package/src/module/workflow/repository/stage-movement.repository.ts +244 -244
- package/src/module/workflow/repository/stage.repository.ts +172 -172
- package/src/module/workflow/repository/task.repository.ts +134 -134
- package/src/module/workflow/repository/workflow.repository.ts +42 -42
- package/src/module/workflow/service/action-category.service.ts +33 -33
- package/src/module/workflow/service/action-data.service.ts +62 -62
- package/src/module/workflow/service/action-resources-mapping.service.ts +10 -10
- package/src/module/workflow/service/action-template-mapping.service.ts +106 -106
- package/src/module/workflow/service/action.service.ts +279 -279
- package/src/module/workflow/service/activity-log.service.ts +107 -107
- package/src/module/workflow/service/comm-template.service.ts +180 -180
- package/src/module/workflow/service/entity-modification.service.ts +67 -67
- package/src/module/workflow/service/form-master.service.ts +35 -35
- package/src/module/workflow/service/populate-workflow.service.ts +303 -303
- package/src/module/workflow/service/stage-action-mapping.service.ts +5 -5
- package/src/module/workflow/service/stage-group.service.ts +319 -319
- package/src/module/workflow/service/stage.service.ts +199 -199
- package/src/module/workflow/service/task.service.ts +569 -569
- package/src/module/workflow/service/workflow-list-master.service.ts +60 -60
- package/src/module/workflow/service/workflow-meta.service.ts +654 -654
- package/src/module/workflow/service/workflow.service.ts +205 -205
- package/src/module/workflow/workflow.module.ts +176 -176
- package/src/module/workflow-automation/SCHEDULING_GUIDE.md +145 -145
- package/src/module/workflow-automation/controller/workflow-automation.controller.ts +43 -43
- package/src/module/workflow-automation/entity/workflow-automation-action.entity.ts +26 -26
- package/src/module/workflow-automation/entity/workflow-automation.entity.ts +40 -40
- package/src/module/workflow-automation/interface/action.decorator.ts +7 -7
- package/src/module/workflow-automation/interface/action.interface.ts +5 -5
- package/src/module/workflow-automation/service/action-registery.service.ts +35 -35
- package/src/module/workflow-automation/service/schedule-handler.service.ts +149 -149
- package/src/module/workflow-automation/service/workflow-automation-engine.service.ts +214 -214
- package/src/module/workflow-automation/service/workflow-automation.service.ts +508 -508
- package/src/module/workflow-automation/workflow-automation.module.ts +47 -47
- package/src/module/workflow-schedule/INSTALLATION.md +244 -244
- package/src/module/workflow-schedule/MULTI_PROJECT_GUIDE.md +196 -196
- package/src/module/workflow-schedule/README.md +422 -422
- package/src/module/workflow-schedule/constants/schedule.constants.ts +48 -48
- package/src/module/workflow-schedule/controller/workflow-schedule.controller.ts +255 -255
- package/src/module/workflow-schedule/docs/CLAUDE_CODE_GUIDE.md +510 -510
- package/src/module/workflow-schedule/docs/CLAUDE_CODE_PROMPT.md +362 -362
- package/src/module/workflow-schedule/docs/RUN_CLAUDE_CODE.sh +68 -68
- package/src/module/workflow-schedule/dto/create-schedule.dto.ts +147 -147
- package/src/module/workflow-schedule/dto/get-execution-logs.dto.ts +119 -119
- package/src/module/workflow-schedule/dto/update-schedule.dto.ts +96 -96
- package/src/module/workflow-schedule/entities/scheduled-workflow.entity.ts +148 -148
- package/src/module/workflow-schedule/entities/workflow-execution-log.entity.ts +154 -154
- package/src/module/workflow-schedule/interfaces/schedule-job-data.interface.ts +53 -53
- package/src/module/workflow-schedule/interfaces/workflow-schedule-options.interface.ts +12 -12
- package/src/module/workflow-schedule/processors/schedule.processor.ts +584 -584
- package/src/module/workflow-schedule/service/workflow-schedule.service.ts +600 -600
- package/src/module/workflow-schedule/workflow-schedule.module.ts +67 -67
- package/src/resources/dev.properties.yaml +30 -31
- package/src/resources/local.properties.yaml +27 -27
- package/src/resources/properties.module.ts +12 -12
- package/src/resources/properties.yaml.ts +11 -11
- package/src/resources/uat.properties.yaml +31 -31
- package/src/table.config.ts +128 -130
- package/src/utils/dto/excel-data.dto.ts +14 -14
- package/src/utils/dto/excelsheet-data.dto.ts +5 -5
- package/src/utils/service/base64util.service.ts +18 -18
- package/src/utils/service/clockIDGenUtil.service.ts +21 -21
- package/src/utils/service/codeGenerator.service.ts +22 -22
- package/src/utils/service/dateUtil.service.ts +17 -17
- package/src/utils/service/encryptUtil.service.ts +97 -97
- package/src/utils/service/excel-helper.service.ts +72 -72
- package/src/utils/service/excelUtil.service.ts +15 -15
- package/src/utils/service/file-util.service.ts +11 -11
- package/src/utils/service/json-util.service.ts +23 -23
- package/src/utils/service/loggingUtil.service.ts +88 -88
- package/src/utils/service/reflection-helper.service.ts +62 -62
- package/src/utils/service/wbsCodeGen.service.ts +8 -8
- package/src/utils/utils.module.ts +27 -27
- package/tsconfig.build.json +4 -4
- package/tsconfig.json +24 -24
- package/.claude/settings.local.json +0 -26
- package/.idea/250218_nodejs_core.iml +0 -9
- package/.idea/codeStyles/Project.xml +0 -59
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/copilot.data.migration.agent.xml +0 -6
- package/.idea/copilot.data.migration.ask.xml +0 -6
- package/.idea/copilot.data.migration.ask2agent.xml +0 -6
- package/.idea/copilot.data.migration.edit.xml +0 -6
- package/.idea/inspectionProfiles/Project_Default.xml +0 -6
- package/.idea/misc.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/prettier.xml +0 -6
- package/.idea/vcs.xml +0 -6
- package/server.log +0 -850
|
@@ -30,7 +30,7 @@ let EntityJSONService = class EntityJSONService extends entity_service_impl_serv
|
|
|
30
30
|
const mainAttributes = await this.dataSource
|
|
31
31
|
.getRepository(attribute_master_entity_1.AttributeMaster)
|
|
32
32
|
.createQueryBuilder('attr')
|
|
33
|
-
.select(['attr.id', 'attr.name', 'attr.attribute_key'])
|
|
33
|
+
.select(['attr.id', 'attr.name', 'attr.flat_json_key', 'attr.attribute_key'])
|
|
34
34
|
.where('attr.mapped_entity_type = :entityType', { entityType })
|
|
35
35
|
.andWhere('attr.organization_id = :orgId', { orgId })
|
|
36
36
|
.getMany();
|
|
@@ -41,16 +41,26 @@ let EntityJSONService = class EntityJSONService extends entity_service_impl_serv
|
|
|
41
41
|
.select(['rel.target_entity_type'])
|
|
42
42
|
.where('rel.source_entity_type = :entityType', { entityType })
|
|
43
43
|
.andWhere('rel.organization_id = :orgId', { orgId })
|
|
44
|
-
.andWhere('rel.relation_type = :relationType', {
|
|
44
|
+
.andWhere('rel.relation_type = :relationType', {
|
|
45
|
+
relationType: 'ONE_TO_ONE',
|
|
46
|
+
})
|
|
45
47
|
.getRawMany();
|
|
46
|
-
const relatedTypesList = relatedEntityTypes.map(x => x.rel_target_entity_type);
|
|
48
|
+
const relatedTypesList = relatedEntityTypes.map((x) => x.rel_target_entity_type);
|
|
47
49
|
await this.loggerService.log('debug', 'EntityJSONService', 'getAttributeForFlatJSON', `Found ${relatedTypesList.length} ONE-TO-ONE related entity types`);
|
|
48
50
|
const relatedAttributes = relatedTypesList.length
|
|
49
51
|
? await this.dataSource
|
|
50
52
|
.getRepository(attribute_master_entity_1.AttributeMaster)
|
|
51
53
|
.createQueryBuilder('attr')
|
|
52
|
-
.select([
|
|
53
|
-
|
|
54
|
+
.select([
|
|
55
|
+
'attr.id',
|
|
56
|
+
'attr.name',
|
|
57
|
+
'attr.flat_json_key',
|
|
58
|
+
'attr.mapped_entity_type',
|
|
59
|
+
'attr.attribute_key',
|
|
60
|
+
])
|
|
61
|
+
.where('attr.mapped_entity_type IN (:...types)', {
|
|
62
|
+
types: relatedTypesList,
|
|
63
|
+
})
|
|
54
64
|
.andWhere('attr.organization_id = :orgId', { orgId })
|
|
55
65
|
.getMany()
|
|
56
66
|
: [];
|
|
@@ -68,75 +78,106 @@ let EntityJSONService = class EntityJSONService extends entity_service_impl_serv
|
|
|
68
78
|
.where('attr.organization_id = :orgId', { orgId })
|
|
69
79
|
.getRawMany();
|
|
70
80
|
await this.loggerService.log('debug', 'EntityJSONService', 'getAttributeForFlatJSON', `Loaded ${linkedAttributes.length} linked attributes`);
|
|
71
|
-
if (flag === 'flat_json') {
|
|
81
|
+
if (flag === 'flat_json' || flag === 'all') {
|
|
72
82
|
const result = {};
|
|
73
|
-
mainAttributes.forEach(attr => {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
83
|
+
mainAttributes.forEach((attr) => {
|
|
84
|
+
if (attr.flat_json_key)
|
|
85
|
+
result[attr.flat_json_key] = null;
|
|
86
|
+
});
|
|
87
|
+
relatedAttributes.forEach((attr) => {
|
|
88
|
+
if (attr.flat_json_key)
|
|
89
|
+
result[attr.flat_json_key] = null;
|
|
90
|
+
});
|
|
91
|
+
linkedAttributes.forEach((link) => {
|
|
92
|
+
if (link.applicable_attribute_key)
|
|
93
|
+
result[link.applicable_attribute_key] = null;
|
|
94
|
+
});
|
|
95
|
+
if (flag === 'all')
|
|
96
|
+
return { flat_json: result, attributes: { mainAttributes, relatedAttributes, linkedAttributes } };
|
|
79
97
|
return result;
|
|
80
98
|
}
|
|
81
99
|
const dropdown = [];
|
|
82
|
-
dropdown.push(...mainAttributes.map(a => ({ label: a.name, value: a.
|
|
83
|
-
dropdown.push(...relatedAttributes.map(a => ({
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
});
|
|
100
|
+
dropdown.push(...mainAttributes.map((a) => ({ label: a.name, value: a.flat_json_key })));
|
|
101
|
+
dropdown.push(...relatedAttributes.map((a) => ({
|
|
102
|
+
label: a.name,
|
|
103
|
+
value: a.flat_json_key,
|
|
104
|
+
})));
|
|
105
|
+
if (linkedAttributes.length > 0) {
|
|
106
|
+
dropdown.push({
|
|
107
|
+
...linkedAttributes.map((a) => ({
|
|
108
|
+
label: a.name,
|
|
109
|
+
value: a.attribute_key,
|
|
110
|
+
})),
|
|
111
|
+
});
|
|
112
|
+
}
|
|
87
113
|
return dropdown;
|
|
88
114
|
}
|
|
89
115
|
async updateEntityJSON(entityType, entityId, loggedInUser) {
|
|
90
116
|
await this.loggerService.log('info', 'EntityJSONService', 'updateEntityJSON', `Building flat JSON for entity: ${entityType}#${entityId}`);
|
|
91
|
-
const
|
|
117
|
+
const response = await this.getAttributeForFlatJSON(entityType, loggedInUser, 'all');
|
|
118
|
+
if (!response ||
|
|
119
|
+
!('flat_json' in response) ||
|
|
120
|
+
!('attributes' in response) ||
|
|
121
|
+
!response.attributes) {
|
|
122
|
+
await this.loggerService.log('error', 'EntityJSONService', 'updateEntityJSON', `getAttributeForFlatJSON() did not return expected structure`);
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
const { flat_json: flatJson, attributes } = response;
|
|
92
126
|
if (!flatJson) {
|
|
93
127
|
await this.loggerService.log('error', 'EntityJSONService', 'updateEntityJSON', `Flat JSON template not found for entity: ${entityType}`);
|
|
94
|
-
|
|
128
|
+
return null;
|
|
95
129
|
}
|
|
130
|
+
const safeAttributes = {
|
|
131
|
+
mainAttributes: attributes.mainAttributes || [],
|
|
132
|
+
relatedAttributes: attributes.relatedAttributes || [],
|
|
133
|
+
linkedAttributes: attributes.linkedAttributes || [],
|
|
134
|
+
};
|
|
135
|
+
const attrMap = {};
|
|
136
|
+
const allAttrs = [
|
|
137
|
+
...safeAttributes.mainAttributes,
|
|
138
|
+
...safeAttributes.relatedAttributes,
|
|
139
|
+
...safeAttributes.linkedAttributes,
|
|
140
|
+
];
|
|
141
|
+
allAttrs.forEach(attr => {
|
|
142
|
+
if (attr.attribute_key) {
|
|
143
|
+
attrMap[attr.attribute_key] = attr.flat_json_key || attr.attribute_key;
|
|
144
|
+
}
|
|
145
|
+
});
|
|
96
146
|
const mainData = await this.getResolvedEntityData(entityType, entityId, loggedInUser);
|
|
97
|
-
this.
|
|
98
|
-
await this.loggerService.log('debug', 'EntityJSONService', 'updateEntityJSON', 'Merged main entity data into flat JSON');
|
|
147
|
+
this.mergeEntityDataIntoFlatJson(flatJson, mainData, attrMap);
|
|
99
148
|
const relations = await this.dataSource
|
|
100
149
|
.getRepository('frm_entity_relation_data')
|
|
101
150
|
.createQueryBuilder('erd')
|
|
102
|
-
.select([
|
|
151
|
+
.select([
|
|
152
|
+
'erd.target_entity_id AS target_entity_id',
|
|
153
|
+
'erd.target_entity_type AS target_entity_type',
|
|
154
|
+
])
|
|
103
155
|
.where('erd.source_entity_type = :entityType', { entityType })
|
|
104
156
|
.andWhere('erd.source_entity_id = :entityId', { entityId })
|
|
105
157
|
.andWhere('erd.relation_type = :rt', { rt: 'ONE_TO_ONE' })
|
|
106
158
|
.getRawMany();
|
|
107
|
-
await this.loggerService.log('debug', 'EntityJSONService', 'updateEntityJSON', `Found ${relations.length} ONE-TO-ONE relations`);
|
|
108
159
|
for (const rel of relations) {
|
|
109
|
-
const
|
|
110
|
-
this.
|
|
111
|
-
await this.loggerService.log('debug', 'EntityJSONService', 'updateEntityJSON', `Merged related entity ${rel.target_entity_type}#${rel.target_entity_id}`);
|
|
160
|
+
const relatedData = await this.getResolvedEntityData(rel.target_entity_type, rel.target_entity_id, loggedInUser);
|
|
161
|
+
this.mergeEntityDataIntoFlatJson(flatJson, relatedData, attrMap);
|
|
112
162
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
.where('la.entity_type = :entityType', { entityType })
|
|
117
|
-
.getMany();
|
|
118
|
-
await this.loggerService.log('debug', 'EntityJSONService', 'updateEntityJSON', `Found ${linkedAttrs.length} linked attributes`);
|
|
119
|
-
for (const la of linkedAttrs) {
|
|
120
|
-
const mappingValue = flatJson[la.mapping_attribute];
|
|
121
|
-
const result = await this.applyLinkedFilterUsingSavedFilter(la.child_entity_type, la.saved_filter_code, la.filter_attribute, mappingValue, la.target_attribute, loggedInUser);
|
|
122
|
-
flatJson[la.target_attribute] = result;
|
|
123
|
-
await this.loggerService.log('debug', 'EntityJSONService', 'updateEntityJSON', `Linked attribute ${la.target_attribute} set from child entity ${la.child_entity_type}`);
|
|
124
|
-
}
|
|
125
|
-
await this.dataSource.query(`INSERT INTO frm_entity_json (entity_type, entity_id, json_data, created_by)
|
|
126
|
-
VALUES (?, ?, ?, ?)
|
|
127
|
-
ON DUPLICATE KEY UPDATE json_data = VALUES(json_data), updated_by = VALUES(created_by)`, [entityType, entityId, JSON.stringify(flatJson), loggedInUser.id]);
|
|
128
|
-
await this.loggerService.log('info', 'EntityJSONService', 'updateEntityJSON', `Flat JSON saved for entity: ${entityType}#${entityId}`);
|
|
163
|
+
await this.dataSource.query(`INSERT INTO frm_entity_json (entity_type, entity_id, json_data, created_by)
|
|
164
|
+
VALUES (?, ?, ?, ?)
|
|
165
|
+
ON DUPLICATE KEY UPDATE json_data = VALUES(json_data), updated_by = VALUES(created_by)`, [entityType, entityId, JSON.stringify(flatJson), loggedInUser.id]);
|
|
129
166
|
return flatJson;
|
|
130
167
|
}
|
|
131
|
-
|
|
132
|
-
for (const
|
|
133
|
-
|
|
134
|
-
|
|
168
|
+
mergeEntityDataIntoFlatJson(flatJson, entityData, attrMap) {
|
|
169
|
+
for (const record of entityData) {
|
|
170
|
+
for (const key of Object.keys(record)) {
|
|
171
|
+
const flatKey = attrMap[key] || key;
|
|
172
|
+
if (flatJson.hasOwnProperty(flatKey)) {
|
|
173
|
+
flatJson[flatKey] = record[key];
|
|
174
|
+
}
|
|
135
175
|
}
|
|
136
176
|
}
|
|
137
177
|
}
|
|
138
178
|
async applyLinkedFilterUsingSavedFilter(childEntityType, savedFilterCode, childFilterAttribute, mappingValue, targetAttribute, loggedInUser) {
|
|
139
|
-
if (!savedFilterCode &&
|
|
179
|
+
if (!savedFilterCode &&
|
|
180
|
+
(mappingValue === null || mappingValue === undefined))
|
|
140
181
|
return null;
|
|
141
182
|
const dto = {
|
|
142
183
|
entity_type: childEntityType,
|
|
@@ -145,18 +186,20 @@ let EntityJSONService = class EntityJSONService extends entity_service_impl_serv
|
|
|
145
186
|
page: 1,
|
|
146
187
|
size: 1,
|
|
147
188
|
};
|
|
148
|
-
if (mappingValue !== null &&
|
|
189
|
+
if (mappingValue !== null &&
|
|
190
|
+
mappingValue !== undefined &&
|
|
191
|
+
mappingValue !== '') {
|
|
149
192
|
dto.quickFilter = [
|
|
150
193
|
{
|
|
151
194
|
filter_attribute: childFilterAttribute,
|
|
152
195
|
filter_operator: 'equal',
|
|
153
196
|
filter_value: mappingValue,
|
|
154
|
-
}
|
|
197
|
+
},
|
|
155
198
|
];
|
|
156
199
|
}
|
|
157
200
|
const result = await this.filterService.applyFilter(dto);
|
|
158
201
|
const rows = result?.data?.entity_list || [];
|
|
159
|
-
return rows.length ? rows[0][targetAttribute] ?? null : null;
|
|
202
|
+
return rows.length ? (rows[0][targetAttribute] ?? null) : null;
|
|
160
203
|
}
|
|
161
204
|
};
|
|
162
205
|
exports.EntityJSONService = EntityJSONService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity_json.service.js","sourceRoot":"","sources":["../../../../src/module/entity_json/service/entity_json.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,wEAAyE;AACzE,uFAAiF;AACjF,qFAA+E;AAC/E,gGAAwF;AACxF,oFAAuE;AACvE,qCAAqC;AAG9B,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,+CAAiB;IACtD,YACmB,UAAsB,EACtB,aAA4B,EAC5B,aAA6B;QAE9C,KAAK,EAAE,CAAC;QAJS,eAAU,GAAV,UAAU,CAAY;QACtB,kBAAa,GAAb,aAAa,CAAe;QAC5B,kBAAa,GAAb,aAAa,CAAgB;IAGhD,CAAC;IAED,KAAK,CAAC,uBAAuB,CAC3B,UAAkB,EAClB,YAAiB,EACjB,
|
|
1
|
+
{"version":3,"file":"entity_json.service.js","sourceRoot":"","sources":["../../../../src/module/entity_json/service/entity_json.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,wEAAyE;AACzE,uFAAiF;AACjF,qFAA+E;AAC/E,gGAAwF;AACxF,oFAAuE;AACvE,qCAAqC;AAG9B,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,+CAAiB;IACtD,YACmB,UAAsB,EACtB,aAA4B,EAC5B,aAA6B;QAE9C,KAAK,EAAE,CAAC;QAJS,eAAU,GAAV,UAAU,CAAY;QACtB,kBAAa,GAAb,aAAa,CAAe;QAC5B,kBAAa,GAAb,aAAa,CAAgB;IAGhD,CAAC;IAED,KAAK,CAAC,uBAAuB,CAC3B,UAAkB,EAClB,YAAiB,EACjB,IAAuC;QAEvC,MAAM,KAAK,GAAG,YAAY,CAAC,eAAe,CAAC;QAC3C,MAAM,I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CAAC;QACzD,MAAM,IAAI,GAAG,MAAM,EAAE,IAAI,EAAE,WAAW,IAAI,EAAE,CAAC;QAC7C,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACjE,CAAC;CACF,CAAA;AAnTY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;qCAGoB,oBAAU;QACP,8BAAa;QACb,oCAAc;GAJrC,iBAAiB,CAmT7B"}
|
|
@@ -117,10 +117,10 @@ let SavedFilterRepositoryService = class SavedFilterRepositoryService {
|
|
|
117
117
|
}));
|
|
118
118
|
}
|
|
119
119
|
async getSavedFilterByCode(code, loggedInUser) {
|
|
120
|
-
const [filterMaster] = await this.dataSource.query(`SELECT id, name, code
|
|
121
|
-
FROM frm_saved_filter_master
|
|
122
|
-
WHERE code =
|
|
123
|
-
LIMIT 1
|
|
120
|
+
const [filterMaster] = await this.dataSource.query(`SELECT id, name, code
|
|
121
|
+
FROM frm_saved_filter_master
|
|
122
|
+
WHERE code = ? AND organization_id = ?
|
|
123
|
+
LIMIT 1
|
|
124
124
|
`, [code, loggedInUser.organization_id]);
|
|
125
125
|
if (!filterMaster) {
|
|
126
126
|
return null;
|
|
@@ -20,9 +20,9 @@ let FilterEvaluatorService = class FilterEvaluatorService {
|
|
|
20
20
|
}
|
|
21
21
|
async evaluateTriggerAttributes(oldEntity, newEntity, savedFilterCode) {
|
|
22
22
|
console.log('IN FILTER EVALUATOR SERVICE');
|
|
23
|
-
const triggerFilters = await this.dataSource.query(`SELECT *
|
|
24
|
-
FROM frm_saved_filter_detail
|
|
25
|
-
WHERE mapped_filter_code =
|
|
23
|
+
const triggerFilters = await this.dataSource.query(`SELECT *
|
|
24
|
+
FROM frm_saved_filter_detail
|
|
25
|
+
WHERE mapped_filter_code = ?`, [savedFilterCode]);
|
|
26
26
|
if (!triggerFilters || triggerFilters.length === 0) {
|
|
27
27
|
return true;
|
|
28
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter-evaluator.service.js","sourceRoot":"","sources":["../../../../src/module/filter/service/filter-evaluator.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,qCAAqC;AAErC,qDAAiD;AAG1C,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IACjC,YACmB,UAAsB,EACtB,aAA4B;QAD5B,eAAU,GAAV,UAAU,CAAY;QACtB,kBAAa,GAAb,aAAa,CAAe;IAC5C,CAAC;IASJ,KAAK,CAAC,yBAAyB,CAC7B,SAAqC,EACrC,SAA8B,EAC9B,eAAuB;QAGvB,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;QAC3C,MAAM,cAAc,GAAwB,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CACrE;;
|
|
1
|
+
{"version":3,"file":"filter-evaluator.service.js","sourceRoot":"","sources":["../../../../src/module/filter/service/filter-evaluator.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,qCAAqC;AAErC,qDAAiD;AAG1C,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IACjC,YACmB,UAAsB,EACtB,aAA4B;QAD5B,eAAU,GAAV,UAAU,CAAY;QACtB,kBAAa,GAAb,aAAa,CAAe;IAC5C,CAAC;IASJ,KAAK,CAAC,yBAAyB,CAC7B,SAAqC,EACrC,SAA8B,EAC9B,eAAuB;QAGvB,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;QAC3C,MAAM,cAAc,GAAwB,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CACrE;;oCAE8B,EAC9B,CAAC,eAAe,CAAC,CAClB,CAAC;QAGF,IAAI,CAAC,cAAc,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACnD,OAAO,IAAI,CAAC;QACd,CAAC;Q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from 'src/module/meta/service/entity-relation.service';
|
|
7
7
|
import { ResolverService } from 'src/module/meta/service/resolver.service';
|
|
8
8
|
import { LoggingService } from 'src/utils/service/loggingUtil.service';
|
|
9
|
-
import { ConfigService } from '@nestjs/config';
|
|
10
9
|
export declare class FilterService {
|
|
11
10
|
private dataSource;
|
|
12
11
|
private readonly attributeMasterService;
|
|
@@ -15,8 +14,7 @@ export declare class FilterService {
|
|
|
15
14
|
private readonly entityRelationService;
|
|
16
15
|
private readonly resolverService;
|
|
17
16
|
protected readonly loggingService: LoggingService;
|
|
18
|
-
|
|
19
|
-
constructor(dataSource: DataSource, attributeMasterService: AttributeMasterService, entityMasterService: EntityMasterService, savedFilterService: SavedFilterService, entityRelationService: EntityRelationService, resolverService: ResolverService, loggingService: LoggingService, configService: ConfigService);
|
|
17
|
+
constructor(dataSource: DataSource, attributeMasterService: AttributeMasterService, entityMasterService: EntityMasterService, savedFilterService: SavedFilterService, entityRelationService: EntityRelationService, resolverService: ResolverService, loggingService: LoggingService);
|
|
20
18
|
private readonly skipAppCodeFilterEntities;
|
|
21
19
|
private readonly skipOrgFilterEntities;
|
|
22
20
|
private gettab_value_counts;
|
|
@@ -69,5 +67,4 @@ export declare class FilterService {
|
|
|
69
67
|
private buildSelectCondition;
|
|
70
68
|
private buildMultiSelectCondition;
|
|
71
69
|
private buildYearCondition;
|
|
72
|
-
queryWithSchema(sql: string, params?: any[]): Promise<any>;
|
|
73
70
|
}
|
|
@@ -22,9 +22,8 @@ const moment = require("moment");
|
|
|
22
22
|
const entity_relation_service_1 = require("../../meta/service/entity-relation.service");
|
|
23
23
|
const resolver_service_1 = require("../../meta/service/resolver.service");
|
|
24
24
|
const loggingUtil_service_1 = require("../../../utils/service/loggingUtil.service");
|
|
25
|
-
const config_1 = require("@nestjs/config");
|
|
26
25
|
let FilterService = class FilterService {
|
|
27
|
-
constructor(dataSource, attributeMasterService, entityMasterService, savedFilterService, entityRelationService, resolverService, loggingService
|
|
26
|
+
constructor(dataSource, attributeMasterService, entityMasterService, savedFilterService, entityRelationService, resolverService, loggingService) {
|
|
28
27
|
this.dataSource = dataSource;
|
|
29
28
|
this.attributeMasterService = attributeMasterService;
|
|
30
29
|
this.entityMasterService = entityMasterService;
|
|
@@ -32,7 +31,6 @@ let FilterService = class FilterService {
|
|
|
32
31
|
this.entityRelationService = entityRelationService;
|
|
33
32
|
this.resolverService = resolverService;
|
|
34
33
|
this.loggingService = loggingService;
|
|
35
|
-
this.configService = configService;
|
|
36
34
|
this.skipAppCodeFilterEntities = ['ORGP'];
|
|
37
35
|
this.skipOrgFilterEntities = ['ORGP'];
|
|
38
36
|
}
|
|
@@ -41,35 +39,31 @@ let FilterService = class FilterService {
|
|
|
41
39
|
return [];
|
|
42
40
|
let whereSQL = '';
|
|
43
41
|
const values = [];
|
|
44
|
-
let paramIndex = 1;
|
|
45
42
|
if (whereClauses.length > 0) {
|
|
46
43
|
const clauseParts = whereClauses.map((clause) => {
|
|
47
44
|
let parsedQuery = clause.query.replace(/\be\./g, '');
|
|
48
45
|
Object.entries(clause.params).forEach(([key, val]) => {
|
|
49
46
|
if (Array.isArray(val)) {
|
|
50
|
-
const placeholders = val
|
|
51
|
-
.map(() => `$${paramIndex++}`)
|
|
52
|
-
.join(', ');
|
|
47
|
+
const placeholders = val.map(() => '?').join(', ');
|
|
53
48
|
parsedQuery = parsedQuery.replace(new RegExp(`:${key}`, 'g'), `(${placeholders})`);
|
|
54
|
-
values.push(...val
|
|
49
|
+
values.push(...val);
|
|
55
50
|
}
|
|
56
51
|
else {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
values.push(String(val));
|
|
52
|
+
parsedQuery = parsedQuery.replace(new RegExp(`:${key}`, 'g'), '?');
|
|
53
|
+
values.push(val);
|
|
60
54
|
}
|
|
61
55
|
});
|
|
62
56
|
return parsedQuery;
|
|
63
57
|
});
|
|
64
58
|
whereSQL = `WHERE ${clauseParts.join(' AND ')}`;
|
|
65
59
|
}
|
|
66
|
-
const rawSQL = `
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
const rows = await this.
|
|
60
|
+
const rawSQL = `
|
|
61
|
+
SELECT ${column} AS tab_value, COUNT(*) AS tab_value_count
|
|
62
|
+
FROM ${tableName}
|
|
63
|
+
${whereSQL}
|
|
64
|
+
GROUP BY ${column}
|
|
65
|
+
`;
|
|
66
|
+
const rows = await this.dataSource.query(rawSQL, values);
|
|
73
67
|
const total = rows.reduce((sum, r) => sum + parseInt(r.tab_value_count, 10), 0);
|
|
74
68
|
return [
|
|
75
69
|
{ tab_value: 'All', tab_value_count: total },
|
|
@@ -176,27 +170,27 @@ let FilterService = class FilterService {
|
|
|
176
170
|
const templateTable = entityMeta?.data_source || 'frm_wf_comm_template';
|
|
177
171
|
if (level_type === 'ORG') {
|
|
178
172
|
baseWhere.push({
|
|
179
|
-
query: ` ((e.level_type = 'ORG' AND e.level_id =
|
|
173
|
+
query: ` ((e.level_type = 'ORG' AND e.level_id = ${loggedInUser.organization_id} AND e.organization_id = ${loggedInUser.organization_id}))`,
|
|
180
174
|
params: {},
|
|
181
175
|
});
|
|
182
176
|
}
|
|
183
177
|
else if (level_type === 'SCH') {
|
|
184
178
|
baseWhere.push({
|
|
185
|
-
query: `
|
|
186
|
-
(
|
|
187
|
-
(e.level_type = 'SCH' AND e.level_id =
|
|
188
|
-
OR
|
|
189
|
-
(
|
|
190
|
-
e.level_type = 'ORG'
|
|
191
|
-
AND e.level_id =
|
|
192
|
-
AND e.organization_id =
|
|
193
|
-
AND e.code NOT IN (
|
|
194
|
-
SELECT sub.code
|
|
195
|
-
FROM frm_wf_comm_template AS sub
|
|
196
|
-
WHERE sub.level_type = 'SCH' AND sub.level_id =
|
|
197
|
-
)
|
|
198
|
-
)
|
|
199
|
-
)
|
|
179
|
+
query: `
|
|
180
|
+
(
|
|
181
|
+
(e.level_type = 'SCH' AND e.level_id = ${loggedInUser.level_id} AND e.organization_id = ${loggedInUser.organization_id})
|
|
182
|
+
OR
|
|
183
|
+
(
|
|
184
|
+
e.level_type = 'ORG'
|
|
185
|
+
AND e.level_id = ${loggedInUser.organization_id}
|
|
186
|
+
AND e.organization_id = ${loggedInUser.organization_id}
|
|
187
|
+
AND e.code NOT IN (
|
|
188
|
+
SELECT sub.code
|
|
189
|
+
FROM frm_wf_comm_template AS sub
|
|
190
|
+
WHERE sub.level_type = 'SCH' AND sub.level_id = ${loggedInUser.level_id}
|
|
191
|
+
)
|
|
192
|
+
)
|
|
193
|
+
)
|
|
200
194
|
`,
|
|
201
195
|
params: {},
|
|
202
196
|
});
|
|
@@ -212,7 +206,7 @@ let FilterService = class FilterService {
|
|
|
212
206
|
!customLevelId) {
|
|
213
207
|
baseWhere.push({
|
|
214
208
|
query: 'e.organization_id = :organization_id AND e.level_type = :level_type AND e.level_id = :level_id',
|
|
215
|
-
params: { organization_id
|
|
209
|
+
params: { organization_id, level_type, level_id },
|
|
216
210
|
});
|
|
217
211
|
}
|
|
218
212
|
if (entity_type == 'USR' || entity_type == 'UPR') {
|
|
@@ -225,9 +219,9 @@ let FilterService = class FilterService {
|
|
|
225
219
|
baseWhere.push({
|
|
226
220
|
query: 'e.organization_id = :organization_id AND e.level_type = :customLevelType AND e.level_id = :customLevelId AND e.appcode = :customAppCode',
|
|
227
221
|
params: {
|
|
228
|
-
organization_id
|
|
222
|
+
organization_id,
|
|
229
223
|
customLevelType,
|
|
230
|
-
customLevelId
|
|
224
|
+
customLevelId,
|
|
231
225
|
customAppCode,
|
|
232
226
|
},
|
|
233
227
|
});
|
|
@@ -236,10 +230,9 @@ let FilterService = class FilterService {
|
|
|
236
230
|
Object.entries(queryParams).forEach(([key, value]) => {
|
|
237
231
|
if (!value)
|
|
238
232
|
return;
|
|
239
|
-
const strValue = String(value);
|
|
240
233
|
if (key === 'attributeName' && queryParams['attributeValue']) {
|
|
241
|
-
const attrName =
|
|
242
|
-
const attrValue =
|
|
234
|
+
const attrName = value;
|
|
235
|
+
const attrValue = queryParams['attributeValue'];
|
|
243
236
|
baseWhere.push({
|
|
244
237
|
query: `e.${attrName} = :${attrName}`,
|
|
245
238
|
params: { [attrName]: attrValue },
|
|
@@ -248,15 +241,15 @@ let FilterService = class FilterService {
|
|
|
248
241
|
else if (key !== 'attributeValue') {
|
|
249
242
|
baseWhere.push({
|
|
250
243
|
query: `e.${key} = :${key}`,
|
|
251
|
-
params: { [key]:
|
|
244
|
+
params: { [key]: value },
|
|
252
245
|
});
|
|
253
246
|
}
|
|
254
247
|
});
|
|
255
248
|
}
|
|
256
249
|
console.log('🟠 [FilterService] Constructed baseWhere clauses:', baseWhere);
|
|
257
|
-
const layoutPreference = await this.dataSource.query(`SELECT mapped_json
|
|
258
|
-
FROM frm_entity_layout_pref
|
|
259
|
-
WHERE user_id =
|
|
250
|
+
const layoutPreference = await this.dataSource.query(`SELECT mapped_json
|
|
251
|
+
FROM frm_entity_layout_pref
|
|
252
|
+
WHERE user_id = ? AND mapped_entity_type = ? AND mapped_level_id = ? AND mapped_level_type = ? AND type = 'layout'`, [user_id, entity_type, level_id, level_type]);
|
|
260
253
|
const layout = layoutPreference?.[0]?.mapped_json?.quick_tab || {};
|
|
261
254
|
const showList = layout?.show_list?.map((val) => {
|
|
262
255
|
if (typeof val === 'string') {
|
|
@@ -315,10 +308,6 @@ let FilterService = class FilterService {
|
|
|
315
308
|
const page = dto.page && dto.page > 0 ? dto.page : 1;
|
|
316
309
|
const size = dto.size && dto.size > 0 ? dto.size : 10;
|
|
317
310
|
qb.skip((page - 1) * size).take(size);
|
|
318
|
-
let query = await qb.getQuery();
|
|
319
|
-
console.log('------------------------------------------------------\n');
|
|
320
|
-
console.log(query);
|
|
321
|
-
console.log('\n------------------------------------------------------');
|
|
322
311
|
const entity_list = await qb.getRawMany();
|
|
323
312
|
console.log(`📦 [FilterService] Fetched ${entity_list.length} records`);
|
|
324
313
|
const dateAttributes = Object.entries(attributeMetaMap)
|
|
@@ -491,17 +480,7 @@ let FilterService = class FilterService {
|
|
|
491
480
|
}
|
|
492
481
|
buildWhereClauses(filters, attributeMeta) {
|
|
493
482
|
return filters
|
|
494
|
-
.map((f) =>
|
|
495
|
-
const clause = this.buildCondition(f, attributeMeta[f.filter_attribute]);
|
|
496
|
-
if (!clause)
|
|
497
|
-
return null;
|
|
498
|
-
if (clause.params) {
|
|
499
|
-
Object.keys(clause.params).forEach((k) => {
|
|
500
|
-
clause.params[k] = String(clause.params[k]);
|
|
501
|
-
});
|
|
502
|
-
}
|
|
503
|
-
return clause;
|
|
504
|
-
})
|
|
483
|
+
.map((f) => this.buildCondition(f, attributeMeta[f.filter_attribute]))
|
|
505
484
|
.filter((clause) => clause !== null);
|
|
506
485
|
}
|
|
507
486
|
buildCondition(filter, meta) {
|
|
@@ -713,14 +692,6 @@ let FilterService = class FilterService {
|
|
|
713
692
|
throw new common_1.BadRequestException(`Unsupported operator for year: ${op}`);
|
|
714
693
|
}
|
|
715
694
|
}
|
|
716
|
-
async queryWithSchema(sql, params = []) {
|
|
717
|
-
await this.dataSource.query('BEGIN');
|
|
718
|
-
const schema = this.configService.get('DB_SCHEMA');
|
|
719
|
-
await this.dataSource.query(`SET LOCAL search_path TO ${schema}`);
|
|
720
|
-
const result = await this.dataSource.query(sql, params);
|
|
721
|
-
await this.dataSource.query('COMMIT');
|
|
722
|
-
return result;
|
|
723
|
-
}
|
|
724
695
|
};
|
|
725
696
|
exports.FilterService = FilterService;
|
|
726
697
|
exports.FilterService = FilterService = __decorate([
|
|
@@ -734,7 +705,6 @@ exports.FilterService = FilterService = __decorate([
|
|
|
734
705
|
saved_filter_service_1.SavedFilterService,
|
|
735
706
|
entity_relation_service_1.EntityRelationService,
|
|
736
707
|
resolver_service_1.ResolverService,
|
|
737
|
-
loggingUtil_service_1.LoggingService
|
|
738
|
-
config_1.ConfigService])
|
|
708
|
+
loggingUtil_service_1.LoggingService])
|
|
739
709
|
], FilterService);
|
|
740
710
|
//# sourceMappingURL=filter.service.js.map
|