@solidstarters/solid-core 1.2.204 → 1.2.206
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/commands/info.command.d.ts +19 -0
- package/dist/commands/info.command.d.ts.map +1 -0
- package/dist/commands/info.command.js +98 -0
- package/dist/commands/info.command.js.map +1 -0
- package/dist/commands/mcp.command.d.ts.map +1 -1
- package/dist/commands/mcp.command.js +2 -10
- package/dist/commands/mcp.command.js.map +1 -1
- package/dist/commands/seed.command.d.ts.map +1 -1
- package/dist/commands/seed.command.js +2 -11
- package/dist/commands/seed.command.js.map +1 -1
- package/dist/controllers/email-template.controller.d.ts +3 -1
- package/dist/controllers/email-template.controller.d.ts.map +1 -1
- package/dist/controllers/email-template.controller.js +7 -4
- package/dist/controllers/email-template.controller.js.map +1 -1
- package/dist/controllers/google-authentication.controller.d.ts +4 -5
- package/dist/controllers/google-authentication.controller.d.ts.map +1 -1
- package/dist/controllers/google-authentication.controller.js +21 -14
- package/dist/controllers/google-authentication.controller.js.map +1 -1
- package/dist/controllers/otp-authentication.controller.d.ts +10 -0
- package/dist/controllers/otp-authentication.controller.d.ts.map +1 -1
- package/dist/controllers/otp-authentication.controller.js +1 -1
- package/dist/controllers/setting.controller.d.ts +2 -34
- package/dist/controllers/setting.controller.d.ts.map +1 -1
- package/dist/controllers/setting.controller.js +4 -130
- package/dist/controllers/setting.controller.js.map +1 -1
- package/dist/decorators/settings-provider.decorator.d.ts +3 -0
- package/dist/decorators/settings-provider.decorator.d.ts.map +1 -0
- package/dist/decorators/settings-provider.decorator.js +8 -0
- package/dist/decorators/settings-provider.decorator.js.map +1 -0
- package/dist/decorators/solid-password.decorator.d.ts.map +1 -1
- package/dist/decorators/solid-password.decorator.js +3 -3
- package/dist/decorators/solid-password.decorator.js.map +1 -1
- package/dist/dtos/create-role-metadata.dto.d.ts +3 -4
- package/dist/dtos/create-role-metadata.dto.d.ts.map +1 -1
- package/dist/dtos/create-role-metadata.dto.js +4 -51
- package/dist/dtos/create-role-metadata.dto.js.map +1 -1
- package/dist/dtos/create-setting.dto.d.ts +3 -0
- package/dist/dtos/create-setting.dto.d.ts.map +1 -1
- package/dist/dtos/create-setting.dto.js +20 -2
- package/dist/dtos/create-setting.dto.js.map +1 -1
- package/dist/dtos/update-setting.dto.d.ts +3 -0
- package/dist/dtos/update-setting.dto.d.ts.map +1 -1
- package/dist/dtos/update-setting.dto.js +19 -1
- package/dist/dtos/update-setting.dto.js.map +1 -1
- package/dist/entities/setting.entity.d.ts +3 -0
- package/dist/entities/setting.entity.d.ts.map +1 -1
- package/dist/entities/setting.entity.js +13 -1
- package/dist/entities/setting.entity.js.map +1 -1
- package/dist/factories/mail.factory.d.ts +3 -4
- package/dist/factories/mail.factory.d.ts.map +1 -1
- package/dist/factories/mail.factory.js +6 -12
- package/dist/factories/mail.factory.js.map +1 -1
- package/dist/factories/sms.factory.d.ts +3 -4
- package/dist/factories/sms.factory.d.ts.map +1 -1
- package/dist/factories/sms.factory.js +6 -12
- package/dist/factories/sms.factory.js.map +1 -1
- package/dist/factories/whatsapp.factory.d.ts +3 -4
- package/dist/factories/whatsapp.factory.d.ts.map +1 -1
- package/dist/factories/whatsapp.factory.js +6 -12
- package/dist/factories/whatsapp.factory.js.map +1 -1
- package/dist/guards/access-token.guard.d.ts +3 -4
- package/dist/guards/access-token.guard.d.ts.map +1 -1
- package/dist/guards/access-token.guard.js +14 -9
- package/dist/guards/access-token.guard.js.map +1 -1
- package/dist/helpers/cors.helper.d.ts +1 -2
- package/dist/helpers/cors.helper.d.ts.map +1 -1
- package/dist/helpers/cors.helper.js +2 -2
- package/dist/helpers/cors.helper.js.map +1 -1
- package/dist/helpers/error-mapper.service.d.ts.map +1 -1
- package/dist/helpers/error-mapper.service.js.map +1 -1
- package/dist/helpers/google-oauth.helper.d.ts +7 -3
- package/dist/helpers/google-oauth.helper.d.ts.map +1 -1
- package/dist/helpers/google-oauth.helper.js +1 -2
- package/dist/helpers/google-oauth.helper.js.map +1 -1
- package/dist/helpers/module.helper.js +0 -2
- package/dist/helpers/module.helper.js.map +1 -1
- package/dist/helpers/solid-registry.d.ts +8 -3
- package/dist/helpers/solid-registry.d.ts.map +1 -1
- package/dist/helpers/solid-registry.js +32 -9
- package/dist/helpers/solid-registry.js.map +1 -1
- package/dist/index.d.ts +2 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -6
- package/dist/index.js.map +1 -1
- package/dist/interfaces.d.ts +21 -0
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/interfaces.js +8 -1
- package/dist/interfaces.js.map +1 -1
- package/dist/passport-strategies/google-oauth.strategy.d.ts +1 -4
- package/dist/passport-strategies/google-oauth.strategy.d.ts.map +1 -1
- package/dist/passport-strategies/google-oauth.strategy.js +12 -12
- package/dist/passport-strategies/google-oauth.strategy.js.map +1 -1
- package/dist/seeders/email-template-seeder.service.d.ts +3 -4
- package/dist/seeders/email-template-seeder.service.d.ts.map +1 -1
- package/dist/seeders/email-template-seeder.service.js +7 -12
- package/dist/seeders/email-template-seeder.service.js.map +1 -1
- package/dist/seeders/module-metadata-seeder.service.d.ts +1 -5
- package/dist/seeders/module-metadata-seeder.service.d.ts.map +1 -1
- package/dist/seeders/module-metadata-seeder.service.js +23 -23
- package/dist/seeders/module-metadata-seeder.service.js.map +1 -1
- package/dist/seeders/seed-data/solid-core-metadata.json +98 -4
- package/dist/seeders/sms-template-seeder.service.d.ts +3 -4
- package/dist/seeders/sms-template-seeder.service.d.ts.map +1 -1
- package/dist/seeders/sms-template-seeder.service.js +7 -12
- package/dist/seeders/sms-template-seeder.service.js.map +1 -1
- package/dist/services/action-metadata.service.d.ts +2 -13
- package/dist/services/action-metadata.service.d.ts.map +1 -1
- package/dist/services/action-metadata.service.js +4 -22
- package/dist/services/action-metadata.service.js.map +1 -1
- package/dist/services/ai-interaction.service.d.ts +2 -13
- package/dist/services/ai-interaction.service.d.ts.map +1 -1
- package/dist/services/ai-interaction.service.js +6 -24
- package/dist/services/ai-interaction.service.js.map +1 -1
- package/dist/services/authentication.service.d.ts +14 -10
- package/dist/services/authentication.service.d.ts.map +1 -1
- package/dist/services/authentication.service.js +159 -114
- package/dist/services/authentication.service.js.map +1 -1
- package/dist/services/bcrypt.service.d.ts +3 -5
- package/dist/services/bcrypt.service.d.ts.map +1 -1
- package/dist/services/bcrypt.service.js +10 -14
- package/dist/services/bcrypt.service.js.map +1 -1
- package/dist/services/chatter-message-details.service.d.ts +2 -13
- package/dist/services/chatter-message-details.service.d.ts.map +1 -1
- package/dist/services/chatter-message-details.service.js +4 -22
- package/dist/services/chatter-message-details.service.js.map +1 -1
- package/dist/services/chatter-message.service.d.ts +2 -13
- package/dist/services/chatter-message.service.d.ts.map +1 -1
- package/dist/services/chatter-message.service.js +5 -23
- package/dist/services/chatter-message.service.js.map +1 -1
- package/dist/services/crud.service.d.ts +12 -12
- package/dist/services/crud.service.d.ts.map +1 -1
- package/dist/services/crud.service.js +25 -17
- package/dist/services/crud.service.js.map +1 -1
- package/dist/services/dashboard-question-sql-dataset-config.service.d.ts +2 -13
- package/dist/services/dashboard-question-sql-dataset-config.service.d.ts.map +1 -1
- package/dist/services/dashboard-question-sql-dataset-config.service.js +4 -21
- package/dist/services/dashboard-question-sql-dataset-config.service.js.map +1 -1
- package/dist/services/dashboard-question.service.d.ts +2 -13
- package/dist/services/dashboard-question.service.d.ts.map +1 -1
- package/dist/services/dashboard-question.service.js +4 -21
- package/dist/services/dashboard-question.service.js.map +1 -1
- package/dist/services/dashboard-variable.service.d.ts +2 -13
- package/dist/services/dashboard-variable.service.d.ts.map +1 -1
- package/dist/services/dashboard-variable.service.js +4 -21
- package/dist/services/dashboard-variable.service.js.map +1 -1
- package/dist/services/dashboard.service.d.ts +2 -13
- package/dist/services/dashboard.service.d.ts.map +1 -1
- package/dist/services/dashboard.service.js +4 -21
- package/dist/services/dashboard.service.js.map +1 -1
- package/dist/services/email-template.service.d.ts +2 -13
- package/dist/services/email-template.service.d.ts.map +1 -1
- package/dist/services/email-template.service.js +4 -22
- package/dist/services/email-template.service.js.map +1 -1
- package/dist/services/export-template.service.d.ts +2 -13
- package/dist/services/export-template.service.d.ts.map +1 -1
- package/dist/services/export-template.service.js +4 -21
- package/dist/services/export-template.service.js.map +1 -1
- package/dist/services/export-transaction.service.d.ts +2 -13
- package/dist/services/export-transaction.service.d.ts.map +1 -1
- package/dist/services/export-transaction.service.js +4 -21
- package/dist/services/export-transaction.service.js.map +1 -1
- package/dist/services/field-metadata.service.d.ts +11 -0
- package/dist/services/field-metadata.service.d.ts.map +1 -1
- package/dist/services/field-metadata.service.js +3 -0
- package/dist/services/field-metadata.service.js.map +1 -1
- package/dist/services/file/file-service.interface.d.ts +22 -0
- package/dist/services/file/file-service.interface.d.ts.map +1 -0
- package/dist/services/file/file-service.interface.js +5 -0
- package/dist/services/file/file-service.interface.js.map +1 -0
- package/dist/services/file.service.d.ts +1 -4
- package/dist/services/file.service.d.ts.map +1 -1
- package/dist/services/file.service.js +11 -12
- package/dist/services/file.service.js.map +1 -1
- package/dist/services/genai/r2r-helper.service.d.ts +3 -1
- package/dist/services/genai/r2r-helper.service.d.ts.map +1 -1
- package/dist/services/genai/r2r-helper.service.js +11 -7
- package/dist/services/genai/r2r-helper.service.js.map +1 -1
- package/dist/services/import-transaction-error-log.service.d.ts +2 -13
- package/dist/services/import-transaction-error-log.service.d.ts.map +1 -1
- package/dist/services/import-transaction-error-log.service.js +4 -22
- package/dist/services/import-transaction-error-log.service.js.map +1 -1
- package/dist/services/import-transaction.service.d.ts +2 -13
- package/dist/services/import-transaction.service.d.ts.map +1 -1
- package/dist/services/import-transaction.service.js +4 -22
- package/dist/services/import-transaction.service.js.map +1 -1
- package/dist/services/list-of-values.service.d.ts +2 -13
- package/dist/services/list-of-values.service.d.ts.map +1 -1
- package/dist/services/list-of-values.service.js +4 -22
- package/dist/services/list-of-values.service.js.map +1 -1
- package/dist/services/locale.service.d.ts +2 -13
- package/dist/services/locale.service.d.ts.map +1 -1
- package/dist/services/locale.service.js +4 -22
- package/dist/services/locale.service.js.map +1 -1
- package/dist/services/mail/elastic-email.service.d.ts +4 -5
- package/dist/services/mail/elastic-email.service.d.ts.map +1 -1
- package/dist/services/mail/elastic-email.service.js +10 -13
- package/dist/services/mail/elastic-email.service.js.map +1 -1
- package/dist/services/mail/smtp-email.service.d.ts +3 -4
- package/dist/services/mail/smtp-email.service.d.ts.map +1 -1
- package/dist/services/mail/smtp-email.service.js +19 -17
- package/dist/services/mail/smtp-email.service.js.map +1 -1
- package/dist/services/media-storage-provider-metadata.service.d.ts +11 -0
- package/dist/services/media-storage-provider-metadata.service.d.ts.map +1 -1
- package/dist/services/media-storage-provider-metadata.service.js +3 -0
- package/dist/services/media-storage-provider-metadata.service.js.map +1 -1
- package/dist/services/media.service.d.ts +2 -9
- package/dist/services/media.service.d.ts.map +1 -1
- package/dist/services/media.service.js +17 -28
- package/dist/services/media.service.js.map +1 -1
- package/dist/services/mediaStorageProviders/file-s3-storage-provider.d.ts +2 -4
- package/dist/services/mediaStorageProviders/file-s3-storage-provider.d.ts.map +1 -1
- package/dist/services/mediaStorageProviders/file-s3-storage-provider.js +2 -11
- package/dist/services/mediaStorageProviders/file-s3-storage-provider.js.map +1 -1
- package/dist/services/mediaStorageProviders/file-storage-provider.d.ts +3 -1
- package/dist/services/mediaStorageProviders/file-storage-provider.d.ts.map +1 -1
- package/dist/services/mediaStorageProviders/file-storage-provider.js +16 -12
- package/dist/services/mediaStorageProviders/file-storage-provider.js.map +1 -1
- package/dist/services/mediaStorageProviders/index.d.ts +1 -1
- package/dist/services/mediaStorageProviders/index.d.ts.map +1 -1
- package/dist/services/mediaStorageProviders/index.js +1 -1
- package/dist/services/mediaStorageProviders/index.js.map +1 -1
- package/dist/services/menu-item-metadata.service.d.ts +2 -13
- package/dist/services/menu-item-metadata.service.d.ts.map +1 -1
- package/dist/services/menu-item-metadata.service.js +4 -22
- package/dist/services/menu-item-metadata.service.js.map +1 -1
- package/dist/services/model-metadata.service.d.ts +11 -0
- package/dist/services/model-metadata.service.d.ts.map +1 -1
- package/dist/services/model-metadata.service.js +3 -0
- package/dist/services/model-metadata.service.js.map +1 -1
- package/dist/services/model-sequence.service.d.ts +2 -13
- package/dist/services/model-sequence.service.d.ts.map +1 -1
- package/dist/services/model-sequence.service.js +4 -21
- package/dist/services/model-sequence.service.js.map +1 -1
- package/dist/services/module-metadata.service.d.ts +14 -1
- package/dist/services/module-metadata.service.d.ts.map +1 -1
- package/dist/services/module-metadata.service.js +13 -6
- package/dist/services/module-metadata.service.js.map +1 -1
- package/dist/services/mq-message-queue.service.d.ts +2 -13
- package/dist/services/mq-message-queue.service.d.ts.map +1 -1
- package/dist/services/mq-message-queue.service.js +4 -22
- package/dist/services/mq-message-queue.service.js.map +1 -1
- package/dist/services/mq-message.service.d.ts +2 -13
- package/dist/services/mq-message.service.d.ts.map +1 -1
- package/dist/services/mq-message.service.js +4 -22
- package/dist/services/mq-message.service.js.map +1 -1
- package/dist/services/permission-metadata.service.d.ts +2 -13
- package/dist/services/permission-metadata.service.d.ts.map +1 -1
- package/dist/services/permission-metadata.service.js +4 -22
- package/dist/services/permission-metadata.service.js.map +1 -1
- package/dist/services/role-metadata.service.d.ts +2 -13
- package/dist/services/role-metadata.service.d.ts.map +1 -1
- package/dist/services/role-metadata.service.js +4 -23
- package/dist/services/role-metadata.service.js.map +1 -1
- package/dist/services/saved-filters.service.d.ts +2 -13
- package/dist/services/saved-filters.service.d.ts.map +1 -1
- package/dist/services/saved-filters.service.js +4 -21
- package/dist/services/saved-filters.service.js.map +1 -1
- package/dist/services/scheduled-job.service.d.ts +2 -13
- package/dist/services/scheduled-job.service.d.ts.map +1 -1
- package/dist/services/scheduled-job.service.js +4 -22
- package/dist/services/scheduled-job.service.js.map +1 -1
- package/dist/services/security-rule.service.d.ts +2 -13
- package/dist/services/security-rule.service.d.ts.map +1 -1
- package/dist/services/security-rule.service.js +5 -23
- package/dist/services/security-rule.service.js.map +1 -1
- package/dist/services/setting.service.d.ts +23 -30
- package/dist/services/setting.service.d.ts.map +1 -1
- package/dist/services/setting.service.js +147 -196
- package/dist/services/setting.service.js.map +1 -1
- package/dist/services/settings/default-settings-provider.service.d.ts +1058 -0
- package/dist/services/settings/default-settings-provider.service.d.ts.map +1 -0
- package/dist/services/settings/default-settings-provider.service.js +139 -0
- package/dist/services/settings/default-settings-provider.service.js.map +1 -0
- package/dist/services/short-url/tiny-url.service.d.ts +3 -4
- package/dist/services/short-url/tiny-url.service.d.ts.map +1 -1
- package/dist/services/short-url/tiny-url.service.js +10 -13
- package/dist/services/short-url/tiny-url.service.js.map +1 -1
- package/dist/services/sms/Msg91BaseSMSService.d.ts +3 -4
- package/dist/services/sms/Msg91BaseSMSService.d.ts.map +1 -1
- package/dist/services/sms/Msg91BaseSMSService.js +3 -3
- package/dist/services/sms/Msg91BaseSMSService.js.map +1 -1
- package/dist/services/sms/Msg91OTPService.d.ts +2 -3
- package/dist/services/sms/Msg91OTPService.d.ts.map +1 -1
- package/dist/services/sms/Msg91OTPService.js +7 -13
- package/dist/services/sms/Msg91OTPService.js.map +1 -1
- package/dist/services/sms/Msg91SMSService.d.ts +2 -3
- package/dist/services/sms/Msg91SMSService.d.ts.map +1 -1
- package/dist/services/sms/Msg91SMSService.js +7 -13
- package/dist/services/sms/Msg91SMSService.js.map +1 -1
- package/dist/services/sms/TwilioSMSService.d.ts +3 -4
- package/dist/services/sms/TwilioSMSService.d.ts.map +1 -1
- package/dist/services/sms/TwilioSMSService.js +13 -16
- package/dist/services/sms/TwilioSMSService.js.map +1 -1
- package/dist/services/sms-template.service.d.ts +2 -13
- package/dist/services/sms-template.service.d.ts.map +1 -1
- package/dist/services/sms-template.service.js +4 -22
- package/dist/services/sms-template.service.js.map +1 -1
- package/dist/services/solid-introspect.service.d.ts +4 -1
- package/dist/services/solid-introspect.service.d.ts.map +1 -1
- package/dist/services/solid-introspect.service.js +33 -47
- package/dist/services/solid-introspect.service.js.map +1 -1
- package/dist/services/textract.service.d.ts +1 -4
- package/dist/services/textract.service.d.ts.map +1 -1
- package/dist/services/textract.service.js +14 -18
- package/dist/services/textract.service.js.map +1 -1
- package/dist/services/user-activity-history.service.d.ts +2 -13
- package/dist/services/user-activity-history.service.d.ts.map +1 -1
- package/dist/services/user-activity-history.service.js +4 -22
- package/dist/services/user-activity-history.service.js.map +1 -1
- package/dist/services/user-view-metadata.service.d.ts +2 -13
- package/dist/services/user-view-metadata.service.d.ts.map +1 -1
- package/dist/services/user-view-metadata.service.js +4 -22
- package/dist/services/user-view-metadata.service.js.map +1 -1
- package/dist/services/user.service.d.ts +2 -15
- package/dist/services/user.service.d.ts.map +1 -1
- package/dist/services/user.service.js +7 -28
- package/dist/services/user.service.js.map +1 -1
- package/dist/services/view-metadata.service.d.ts +2 -13
- package/dist/services/view-metadata.service.d.ts.map +1 -1
- package/dist/services/view-metadata.service.js +5 -23
- package/dist/services/view-metadata.service.js.map +1 -1
- package/dist/services/whatsapp/Msg91WhatsappService.d.ts +3 -4
- package/dist/services/whatsapp/Msg91WhatsappService.d.ts.map +1 -1
- package/dist/services/whatsapp/Msg91WhatsappService.js +12 -18
- package/dist/services/whatsapp/Msg91WhatsappService.js.map +1 -1
- package/dist/services/whatsapp/Three60WhatsappService.d.ts +1 -4
- package/dist/services/whatsapp/Three60WhatsappService.d.ts.map +1 -1
- package/dist/services/whatsapp/Three60WhatsappService.js +2 -11
- package/dist/services/whatsapp/Three60WhatsappService.js.map +1 -1
- package/dist/solid-core.module.d.ts.map +1 -1
- package/dist/solid-core.module.js +9 -47
- package/dist/solid-core.module.js.map +1 -1
- package/dist/transformers/typeorm/local-date-time-transformer.d.ts.map +1 -1
- package/dist/transformers/typeorm/local-date-time-transformer.js +4 -2
- package/dist/transformers/typeorm/local-date-time-transformer.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/commands/info.command.ts +101 -0
- package/src/commands/mcp.command.ts +3 -17
- package/src/commands/seed.command.ts +4 -16
- package/src/controllers/email-template.controller.ts +9 -4
- package/src/controllers/google-authentication.controller.ts +19 -12
- package/src/controllers/setting.controller.ts +6 -81
- package/src/decorators/settings-provider.decorator.ts +7 -0
- package/src/decorators/solid-password.decorator.ts +43 -43
- package/src/dtos/create-role-metadata.dto.ts +4 -81
- package/src/dtos/create-setting.dto.ts +14 -1
- package/src/dtos/update-setting.dto.ts +14 -0
- package/src/entities/setting.entity.ts +15 -1
- package/src/factories/mail.factory.ts +4 -4
- package/src/factories/sms.factory.ts +9 -7
- package/src/factories/whatsapp.factory.ts +4 -4
- package/src/guards/access-token.guard.ts +12 -5
- package/src/helpers/cors.helper.ts +3 -3
- package/src/helpers/error-mapper.service.ts +0 -1
- package/src/helpers/google-oauth.helper.ts +11 -7
- package/src/helpers/module.helper.ts +2 -2
- package/src/helpers/solid-registry.ts +45 -16
- package/src/index.ts +2 -4
- package/src/interfaces.ts +29 -0
- package/src/passport-strategies/google-oauth.strategy.ts +11 -8
- package/src/seeders/email-template-seeder.service.ts +6 -4
- package/src/seeders/module-metadata-seeder.service.ts +40 -28
- package/src/seeders/seed-data/solid-core-metadata.json +99 -5
- package/src/seeders/sms-template-seeder.service.ts +6 -4
- package/src/services/action-metadata.service.ts +4 -16
- package/src/services/ai-interaction.service.ts +6 -17
- package/src/services/authentication.service.ts +173 -111
- package/src/services/bcrypt.service.ts +9 -9
- package/src/services/chatter-message-details.service.ts +5 -17
- package/src/services/chatter-message.service.ts +2 -14
- package/src/services/crud.service.ts +36 -28
- package/src/services/dashboard-question-sql-dataset-config.service.ts +4 -15
- package/src/services/dashboard-question.service.ts +4 -17
- package/src/services/dashboard-variable.service.ts +4 -16
- package/src/services/dashboard.service.ts +2 -13
- package/src/services/email-template.service.ts +3 -15
- package/src/services/export-template.service.ts +4 -18
- package/src/services/export-transaction.service.ts +4 -19
- package/src/services/field-metadata.service.ts +5 -1
- package/src/services/file/file-service.interface.ts +74 -0
- package/src/services/file.service.ts +10 -7
- package/src/services/genai/r2r-helper.service.ts +10 -6
- package/src/services/import-transaction-error-log.service.ts +5 -17
- package/src/services/import-transaction.service.ts +3 -15
- package/src/services/list-of-values.service.ts +3 -16
- package/src/services/locale.service.ts +3 -15
- package/src/services/mail/elastic-email.service.ts +7 -7
- package/src/services/mail/smtp-email.service.ts +19 -11
- package/src/services/media-storage-provider-metadata.service.ts +4 -0
- package/src/services/media.service.ts +39 -22
- package/src/services/mediaStorageProviders/file-s3-storage-provider.ts +0 -3
- package/src/services/mediaStorageProviders/file-storage-provider.ts +24 -12
- package/src/services/mediaStorageProviders/index.ts +1 -1
- package/src/services/menu-item-metadata.service.ts +5 -17
- package/src/services/model-metadata.service.ts +4 -0
- package/src/services/model-sequence.service.ts +4 -15
- package/src/services/module-metadata.service.ts +13 -4
- package/src/services/mq-message-queue.service.ts +5 -17
- package/src/services/mq-message.service.ts +5 -17
- package/src/services/permission-metadata.service.ts +4 -16
- package/src/services/role-metadata.service.ts +3 -16
- package/src/services/saved-filters.service.ts +2 -13
- package/src/services/scheduled-job.service.ts +3 -15
- package/src/services/security-rule.service.ts +4 -16
- package/src/services/setting.service.ts +223 -212
- package/src/services/settings/default-settings-provider.service.ts +157 -0
- package/src/services/short-url/tiny-url.service.ts +9 -7
- package/src/services/sms/Msg91BaseSMSService.ts +6 -4
- package/src/services/sms/Msg91OTPService.ts +7 -7
- package/src/services/sms/Msg91SMSService.ts +7 -6
- package/src/services/sms/TwilioSMSService.ts +18 -19
- package/src/services/sms-template.service.ts +3 -15
- package/src/services/solid-introspect.service.ts +45 -66
- package/src/services/textract.service.ts +13 -10
- package/src/services/user-activity-history.service.ts +5 -17
- package/src/services/user-view-metadata.service.ts +5 -17
- package/src/services/user.service.ts +7 -22
- package/src/services/view-metadata.service.ts +3 -15
- package/src/services/whatsapp/Msg91WhatsappService.ts +10 -11
- package/src/services/whatsapp/Three60WhatsappService.ts +0 -3
- package/src/solid-core.module.ts +17 -49
- package/src/transformers/typeorm/local-date-time-transformer.ts +10 -5
- package/dist/config/app-builder.config.d.ts +0 -11
- package/dist/config/app-builder.config.d.ts.map +0 -1
- package/dist/config/app-builder.config.js +0 -13
- package/dist/config/app-builder.config.js.map +0 -1
- package/dist/config/common.config.d.ts +0 -96
- package/dist/config/common.config.d.ts.map +0 -1
- package/dist/config/common.config.js +0 -51
- package/dist/config/common.config.js.map +0 -1
- package/dist/config/iam.config.d.ts +0 -56
- package/dist/config/iam.config.d.ts.map +0 -1
- package/dist/config/iam.config.js +0 -35
- package/dist/config/iam.config.js.map +0 -1
- package/dist/config/jwt.config.d.ts +0 -14
- package/dist/config/jwt.config.d.ts.map +0 -1
- package/dist/config/jwt.config.js +0 -15
- package/dist/config/jwt.config.js.map +0 -1
- package/dist/services/genai/mcp-handlers/solid-add-button-to-form-view-mcp-handler.service.d.ts +0 -16
- package/dist/services/genai/mcp-handlers/solid-add-button-to-form-view-mcp-handler.service.d.ts.map +0 -1
- package/dist/services/genai/mcp-handlers/solid-add-button-to-form-view-mcp-handler.service.js +0 -151
- package/dist/services/genai/mcp-handlers/solid-add-button-to-form-view-mcp-handler.service.js.map +0 -1
- package/dist/services/genai/mcp-handlers/solid-add-controller-handler-method-mcp-handler.service.d.ts +0 -17
- package/dist/services/genai/mcp-handlers/solid-add-controller-handler-method-mcp-handler.service.d.ts.map +0 -1
- package/dist/services/genai/mcp-handlers/solid-add-controller-handler-method-mcp-handler.service.js +0 -80
- package/dist/services/genai/mcp-handlers/solid-add-controller-handler-method-mcp-handler.service.js.map +0 -1
- package/dist/services/genai/mcp-handlers/solid-add-custom-service-method-mcp-handler.service.d.ts +0 -16
- package/dist/services/genai/mcp-handlers/solid-add-custom-service-method-mcp-handler.service.d.ts.map +0 -1
- package/dist/services/genai/mcp-handlers/solid-add-custom-service-method-mcp-handler.service.js +0 -74
- package/dist/services/genai/mcp-handlers/solid-add-custom-service-method-mcp-handler.service.js.map +0 -1
- package/dist/services/genai/mcp-handlers/solid-add-fields-to-model-mcp-handler.service.d.ts +0 -12
- package/dist/services/genai/mcp-handlers/solid-add-fields-to-model-mcp-handler.service.d.ts.map +0 -1
- package/dist/services/genai/mcp-handlers/solid-add-fields-to-model-mcp-handler.service.js +0 -47
- package/dist/services/genai/mcp-handlers/solid-add-fields-to-model-mcp-handler.service.js.map +0 -1
- package/dist/services/genai/mcp-handlers/solid-add-header-button-or-row-button-to-list-view-mcp-handler.service.d.ts +0 -16
- package/dist/services/genai/mcp-handlers/solid-add-header-button-or-row-button-to-list-view-mcp-handler.service.d.ts.map +0 -1
- package/dist/services/genai/mcp-handlers/solid-add-header-button-or-row-button-to-list-view-mcp-handler.service.js +0 -151
- package/dist/services/genai/mcp-handlers/solid-add-header-button-or-row-button-to-list-view-mcp-handler.service.js.map +0 -1
- package/dist/services/genai/mcp-handlers/solid-create-computed-provider-mcp-handler.service.d.ts +0 -16
- package/dist/services/genai/mcp-handlers/solid-create-computed-provider-mcp-handler.service.d.ts.map +0 -1
- package/dist/services/genai/mcp-handlers/solid-create-computed-provider-mcp-handler.service.js +0 -75
- package/dist/services/genai/mcp-handlers/solid-create-computed-provider-mcp-handler.service.js.map +0 -1
- package/dist/services/genai/mcp-handlers/solid-create-custom-form-view-widget-mcp-handler.service.d.ts +0 -14
- package/dist/services/genai/mcp-handlers/solid-create-custom-form-view-widget-mcp-handler.service.d.ts.map +0 -1
- package/dist/services/genai/mcp-handlers/solid-create-custom-form-view-widget-mcp-handler.service.js +0 -73
- package/dist/services/genai/mcp-handlers/solid-create-custom-form-view-widget-mcp-handler.service.js.map +0 -1
- package/dist/services/genai/mcp-handlers/solid-create-model-with-fields-mcp-handler.service.d.ts +0 -14
- package/dist/services/genai/mcp-handlers/solid-create-model-with-fields-mcp-handler.service.d.ts.map +0 -1
- package/dist/services/genai/mcp-handlers/solid-create-model-with-fields-mcp-handler.service.js +0 -45
- package/dist/services/genai/mcp-handlers/solid-create-model-with-fields-mcp-handler.service.js.map +0 -1
- package/dist/services/genai/mcp-handlers/solid-create-module-mcp-handler.service.d.ts +0 -14
- package/dist/services/genai/mcp-handlers/solid-create-module-mcp-handler.service.d.ts.map +0 -1
- package/dist/services/genai/mcp-handlers/solid-create-module-mcp-handler.service.js +0 -51
- package/dist/services/genai/mcp-handlers/solid-create-module-mcp-handler.service.js.map +0 -1
- package/dist/services/genai/mcp-handlers/solid-update-layout-mcp-handler.service.d.ts +0 -12
- package/dist/services/genai/mcp-handlers/solid-update-layout-mcp-handler.service.d.ts.map +0 -1
- package/dist/services/genai/mcp-handlers/solid-update-layout-mcp-handler.service.js +0 -38
- package/dist/services/genai/mcp-handlers/solid-update-layout-mcp-handler.service.js.map +0 -1
- package/dist/services/media-storage-provider-metadata-seeder.service.d.ts +0 -8
- package/dist/services/media-storage-provider-metadata-seeder.service.d.ts.map +0 -1
- package/dist/services/media-storage-provider-metadata-seeder.service.js +0 -43
- package/dist/services/media-storage-provider-metadata-seeder.service.js.map +0 -1
- package/src/config/app-builder.config.ts +0 -12
- package/src/config/common.config.ts +0 -55
- package/src/config/iam.config.ts +0 -32
- package/src/config/jwt.config.ts +0 -13
- package/src/services/export_issues.txt +0 -10
- package/src/services/genai/mcp-handlers/solid-add-button-to-form-view-mcp-handler.service.ts +0 -137
- package/src/services/genai/mcp-handlers/solid-add-controller-handler-method-mcp-handler.service.ts +0 -81
- package/src/services/genai/mcp-handlers/solid-add-custom-service-method-mcp-handler.service.ts +0 -69
- package/src/services/genai/mcp-handlers/solid-add-fields-to-model-mcp-handler.service.ts +0 -68
- package/src/services/genai/mcp-handlers/solid-add-header-button-or-row-button-to-list-view-mcp-handler.service.ts +0 -141
- package/src/services/genai/mcp-handlers/solid-create-computed-provider-mcp-handler.service.ts +0 -71
- package/src/services/genai/mcp-handlers/solid-create-custom-form-view-widget-mcp-handler.service.ts +0 -72
- package/src/services/genai/mcp-handlers/solid-create-model-with-fields-mcp-handler.service.ts +0 -45
- package/src/services/genai/mcp-handlers/solid-create-module-mcp-handler.service.ts +0 -58
- package/src/services/genai/mcp-handlers/solid-update-layout-mcp-handler.service.ts +0 -40
- package/src/services/groupBy.json +0 -92
- package/src/services/media-storage-provider-metadata-seeder.service.ts +0 -33
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import-transaction.service.js","sourceRoot":"","sources":["../../src/services/import-transaction.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAiH;AACjH,uCAA2D;AAC3D,6CAAsD;AACtD,qCAAwC;AAExC,2CAA+C;AAC/C,+DAAqE;AACrE,iDAAwD;AACxD,iDAAwD;AACxD,qEAA2E;AAC3E,uEAA6E;AAG7E,oEAAkE;AAClE,yCAA4C;AAC5C,gEAA8D;AAC9D,iFAAyG;AAGzG,yGAA6F;AAE7F,wDAA4D;AAE5D,+FAA2F;AAE3F,+BAAoC;AAEpC,+CAA2C;AAC3C,mDAA+C;AAC/C,yEAAoE;AACpE,4FAAuF;AACvF,wDAAgE;AAEhE,mCAA6C;AAQ7C,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,2BAAW,CAAA;IACX,+BAAe,CAAA;AACjB,CAAC,EAHW,YAAY,4BAAZ,YAAY,QAGvB;AAED,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,mCAAgB,CAAA;IAChB,8FAA2E,CAAA;AAC7E,CAAC,EAHW,eAAe,+BAAf,eAAe,QAG1B;AAyBD,IAAY,uBAMX;AAND,WAAY,uBAAuB;IACjC,0CAAe,CAAA;IACf,8DAAmC,CAAA;IACnC,4DAAiC,CAAA;IACjC,gEAAqC,CAAA;IACrC,0DAA+B,CAAA;AACjC,CAAC,EANW,uBAAuB,uCAAvB,uBAAuB,QAMlC;AAcM,IAAM,wBAAwB,gCAA9B,MAAM,wBAAyB,SAAQ,0BAA8B;IAC1E,YAEE,oBAAmD,EAC1C,qBAA4C,EAC5C,aAA4B,EAC5B,WAAwB,EACxB,gBAAkC,EAClC,iBAAoC,EAE7C,aAAqC,EAG5B,IAAiC,EACjC,SAAoB,EACpB,YAA0B,EAC1B,UAAsB,EACtB,WAAwB,EACxB,iB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M,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAChF,OAAO,iBAAiB,CAAC;IAC3B,CAAC;CACF,CAAA;AAxsBY,4DAAwB;mCAAxB,wBAAwB;IADpC,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,6CAAoB,CAAC,CAAC,CAAA;IAO9C,WAAA,IAAA,6BAAmB,GAAE,CAAA;qCANS,6CAAoB;QACnB,+CAAqB;QAC7B,sBAAa;QACf,0BAAW;QACN,uBAAgB;QACf,uCAAiB;QAErB,uBAAa;QAGtB,2DAA2B;QACtB,gBAAS;QACN,4BAAY;QACd,wBAAU;QACT,mBAAW;QACL,iDAAsB;QACL,0DAA0B;GAnB9D,wBAAwB,CAwsBpC","sourcesContent":["import { BadRequestException, ForbiddenException, forwardRef, Inject, Injectable, Logger } from '@nestjs/common';\nimport { DiscoveryService, ModuleRef } from \"@nestjs/core\";\nimport { InjectEntityManager } from '@nestjs/typeorm';\nimport { EntityManager } from 'typeorm';\n\nimport { ConfigService } from '@nestjs/config';\nimport { CrudHelperService } from 'src/services/crud-helper.service';\nimport { CRUDService } from 'src/services/crud.service';\nimport { FileService } from 'src/services/file.service';\nimport { ModelMetadataService } from 'src/services/model-metadata.service';\nimport { ModuleMetadataService } from 'src/services/module-metadata.service';\n\n\nimport { classify } from '@angular-devkit/core/src/utils/strings';\nimport { HttpService } from '@nestjs/axios';\nimport { ERROR_MESSAGES } from 'src/constants/error-messages';\nimport { RelationFieldsCommand, RelationType, SolidFieldType } from 'src/dtos/create-field-metadata.dto';\nimport { ImportInstructionsResponseDto, StandardImportInstructionsResponseDto } from 'src/dtos/import-instructions.dto';\nimport { FieldMetadata } from 'src/entities/field-metadata.entity';\nimport { ImportTransactionErrorLog } from 'src/entities/import-transaction-error-log.entity';\nimport { ModelMetadata } from 'src/entities/model-metadata.entity';\nimport { parseFlexibleDate } from 'src/helpers/date.helper';\nimport { MediaWithFullUrl } from 'src/interfaces';\nimport { ImportTransactionRepository } from 'src/repository/import-transaction.repository';\nimport { Readable } from 'stream';\nimport { v4 as uuidv4 } from 'uuid';\nimport { ImportTransaction } from '../entities/import-transaction.entity';\nimport { CsvService } from './csv.service';\nimport { ExcelService } from './excel.service';\nimport { SolidIntrospectService } from './solid-introspect.service';\nimport { ModelMetadataHelperService } from 'src/helpers/model-metadata-helper.service';\nimport { getUserExcludedFields } from 'src/helpers/user-helper';\nimport { ActiveUserData } from 'src/interfaces/active-user-data.interface';\nimport {upperFirst, camelCase} from 'lodash';\n\ninterface ImportTemplateFileInfo {\n stream: NodeJS.ReadableStream;\n fileName: string;\n mimeType: string;\n}\n\nexport enum ImportFormat {\n CSV = 'csv',\n EXCEL = 'excel',\n}\n\nexport enum ImportMimeTypes {\n CSV = 'text/csv',\n EXCEL = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n}\nexport interface ImportMappingInfo {\n sampleImportedRecordInfo: SampleImportedRecordInfo[];\n importableFields: ImportableFieldInfo[];\n}\nexport interface SampleImportedRecordInfo {\n cellHeader: string; // The header of the cell in the import file\n cellValue: string; // The value of the cell in the import file\n defaultMappedFieldName: string; // The default mapped field name in the model metadata\n}\nexport interface ImportableFieldInfo {\n name: string;\n displayName: string;\n}\n\nexport interface ImportPaginatedReadResult {\n headers: string[]; // Headers of the CSV file\n data: Record<string, any>[]; // Data records in the current page\n}\n\ninterface ImportMapping {\n header: string; // The name of the field in the import file\n fieldName: string; // The name of the field in the model metadata to which the imported field is mapped\n}\n\nexport enum ImportTransactionStatus {\n draft = 'draft',\n mapping_created = 'mapping_created',\n import_started = 'import_started',\n import_succeeded = 'import_succeeded',\n import_failed = 'import_failed',\n}\n\nexport interface ImportSyncResult {\n status: string; // The status of the import transaction\n importedIds: Array<number>; // The IDs of the records created during the import\n importedCount: number; // The number of records created during the import\n failedCount: number; // The number of records that failed to import\n}\ninterface ImportRecordsResult {\n ids: Array<number>; // The IDs of the records created during the import\n errorLogIds: Array<number>; // The IDs of the error log entries created during the import\n}\n\n@Injectable()\nexport class ImportTransactionService extends CRUDService<ImportTransaction> {\n constructor(\n @Inject(forwardRef(() => ModelMetadataService))\n readonly modelMetadataService: ModelMetadataService,\n readonly moduleMetadataService: ModuleMetadataService,\n readonly configService: ConfigService,\n readonly fileService: FileService,\n readonly discoveryService: DiscoveryService,\n readonly crudHelperService: CrudHelperService,\n @InjectEntityManager()\n readonly entityManager: EntityManager,\n // @InjectRepository(ImportTransaction, 'default')\n // readonly repo: Repository<ImportTransaction>,\n readonly repo: ImportTransactionRepository,\n readonly moduleRef: ModuleRef,\n readonly excelService: ExcelService,\n readonly csvService: CsvService,\n readonly httpService: HttpService,\n readonly introspectService: SolidIntrospectService,\n private readonly modelMetadataHelperService: ModelMetadataHelperService,\n // readonly fieldMetadataService: FieldMetadataService,\n ) {\n super(modelMetadataService, moduleMetadataService, configService, fileService, discoveryService, crudHelperService, entityManager, repo, 'importTransaction', 'solid-core', moduleRef);\n }\n\n private readonly logger = new Logger(ImportTransactionService.name);\n\n /**\n * This method is used to return a csv / excel template for the import transaction\n * It will contain the display names of the fields in the header row\n * @param modelMetadataId \n */\n async getImportTemplate(modelMetadataId: number, format: ImportFormat = ImportFormat.CSV): Promise<ImportTemplateFileInfo> {\n // Load the model metadata for the given ID\n const modelMetadata = await this.modelMetadataService.findOne(modelMetadataId, {\n populate: ['fields'],\n });\n if (!modelMetadata) {\n throw new Error(ERROR_MESSAGES.MODEL_METADATA_NOT_FOUND(modelMetadataId));\n }\n\n const allFields = await this.modelMetadataHelperService.loadFieldHierarchy(\n modelMetadata.singularName,\n );\n\n // Replace original fields with full hierarchy fields\n // modelMetadata.fields = allFields; \n\n // Create a header row with the display names of the fields, excluding the media fields,computed fields\n const headers = this.fieldsAllowedForImport(allFields)\n .map(field => field.displayName);\n\n // Depending on the format, generate the template\n if (format === ImportFormat.CSV) {\n const stream = await this.csvService.createCsvStream(null, 0, headers); // Create a CSV stream with the header row\n const fileName = `${modelMetadata.singularName}-import-template.csv`;\n const mimeType = 'text/csv';\n return {\n stream,\n fileName,\n mimeType,\n };\n } else if (format === ImportFormat.EXCEL) {\n const stream = await this.excelService.createExcelStream(null, 0, headers); // Create an Excel stream with the header row\n const fileName = `${modelMetadata.singularName}-import-template.xlsx`;\n // Set the MIME type for Excel files\n const mimeType = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';\n return {\n stream,\n fileName,\n mimeType,\n };\n } else {\n throw new Error(ERROR_MESSAGES.INVALID_FORMAT('import' + format));\n }\n\n }\n\n async getImportInstructions(modelMetadataId: number): Promise<ImportInstructionsResponseDto> {\n // Load the model metadata for the given ID\n const modelMetadata = await this.modelMetadataService.findOne(modelMetadataId, {\n populate: ['fields'],\n });\n if (!modelMetadata) {\n throw new Error(ERROR_MESSAGES.MODEL_METADATA_NOT_FOUND(modelMetadataId));\n }\n\n // Step 2: Load full field hierarchy (includes parent model fields)\n const allFields = await this.modelMetadataHelperService.loadFieldHierarchy(\n modelMetadata.singularName,\n );\n\n const systemFieldNames = this.modelMetadataHelperService\n .getSystemFieldsMetadata()\n .map(field => field.name);\n\n const userExcluded = getUserExcludedFields();\n // Replace modelMetadata.fields with combined (child + parent) fields\n // modelMetadata.fields = allFields;\n\n // Create the standard import instructions\n const standardInstructions: StandardImportInstructionsResponseDto = {\n requiredFields: [],\n dateFields: [],\n dateTimeFields: [],\n numberFields: [],\n emailFields: [],\n regexFields: [],\n jsonFields: [],\n booleanFields: [],\n };\n\n // Iterate through the fields and populate the standard instructions\n for (const field of allFields) {\n // Skip system fields\n if (systemFieldNames.includes(field.name)) {\n continue;\n }\n\n // Skip excluded user fields (NO model name check needed)\n if (userExcluded.includes(field.name)) {\n continue;\n }\n\n // if (field.isSystem) continue; // Skip system fields\n if (field.required) {\n standardInstructions.requiredFields.push(field.displayName);\n }\n if (field.type === SolidFieldType.date) {\n standardInstructions.dateFields.push(field.displayName);\n }\n if (field.type === SolidFieldType.datetime) {\n standardInstructions.dateTimeFields.push(field.displayName);\n }\n if ([SolidFieldType.bigint, SolidFieldType.int, SolidFieldType.decimal].includes(field.type as SolidFieldType)) {\n standardInstructions.numberFields.push(field.displayName);\n }\n if (field.type === SolidFieldType.email) {\n standardInstructions.emailFields.push(field.displayName);\n }\n if (field.regexPattern) {\n standardInstructions.regexFields.push({\n fieldName: field.displayName,\n regexPattern: field.regexPattern,\n });\n }\n if (field.type === SolidFieldType.json) {\n standardInstructions.jsonFields.push(field.displayName);\n }\n if (field.type === SolidFieldType.boolean) {\n standardInstructions.booleanFields.push(field.displayName);\n }\n }\n\n // Create the custom instructions\n const customInstructions: string[] = [];\n\n return {\n standard: standardInstructions,\n custom: customInstructions,\n };\n }\n\n async getImportMappingInfo(importTransactionId: number): Promise<ImportMappingInfo> {\n // Load the import transaction for the given ID\n const importTransaction = await this.loadImportTransaction(importTransactionId);\n\n // Get all the importable fields from the model metadata\n const importableFields: ImportableFieldInfo[] = this.fieldsAllowedForImport(importTransaction.modelMetadata.fields).map(field => ({\n name: field.name,\n displayName: field.displayName,\n required: field.required,\n }));\n\n // Get the import file media object from the import transaction\n const importFileMediaObject = this.getImportFileObject(importTransaction);\n\n // Get the import file stream for the import transaction\n const importFileStream = await this.getImportFileStream(importFileMediaObject);\n\n // Get a sample of records from the import file\n const sampleRecord = await this.getFileRecordsSample(importFileStream, importFileMediaObject.mimeType);\n\n // Convert sampleRecord to the format required for SampleImportedRecordInfo\n const wrappedRecords: SampleImportedRecordInfo[] = sampleRecord.data.map((record: Record<string, any>) => {\n return Object.entries(record).map(([key, value]) => ({\n cellHeader: key,\n cellValue: value,\n defaultMappedFieldName: importableFields.find(field => field.displayName === key)?.name || '',\n }));\n }).flat();\n\n // for await (const page of this.csvService.readCsvInPagesFromStream(importFileStream)) {\n // // await dbService.bulkInsert(page);\n // }\n\n return {\n sampleImportedRecordInfo: wrappedRecords, // This will hold the sample data from the file\n importableFields: importableFields, // This will hold the fields that can be imported\n };\n }\n\n async startImportSync(importTransactionId: number, activeUser: ActiveUserData): Promise<ImportSyncResult> {\n // Load the import transaction for the given ID\n const importTransaction = await this.loadImportTransaction(importTransactionId);\n const modelName = upperFirst(camelCase(importTransaction.modelMetadata.singularName));\n const permissionKey = `${modelName}Controller.insertMany`;\n\n const userPermissions = activeUser.permissions ?? [];\n const hasPermission = Array.isArray(userPermissions)\n ? userPermissions.includes(permissionKey)\n : userPermissions[permissionKey] === true;\n\n if (!hasPermission) {\n const action = permissionKey.split('.').pop()!;\n const message = ERROR_MESSAGES.PERMISSION_MESSAGES[action]?.(modelName) ?? 'You are not allowed to perform this action.';\n throw new ForbiddenException({\n message,\n errorCode: 'permission-denied',\n });\n }\n\n // Get the import file media object from the import transaction\n const importFileMediaObject = this.getImportFileObject(importTransaction);\n\n // Get the import file stream for the import transaction\n const importFileStream = await this.getImportFileStream(importFileMediaObject);\n\n const { ids, errorLogIds } = await this.importFromFileToDB(\n importTransaction,\n importFileStream,\n importFileMediaObject.mimeType,\n );\n\n // Update the import transaction status to 'completed'\n (errorLogIds.length > 0) ? importTransaction.status = ImportTransactionStatus.import_failed : importTransaction.status = ImportTransactionStatus.import_succeeded; //FIXME: We can probably have import_partially_failed status to differentiate\n // Save the import transaction\n await this.repo.save(importTransaction);\n return {\n status: importTransaction.status,\n importedIds: ids, // The IDs of the records created during the import\n importedCount: ids.length, // The number of records created during the import\n failedCount: errorLogIds.length, // The number of records that failed to import\n };\n }\n\n startImportAsync(importTransactionId: number): Promise<void> {\n throw new Error('Method not implemented.');\n }\n\n async exportFailedImportedImports(importTransactionId: number) {\n // Get the 1st error log entry to determine the headers for the export file\n const firstErrorLogEntry = await this.entityManager.getRepository(ImportTransactionErrorLog).findOne({\n where: {\n importTransaction: { id: importTransactionId },\n },\n });\n\n if (!firstErrorLogEntry) {\n throw new BadRequestException(ERROR_MESSAGES.NO_ERROR_LOG_FOR_IMPORT(importTransactionId));\n }\n\n // Create the headers for the export file\n const headers = [\n ...Object.keys(firstErrorLogEntry.rowData ? JSON.parse(firstErrorLogEntry.rowData) : {}), // Include all keys from the rowData JSON\n 'Error', // Error message for the failed record\n ];\n\n\n // Depending upon the format of the import tranaction file, create a readable stream of the error log entries\n const importTransaction = await this.loadImportTransaction(importTransactionId);\n const importFileMediaObject = this.getImportFileObject(importTransaction);\n const mimeType = importFileMediaObject.mimeType;\n const templateFormat = mimeType === ImportMimeTypes.CSV ? \"csv\" : \"excel\";\n const dataRecordsFunc = async (chunkIndex: number, chunkSize: number): Promise<any[]> => {\n // Get the error log entries for the import transaction\n const errorLogEntries = await this.entityManager.getRepository(ImportTransactionErrorLog).find({\n where: {\n importTransaction: { id: importTransactionId },\n },\n skip: chunkIndex * chunkSize,\n take: chunkSize,\n });\n\n if (!errorLogEntries || errorLogEntries.length === 0) {\n return []; // Return an empty array if no error log entries found\n }\n\n // Read the row data json from the error log entry, parse it and write it as a record to the stream\n return errorLogEntries.map(entry => {\n const rowData = entry.rowData ? JSON.parse(entry.rowData) : {};\n return {\n ...rowData, // Spread the row data into the record\n Error: entry.errorMessage,\n };\n });\n };\n\n // Get the export stream for the failed records\n const exportStream = await this.getFailedRecordsStream(templateFormat, headers, dataRecordsFunc);\n if (!exportStream) {\n throw new BadRequestException(`Failed to create export stream for import transaction ID ${importTransactionId}.`);\n }\n // Return the export stream\n const extension = templateFormat === \"excel\" ? 'xlsx' : 'csv';\n return {\n stream: exportStream,\n fileName: `${importTransaction.modelMetadata.singularName}-failed-imports.${extension}`,\n mimeType: templateFormat === \"excel\" ? ImportMimeTypes.EXCEL : ImportMimeTypes.CSV,\n };\n\n }\n\n private async getFailedRecordsStream(templateFormat: string, headers: string[], dataRecordsFunc: (chunkIndex: number, chunkSize: number) => Promise<any[]>) {\n let exportStream = null;\n switch (templateFormat) {\n case \"excel\":\n exportStream = await this.excelService.createExcelStream(dataRecordsFunc, 100, headers);\n break;\n case \"csv\":\n exportStream = await this.csvService.createCsvStream(dataRecordsFunc, 100, headers);\n break;\n default:\n throw new Error('Invalid export format');\n }\n return exportStream;\n }\n\n\n // private async loadImportTransaction(importTransactionId: number) {\n // const importTransaction = await this.findOne(importTransactionId, {\n // populate: ['modelMetadata', 'modelMetadata.fields'],\n // populateMedia: ['fileLocation'],\n // });\n // if (!importTransaction) {\n // throw new Error(`Import transaction with ID ${importTransactionId} not found.`);\n // }\n // return importTransaction;\n // }\n\n private async loadImportTransaction(importTransactionId: number) {\n // Step 1: Load the transaction with model metadata\n const importTransaction = await this.findOne(importTransactionId, {\n populate: ['modelMetadata'],\n populateMedia: ['fileLocation'],\n });\n\n // Step 2: Load full field hierarchy (child + parent fields)\n const modelFields = await this.modelMetadataHelperService.loadFieldHierarchy(\n importTransaction.modelMetadata.singularName,\n );\n\n // Step 3: Attach the combined fields back into the modelMetadata\n importTransaction.modelMetadata.fields = modelFields;\n\n return importTransaction;\n }\n\n private fieldsAllowedForImport(fields: FieldMetadata[]): FieldMetadata[] {\n // Get system field names (e.g. id, createdAt, updatedAt...)\n const systemFieldNames = this.modelMetadataHelperService\n .getSystemFieldsMetadata()\n .map(field => field.name);\n\n const userExcluded = getUserExcludedFields();\n\n // Filter out fields that are not allowed for import\n return fields.filter(field =>\n field.type !== SolidFieldType.mediaMultiple && // Exclude media multiple fields\n field.type !== SolidFieldType.mediaSingle &&\n field.type !== SolidFieldType.computed && // Exclude computed fields\n field.type !== SolidFieldType.password &&\n field.type !== SolidFieldType.richText &&\n field.type !== SolidFieldType.uuid &&\n field.relationType !== RelationType.oneToMany &&\n !systemFieldNames.includes(field.name) &&\n // field.isSystem !== true // Exclude system fields\n\n !userExcluded.includes(field.name)\n );\n }\n\n private async getFileRecordsSample(importFileStream: Readable, mimeType: string): Promise<ImportPaginatedReadResult> {\n // Depending upon the mime type of the file, read the file in pages\n // For CSV files, use the csvService to read the file in pages\n // For Excel files, use the excelService to read the file in pages\n if (mimeType === 'text/csv') {\n const generator = this.csvService.readCsvInPagesFromStream(importFileStream, { pageSize: 1 });\n const firstRecord = await generator.next(); // Get the first record to extract headers and sample data\n return firstRecord.value;\n } else if (mimeType === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') {\n const generator = this.excelService.readExcelInPagesFromStream(importFileStream, { pageSize: 1 });\n const firstRecord = await generator.next(); // Get the first record to extract headers and sample data\n return firstRecord.value;\n }\n else { // If the file is neither CSV nor Excel, throw an error\n throw new Error(ERROR_MESSAGES.INVALID_FORMAT(mimeType));\n }\n }\n\n private getImportFileObject(importTransaction: ImportTransaction): MediaWithFullUrl {\n const importFileMediaObject = importTransaction['_media']['fileLocation'][0] as MediaWithFullUrl; // Since there can be only one fileLocation, we can safely access the first element\n if (!importFileMediaObject) {\n throw new Error(`Import file for transaction ID ${importTransaction.id} not found.`);\n }\n return importFileMediaObject;\n }\n\n private async getImportFileStream(importFileMediaObject: MediaWithFullUrl): Promise<Readable> {\n const fileUrl = importFileMediaObject['_full_url'];\n const mimeType = importFileMediaObject['mimeType'];\n if (!fileUrl) {\n throw new Error(`File URL ${fileUrl} not found.`);\n }\n // From the file URL, convert the file URL to a readable stream using nestjs http service and axios\n const fileUrlResponse = await this.httpService.axiosRef.get(fileUrl, {\n responseType: 'stream',\n });\n\n if (!fileUrlResponse || !fileUrlResponse.data) {\n throw new Error(ERROR_MESSAGES.FILE_READ_FAILED_FROM_URL(fileUrl));\n }\n // fileUrlResponse.data is a Node.js Readable stream\n return fileUrlResponse.data;\n }\n\n private async importFromFileToDB(\n importTransaction: ImportTransaction,\n importFileStream: Readable,\n mimeType: string,\n ): Promise<ImportRecordsResult> {\n if (!importTransaction.modelMetadata) {\n throw new Error(`Model metadata for import transaction ID ${importTransaction.id} not found.`);\n }\n\n const createdRecordIds = [];\n const createdErrorLogIds = [];\n\n // Get the model service for the model metadata name\n const modelService = this.getModelService(importTransaction.modelMetadata.singularName);\n\n // Depending upon the mime type of the file, read the file in pages and insert the records into the database\n if (mimeType === ImportMimeTypes.CSV) {\n for await (const page of this.csvService.readCsvInPagesFromStream(importFileStream)) {\n const { ids, errorLogIds } = await this.importRecords(page, importTransaction, modelService);\n createdRecordIds.push(...ids);\n createdErrorLogIds.push(...errorLogIds);\n }\n }\n else if (mimeType === ImportMimeTypes.EXCEL) {\n for await (const page of this.excelService.readExcelInPagesFromStream(importFileStream)) {\n const { ids, errorLogIds } = await this.importRecords(page, importTransaction, modelService);\n createdRecordIds.push(...ids);\n createdErrorLogIds.push(...errorLogIds);\n }\n } else { // If the file is neither CSV nor Excel, throw an error\n throw new Error(ERROR_MESSAGES.INVALID_FORMAT(mimeType));\n }\n\n return {\n ids: createdRecordIds, // Return the IDs of the created records\n errorLogIds: createdErrorLogIds, // Return the IDs of the error log entries created during the import\n }\n }\n\n private async importRecords(page: ImportPaginatedReadResult, importTransaction: ImportTransaction, modelService: CRUDService<any>): Promise<ImportRecordsResult> {\n if (!importTransaction.modelMetadata || !importTransaction.modelMetadata.fields) {\n throw new Error(`Model metadata with fields for import transaction ID ${importTransaction.id} not found.`);\n }\n\n const ids: Array<number> = [];\n const errorLogIds: Array<number> = [];\n for (const record of page.data) {\n try {\n const createdRecord = await this.insertRecord(record, JSON.parse(importTransaction.mapping) as ImportMapping[], importTransaction.modelMetadata, modelService);\n ids.push(createdRecord.id); // Add the ID of the created record to the ids array\n }\n catch (error) {\n this.logger.debug(`Error inserting record: ${JSON.stringify(record)}. Error: ${error.message}`);\n // Get the Import transaction error log repo\n const errorLog = await this.createErrorLogEntry(importTransaction, record, error);\n errorLogIds.push(errorLog.id); // Add the ID of the error log entry to the errorLogIds array\n }\n }\n return {\n ids: ids, // Return the IDs of the created records\n errorLogIds: errorLogIds, // Return the IDs of the error log entries created during the import\n };\n }\n\n async createErrorLogEntry(importTransaction: ImportTransaction, record: Record<string, any>, error: any) {\n const importTransactionRepo = this.entityManager.getRepository(ImportTransactionErrorLog);\n // Create a new ImportTransactionErrorLog entry\n const rowNumber = uuidv4(); // Generate a unique row number or use page.rowNumber if available \n\n const errorLogEntry = {\n importTransactionErrorLogId: `${importTransaction.id}-${rowNumber}`, // FIXME pending to retrieve the row number from the page\n rowNumber: 1, // FIXME pending to retrieve the row number from the page\n rowData: JSON.stringify(record), // Store the row data\n importTransaction: importTransaction, // Link to the import transaction\n errorMessage: error.message, // Store the error message\n errorTrace: error.stack || '', // Store the error stack trace if available\n } as ImportTransactionErrorLog;\n\n // Save the error log entry to the database\n const savedEntry = await importTransactionRepo.save(errorLogEntry);\n return savedEntry; // Return the ID of the saved error log entry\n }\n\n //FIXME Currently below method fails if any field in the record is not valid or if the record is not valid. It does not collect the errors for all fields in a record\n private async insertRecord(record: Record<string, any>, mapping: ImportMapping[], modelMetadataWithFields: ModelMetadata, modelService: CRUDService<any>): Promise<any> {\n // Convert the imported record to a DTO\n const dto = await this.convertImportedRecordToDto(record, mapping, modelMetadataWithFields);\n // Use the model service to create the record in the database\n const createdRecord = await modelService.create(dto, [], {}); //FIXME: Need to handle this part alongwith the refactoring of the CRUDService for permissions\n return createdRecord; // Return the created record\n }\n\n private getModelService(modelSingularName: string): CRUDService<any> {\n // Get the model service for the model metadata name\n const modelServiceWrapper = this.introspectService.getProvider(`${classify(modelSingularName)}Service`);\n const modelService = modelServiceWrapper.instance as CRUDService<any>;\n if (!modelService) {\n throw new Error(ERROR_MESSAGES.MODEL_SERVICE_NOT_FOUND(modelSingularName));\n }\n return modelService;\n }\n\n private async convertImportedRecordToDto(record: Record<string, any>, mapping: ImportMapping[], modelMetadataWithFields: ModelMetadata) {\n // Create a new record object\n const dtoRecord: Record<string, any> = {};\n\n // Iterate through every cell in the record\n // Using the saved mapping, populate the dtoRecord w.r.t the record and fields\n for (const key in record) {\n const mappedField = mapping.find(m => m.header === key);\n if (mappedField) {\n // If the field is found in the mapping, get the field metadata from the model metadata\n const fieldMetadata = modelMetadataWithFields.fields.find(f => f.name === mappedField.fieldName);\n // const userKeyField = modelMetadataWithFields.fields.find(f => f.isUserKey === true); // Assuming userKey is a field in the model metadata\n if (fieldMetadata) {\n // If the field is found in the model metadata, set the value in the dtoRecord\n await this.populateDtoForACell(dtoRecord, fieldMetadata, record, key);\n } else {\n this.logger.warn(`Field ${mappedField.fieldName} not found in model metadata ${modelMetadataWithFields.singularName}`);\n }\n }\n }\n return dtoRecord;\n }\n\n private async populateDtoForACell(dtoRecord: Record<string, any>, fieldMetadata: FieldMetadata, record: Record<string, any>, key: string): Promise<Record<string, any>> {\n const fieldType = fieldMetadata.type;\n // const userKeyFieldName = userKeyField?.name || 'id'; // Default to 'id' if not found\n\n // TODO Move this logic to field crud managers i.e add a parse method to the field crud manager interface\n switch (fieldType) {\n case SolidFieldType.relation: {\n return await this.populateDtoForRelations(fieldMetadata, record, key, dtoRecord);\n }\n case SolidFieldType.date:\n case SolidFieldType.datetime:\n return this.populateDtoForDate(record, key, fieldMetadata, dtoRecord);\n case SolidFieldType.int:\n case SolidFieldType.bigint:\n case SolidFieldType.decimal:\n return this.populateDtoForNumber(dtoRecord, fieldMetadata, record, key);\n case SolidFieldType.boolean:\n return this.populateDtoForBoolean(dtoRecord, fieldMetadata, record, key);\n case SolidFieldType.selectionStatic:\n case SolidFieldType.selectionDynamic:\n return this.populateDtoForSelectionValues(dtoRecord, fieldMetadata, record, key);\n case SolidFieldType.email:\n case SolidFieldType.shortText:\n case SolidFieldType.longtext:\n case SolidFieldType.richText: {\n dtoRecord[fieldMetadata.name] = record[key] ? String(record[key]).trim() : null; // Trim text fields and set to null if empty\n return dtoRecord;\n }\n default: {\n dtoRecord[fieldMetadata.name] = record[key];\n return dtoRecord;\n }\n }\n }\n\n private populateDtoForSelectionValues(dtoRecord: Record<string, any>, fieldMetadata: FieldMetadata, record: Record<string, any>, key: string) {\n const rawValue = record[key];\n\n if (rawValue == null || rawValue === '' || (typeof rawValue === 'string' && rawValue.trim() === '')) {\n dtoRecord[fieldMetadata.name] = null;\n return dtoRecord;\n }\n\n const isMultipleSelection = fieldMetadata.isMultiSelect;\n\n if (isMultipleSelection) {\n const selectionValues = String(rawValue)\n .split(',')\n .map(value => value.trim())\n .filter(value => value !== '');\n\n dtoRecord[fieldMetadata.name] = JSON.stringify(selectionValues);\n } else {\n dtoRecord[fieldMetadata.name] = rawValue; // Single select: assign directly\n }\n\n return dtoRecord;\n }\n\n\n private populateDtoForBoolean(dtoRecord: Record<string, any>, fieldMetadata: FieldMetadata, record: Record<string, any>, key: string) {\n const cellValue = record[key];\n if (cellValue === null || cellValue === undefined || cellValue === '') {\n dtoRecord[fieldMetadata.name] = null; // If the cell is empty, set the field to null\n return dtoRecord;\n }\n\n // If the cell contains values other than 'true', '1', 'yes', 'false', '0', 'no', throw an error\n const booleanValue = (String(cellValue).toLowerCase() === 'true' || String(cellValue) === '1' || String(cellValue).toLowerCase() === 'yes') ? true : (String(cellValue).toLowerCase() === 'false' || String(cellValue) === '0' || String(cellValue).toLowerCase() === 'no') ? false : null;\n if (booleanValue === null) {\n throw new Error(`Invalid boolean value for cell ${key} with value ${cellValue}`);\n }\n dtoRecord[fieldMetadata.name] = booleanValue;\n return dtoRecord;\n }\n\n private populateDtoForNumber(dtoRecord: Record<string, any>, fieldMetadata: FieldMetadata, record: Record<string, any>, key: string) {\n const cellValue = record[key];\n if (cellValue === null || cellValue === undefined || cellValue === '') {\n dtoRecord[fieldMetadata.name] = null; // If the cell is empty, set the field to null\n return dtoRecord;\n }\n const numberValue = Number(cellValue);\n if (isNaN(numberValue)) {\n throw new Error(`Invalid number value for cell ${key} with value ${record[key]}`);\n }\n dtoRecord[fieldMetadata.name] = numberValue;\n return dtoRecord;\n }\n\n private populateDtoForDate(record: Record<string, any>, key: string, fieldMetadata: FieldMetadata, dtoRecord: Record<string, any>) {\n {\n // Get the cell value\n const cellValue = record[key];\n if (!cellValue) { //If cell is a falsy value (empty)\n dtoRecord[fieldMetadata.name] = null; // If the cell is empty, set the field to null\n return dtoRecord;\n }\n // Use flexible date parser\n this.logger.verbose(cellValue, 'cellValue');\n\n const dateValue = parseFlexibleDate(cellValue);\n this.logger.verbose(dateValue, 'dateValue');\n\n if (!dateValue) {\n throw new Error(\n `Invalid date value for cell ${key} with value ${cellValue}`\n );\n }\n dtoRecord[fieldMetadata.name] = dateValue;\n return dtoRecord;\n }\n }\n\n private async populateDtoForRelations(fieldMetadata: FieldMetadata, record: Record<string, any>, key: string, dtoRecord: Record<string, any>) {\n if (!fieldMetadata.relationCoModelSingularName) {\n throw new Error(ERROR_MESSAGES.RELATION_CO_MODEL_NOT_DEFINED_FOR_FIELD(fieldMetadata.name));\n }\n\n const relatedRecordsIds = await this.getRelatedEntityIdsFromUserKeys(fieldMetadata, record, key);\n if (relatedRecordsIds.length === 0) {\n return dtoRecord; // If no related records found, return the dtoRecord as is\n }\n\n if (fieldMetadata.relationType === RelationType.manyTomany || fieldMetadata.relationType === RelationType.oneToMany) {\n dtoRecord[`${fieldMetadata.name}Ids`] = relatedRecordsIds;\n dtoRecord[`${fieldMetadata.name}Command`] = RelationFieldsCommand.set; // Reset the relation field association with the related records IDs\n }\n else if (fieldMetadata.relationType === RelationType.manyToOne) {\n dtoRecord[`${fieldMetadata.name}Id`] = relatedRecordsIds.pop(); // For many-to-one relations, we need only one ID\n }\n return dtoRecord;\n }\n\n private async getRelatedEntityIdsFromUserKeys(fieldMetadata: FieldMetadata, record: Record<string, any>, key: string): Promise<Array<number>> {\n // For many-to-many or one-to-many relations, we expect the record cell to contains a comma-separated list of userKeys\n const relationUserKeys = record[key] ? String(record[key]).split(',').map((userKey: string) => userKey.trim()) : [];\n if (relationUserKeys.length === 0) return [];\n\n const coModelService = this.getModelService(fieldMetadata.relationCoModelSingularName);\n const coModelWithUserKeyField = await this.modelMetadataService.findOneBySingularName(fieldMetadata.relationCoModelSingularName, ['userKeyField']);\n const coModelUserKeyFieldName = coModelWithUserKeyField?.userKeyField?.name || 'id'; // Default to 'id' if not found\n\n\n // Set the relation basic filter dto filters with the userkeys and call the find method of the model service to get the related records\n const relationFilterDto = {\n filters: {\n [coModelUserKeyFieldName]: {\n $in: relationUserKeys, // Use the userKeyFieldName to filter by userKeys\n },\n },\n };\n\n // From the userKeys, we will get the IDs of the related records using the userKeyFieldName and throw an error if any of the userKeys is not found\n const relatedRecordsResult = await coModelService.find(relationFilterDto);\n if (!relatedRecordsResult || !relatedRecordsResult.records || relatedRecordsResult.records.length === 0 || relatedRecordsResult.records.length !== relationUserKeys.length) {\n throw new Error(`Invalid related records userKey values found for cell ${key} with value ${record[key]}`);\n }\n const relatedRecordsIds = relatedRecordsResult.records.map(record => record.id);\n return relatedRecordsIds;\n }\n}"]}
|
|
1
|
+
{"version":3,"file":"import-transaction.service.js","sourceRoot":"","sources":["../../src/services/import-transaction.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAA6F;AAC7F,uCAAyC;AACzC,6CAAsD;AACtD,qCAAwC;AAExC,iDAAwD;AAGxD,oEAAkE;AAClE,yCAA4C;AAC5C,gEAA8D;AAC9D,iFAAyG;AAGzG,yGAA6F;AAE7F,wDAA4D;AAE5D,+FAA2F;AAE3F,+BAAoC;AAEpC,+CAA2C;AAC3C,mDAA+C;AAC/C,yEAAoE;AACpE,4FAAuF;AACvF,wDAAgE;AAEhE,mCAA6C;AAQ7C,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,2BAAW,CAAA;IACX,+BAAe,CAAA;AACjB,CAAC,EAHW,YAAY,4BAAZ,YAAY,QAGvB;AAED,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,mCAAgB,CAAA;IAChB,8FAA2E,CAAA;AAC7E,CAAC,EAHW,eAAe,+BAAf,eAAe,QAG1B;AAyBD,IAAY,uBAMX;AAND,WAAY,uBAAuB;IACjC,0CAAe,CAAA;IACf,8DAAmC,CAAA;IACnC,4DAAiC,CAAA;IACjC,gEAAqC,CAAA;IACrC,0DAA+B,CAAA;AACjC,CAAC,EANW,uBAAuB,uCAAvB,uBAAuB,QAMlC;AAcM,IAAM,wBAAwB,gCAA9B,MAAM,wBAAyB,SAAQ,0BAA8B;IAC1E,YAEE,aAAqC,EAG5B,IAAiC,EACjC,SAAoB,EACpB,YAA0B,EAC1B,UAAsB,EACtB,WAAwB,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;QACL,0DAA0B;GAZ9D,wBAAwB,CAisBpC","sourcesContent":["import { BadRequestException, ForbiddenException, Injectable, Logger } from '@nestjs/common';\nimport { ModuleRef } from \"@nestjs/core\";\nimport { InjectEntityManager } from '@nestjs/typeorm';\nimport { EntityManager } from 'typeorm';\n\nimport { CRUDService } from 'src/services/crud.service';\n\n\nimport { classify } from '@angular-devkit/core/src/utils/strings';\nimport { HttpService } from '@nestjs/axios';\nimport { ERROR_MESSAGES } from 'src/constants/error-messages';\nimport { RelationFieldsCommand, RelationType, SolidFieldType } from 'src/dtos/create-field-metadata.dto';\nimport { ImportInstructionsResponseDto, StandardImportInstructionsResponseDto } from 'src/dtos/import-instructions.dto';\nimport { FieldMetadata } from 'src/entities/field-metadata.entity';\nimport { ImportTransactionErrorLog } from 'src/entities/import-transaction-error-log.entity';\nimport { ModelMetadata } from 'src/entities/model-metadata.entity';\nimport { parseFlexibleDate } from 'src/helpers/date.helper';\nimport { MediaWithFullUrl } from 'src/interfaces';\nimport { ImportTransactionRepository } from 'src/repository/import-transaction.repository';\nimport { Readable } from 'stream';\nimport { v4 as uuidv4 } from 'uuid';\nimport { ImportTransaction } from '../entities/import-transaction.entity';\nimport { CsvService } from './csv.service';\nimport { ExcelService } from './excel.service';\nimport { SolidIntrospectService } from './solid-introspect.service';\nimport { ModelMetadataHelperService } from 'src/helpers/model-metadata-helper.service';\nimport { getUserExcludedFields } from 'src/helpers/user-helper';\nimport { ActiveUserData } from 'src/interfaces/active-user-data.interface';\nimport {upperFirst, camelCase} from 'lodash';\n\ninterface ImportTemplateFileInfo {\n stream: NodeJS.ReadableStream;\n fileName: string;\n mimeType: string;\n}\n\nexport enum ImportFormat {\n CSV = 'csv',\n EXCEL = 'excel',\n}\n\nexport enum ImportMimeTypes {\n CSV = 'text/csv',\n EXCEL = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n}\nexport interface ImportMappingInfo {\n sampleImportedRecordInfo: SampleImportedRecordInfo[];\n importableFields: ImportableFieldInfo[];\n}\nexport interface SampleImportedRecordInfo {\n cellHeader: string; // The header of the cell in the import file\n cellValue: string; // The value of the cell in the import file\n defaultMappedFieldName: string; // The default mapped field name in the model metadata\n}\nexport interface ImportableFieldInfo {\n name: string;\n displayName: string;\n}\n\nexport interface ImportPaginatedReadResult {\n headers: string[]; // Headers of the CSV file\n data: Record<string, any>[]; // Data records in the current page\n}\n\ninterface ImportMapping {\n header: string; // The name of the field in the import file\n fieldName: string; // The name of the field in the model metadata to which the imported field is mapped\n}\n\nexport enum ImportTransactionStatus {\n draft = 'draft',\n mapping_created = 'mapping_created',\n import_started = 'import_started',\n import_succeeded = 'import_succeeded',\n import_failed = 'import_failed',\n}\n\nexport interface ImportSyncResult {\n status: string; // The status of the import transaction\n importedIds: Array<number>; // The IDs of the records created during the import\n importedCount: number; // The number of records created during the import\n failedCount: number; // The number of records that failed to import\n}\ninterface ImportRecordsResult {\n ids: Array<number>; // The IDs of the records created during the import\n errorLogIds: Array<number>; // The IDs of the error log entries created during the import\n}\n\n@Injectable()\nexport class ImportTransactionService extends CRUDService<ImportTransaction> {\n constructor(\n @InjectEntityManager()\n readonly entityManager: EntityManager,\n // @InjectRepository(ImportTransaction, 'default')\n // readonly repo: Repository<ImportTransaction>,\n readonly repo: ImportTransactionRepository,\n readonly moduleRef: ModuleRef,\n readonly excelService: ExcelService,\n readonly csvService: CsvService,\n readonly httpService: HttpService,\n readonly introspectService: SolidIntrospectService,\n private readonly modelMetadataHelperService: ModelMetadataHelperService,\n // readonly fieldMetadataService: FieldMetadataService,\n ) {\n super(entityManager, repo, 'importTransaction', 'solid-core', moduleRef);\n }\n\n private readonly logger = new Logger(ImportTransactionService.name);\n\n /**\n * This method is used to return a csv / excel template for the import transaction\n * It will contain the display names of the fields in the header row\n * @param modelMetadataId \n */\n async getImportTemplate(modelMetadataId: number, format: ImportFormat = ImportFormat.CSV): Promise<ImportTemplateFileInfo> {\n // Load the model metadata for the given ID\n const modelMetadata = await this.modelMetadataService.findOne(modelMetadataId, {\n populate: ['fields'],\n });\n if (!modelMetadata) {\n throw new Error(ERROR_MESSAGES.MODEL_METADATA_NOT_FOUND(modelMetadataId));\n }\n\n const allFields = await this.modelMetadataHelperService.loadFieldHierarchy(\n modelMetadata.singularName,\n );\n\n // Replace original fields with full hierarchy fields\n // modelMetadata.fields = allFields; \n\n // Create a header row with the display names of the fields, excluding the media fields,computed fields\n const headers = this.fieldsAllowedForImport(allFields)\n .map(field => field.displayName);\n\n // Depending on the format, generate the template\n if (format === ImportFormat.CSV) {\n const stream = await this.csvService.createCsvStream(null, 0, headers); // Create a CSV stream with the header row\n const fileName = `${modelMetadata.singularName}-import-template.csv`;\n const mimeType = 'text/csv';\n return {\n stream,\n fileName,\n mimeType,\n };\n } else if (format === ImportFormat.EXCEL) {\n const stream = await this.excelService.createExcelStream(null, 0, headers); // Create an Excel stream with the header row\n const fileName = `${modelMetadata.singularName}-import-template.xlsx`;\n // Set the MIME type for Excel files\n const mimeType = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';\n return {\n stream,\n fileName,\n mimeType,\n };\n } else {\n throw new Error(ERROR_MESSAGES.INVALID_FORMAT('import' + format));\n }\n\n }\n\n async getImportInstructions(modelMetadataId: number): Promise<ImportInstructionsResponseDto> {\n // Load the model metadata for the given ID\n const modelMetadata = await this.modelMetadataService.findOne(modelMetadataId, {\n populate: ['fields'],\n });\n if (!modelMetadata) {\n throw new Error(ERROR_MESSAGES.MODEL_METADATA_NOT_FOUND(modelMetadataId));\n }\n\n // Step 2: Load full field hierarchy (includes parent model fields)\n const allFields = await this.modelMetadataHelperService.loadFieldHierarchy(\n modelMetadata.singularName,\n );\n\n const systemFieldNames = this.modelMetadataHelperService\n .getSystemFieldsMetadata()\n .map(field => field.name);\n\n const userExcluded = getUserExcludedFields();\n // Replace modelMetadata.fields with combined (child + parent) fields\n // modelMetadata.fields = allFields;\n\n // Create the standard import instructions\n const standardInstructions: StandardImportInstructionsResponseDto = {\n requiredFields: [],\n dateFields: [],\n dateTimeFields: [],\n numberFields: [],\n emailFields: [],\n regexFields: [],\n jsonFields: [],\n booleanFields: [],\n };\n\n // Iterate through the fields and populate the standard instructions\n for (const field of allFields) {\n // Skip system fields\n if (systemFieldNames.includes(field.name)) {\n continue;\n }\n\n // Skip excluded user fields (NO model name check needed)\n if (userExcluded.includes(field.name)) {\n continue;\n }\n\n // if (field.isSystem) continue; // Skip system fields\n if (field.required) {\n standardInstructions.requiredFields.push(field.displayName);\n }\n if (field.type === SolidFieldType.date) {\n standardInstructions.dateFields.push(field.displayName);\n }\n if (field.type === SolidFieldType.datetime) {\n standardInstructions.dateTimeFields.push(field.displayName);\n }\n if ([SolidFieldType.bigint, SolidFieldType.int, SolidFieldType.decimal].includes(field.type as SolidFieldType)) {\n standardInstructions.numberFields.push(field.displayName);\n }\n if (field.type === SolidFieldType.email) {\n standardInstructions.emailFields.push(field.displayName);\n }\n if (field.regexPattern) {\n standardInstructions.regexFields.push({\n fieldName: field.displayName,\n regexPattern: field.regexPattern,\n });\n }\n if (field.type === SolidFieldType.json) {\n standardInstructions.jsonFields.push(field.displayName);\n }\n if (field.type === SolidFieldType.boolean) {\n standardInstructions.booleanFields.push(field.displayName);\n }\n }\n\n // Create the custom instructions\n const customInstructions: string[] = [];\n\n return {\n standard: standardInstructions,\n custom: customInstructions,\n };\n }\n\n async getImportMappingInfo(importTransactionId: number): Promise<ImportMappingInfo> {\n // Load the import transaction for the given ID\n const importTransaction = await this.loadImportTransaction(importTransactionId);\n\n // Get all the importable fields from the model metadata\n const importableFields: ImportableFieldInfo[] = this.fieldsAllowedForImport(importTransaction.modelMetadata.fields).map(field => ({\n name: field.name,\n displayName: field.displayName,\n required: field.required,\n }));\n\n // Get the import file media object from the import transaction\n const importFileMediaObject = this.getImportFileObject(importTransaction);\n\n // Get the import file stream for the import transaction\n const importFileStream = await this.getImportFileStream(importFileMediaObject);\n\n // Get a sample of records from the import file\n const sampleRecord = await this.getFileRecordsSample(importFileStream, importFileMediaObject.mimeType);\n\n // Convert sampleRecord to the format required for SampleImportedRecordInfo\n const wrappedRecords: SampleImportedRecordInfo[] = sampleRecord.data.map((record: Record<string, any>) => {\n return Object.entries(record).map(([key, value]) => ({\n cellHeader: key,\n cellValue: value,\n defaultMappedFieldName: importableFields.find(field => field.displayName === key)?.name || '',\n }));\n }).flat();\n\n // for await (const page of this.csvService.readCsvInPagesFromStream(importFileStream)) {\n // // await dbService.bulkInsert(page);\n // }\n\n return {\n sampleImportedRecordInfo: wrappedRecords, // This will hold the sample data from the file\n importableFields: importableFields, // This will hold the fields that can be imported\n };\n }\n\n async startImportSync(importTransactionId: number, activeUser: ActiveUserData): Promise<ImportSyncResult> {\n // Load the import transaction for the given ID\n const importTransaction = await this.loadImportTransaction(importTransactionId);\n const modelName = upperFirst(camelCase(importTransaction.modelMetadata.singularName));\n const permissionKey = `${modelName}Controller.insertMany`;\n\n const userPermissions = activeUser.permissions ?? [];\n const hasPermission = Array.isArray(userPermissions)\n ? userPermissions.includes(permissionKey)\n : userPermissions[permissionKey] === true;\n\n if (!hasPermission) {\n const action = permissionKey.split('.').pop()!;\n const message = ERROR_MESSAGES.PERMISSION_MESSAGES[action]?.(modelName) ?? 'You are not allowed to perform this action.';\n throw new ForbiddenException({\n message,\n errorCode: 'permission-denied',\n });\n }\n\n // Get the import file media object from the import transaction\n const importFileMediaObject = this.getImportFileObject(importTransaction);\n\n // Get the import file stream for the import transaction\n const importFileStream = await this.getImportFileStream(importFileMediaObject);\n\n const { ids, errorLogIds } = await this.importFromFileToDB(\n importTransaction,\n importFileStream,\n importFileMediaObject.mimeType,\n );\n\n // Update the import transaction status to 'completed'\n (errorLogIds.length > 0) ? importTransaction.status = ImportTransactionStatus.import_failed : importTransaction.status = ImportTransactionStatus.import_succeeded; //FIXME: We can probably have import_partially_failed status to differentiate\n // Save the import transaction\n await this.repo.save(importTransaction);\n return {\n status: importTransaction.status,\n importedIds: ids, // The IDs of the records created during the import\n importedCount: ids.length, // The number of records created during the import\n failedCount: errorLogIds.length, // The number of records that failed to import\n };\n }\n\n startImportAsync(importTransactionId: number): Promise<void> {\n throw new Error('Method not implemented.');\n }\n\n async exportFailedImportedImports(importTransactionId: number) {\n // Get the 1st error log entry to determine the headers for the export file\n const firstErrorLogEntry = await this.entityManager.getRepository(ImportTransactionErrorLog).findOne({\n where: {\n importTransaction: { id: importTransactionId },\n },\n });\n\n if (!firstErrorLogEntry) {\n throw new BadRequestException(ERROR_MESSAGES.NO_ERROR_LOG_FOR_IMPORT(importTransactionId));\n }\n\n // Create the headers for the export file\n const headers = [\n ...Object.keys(firstErrorLogEntry.rowData ? JSON.parse(firstErrorLogEntry.rowData) : {}), // Include all keys from the rowData JSON\n 'Error', // Error message for the failed record\n ];\n\n\n // Depending upon the format of the import tranaction file, create a readable stream of the error log entries\n const importTransaction = await this.loadImportTransaction(importTransactionId);\n const importFileMediaObject = this.getImportFileObject(importTransaction);\n const mimeType = importFileMediaObject.mimeType;\n const templateFormat = mimeType === ImportMimeTypes.CSV ? \"csv\" : \"excel\";\n const dataRecordsFunc = async (chunkIndex: number, chunkSize: number): Promise<any[]> => {\n // Get the error log entries for the import transaction\n const errorLogEntries = await this.entityManager.getRepository(ImportTransactionErrorLog).find({\n where: {\n importTransaction: { id: importTransactionId },\n },\n skip: chunkIndex * chunkSize,\n take: chunkSize,\n });\n\n if (!errorLogEntries || errorLogEntries.length === 0) {\n return []; // Return an empty array if no error log entries found\n }\n\n // Read the row data json from the error log entry, parse it and write it as a record to the stream\n return errorLogEntries.map(entry => {\n const rowData = entry.rowData ? JSON.parse(entry.rowData) : {};\n return {\n ...rowData, // Spread the row data into the record\n Error: entry.errorMessage,\n };\n });\n };\n\n // Get the export stream for the failed records\n const exportStream = await this.getFailedRecordsStream(templateFormat, headers, dataRecordsFunc);\n if (!exportStream) {\n throw new BadRequestException(`Failed to create export stream for import transaction ID ${importTransactionId}.`);\n }\n // Return the export stream\n const extension = templateFormat === \"excel\" ? 'xlsx' : 'csv';\n return {\n stream: exportStream,\n fileName: `${importTransaction.modelMetadata.singularName}-failed-imports.${extension}`,\n mimeType: templateFormat === \"excel\" ? ImportMimeTypes.EXCEL : ImportMimeTypes.CSV,\n };\n\n }\n\n private async getFailedRecordsStream(templateFormat: string, headers: string[], dataRecordsFunc: (chunkIndex: number, chunkSize: number) => Promise<any[]>) {\n let exportStream = null;\n switch (templateFormat) {\n case \"excel\":\n exportStream = await this.excelService.createExcelStream(dataRecordsFunc, 100, headers);\n break;\n case \"csv\":\n exportStream = await this.csvService.createCsvStream(dataRecordsFunc, 100, headers);\n break;\n default:\n throw new Error('Invalid export format');\n }\n return exportStream;\n }\n\n\n // private async loadImportTransaction(importTransactionId: number) {\n // const importTransaction = await this.findOne(importTransactionId, {\n // populate: ['modelMetadata', 'modelMetadata.fields'],\n // populateMedia: ['fileLocation'],\n // });\n // if (!importTransaction) {\n // throw new Error(`Import transaction with ID ${importTransactionId} not found.`);\n // }\n // return importTransaction;\n // }\n\n private async loadImportTransaction(importTransactionId: number) {\n // Step 1: Load the transaction with model metadata\n const importTransaction = await this.findOne(importTransactionId, {\n populate: ['modelMetadata'],\n populateMedia: ['fileLocation'],\n });\n\n // Step 2: Load full field hierarchy (child + parent fields)\n const modelFields = await this.modelMetadataHelperService.loadFieldHierarchy(\n importTransaction.modelMetadata.singularName,\n );\n\n // Step 3: Attach the combined fields back into the modelMetadata\n importTransaction.modelMetadata.fields = modelFields;\n\n return importTransaction;\n }\n\n private fieldsAllowedForImport(fields: FieldMetadata[]): FieldMetadata[] {\n // Get system field names (e.g. id, createdAt, updatedAt...)\n const systemFieldNames = this.modelMetadataHelperService\n .getSystemFieldsMetadata()\n .map(field => field.name);\n\n const userExcluded = getUserExcludedFields();\n\n // Filter out fields that are not allowed for import\n return fields.filter(field =>\n field.type !== SolidFieldType.mediaMultiple && // Exclude media multiple fields\n field.type !== SolidFieldType.mediaSingle &&\n field.type !== SolidFieldType.computed && // Exclude computed fields\n field.type !== SolidFieldType.password &&\n field.type !== SolidFieldType.richText &&\n field.type !== SolidFieldType.uuid &&\n field.relationType !== RelationType.oneToMany &&\n !systemFieldNames.includes(field.name) &&\n // field.isSystem !== true // Exclude system fields\n\n !userExcluded.includes(field.name)\n );\n }\n\n private async getFileRecordsSample(importFileStream: Readable, mimeType: string): Promise<ImportPaginatedReadResult> {\n // Depending upon the mime type of the file, read the file in pages\n // For CSV files, use the csvService to read the file in pages\n // For Excel files, use the excelService to read the file in pages\n if (mimeType === 'text/csv') {\n const generator = this.csvService.readCsvInPagesFromStream(importFileStream, { pageSize: 1 });\n const firstRecord = await generator.next(); // Get the first record to extract headers and sample data\n return firstRecord.value;\n } else if (mimeType === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') {\n const generator = this.excelService.readExcelInPagesFromStream(importFileStream, { pageSize: 1 });\n const firstRecord = await generator.next(); // Get the first record to extract headers and sample data\n return firstRecord.value;\n }\n else { // If the file is neither CSV nor Excel, throw an error\n throw new Error(ERROR_MESSAGES.INVALID_FORMAT(mimeType));\n }\n }\n\n private getImportFileObject(importTransaction: ImportTransaction): MediaWithFullUrl {\n const importFileMediaObject = importTransaction['_media']['fileLocation'][0] as MediaWithFullUrl; // Since there can be only one fileLocation, we can safely access the first element\n if (!importFileMediaObject) {\n throw new Error(`Import file for transaction ID ${importTransaction.id} not found.`);\n }\n return importFileMediaObject;\n }\n\n private async getImportFileStream(importFileMediaObject: MediaWithFullUrl): Promise<Readable> {\n const fileUrl = importFileMediaObject['_full_url'];\n const mimeType = importFileMediaObject['mimeType'];\n if (!fileUrl) {\n throw new Error(`File URL ${fileUrl} not found.`);\n }\n // From the file URL, convert the file URL to a readable stream using nestjs http service and axios\n const fileUrlResponse = await this.httpService.axiosRef.get(fileUrl, {\n responseType: 'stream',\n });\n\n if (!fileUrlResponse || !fileUrlResponse.data) {\n throw new Error(ERROR_MESSAGES.FILE_READ_FAILED_FROM_URL(fileUrl));\n }\n // fileUrlResponse.data is a Node.js Readable stream\n return fileUrlResponse.data;\n }\n\n private async importFromFileToDB(\n importTransaction: ImportTransaction,\n importFileStream: Readable,\n mimeType: string,\n ): Promise<ImportRecordsResult> {\n if (!importTransaction.modelMetadata) {\n throw new Error(`Model metadata for import transaction ID ${importTransaction.id} not found.`);\n }\n\n const createdRecordIds = [];\n const createdErrorLogIds = [];\n\n // Get the model service for the model metadata name\n const modelService = this.getModelService(importTransaction.modelMetadata.singularName);\n\n // Depending upon the mime type of the file, read the file in pages and insert the records into the database\n if (mimeType === ImportMimeTypes.CSV) {\n for await (const page of this.csvService.readCsvInPagesFromStream(importFileStream)) {\n const { ids, errorLogIds } = await this.importRecords(page, importTransaction, modelService);\n createdRecordIds.push(...ids);\n createdErrorLogIds.push(...errorLogIds);\n }\n }\n else if (mimeType === ImportMimeTypes.EXCEL) {\n for await (const page of this.excelService.readExcelInPagesFromStream(importFileStream)) {\n const { ids, errorLogIds } = await this.importRecords(page, importTransaction, modelService);\n createdRecordIds.push(...ids);\n createdErrorLogIds.push(...errorLogIds);\n }\n } else { // If the file is neither CSV nor Excel, throw an error\n throw new Error(ERROR_MESSAGES.INVALID_FORMAT(mimeType));\n }\n\n return {\n ids: createdRecordIds, // Return the IDs of the created records\n errorLogIds: createdErrorLogIds, // Return the IDs of the error log entries created during the import\n }\n }\n\n private async importRecords(page: ImportPaginatedReadResult, importTransaction: ImportTransaction, modelService: CRUDService<any>): Promise<ImportRecordsResult> {\n if (!importTransaction.modelMetadata || !importTransaction.modelMetadata.fields) {\n throw new Error(`Model metadata with fields for import transaction ID ${importTransaction.id} not found.`);\n }\n\n const ids: Array<number> = [];\n const errorLogIds: Array<number> = [];\n for (const record of page.data) {\n try {\n const createdRecord = await this.insertRecord(record, JSON.parse(importTransaction.mapping) as ImportMapping[], importTransaction.modelMetadata, modelService);\n ids.push(createdRecord.id); // Add the ID of the created record to the ids array\n }\n catch (error) {\n this.logger.debug(`Error inserting record: ${JSON.stringify(record)}. Error: ${error.message}`);\n // Get the Import transaction error log repo\n const errorLog = await this.createErrorLogEntry(importTransaction, record, error);\n errorLogIds.push(errorLog.id); // Add the ID of the error log entry to the errorLogIds array\n }\n }\n return {\n ids: ids, // Return the IDs of the created records\n errorLogIds: errorLogIds, // Return the IDs of the error log entries created during the import\n };\n }\n\n async createErrorLogEntry(importTransaction: ImportTransaction, record: Record<string, any>, error: any) {\n const importTransactionRepo = this.entityManager.getRepository(ImportTransactionErrorLog);\n // Create a new ImportTransactionErrorLog entry\n const rowNumber = uuidv4(); // Generate a unique row number or use page.rowNumber if available \n\n const errorLogEntry = {\n importTransactionErrorLogId: `${importTransaction.id}-${rowNumber}`, // FIXME pending to retrieve the row number from the page\n rowNumber: 1, // FIXME pending to retrieve the row number from the page\n rowData: JSON.stringify(record), // Store the row data\n importTransaction: importTransaction, // Link to the import transaction\n errorMessage: error.message, // Store the error message\n errorTrace: error.stack || '', // Store the error stack trace if available\n } as ImportTransactionErrorLog;\n\n // Save the error log entry to the database\n const savedEntry = await importTransactionRepo.save(errorLogEntry);\n return savedEntry; // Return the ID of the saved error log entry\n }\n\n //FIXME Currently below method fails if any field in the record is not valid or if the record is not valid. It does not collect the errors for all fields in a record\n private async insertRecord(record: Record<string, any>, mapping: ImportMapping[], modelMetadataWithFields: ModelMetadata, modelService: CRUDService<any>): Promise<any> {\n // Convert the imported record to a DTO\n const dto = await this.convertImportedRecordToDto(record, mapping, modelMetadataWithFields);\n // Use the model service to create the record in the database\n const createdRecord = await modelService.create(dto, [], {}); //FIXME: Need to handle this part alongwith the refactoring of the CRUDService for permissions\n return createdRecord; // Return the created record\n }\n\n private getModelService(modelSingularName: string): CRUDService<any> {\n // Get the model service for the model metadata name\n const modelServiceWrapper = this.introspectService.getProvider(`${classify(modelSingularName)}Service`);\n const modelService = modelServiceWrapper.instance as CRUDService<any>;\n if (!modelService) {\n throw new Error(ERROR_MESSAGES.MODEL_SERVICE_NOT_FOUND(modelSingularName));\n }\n return modelService;\n }\n\n private async convertImportedRecordToDto(record: Record<string, any>, mapping: ImportMapping[], modelMetadataWithFields: ModelMetadata) {\n // Create a new record object\n const dtoRecord: Record<string, any> = {};\n\n // Iterate through every cell in the record\n // Using the saved mapping, populate the dtoRecord w.r.t the record and fields\n for (const key in record) {\n const mappedField = mapping.find(m => m.header === key);\n if (mappedField) {\n // If the field is found in the mapping, get the field metadata from the model metadata\n const fieldMetadata = modelMetadataWithFields.fields.find(f => f.name === mappedField.fieldName);\n // const userKeyField = modelMetadataWithFields.fields.find(f => f.isUserKey === true); // Assuming userKey is a field in the model metadata\n if (fieldMetadata) {\n // If the field is found in the model metadata, set the value in the dtoRecord\n await this.populateDtoForACell(dtoRecord, fieldMetadata, record, key);\n } else {\n this.logger.warn(`Field ${mappedField.fieldName} not found in model metadata ${modelMetadataWithFields.singularName}`);\n }\n }\n }\n return dtoRecord;\n }\n\n private async populateDtoForACell(dtoRecord: Record<string, any>, fieldMetadata: FieldMetadata, record: Record<string, any>, key: string): Promise<Record<string, any>> {\n const fieldType = fieldMetadata.type;\n // const userKeyFieldName = userKeyField?.name || 'id'; // Default to 'id' if not found\n\n // TODO Move this logic to field crud managers i.e add a parse method to the field crud manager interface\n switch (fieldType) {\n case SolidFieldType.relation: {\n return await this.populateDtoForRelations(fieldMetadata, record, key, dtoRecord);\n }\n case SolidFieldType.date:\n case SolidFieldType.datetime:\n return this.populateDtoForDate(record, key, fieldMetadata, dtoRecord);\n case SolidFieldType.int:\n case SolidFieldType.bigint:\n case SolidFieldType.decimal:\n return this.populateDtoForNumber(dtoRecord, fieldMetadata, record, key);\n case SolidFieldType.boolean:\n return this.populateDtoForBoolean(dtoRecord, fieldMetadata, record, key);\n case SolidFieldType.selectionStatic:\n case SolidFieldType.selectionDynamic:\n return this.populateDtoForSelectionValues(dtoRecord, fieldMetadata, record, key);\n case SolidFieldType.email:\n case SolidFieldType.shortText:\n case SolidFieldType.longtext:\n case SolidFieldType.richText: {\n dtoRecord[fieldMetadata.name] = record[key] ? String(record[key]).trim() : null; // Trim text fields and set to null if empty\n return dtoRecord;\n }\n default: {\n dtoRecord[fieldMetadata.name] = record[key];\n return dtoRecord;\n }\n }\n }\n\n private populateDtoForSelectionValues(dtoRecord: Record<string, any>, fieldMetadata: FieldMetadata, record: Record<string, any>, key: string) {\n const rawValue = record[key];\n\n if (rawValue == null || rawValue === '' || (typeof rawValue === 'string' && rawValue.trim() === '')) {\n dtoRecord[fieldMetadata.name] = null;\n return dtoRecord;\n }\n\n const isMultipleSelection = fieldMetadata.isMultiSelect;\n\n if (isMultipleSelection) {\n const selectionValues = String(rawValue)\n .split(',')\n .map(value => value.trim())\n .filter(value => value !== '');\n\n dtoRecord[fieldMetadata.name] = JSON.stringify(selectionValues);\n } else {\n dtoRecord[fieldMetadata.name] = rawValue; // Single select: assign directly\n }\n\n return dtoRecord;\n }\n\n\n private populateDtoForBoolean(dtoRecord: Record<string, any>, fieldMetadata: FieldMetadata, record: Record<string, any>, key: string) {\n const cellValue = record[key];\n if (cellValue === null || cellValue === undefined || cellValue === '') {\n dtoRecord[fieldMetadata.name] = null; // If the cell is empty, set the field to null\n return dtoRecord;\n }\n\n // If the cell contains values other than 'true', '1', 'yes', 'false', '0', 'no', throw an error\n const booleanValue = (String(cellValue).toLowerCase() === 'true' || String(cellValue) === '1' || String(cellValue).toLowerCase() === 'yes') ? true : (String(cellValue).toLowerCase() === 'false' || String(cellValue) === '0' || String(cellValue).toLowerCase() === 'no') ? false : null;\n if (booleanValue === null) {\n throw new Error(`Invalid boolean value for cell ${key} with value ${cellValue}`);\n }\n dtoRecord[fieldMetadata.name] = booleanValue;\n return dtoRecord;\n }\n\n private populateDtoForNumber(dtoRecord: Record<string, any>, fieldMetadata: FieldMetadata, record: Record<string, any>, key: string) {\n const cellValue = record[key];\n if (cellValue === null || cellValue === undefined || cellValue === '') {\n dtoRecord[fieldMetadata.name] = null; // If the cell is empty, set the field to null\n return dtoRecord;\n }\n const numberValue = Number(cellValue);\n if (isNaN(numberValue)) {\n throw new Error(`Invalid number value for cell ${key} with value ${record[key]}`);\n }\n dtoRecord[fieldMetadata.name] = numberValue;\n return dtoRecord;\n }\n\n private populateDtoForDate(record: Record<string, any>, key: string, fieldMetadata: FieldMetadata, dtoRecord: Record<string, any>) {\n {\n // Get the cell value\n const cellValue = record[key];\n if (!cellValue) { //If cell is a falsy value (empty)\n dtoRecord[fieldMetadata.name] = null; // If the cell is empty, set the field to null\n return dtoRecord;\n }\n // Use flexible date parser\n this.logger.verbose(cellValue, 'cellValue');\n\n const dateValue = parseFlexibleDate(cellValue);\n this.logger.verbose(dateValue, 'dateValue');\n\n if (!dateValue) {\n throw new Error(\n `Invalid date value for cell ${key} with value ${cellValue}`\n );\n }\n dtoRecord[fieldMetadata.name] = dateValue;\n return dtoRecord;\n }\n }\n\n private async populateDtoForRelations(fieldMetadata: FieldMetadata, record: Record<string, any>, key: string, dtoRecord: Record<string, any>) {\n if (!fieldMetadata.relationCoModelSingularName) {\n throw new Error(ERROR_MESSAGES.RELATION_CO_MODEL_NOT_DEFINED_FOR_FIELD(fieldMetadata.name));\n }\n\n const relatedRecordsIds = await this.getRelatedEntityIdsFromUserKeys(fieldMetadata, record, key);\n if (relatedRecordsIds.length === 0) {\n return dtoRecord; // If no related records found, return the dtoRecord as is\n }\n\n if (fieldMetadata.relationType === RelationType.manyTomany || fieldMetadata.relationType === RelationType.oneToMany) {\n dtoRecord[`${fieldMetadata.name}Ids`] = relatedRecordsIds;\n dtoRecord[`${fieldMetadata.name}Command`] = RelationFieldsCommand.set; // Reset the relation field association with the related records IDs\n }\n else if (fieldMetadata.relationType === RelationType.manyToOne) {\n dtoRecord[`${fieldMetadata.name}Id`] = relatedRecordsIds.pop(); // For many-to-one relations, we need only one ID\n }\n return dtoRecord;\n }\n\n private async getRelatedEntityIdsFromUserKeys(fieldMetadata: FieldMetadata, record: Record<string, any>, key: string): Promise<Array<number>> {\n // For many-to-many or one-to-many relations, we expect the record cell to contains a comma-separated list of userKeys\n const relationUserKeys = record[key] ? String(record[key]).split(',').map((userKey: string) => userKey.trim()) : [];\n if (relationUserKeys.length === 0) return [];\n\n const coModelService = this.getModelService(fieldMetadata.relationCoModelSingularName);\n const coModelWithUserKeyField = await this.modelMetadataService.findOneBySingularName(fieldMetadata.relationCoModelSingularName, ['userKeyField']);\n const coModelUserKeyFieldName = coModelWithUserKeyField?.userKeyField?.name || 'id'; // Default to 'id' if not found\n\n\n // Set the relation basic filter dto filters with the userkeys and call the find method of the model service to get the related records\n const relationFilterDto = {\n filters: {\n [coModelUserKeyFieldName]: {\n $in: relationUserKeys, // Use the userKeyFieldName to filter by userKeys\n },\n },\n };\n\n // From the userKeys, we will get the IDs of the related records using the userKeyFieldName and throw an error if any of the userKeys is not found\n const relatedRecordsResult = await coModelService.find(relationFilterDto);\n if (!relatedRecordsResult || !relatedRecordsResult.records || relatedRecordsResult.records.length === 0 || relatedRecordsResult.records.length !== relationUserKeys.length) {\n throw new Error(`Invalid related records userKey values found for cell ${key} with value ${record[key]}`);\n }\n const relatedRecordsIds = relatedRecordsResult.records.map(record => record.id);\n return relatedRecordsIds;\n }\n}"]}
|
|
@@ -1,29 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ModuleRef } from "@nestjs/core";
|
|
2
2
|
import { EntityManager } from 'typeorm';
|
|
3
|
-
import { ConfigService } from '@nestjs/config';
|
|
4
|
-
import { CrudHelperService } from 'src/services/crud-helper.service';
|
|
5
3
|
import { CRUDService } from 'src/services/crud.service';
|
|
6
|
-
import { FileService } from 'src/services/file.service';
|
|
7
|
-
import { ModelMetadataService } from 'src/services/model-metadata.service';
|
|
8
|
-
import { ModuleMetadataService } from 'src/services/module-metadata.service';
|
|
9
4
|
import { ModuleMetadataHelperService } from 'src/helpers/module-metadata-helper.service';
|
|
10
5
|
import { ListOfValuesMapper } from 'src/mappers/list-of-values-mapper';
|
|
11
6
|
import { ListOfValuesRepository } from 'src/repository/list-of-values.repository';
|
|
12
7
|
import { ListOfValues } from '../entities/list-of-values.entity';
|
|
13
8
|
export declare class ListOfValuesService extends CRUDService<ListOfValues> {
|
|
14
|
-
readonly modelMetadataService: ModelMetadataService;
|
|
15
|
-
readonly moduleMetadataService: ModuleMetadataService;
|
|
16
|
-
readonly configService: ConfigService;
|
|
17
|
-
readonly fileService: FileService;
|
|
18
|
-
readonly discoveryService: DiscoveryService;
|
|
19
|
-
readonly crudHelperService: CrudHelperService;
|
|
20
9
|
readonly entityManager: EntityManager;
|
|
21
10
|
readonly repo: ListOfValuesRepository;
|
|
22
11
|
readonly moduleRef: ModuleRef;
|
|
23
12
|
private readonly moduleMetadataHelperService;
|
|
24
13
|
readonly listOfValuesMapper: ListOfValuesMapper;
|
|
25
14
|
logger: any;
|
|
26
|
-
constructor(
|
|
15
|
+
constructor(entityManager: EntityManager, repo: ListOfValuesRepository, moduleRef: ModuleRef, moduleMetadataHelperService: ModuleMetadataHelperService, listOfValuesMapper: ListOfValuesMapper);
|
|
27
16
|
findOneByValueAndType(lovValue: string, lovType: string): Promise<ListOfValues>;
|
|
28
17
|
findAll(): Promise<ListOfValues[]>;
|
|
29
18
|
upsert(updateListOfValuesDto: any): Promise<any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-of-values.service.d.ts","sourceRoot":"","sources":["../../src/services/list-of-values.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"list-of-values.service.d.ts","sourceRoot":"","sources":["../../src/services/list-of-values.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAIxD,OAAO,EAAE,2BAA2B,EAAE,MAAM,4CAA4C,CAAC;AACzF,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAGjE,qBACa,mBAAoB,SAAQ,WAAW,CAAC,YAAY,CAAC;IAM9D,QAAQ,CAAC,aAAa,EAAE,aAAa;IAGrC,QAAQ,CAAC,IAAI,EAAE,sBAAsB;IACrC,QAAQ,CAAC,SAAS,EAAE,SAAS;IAC7B,OAAO,CAAC,QAAQ,CAAC,2BAA2B;IAC5C,QAAQ,CAAC,kBAAkB,EAAE,kBAAkB;IAXjD,MAAM,EAAE,GAAG,CAAC;gBAKD,aAAa,EAAE,aAAa,EAG5B,IAAI,EAAE,sBAAsB,EAC5B,SAAS,EAAE,SAAS,EACZ,2BAA2B,EAAE,2BAA2B,EAChE,kBAAkB,EAAE,kBAAkB;IAK3C,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IASvD,OAAO,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;IAIlC,MAAM,CAAC,qBAAqB,EAAE,GAAG;IAqBjC,wBAAwB,CAAC,MAAM,EAAE,YAAY;IAuB7C,0BAA0B,CAAC,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY;IAwBxE,4BAA4B,CAAC,MAAM,EAAE,YAAY;YAuBzC,oBAAoB;YAWpB,aAAa;YAoCb,cAAc;YAyBd,gBAAgB;CA4B/B"}
|
|
@@ -50,25 +50,14 @@ const common_1 = require("@nestjs/common");
|
|
|
50
50
|
const core_1 = require("@nestjs/core");
|
|
51
51
|
const typeorm_1 = require("@nestjs/typeorm");
|
|
52
52
|
const typeorm_2 = require("typeorm");
|
|
53
|
-
const config_1 = require("@nestjs/config");
|
|
54
|
-
const crud_helper_service_1 = require("./crud-helper.service");
|
|
55
53
|
const crud_service_1 = require("./crud.service");
|
|
56
|
-
const file_service_1 = require("./file.service");
|
|
57
|
-
const model_metadata_service_1 = require("./model-metadata.service");
|
|
58
|
-
const module_metadata_service_1 = require("./module-metadata.service");
|
|
59
54
|
const fs = __importStar(require("fs/promises"));
|
|
60
55
|
const module_metadata_helper_service_1 = require("../helpers/module-metadata-helper.service");
|
|
61
56
|
const list_of_values_mapper_1 = require("../mappers/list-of-values-mapper");
|
|
62
57
|
const list_of_values_repository_1 = require("../repository/list-of-values.repository");
|
|
63
58
|
let ListOfValuesService = class ListOfValuesService extends crud_service_1.CRUDService {
|
|
64
|
-
constructor(
|
|
65
|
-
super(
|
|
66
|
-
this.modelMetadataService = modelMetadataService;
|
|
67
|
-
this.moduleMetadataService = moduleMetadataService;
|
|
68
|
-
this.configService = configService;
|
|
69
|
-
this.fileService = fileService;
|
|
70
|
-
this.discoveryService = discoveryService;
|
|
71
|
-
this.crudHelperService = crudHelperService;
|
|
59
|
+
constructor(entityManager, repo, moduleRef, moduleMetadataHelperService, listOfValuesMapper) {
|
|
60
|
+
super(entityManager, repo, 'listOfValues', 'solid-core', moduleRef);
|
|
72
61
|
this.entityManager = entityManager;
|
|
73
62
|
this.repo = repo;
|
|
74
63
|
this.moduleRef = moduleRef;
|
|
@@ -221,15 +210,8 @@ let ListOfValuesService = class ListOfValuesService extends crud_service_1.CRUDS
|
|
|
221
210
|
exports.ListOfValuesService = ListOfValuesService;
|
|
222
211
|
exports.ListOfValuesService = ListOfValuesService = __decorate([
|
|
223
212
|
(0, common_1.Injectable)(),
|
|
224
|
-
__param(0, (0,
|
|
225
|
-
|
|
226
|
-
__metadata("design:paramtypes", [model_metadata_service_1.ModelMetadataService,
|
|
227
|
-
module_metadata_service_1.ModuleMetadataService,
|
|
228
|
-
config_1.ConfigService,
|
|
229
|
-
file_service_1.FileService,
|
|
230
|
-
core_1.DiscoveryService,
|
|
231
|
-
crud_helper_service_1.CrudHelperService,
|
|
232
|
-
typeorm_2.EntityManager,
|
|
213
|
+
__param(0, (0, typeorm_1.InjectEntityManager)()),
|
|
214
|
+
__metadata("design:paramtypes", [typeorm_2.EntityManager,
|
|
233
215
|
list_of_values_repository_1.ListOfValuesRepository,
|
|
234
216
|
core_1.ModuleRef,
|
|
235
217
|
module_metadata_helper_service_1.ModuleMetadataHelperService,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-of-values.service.js","sourceRoot":"","sources":["../../src/services/list-of-values.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAAgE;AAChE,uCAA2D;AAC3D,6CAAsD;AACtD,qCAAwC;AAExC,2CAA+C;AAC/C,+DAAqE;AACrE,iDAAwD;AACxD,iDAAwD;AACxD,qEAA2E;AAC3E,uEAA6E;AAG7E,gDAAkC;AAClC,8FAAyF;AACzF,4EAAuE;AACvE,uFAAkF;AAK3E,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,0BAAyB;IAIhE,YAEW,oBAA0C,EAC1C,qBAA4C,EAC5C,aAA4B,EAC5B,WAAwB,EACxB,gBAAkC,EAClC,iBAAoC,EAGpC,aAA4B,EAG5B,IAA4B,EAC5B,SAAoB,EACZ,2BAAwD,EAChE,kBAAsC;QAG/C,KAAK,CAAC,oBAAoB,EAAE,qBAAqB,EAAE,aAAa,EAAE,WAAW,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,aAAa,EAAE,IAAI,EAAE,cAAc,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;QAjBzK,yBAAoB,GAApB,oBAAoB,CAAsB;QAC1C,0BAAqB,GAArB,qBAAqB,CAAuB;QAC5C,kBAAa,GAAb,aAAa,CAAe;QAC5B,gBAAW,GAAX,WAAW,CAAa;QACxB,qBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,sBAAiB,GAAjB,iBAAiB,CAAmB;QAGpC,kBAAa,GAAb,aAAa,CAAe;QAG5B,SAAI,GAAJ,IAAI,CAAwB;QAC5B,cAAS,GAAT,SAAS,CAAW;QACZ,gCAA2B,GAA3B,2BAA2B,CAA6B;QAChE,uBAAkB,GAAlB,kBAAkB,CAAoB;IAIjD,CAAC;IACD,KAAK,CAAC,qBAAqB,CAAC,QAAgB,EAAE,OAAe;QAC3D,OA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AG,CAAC,KAAK;YACxB,IAAI,CAAC,MAAM,KAAK,GAAG,CAAC,MAAM,CAC7B,CAAC;QAEF,IAAI,aAAa,KAAK,CAAC,CAAC,EAAE,CAAC;YAEzB,QAAQ,CAAC,YAAY,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;YAC/C,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,eAAe,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,KAAK,YAAY,GAAG,CAAC,MAAM,eAAe,CAAC,CAAC;QAC/F,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,MAAM,CAAC,IAAI,CACd,OAAO,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,KAAK,YAAY,GAAG,CAAC,MAAM,qCAAqC,CACxF,CAAC;QACJ,CAAC;QACD,MAAM,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACzD,MAAM,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;IAE/C,CAAC;CACF,CAAA;AArOY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,mBAAU,GAAE;IAMR,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,6CAAoB,CAAC,CAAC,CAAA;IAQ9C,WAAA,IAAA,6BAAmB,GAAE,CAAA;qCAPS,6CAAoB;QACnB,+CAAqB;QAC7B,sBAAa;QACf,0BAAW;QACN,uBAAgB;QACf,uCAAiB;QAGrB,uBAAa;QAGtB,kDAAsB;QACjB,gBAAS;QACiB,4DAA2B;QAC5C,0CAAkB;GApBtC,mBAAmB,CAqO/B","sourcesContent":["import { forwardRef, Inject, Injectable } from '@nestjs/common';\nimport { DiscoveryService, ModuleRef } from \"@nestjs/core\";\nimport { InjectEntityManager } from '@nestjs/typeorm';\nimport { EntityManager } from 'typeorm';\n\nimport { ConfigService } from '@nestjs/config';\nimport { CrudHelperService } from 'src/services/crud-helper.service';\nimport { CRUDService } from 'src/services/crud.service';\nimport { FileService } from 'src/services/file.service';\nimport { ModelMetadataService } from 'src/services/model-metadata.service';\nimport { ModuleMetadataService } from 'src/services/module-metadata.service';\n\n\nimport * as fs from 'fs/promises'; // Use the Promise-based version of fs for async/await\nimport { ModuleMetadataHelperService } from 'src/helpers/module-metadata-helper.service';\nimport { ListOfValuesMapper } from 'src/mappers/list-of-values-mapper';\nimport { ListOfValuesRepository } from 'src/repository/list-of-values.repository';\nimport { ListOfValues } from '../entities/list-of-values.entity';\n\n\n@Injectable()\nexport class ListOfValuesService extends CRUDService<ListOfValues> {\n logger: any;\n // moduleMetadataHelperService: any;\n // listOfValuesMapper: any;\n constructor(\n @Inject(forwardRef(() => ModelMetadataService))\n readonly modelMetadataService: ModelMetadataService,\n readonly moduleMetadataService: ModuleMetadataService,\n readonly configService: ConfigService,\n readonly fileService: FileService,\n readonly discoveryService: DiscoveryService,\n readonly crudHelperService: CrudHelperService,\n \n @InjectEntityManager()\n readonly entityManager: EntityManager,\n // @InjectRepository(ListOfValues, 'default')\n // readonly repo: Repository<ListOfValues>,\n readonly repo: ListOfValuesRepository,\n readonly moduleRef: ModuleRef,\n private readonly moduleMetadataHelperService: ModuleMetadataHelperService,\n readonly listOfValuesMapper: ListOfValuesMapper,\n\n ) {\n super(modelMetadataService, moduleMetadataService, configService, fileService, discoveryService, crudHelperService, entityManager, repo, 'listOfValues', 'solid-core', moduleRef);\n }\n async findOneByValueAndType(lovValue: string, lovType: string) {\n return await this.repo.findOne({\n where: {\n value: lovValue,\n type: lovType,\n },\n });\n }\n\n async findAll(): Promise<ListOfValues[]> {\n return await this.repo.find();\n }\n\n async upsert(updateListOfValuesDto: any) {\n // First check if module already exists using name\n const existingListOfValue = await this.repo.findOne({\n where: {\n value: updateListOfValuesDto.value\n }\n })\n\n // if found\n if (existingListOfValue) {\n const updatedListOfValuesDto = { ...existingListOfValue, ...updateListOfValuesDto };\n return this.repo.save(updatedListOfValuesDto);\n }\n // if not found - create new \n else {\n const listOfValue = this.repo.create(updateListOfValuesDto);\n return this.repo.save(listOfValue);\n }\n }\n\n\n async saveListofValuesToConfig(entity: ListOfValues) {\n if (!entity) {\n this.logger.debug('No entity found in the ListofValuesSubscriber saveListofvalueToConfig method');\n return;\n }\n\n // Validate list of value details\n const listofvalue = entity as ListOfValues;\n const moduleMetadata = entity.module;\n if (!moduleMetadata) {\n throw new Error(`Module metadata not found for listofvalue id ${entity.id}`);\n }\n\n // Get config file details\n const { filePath, metaData } = await this.getConfigFileDetails(moduleMetadata.name); // sting expected module name\n if (!filePath || !metaData) {\n throw new Error(`Configuration details not found for module: ${moduleMetadata.name}`);\n }\n\n // Write the listofvalue to the config file\n await this.writeToConfig(metaData, listofvalue, filePath);\n }\n\n async updateListofValuesToConfig(oldentity: ListOfValues, entity: ListOfValues) {\n if (!entity) {\n this.logger.debug('No entity found in the ListofValuesSubscriber saveListofvalueToConfig method');\n return;\n }\n\n // Validate list of value details\n const oldlistofvalue = oldentity as ListOfValues;\n const listofvalue = entity as ListOfValues;\n const moduleMetadata = entity.module;\n if (!moduleMetadata) {\n throw new Error(`Module metadata not found for listofvalue id ${entity.id}`);\n }\n\n // Get config file details\n const { filePath, metaData } = await this.getConfigFileDetails(moduleMetadata.name); // sting expected module name\n if (!filePath || !metaData) {\n throw new Error(`Configuration details not found for module: ${moduleMetadata.name}`);\n }\n\n // Write the listofvalue to the config file\n await this.updateToConfig(metaData, oldlistofvalue, listofvalue, filePath);\n }\n\n async deleteListOfValuesFromConfig(entity: ListOfValues) {\n if (!entity) {\n this.logger.debug('No entity found in the ListofValuesSubscriber saveListofvalueToConfig method');\n return;\n }\n\n // Validate list of value details\n const listofvalue = entity as ListOfValues;\n const moduleMetadata = entity.module;\n if (!moduleMetadata) {\n throw new Error(`Module metadata not found for listofvalue id ${entity.id}`);\n }\n\n // Get config file details\n const { filePath, metaData } = await this.getConfigFileDetails(moduleMetadata.name); // sting expected module name\n if (!filePath || !metaData) {\n throw new Error(`Configuration details not found for module: ${moduleMetadata.name}`);\n }\n\n // delete the listofvalue to the config file\n await this.deleteFromConfig(metaData, listofvalue, filePath);\n }\n\n private async getConfigFileDetails(moduleName: string): Promise<{ filePath: string; metaData: any }> {\n const filePath = await this.moduleMetadataHelperService.getModuleMetadataFilePath(moduleName);\n try {\n await fs.access(filePath);\n } catch (error) {\n throw new Error(`Configuration file not found for module: ${moduleName}`);\n }\n const metaData = await this.moduleMetadataHelperService.getModuleMetadataConfiguration(filePath);\n return { filePath, metaData };\n }\n\n private async writeToConfig(metaData: any, listofvalues: ListOfValues, filePath: string) {\n const dto = await this.listOfValuesMapper.toDto(listofvalues);\n\n if (!Array.isArray(metaData.listOfValues)) {\n metaData.listOfValues = [];\n }\n\n // Match by type + value + module\n const existingIndex = metaData.listOfValues.findIndex(\n (item: { type: string; value: string; module: number }) =>\n item.type === dto.type &&\n item.value === dto.value &&\n item.module === dto.module\n );\n\n if (existingIndex !== -1) {\n // Replace existing entry\n metaData.listOfValues[existingIndex] = dto;\n } else {\n // Insert new entry\n // metaData.listOfValues.unshift(dto);\n\n if (metaData.listOfValues.length === 0) {\n // Case 1: Empty array → add first item\n metaData.listOfValues.push(dto);\n } else {\n // Case 2: Insert new item right after index 0\n metaData.listOfValues.unshift(dto);\n }\n\n }\n\n const updatedContent = JSON.stringify(metaData, null, 2);\n await fs.writeFile(filePath, updatedContent);\n }\n\n private async updateToConfig(metaData: any, oldlistofvalues: ListOfValues, listofvalues: ListOfValues, filePath: string) {\n const newvalue = await this.listOfValuesMapper.toDto(listofvalues);\n const oldvalue = await this.listOfValuesMapper.toDto(oldlistofvalues);\n\n if (!Array.isArray(metaData.listOfValues)) {\n metaData.listOfValues = [];\n }\n\n const searchType = oldvalue.type || newvalue.type;\n const searchValue = oldvalue.value || newvalue.value;\n const searchModule = oldvalue.module || newvalue.module;\n\n const existingIndex = metaData.listOfValues.findIndex(\n (item: { type: string; value: string; module: number }) =>\n item.type === searchType && item.value === searchValue && item.module === searchModule\n );\n if (existingIndex !== -1) {\n // Replace existing match\n metaData.listOfValues[existingIndex] = newvalue;\n }\n\n const updatedContent = JSON.stringify(metaData, null, 2);\n await fs.writeFile(filePath, updatedContent);\n }\n\n private async deleteFromConfig(metaData: any, listofvalues: ListOfValues, filePath: string) {\n const dto = await this.listOfValuesMapper.toDto(listofvalues);\n\n if (!Array.isArray(metaData.listOfValues)) {\n metaData.listOfValues = [];\n }\n\n // Match by type + value + module\n const existingIndex = metaData.listOfValues.findIndex(\n (item: { type: string; value: string; module: number }) =>\n item.type === dto.type &&\n item.value === dto.value &&\n item.module === dto.module\n );\n\n if (existingIndex !== -1) {\n // Remove the item\n metaData.listOfValues.splice(existingIndex, 1);\n this.logger.debug(`Deleted LOV ${dto.type}:${dto.value} (module ${dto.module}) from config`);\n } else {\n this.logger.warn(\n `LOV ${dto.type}:${dto.value} (module ${dto.module}) not found in config during delete`\n );\n }\n const updatedContent = JSON.stringify(metaData, null, 2);\n await fs.writeFile(filePath, updatedContent);\n\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"list-of-values.service.js","sourceRoot":"","sources":["../../src/services/list-of-values.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,uCAAyC;AACzC,6CAAsD;AACtD,qCAAwC;AAExC,iDAAwD;AAGxD,gDAAkC;AAClC,8FAAyF;AACzF,4EAAuE;AACvE,uFAAkF;AAK3E,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,0BAAyB;IAIhE,YAEW,aAA4B,EAG5B,IAA4B,EAC5B,SAAoB,EACZ,2BAAwD,EAChE,kBAAsC;QAG/C,KAAK,CAAC,aAAa,EAAE,IAAI,EAAE,cAAc,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;QAT3D,kBAAa,GAAb,aAAa,CAAe;QAG5B,SAAI,GAAJ,IAAI,CAAwB;QAC5B,cA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C;QAGD,MAAM,aAAa,GAAG,QAAQ,CAAC,YAAY,CAAC,SAAS,CACnD,CAAC,IAAqD,EAAE,EAAE,CACxD,IAAI,CAAC,IAAI,KAAK,GAAG,CAAC,IAAI;YACtB,IAAI,CAAC,KAAK,KAAK,GAAG,CAAC,KAAK;YACxB,IAAI,CAAC,MAAM,KAAK,GAAG,CAAC,MAAM,CAC7B,CAAC;QAEF,IAAI,aAAa,KAAK,CAAC,CAAC,EAAE,CAAC;YAEzB,QAAQ,CAAC,YAAY,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;YAC/C,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,eAAe,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,KAAK,YAAY,GAAG,CAAC,MAAM,eAAe,CAAC,CAAC;QAC/F,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,MAAM,CAAC,IAAI,CACd,OAAO,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,KAAK,YAAY,GAAG,CAAC,MAAM,qCAAqC,CACxF,CAAC;QACJ,CAAC;QACD,MAAM,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACzD,MAAM,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;IAE/C,CAAC;CACF,CAAA;AA7NY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,mBAAU,GAAE;IAMR,WAAA,IAAA,6BAAmB,GAAE,CAAA;qCACE,uBAAa;QAGtB,kDAAsB;QACjB,gBAAS;QACiB,4DAA2B;QAC5C,0CAAkB;GAZtC,mBAAmB,CA6N/B","sourcesContent":["import { Injectable } from '@nestjs/common';\nimport { ModuleRef } from \"@nestjs/core\";\nimport { InjectEntityManager } from '@nestjs/typeorm';\nimport { EntityManager } from 'typeorm';\n\nimport { CRUDService } from 'src/services/crud.service';\n\n\nimport * as fs from 'fs/promises'; // Use the Promise-based version of fs for async/await\nimport { ModuleMetadataHelperService } from 'src/helpers/module-metadata-helper.service';\nimport { ListOfValuesMapper } from 'src/mappers/list-of-values-mapper';\nimport { ListOfValuesRepository } from 'src/repository/list-of-values.repository';\nimport { ListOfValues } from '../entities/list-of-values.entity';\n\n\n@Injectable()\nexport class ListOfValuesService extends CRUDService<ListOfValues> {\n logger: any;\n // moduleMetadataHelperService: any;\n // listOfValuesMapper: any;\n constructor(\n @InjectEntityManager()\n readonly entityManager: EntityManager,\n // @InjectRepository(ListOfValues, 'default')\n // readonly repo: Repository<ListOfValues>,\n readonly repo: ListOfValuesRepository,\n readonly moduleRef: ModuleRef,\n private readonly moduleMetadataHelperService: ModuleMetadataHelperService,\n readonly listOfValuesMapper: ListOfValuesMapper,\n\n ) {\n super(entityManager, repo, 'listOfValues', 'solid-core', moduleRef);\n }\n async findOneByValueAndType(lovValue: string, lovType: string) {\n return await this.repo.findOne({\n where: {\n value: lovValue,\n type: lovType,\n },\n });\n }\n\n async findAll(): Promise<ListOfValues[]> {\n return await this.repo.find();\n }\n\n async upsert(updateListOfValuesDto: any) {\n // First check if module already exists using name\n const existingListOfValue = await this.repo.findOne({\n where: {\n value: updateListOfValuesDto.value\n }\n })\n\n // if found\n if (existingListOfValue) {\n const updatedListOfValuesDto = { ...existingListOfValue, ...updateListOfValuesDto };\n return this.repo.save(updatedListOfValuesDto);\n }\n // if not found - create new \n else {\n const listOfValue = this.repo.create(updateListOfValuesDto);\n return this.repo.save(listOfValue);\n }\n }\n\n\n async saveListofValuesToConfig(entity: ListOfValues) {\n if (!entity) {\n this.logger.debug('No entity found in the ListofValuesSubscriber saveListofvalueToConfig method');\n return;\n }\n\n // Validate list of value details\n const listofvalue = entity as ListOfValues;\n const moduleMetadata = entity.module;\n if (!moduleMetadata) {\n throw new Error(`Module metadata not found for listofvalue id ${entity.id}`);\n }\n\n // Get config file details\n const { filePath, metaData } = await this.getConfigFileDetails(moduleMetadata.name); // sting expected module name\n if (!filePath || !metaData) {\n throw new Error(`Configuration details not found for module: ${moduleMetadata.name}`);\n }\n\n // Write the listofvalue to the config file\n await this.writeToConfig(metaData, listofvalue, filePath);\n }\n\n async updateListofValuesToConfig(oldentity: ListOfValues, entity: ListOfValues) {\n if (!entity) {\n this.logger.debug('No entity found in the ListofValuesSubscriber saveListofvalueToConfig method');\n return;\n }\n\n // Validate list of value details\n const oldlistofvalue = oldentity as ListOfValues;\n const listofvalue = entity as ListOfValues;\n const moduleMetadata = entity.module;\n if (!moduleMetadata) {\n throw new Error(`Module metadata not found for listofvalue id ${entity.id}`);\n }\n\n // Get config file details\n const { filePath, metaData } = await this.getConfigFileDetails(moduleMetadata.name); // sting expected module name\n if (!filePath || !metaData) {\n throw new Error(`Configuration details not found for module: ${moduleMetadata.name}`);\n }\n\n // Write the listofvalue to the config file\n await this.updateToConfig(metaData, oldlistofvalue, listofvalue, filePath);\n }\n\n async deleteListOfValuesFromConfig(entity: ListOfValues) {\n if (!entity) {\n this.logger.debug('No entity found in the ListofValuesSubscriber saveListofvalueToConfig method');\n return;\n }\n\n // Validate list of value details\n const listofvalue = entity as ListOfValues;\n const moduleMetadata = entity.module;\n if (!moduleMetadata) {\n throw new Error(`Module metadata not found for listofvalue id ${entity.id}`);\n }\n\n // Get config file details\n const { filePath, metaData } = await this.getConfigFileDetails(moduleMetadata.name); // sting expected module name\n if (!filePath || !metaData) {\n throw new Error(`Configuration details not found for module: ${moduleMetadata.name}`);\n }\n\n // delete the listofvalue to the config file\n await this.deleteFromConfig(metaData, listofvalue, filePath);\n }\n\n private async getConfigFileDetails(moduleName: string): Promise<{ filePath: string; metaData: any }> {\n const filePath = await this.moduleMetadataHelperService.getModuleMetadataFilePath(moduleName);\n try {\n await fs.access(filePath);\n } catch (error) {\n throw new Error(`Configuration file not found for module: ${moduleName}`);\n }\n const metaData = await this.moduleMetadataHelperService.getModuleMetadataConfiguration(filePath);\n return { filePath, metaData };\n }\n\n private async writeToConfig(metaData: any, listofvalues: ListOfValues, filePath: string) {\n const dto = await this.listOfValuesMapper.toDto(listofvalues);\n\n if (!Array.isArray(metaData.listOfValues)) {\n metaData.listOfValues = [];\n }\n\n // Match by type + value + module\n const existingIndex = metaData.listOfValues.findIndex(\n (item: { type: string; value: string; module: number }) =>\n item.type === dto.type &&\n item.value === dto.value &&\n item.module === dto.module\n );\n\n if (existingIndex !== -1) {\n // Replace existing entry\n metaData.listOfValues[existingIndex] = dto;\n } else {\n // Insert new entry\n // metaData.listOfValues.unshift(dto);\n\n if (metaData.listOfValues.length === 0) {\n // Case 1: Empty array → add first item\n metaData.listOfValues.push(dto);\n } else {\n // Case 2: Insert new item right after index 0\n metaData.listOfValues.unshift(dto);\n }\n\n }\n\n const updatedContent = JSON.stringify(metaData, null, 2);\n await fs.writeFile(filePath, updatedContent);\n }\n\n private async updateToConfig(metaData: any, oldlistofvalues: ListOfValues, listofvalues: ListOfValues, filePath: string) {\n const newvalue = await this.listOfValuesMapper.toDto(listofvalues);\n const oldvalue = await this.listOfValuesMapper.toDto(oldlistofvalues);\n\n if (!Array.isArray(metaData.listOfValues)) {\n metaData.listOfValues = [];\n }\n\n const searchType = oldvalue.type || newvalue.type;\n const searchValue = oldvalue.value || newvalue.value;\n const searchModule = oldvalue.module || newvalue.module;\n\n const existingIndex = metaData.listOfValues.findIndex(\n (item: { type: string; value: string; module: number }) =>\n item.type === searchType && item.value === searchValue && item.module === searchModule\n );\n if (existingIndex !== -1) {\n // Replace existing match\n metaData.listOfValues[existingIndex] = newvalue;\n }\n\n const updatedContent = JSON.stringify(metaData, null, 2);\n await fs.writeFile(filePath, updatedContent);\n }\n\n private async deleteFromConfig(metaData: any, listofvalues: ListOfValues, filePath: string) {\n const dto = await this.listOfValuesMapper.toDto(listofvalues);\n\n if (!Array.isArray(metaData.listOfValues)) {\n metaData.listOfValues = [];\n }\n\n // Match by type + value + module\n const existingIndex = metaData.listOfValues.findIndex(\n (item: { type: string; value: string; module: number }) =>\n item.type === dto.type &&\n item.value === dto.value &&\n item.module === dto.module\n );\n\n if (existingIndex !== -1) {\n // Remove the item\n metaData.listOfValues.splice(existingIndex, 1);\n this.logger.debug(`Deleted LOV ${dto.type}:${dto.value} (module ${dto.module}) from config`);\n } else {\n this.logger.warn(\n `LOV ${dto.type}:${dto.value} (module ${dto.module}) not found in config during delete`\n );\n }\n const updatedContent = JSON.stringify(metaData, null, 2);\n await fs.writeFile(filePath, updatedContent);\n\n }\n}\n"]}
|
|
@@ -1,29 +1,18 @@
|
|
|
1
1
|
import { OnApplicationBootstrap } from '@nestjs/common';
|
|
2
|
-
import {
|
|
2
|
+
import { ModuleRef } from "@nestjs/core";
|
|
3
3
|
import { EntityManager } from 'typeorm';
|
|
4
|
-
import { ConfigService } from '@nestjs/config';
|
|
5
4
|
import { Locale } from 'src/entities/locale.entity';
|
|
6
5
|
import { SolidRegistry } from 'src/helpers/solid-registry';
|
|
7
6
|
import { LocaleRepository } from 'src/repository/locale.repository';
|
|
8
|
-
import { CrudHelperService } from 'src/services/crud-helper.service';
|
|
9
7
|
import { CRUDService } from 'src/services/crud.service';
|
|
10
|
-
import { FileService } from 'src/services/file.service';
|
|
11
|
-
import { ModelMetadataService } from 'src/services/model-metadata.service';
|
|
12
|
-
import { ModuleMetadataService } from 'src/services/module-metadata.service';
|
|
13
8
|
import { RequestContextService } from './request-context.service';
|
|
14
9
|
export declare class LocaleService extends CRUDService<Locale> implements OnApplicationBootstrap {
|
|
15
|
-
readonly modelMetadataService: ModelMetadataService;
|
|
16
|
-
readonly moduleMetadataService: ModuleMetadataService;
|
|
17
|
-
readonly configService: ConfigService;
|
|
18
|
-
readonly fileService: FileService;
|
|
19
|
-
readonly discoveryService: DiscoveryService;
|
|
20
|
-
readonly crudHelperService: CrudHelperService;
|
|
21
10
|
readonly entityManager: EntityManager;
|
|
22
11
|
readonly repo: LocaleRepository;
|
|
23
12
|
readonly moduleRef: ModuleRef;
|
|
24
13
|
readonly requestContextService: RequestContextService;
|
|
25
14
|
readonly solidRegistry: SolidRegistry;
|
|
26
|
-
constructor(
|
|
15
|
+
constructor(entityManager: EntityManager, repo: LocaleRepository, moduleRef: ModuleRef, requestContextService: RequestContextService, solidRegistry: SolidRegistry);
|
|
27
16
|
private readonly logger;
|
|
28
17
|
onApplicationBootstrap(): void;
|
|
29
18
|
loadLocales(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locale.service.d.ts","sourceRoot":"","sources":["../../src/services/locale.service.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"locale.service.d.ts","sourceRoot":"","sources":["../../src/services/locale.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,qBACa,aAAc,SAAQ,WAAW,CAAC,MAAM,CAAE,YAAW,sBAAsB;IAGpF,QAAQ,CAAC,aAAa,EAAE,aAAa;IAGrC,QAAQ,CAAC,IAAI,EAAE,gBAAgB;IAE/B,QAAQ,CAAC,SAAS,EAAE,SAAS;IAI7B,QAAQ,CAAC,qBAAqB,EAAE,qBAAqB;IACrD,QAAQ,CAAC,aAAa,EAAE,aAAa;gBAV5B,aAAa,EAAE,aAAa,EAG5B,IAAI,EAAE,gBAAgB,EAEtB,SAAS,EAAE,SAAS,EAIpB,qBAAqB,EAAE,qBAAqB,EAC5C,aAAa,EAAE,aAAa;IAIvC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAiC;IACxD,sBAAsB;IAIf,WAAW;CAKnB"}
|
|
@@ -18,24 +18,13 @@ const common_1 = require("@nestjs/common");
|
|
|
18
18
|
const core_1 = require("@nestjs/core");
|
|
19
19
|
const typeorm_1 = require("@nestjs/typeorm");
|
|
20
20
|
const typeorm_2 = require("typeorm");
|
|
21
|
-
const config_1 = require("@nestjs/config");
|
|
22
21
|
const solid_registry_1 = require("../helpers/solid-registry");
|
|
23
22
|
const locale_repository_1 = require("../repository/locale.repository");
|
|
24
|
-
const crud_helper_service_1 = require("./crud-helper.service");
|
|
25
23
|
const crud_service_1 = require("./crud.service");
|
|
26
|
-
const file_service_1 = require("./file.service");
|
|
27
|
-
const model_metadata_service_1 = require("./model-metadata.service");
|
|
28
|
-
const module_metadata_service_1 = require("./module-metadata.service");
|
|
29
24
|
const request_context_service_1 = require("./request-context.service");
|
|
30
25
|
let LocaleService = LocaleService_1 = class LocaleService extends crud_service_1.CRUDService {
|
|
31
|
-
constructor(
|
|
32
|
-
super(
|
|
33
|
-
this.modelMetadataService = modelMetadataService;
|
|
34
|
-
this.moduleMetadataService = moduleMetadataService;
|
|
35
|
-
this.configService = configService;
|
|
36
|
-
this.fileService = fileService;
|
|
37
|
-
this.discoveryService = discoveryService;
|
|
38
|
-
this.crudHelperService = crudHelperService;
|
|
26
|
+
constructor(entityManager, repo, moduleRef, requestContextService, solidRegistry) {
|
|
27
|
+
super(entityManager, repo, 'locale', 'solid-core', moduleRef);
|
|
39
28
|
this.entityManager = entityManager;
|
|
40
29
|
this.repo = repo;
|
|
41
30
|
this.moduleRef = moduleRef;
|
|
@@ -55,15 +44,8 @@ let LocaleService = LocaleService_1 = class LocaleService extends crud_service_1
|
|
|
55
44
|
exports.LocaleService = LocaleService;
|
|
56
45
|
exports.LocaleService = LocaleService = LocaleService_1 = __decorate([
|
|
57
46
|
(0, common_1.Injectable)(),
|
|
58
|
-
__param(0, (0,
|
|
59
|
-
|
|
60
|
-
__metadata("design:paramtypes", [model_metadata_service_1.ModelMetadataService,
|
|
61
|
-
module_metadata_service_1.ModuleMetadataService,
|
|
62
|
-
config_1.ConfigService,
|
|
63
|
-
file_service_1.FileService,
|
|
64
|
-
core_1.DiscoveryService,
|
|
65
|
-
crud_helper_service_1.CrudHelperService,
|
|
66
|
-
typeorm_2.EntityManager,
|
|
47
|
+
__param(0, (0, typeorm_1.InjectEntityManager)()),
|
|
48
|
+
__metadata("design:paramtypes", [typeorm_2.EntityManager,
|
|
67
49
|
locale_repository_1.LocaleRepository,
|
|
68
50
|
core_1.ModuleRef,
|
|
69
51
|
request_context_service_1.RequestContextService,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locale.service.js","sourceRoot":"","sources":["../../src/services/locale.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"locale.service.js","sourceRoot":"","sources":["../../src/services/locale.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAA4E;AAC5E,uCAAyC;AACzC,6CAAsD;AACtD,qCAAwC;AAGxC,8DAA2D;AAC3D,uEAAoE;AACpE,iDAAwD;AACxD,uEAAkE;AAE3D,IAAM,aAAa,qBAAnB,MAAM,aAAc,SAAQ,0BAAmB;IACpD,YAEE,aAAqC,EAG5B,IAAsB,EAEtB,SAAoB,EAIpB,qBAA4C,EAC5C,aAA4B;QAEtC,KAAK,CAAC,aAAa,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;QAZpD,kBAAa,GAAb,aAAa,CAAe;QAG5B,SAAI,GAAJ,IAAI,CAAkB;QAEtB,cAAS,GAAT,SAAS,CAAW;QAIpB,0BAAqB,GAArB,qBAAqB,CAAuB;QAC5C,kBAAa,GAAb,aAAa,CAAe;QAItB,WAAM,GAAG,IAAI,eAAM,CAAC,eAAa,CAAC,IAAI,CAAC,CAAA;IADzD,CAAC;IAEA,sBAAsB;QAEpB,IAAI,CAAC,WAAW,EAAE,CAAC;IACrB,CAAC;IACA,KAAK,CAAC,WAAW;QAChB,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QACvC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,OAAO,CAAC,MAAM,wBAAwB,CAAC,CAAC;QACpE,IAAI,CAAC,aAAa,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IAC9C,CAAC;CACF,CAAA;AA3BY,sCAAa;wBAAb,aAAa;IADzB,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,6BAAmB,GAAE,CAAA;qCACE,uBAAa;QAGtB,oCAAgB;QAEX,gBAAS;QAIG,+CAAqB;QAC7B,8BAAa;GAb5B,aAAa,CA2BzB","sourcesContent":["import { Injectable, Logger, OnApplicationBootstrap } from '@nestjs/common';\nimport { ModuleRef } from \"@nestjs/core\";\nimport { InjectEntityManager } from '@nestjs/typeorm';\nimport { EntityManager } from 'typeorm';\n\nimport { Locale } from 'src/entities/locale.entity';\nimport { SolidRegistry } from 'src/helpers/solid-registry';\nimport { LocaleRepository } from 'src/repository/locale.repository';\nimport { CRUDService } from 'src/services/crud.service';\nimport { RequestContextService } from './request-context.service';\n@Injectable()\nexport class LocaleService extends CRUDService<Locale> implements OnApplicationBootstrap{\n constructor(\n @InjectEntityManager()\n readonly entityManager: EntityManager,\n // @InjectRepository(Locale, 'default')\n // readonly repo: Repository<Locale>,\n readonly repo: LocaleRepository,\n // @InjectRepository(Locale, 'default')\n readonly moduleRef: ModuleRef,\n // @InjectRepository(ModelMetadata)\n // private readonly modelMetadataRepo: Repository<ModelMetadata>,\n // private readonly modelMetadataRepo: ModelMetadataRepository,\n readonly requestContextService: RequestContextService,\n readonly solidRegistry: SolidRegistry,\n ) {\n super(entityManager, repo, 'locale', 'solid-core', moduleRef);\n }\n private readonly logger = new Logger(LocaleService.name)\n onApplicationBootstrap() {\n // Load the security rules from the database\n this.loadLocales();\n }\n async loadLocales() {\n const locales = await this.repo.find();\n this.logger.debug(`Loaded ${locales.length} locales into registry`);\n this.solidRegistry.registerlocales(locales);\n }\n}\n"]}
|
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
import { ConfigType } from '@nestjs/config';
|
|
2
|
-
import commonConfig from 'src/config/common.config';
|
|
3
1
|
import { QueueMessage } from 'src/interfaces/mq';
|
|
4
2
|
import { EmailTemplateService } from '../email-template.service';
|
|
5
3
|
import { PdfService } from '../pdf.service';
|
|
6
4
|
import { FileService } from '../file.service';
|
|
7
5
|
import { IMail, MailAttachmentWrapper } from "../../interfaces";
|
|
8
6
|
import { PublisherFactory } from '../queues/publisher-factory.service';
|
|
7
|
+
import { SettingService } from '../setting.service';
|
|
9
8
|
export declare class ElasticEmailService implements IMail {
|
|
10
|
-
private readonly commonConfiguration;
|
|
11
9
|
private readonly publisherFactory;
|
|
12
10
|
private readonly emailTemplateService;
|
|
13
11
|
private readonly pdfService;
|
|
14
12
|
private readonly fileService;
|
|
13
|
+
private readonly settingService;
|
|
15
14
|
private readonly logger;
|
|
16
15
|
private readonly emailsApi;
|
|
17
|
-
constructor(
|
|
16
|
+
constructor(publisherFactory: PublisherFactory<any>, emailTemplateService: EmailTemplateService, pdfService: PdfService, fileService: FileService, settingService: SettingService);
|
|
18
17
|
sendEmailUsingTemplate(to: string, templateName: string, templateParams: any, shouldQueueEmails?: boolean, parentEntity?: any, parentEntityId?: any): Promise<void>;
|
|
19
18
|
sendEmail(to: string, subject: string, body: string, shouldQueueEmails?: boolean, parentEntity?: any, parentEntityId?: any, wrapperAttachments?: MailAttachmentWrapper[]): Promise<void>;
|
|
20
|
-
sendEmailAsynchronously(message: QueueMessage<any>):
|
|
19
|
+
sendEmailAsynchronously(message: QueueMessage<any>): void;
|
|
21
20
|
sendEmailSynchronously(message: QueueMessage<any>): Promise<void>;
|
|
22
21
|
private toAttachmentWrapper;
|
|
23
22
|
private toMessageAttachment;
|