@hexabot-ai/api 3.2.2-alpha.0 → 3.2.2-alpha.10
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/README.md +1 -1
- package/dist/actions/actions.service.d.ts +3 -3
- package/dist/actions/base-action.d.ts +3 -3
- package/dist/actions/create-action.d.ts +1 -1
- package/dist/actions/types.d.ts +3 -3
- package/dist/analytics/controllers/stats.controller.d.ts +1 -1
- package/dist/analytics/dto/stats.dto.d.ts +1 -1
- package/dist/analytics/entities/stats.entity.d.ts +1 -1
- package/dist/analytics/repositories/stats.repository.d.ts +1 -1
- package/dist/analytics/services/stats.service.d.ts +7 -7
- package/dist/app.controller.d.ts +1 -0
- package/dist/app.controller.js +1 -0
- package/dist/app.controller.js.map +1 -1
- package/dist/app.module.js +11 -1
- package/dist/app.module.js.map +1 -1
- package/dist/attachment/controllers/attachment.controller.d.ts +1 -1
- package/dist/attachment/dto/attachment.dto.d.ts +2 -2
- package/dist/attachment/entities/attachment.entity.d.ts +3 -3
- package/dist/attachment/guards/attachment-ability.guard.d.ts +2 -2
- package/dist/attachment/repositories/attachment.repository.d.ts +2 -2
- package/dist/attachment/services/attachment.service.d.ts +3 -3
- package/dist/attachment/utilities/index.js +2 -2
- package/dist/attachment/utilities/index.js.map +1 -1
- package/dist/audit/controllers/audit-log.controller.d.ts +2 -2
- package/dist/audit/dto/audit-log.dto.d.ts +1 -1
- package/dist/audit/entities/audit-log.entity.d.ts +1 -1
- package/dist/audit/exporters/audit-backend.factory.d.ts +1 -1
- package/dist/audit/exporters/audit-safe.exporter.d.ts +1 -1
- package/dist/audit/repositories/audit-log.repository.d.ts +1 -1
- package/dist/audit/services/audit-log-record.service.d.ts +1 -1
- package/dist/bindings/base-binding-kind.d.ts +2 -2
- package/dist/bindings/runtime-bindings.service.d.ts +2 -2
- package/dist/bootstrap.js +11 -0
- package/dist/bootstrap.js.map +1 -1
- package/dist/channel/channel.controller.d.ts +1 -1
- package/dist/channel/channel.service.d.ts +5 -5
- package/dist/channel/channel.service.js +3 -1
- package/dist/channel/channel.service.js.map +1 -1
- package/dist/channel/dto/source.dto.d.ts +1 -1
- package/dist/channel/entities/source.entity.d.ts +2 -2
- package/dist/channel/lib/Handler.d.ts +7 -7
- package/dist/channel/lib/Handler.js +2 -2
- package/dist/channel/lib/Handler.js.map +1 -1
- package/dist/channel/lib/__test__/label.mock.js +0 -24
- package/dist/channel/lib/__test__/label.mock.js.map +1 -1
- package/dist/channel/lib/channel-event-bus.d.ts +1 -1
- package/dist/channel/lib/inbound-events/channel-inbound-event-context.d.ts +1 -1
- package/dist/channel/lib/inbound-events/channel-inbound-event-decoder.d.ts +1 -1
- package/dist/channel/lib/inbound-events/channel-inbound-event.d.ts +2 -2
- package/dist/channel/lib/inbound-events/message-inbound-event.d.ts +1 -1
- package/dist/channel/lib/transports/http-channel-handler.d.ts +2 -2
- package/dist/channel/lib/transports/websocket-channel-handler.d.ts +3 -3
- package/dist/channel/repositories/source.repository.d.ts +1 -1
- package/dist/channel/services/channel-attachment.service.d.ts +3 -3
- package/dist/channel/services/source.service.d.ts +5 -3
- package/dist/channel/services/source.service.js +22 -0
- package/dist/channel/services/source.service.js.map +1 -1
- package/dist/channel/services/subscriber-resolver.service.d.ts +2 -2
- package/dist/channel/source.controller.d.ts +1 -1
- package/dist/channel/webhook.controller.d.ts +1 -1
- package/dist/chat/chat.module.js +1 -1
- package/dist/chat/chat.module.js.map +1 -1
- package/dist/chat/controllers/label-group.controller.d.ts +1 -1
- package/dist/chat/controllers/label.controller.d.ts +1 -1
- package/dist/chat/controllers/message.controller.d.ts +2 -2
- package/dist/chat/controllers/subscriber.controller.d.ts +3 -3
- package/dist/chat/controllers/thread.controller.d.ts +2 -2
- package/dist/chat/dto/label-group.dto.d.ts +1 -1
- package/dist/chat/dto/label.dto.d.ts +1 -2
- package/dist/chat/dto/label.dto.js +0 -6
- package/dist/chat/dto/label.dto.js.map +1 -1
- package/dist/chat/dto/message.dto.d.ts +1 -1
- package/dist/chat/dto/subscriber.dto.d.ts +3 -3
- package/dist/chat/dto/thread.dto.d.ts +1 -1
- package/dist/chat/entities/label-group.entity.d.ts +1 -3
- package/dist/chat/entities/label.entity.d.ts +1 -5
- package/dist/chat/entities/label.entity.js +0 -5
- package/dist/chat/entities/label.entity.js.map +1 -1
- package/dist/chat/entities/message.entity.d.ts +2 -2
- package/dist/chat/entities/subscriber.entity.d.ts +4 -4
- package/dist/chat/entities/subscriber.entity.js +3 -1
- package/dist/chat/entities/subscriber.entity.js.map +1 -1
- package/dist/chat/entities/thread.entity.d.ts +2 -2
- package/dist/chat/repositories/label-group.repository.d.ts +1 -1
- package/dist/chat/repositories/label.repository.d.ts +1 -1
- package/dist/chat/repositories/message.repository.d.ts +1 -1
- package/dist/chat/repositories/subscriber.repository.d.ts +1 -1
- package/dist/chat/repositories/thread.repository.d.ts +1 -1
- package/dist/chat/services/chat.service.d.ts +4 -4
- package/dist/chat/services/label-group.service.d.ts +1 -1
- package/dist/chat/services/label.service.d.ts +1 -1
- package/dist/chat/services/message.service.d.ts +2 -2
- package/dist/chat/services/subscriber.service.d.ts +5 -6
- package/dist/chat/services/subscriber.service.js +2 -2
- package/dist/chat/services/subscriber.service.js.map +1 -1
- package/dist/chat/services/thread.service.d.ts +2 -2
- package/dist/chat/types/channel.d.ts +1 -1
- package/dist/cms/controllers/content-type.controller.d.ts +1 -1
- package/dist/cms/controllers/content.controller.d.ts +1 -1
- package/dist/cms/controllers/menu.controller.d.ts +2 -2
- package/dist/cms/dto/content.dto.d.ts +1 -1
- package/dist/cms/dto/contentType.dto.d.ts +2 -2
- package/dist/cms/dto/menu.dto.d.ts +1 -1
- package/dist/cms/entities/content-type.entity.d.ts +2 -2
- package/dist/cms/entities/content-type.entity.js +3 -2
- package/dist/cms/entities/content-type.entity.js.map +1 -1
- package/dist/cms/entities/content.entity.d.ts +2 -2
- package/dist/cms/entities/content.entity.js +4 -3
- package/dist/cms/entities/content.entity.js.map +1 -1
- package/dist/cms/entities/menu.entity.d.ts +1 -1
- package/dist/cms/repositories/content-type.repository.d.ts +1 -1
- package/dist/cms/repositories/content.repository.d.ts +1 -1
- package/dist/cms/repositories/menu.repository.d.ts +1 -1
- package/dist/cms/services/content-type.service.d.ts +2 -2
- package/dist/cms/services/content-type.service.js.map +1 -1
- package/dist/cms/services/content.service.d.ts +1 -1
- package/dist/cms/services/menu.service.d.ts +1 -1
- package/dist/cms/services/rag-backend.service.d.ts +2 -2
- package/dist/cms/services/rag-indexer.service.d.ts +2 -2
- package/dist/cms/services/rag-retriever.service.d.ts +1 -1
- package/dist/cms/services/rag.service.d.ts +4 -4
- package/dist/config/index.js +14 -2
- package/dist/config/index.js.map +1 -1
- package/dist/config/types.d.ts +9 -0
- package/dist/database/decorators/json-column.decorator.js +1 -0
- package/dist/database/decorators/json-column.decorator.js.map +1 -1
- package/dist/database/entities/base.entity.d.ts +1 -1
- package/dist/database/typeorm-config.service.js +1 -1
- package/dist/database/typeorm-config.service.js.map +1 -1
- package/dist/extension/cleanup.service.d.ts +3 -3
- package/dist/extension/extension.module.d.ts +1 -1
- package/dist/extension/types.d.ts +1 -1
- package/dist/extensions/actions/ai/agent.action.d.ts +3 -3
- package/dist/extensions/actions/ai/ai-base.action.d.ts +5 -5
- package/dist/extensions/actions/ai/generate-object.action.d.ts +2 -2
- package/dist/extensions/actions/ai/generate-object.base.action.d.ts +3 -3
- package/dist/extensions/actions/ai/generate-reply.action.d.ts +2 -2
- package/dist/extensions/actions/ai/generate-text.action.d.ts +2 -2
- package/dist/extensions/actions/ai/generate-text.base.action.d.ts +3 -3
- package/dist/extensions/actions/ai/infer-object.action.d.ts +2 -2
- package/dist/extensions/actions/ai/mcp.binding.js +4 -3
- package/dist/extensions/actions/ai/mcp.binding.js.map +1 -1
- package/dist/extensions/actions/ai/retrieve-content-rag.action.d.ts +1 -1
- package/dist/extensions/actions/memory/update-memory.action.d.ts +4 -4
- package/dist/extensions/actions/messaging/attachment.action.d.ts +3 -3
- package/dist/extensions/actions/messaging/await-reply.action.d.ts +4 -4
- package/dist/extensions/actions/messaging/buttons.action.d.ts +3 -3
- package/dist/extensions/actions/messaging/list.action.d.ts +3 -3
- package/dist/extensions/actions/messaging/message-action.base.d.ts +6 -6
- package/dist/extensions/actions/messaging/quick-replies.action.d.ts +3 -3
- package/dist/extensions/actions/messaging/text-message.action.d.ts +3 -3
- package/dist/extensions/actions/subscriber/handover.action.d.ts +1 -1
- package/dist/extensions/actions/subscriber/update-labels.action.d.ts +1 -1
- package/dist/extensions/actions/web/http-request.action.d.ts +1 -1
- package/dist/extensions/actions/web/http-request.action.js +15 -4
- package/dist/extensions/actions/web/http-request.action.js.map +1 -1
- package/dist/extensions/actions/web/i18n/en.translations.json +9 -0
- package/dist/extensions/actions/web/i18n/fr.translations.json +9 -0
- package/dist/extensions/actions/web/send-mail.action.d.ts +30 -0
- package/dist/extensions/actions/web/send-mail.action.js +79 -0
- package/dist/extensions/actions/web/send-mail.action.js.map +1 -0
- package/dist/extensions/channels/web/base-web-channel.d.ts +8 -6
- package/dist/extensions/channels/web/base-web-channel.js +37 -17
- package/dist/extensions/channels/web/base-web-channel.js.map +1 -1
- package/dist/extensions/channels/web/inbound/events/base-web-inbound.event.d.ts +3 -3
- package/dist/extensions/channels/web/inbound/events/delivery.event.d.ts +2 -2
- package/dist/extensions/channels/web/inbound/events/messages/attachment.event.d.ts +2 -2
- package/dist/extensions/channels/web/inbound/events/messages/location.event.d.ts +2 -2
- package/dist/extensions/channels/web/inbound/events/messages/payload.event.d.ts +2 -2
- package/dist/extensions/channels/web/inbound/events/messages/postback.event.d.ts +2 -2
- package/dist/extensions/channels/web/inbound/events/messages/quick-reply.event.d.ts +2 -2
- package/dist/extensions/channels/web/inbound/events/messages/text.event.d.ts +2 -2
- package/dist/extensions/channels/web/inbound/events/messages/web-message.event.d.ts +3 -3
- package/dist/extensions/channels/web/inbound/events/read.event.d.ts +2 -2
- package/dist/extensions/channels/web/inbound/events/typing.event.d.ts +2 -2
- package/dist/extensions/channels/web/inbound/events/unsupported.event.d.ts +2 -2
- package/dist/extensions/channels/web/inbound/web-inbound-event-decoder.d.ts +2 -2
- package/dist/extensions/channels/web/inbound/web-inbound-message-encoder.d.ts +1 -1
- package/dist/extensions/channels/web/outbound/web-outbound-message-encoder.d.ts +4 -4
- package/dist/extensions/channels/web/outbound/web-outbound-message-encoder.js +4 -4
- package/dist/extensions/channels/web/outbound/web-outbound-message-encoder.js.map +1 -1
- package/dist/extensions/channels/web/services/web-history.service.d.ts +2 -2
- package/dist/extensions/channels/web/services/web-session.service.d.ts +12 -6
- package/dist/extensions/channels/web/services/web-session.service.js +15 -0
- package/dist/extensions/channels/web/services/web-session.service.js.map +1 -1
- package/dist/extensions/helpers/local-storage/index.helper.d.ts +2 -2
- package/dist/extensions/index.d.ts +1 -0
- package/dist/extensions/index.js +1 -0
- package/dist/extensions/index.js.map +1 -1
- package/dist/health/health.service.d.ts +3 -3
- package/dist/helper/helper.service.d.ts +2 -2
- package/dist/helper/lib/base-helper.d.ts +2 -2
- package/dist/helper/lib/base-storage-helper.d.ts +1 -1
- package/dist/helper/types.d.ts +1 -1
- package/dist/i18n/controllers/language.controller.d.ts +1 -1
- package/dist/i18n/controllers/translation.controller.d.ts +1 -1
- package/dist/i18n/dto/language.dto.d.ts +1 -1
- package/dist/i18n/dto/translation.dto.d.ts +1 -1
- package/dist/i18n/entities/language.entity.d.ts +1 -1
- package/dist/i18n/entities/translation.entity.d.ts +1 -1
- package/dist/i18n/repositories/language.repository.d.ts +1 -1
- package/dist/i18n/repositories/translation.repository.d.ts +1 -1
- package/dist/i18n/seeds/language.seed.d.ts +1 -1
- package/dist/i18n/seeds/translation.seed.d.ts +1 -1
- package/dist/i18n/services/i18n.service.d.ts +2 -2
- package/dist/i18n/services/language.service.d.ts +1 -1
- package/dist/i18n/services/translation.service.d.ts +3 -3
- package/dist/license/services/lemon-squeezy.service.js +2 -2
- package/dist/license/services/lemon-squeezy.service.js.map +1 -1
- package/dist/license/services/license.service.d.ts +5 -5
- package/dist/mailer/mailer.module.js +1 -49
- package/dist/mailer/mailer.module.js.map +1 -1
- package/dist/mailer/mailer.service.d.ts +11 -2
- package/dist/mailer/mailer.service.js +69 -3
- package/dist/mailer/mailer.service.js.map +1 -1
- package/dist/mcp/controllers/mcp-token.controller.d.ts +47 -0
- package/dist/mcp/controllers/mcp-token.controller.js +70 -0
- package/dist/mcp/controllers/mcp-token.controller.js.map +1 -0
- package/dist/mcp/decorators/mcp-permission.decorator.d.ts +8 -0
- package/dist/mcp/decorators/mcp-permission.decorator.js +11 -0
- package/dist/mcp/decorators/mcp-permission.decorator.js.map +1 -0
- package/dist/mcp/dto/mcp-token.dto.d.ts +17 -0
- package/dist/mcp/dto/mcp-token.dto.js +40 -0
- package/dist/mcp/dto/mcp-token.dto.js.map +1 -0
- package/dist/mcp/entities/mcp-token.entity.d.ts +111 -0
- package/dist/mcp/entities/mcp-token.entity.js +69 -0
- package/dist/mcp/entities/mcp-token.entity.js.map +1 -0
- package/dist/mcp/guards/hexabot-mcp-token.guard.d.ts +9 -0
- package/dist/mcp/guards/hexabot-mcp-token.guard.js +49 -0
- package/dist/mcp/guards/hexabot-mcp-token.guard.js.map +1 -0
- package/dist/mcp/guards/mcp-permission.guard.d.ts +9 -0
- package/dist/mcp/guards/mcp-permission.guard.js +47 -0
- package/dist/mcp/guards/mcp-permission.guard.js.map +1 -0
- package/dist/mcp/mcp-api.module.d.ts +2 -0
- package/dist/mcp/mcp-api.module.js +65 -0
- package/dist/mcp/mcp-api.module.js.map +1 -0
- package/dist/mcp/repositories/mcp-token.repository.d.ts +8 -0
- package/dist/mcp/repositories/mcp-token.repository.js +41 -0
- package/dist/mcp/repositories/mcp-token.repository.js.map +1 -0
- package/dist/mcp/services/mcp-token.service.d.ts +24 -0
- package/dist/mcp/services/mcp-token.service.js +106 -0
- package/dist/mcp/services/mcp-token.service.js.map +1 -0
- package/dist/mcp/tools/hexabot-mcp.tools.d.ts +1141 -0
- package/dist/mcp/tools/hexabot-mcp.tools.js +957 -0
- package/dist/mcp/tools/hexabot-mcp.tools.js.map +1 -0
- package/dist/mcp/types.d.ts +7 -0
- package/dist/{utils/types/extension.js → mcp/types.js} +1 -1
- package/dist/mcp/types.js.map +1 -0
- package/dist/migration/migration.command.d.ts +1 -1
- package/dist/migration/migration.service.d.ts +3 -3
- package/dist/migration/types.d.ts +2 -2
- package/dist/setting/base-setting-group.d.ts +2 -2
- package/dist/setting/controllers/setting.controller.d.ts +1 -1
- package/dist/setting/create-setting-group.d.ts +2 -2
- package/dist/setting/dto/metadata.dto.d.ts +1 -1
- package/dist/setting/dto/setting.dto.d.ts +1 -1
- package/dist/setting/entities/metadata.entity.d.ts +1 -1
- package/dist/setting/entities/setting.entity.d.ts +1 -1
- package/dist/setting/repositories/metadata.repository.d.ts +1 -1
- package/dist/setting/repositories/setting.repository.d.ts +1 -1
- package/dist/setting/runtime-settings.seed.d.ts +3 -3
- package/dist/setting/seeds/metadata.seed.d.ts +1 -1
- package/dist/setting/seeds/setting.seed.d.ts +1 -1
- package/dist/setting/services/metadata.service.d.ts +1 -1
- package/dist/setting/services/runtime-settings.service.d.ts +1 -1
- package/dist/setting/services/setting.service.d.ts +4 -4
- package/dist/static/assets/browser-ponyfill-DN-Mu1Dr.js +2 -0
- package/dist/static/assets/{cssMode-Cl7JZDYi.js → cssMode-BCWxI_Ux.js} +1 -1
- package/dist/static/assets/{freemarker2-Ddcsv82z.js → freemarker2-CFvevPey.js} +1 -1
- package/dist/static/assets/{handlebars-BggcQSEE.js → handlebars-BCStA9Eg.js} +1 -1
- package/dist/static/assets/{html-FN76dqvq.js → html-DkIwCA7q.js} +1 -1
- package/dist/static/assets/{htmlMode-BWRIcbsi.js → htmlMode-DHeMkUp8.js} +1 -1
- package/dist/static/assets/{index-DKozh3Um.css → index-BI1BtkYv.css} +1 -1
- package/dist/static/assets/{index-DOga3_TI.js → index-C6VeVxYx.js} +2152 -2149
- package/dist/static/assets/{javascript-1EusMo1M.js → javascript-DLPKJzLc.js} +1 -1
- package/dist/static/assets/{jsonMode-WNbHOGWa.js → jsonMode-BUIDFK3O.js} +1 -1
- package/dist/static/assets/{liquid-D45yUZ7g.js → liquid-B0XmwdKh.js} +1 -1
- package/dist/static/assets/{lspLanguageFeatures-uwS-CJEU.js → lspLanguageFeatures-Fcpw3Ev_.js} +1 -1
- package/dist/static/assets/{mdx-PpOJ5pZ0.js → mdx-DmJKi-dU.js} +1 -1
- package/dist/static/assets/{python-B3PwxkAn.js → python-B1WnWY4I.js} +1 -1
- package/dist/static/assets/{razor-D0t-tcQz.js → razor-CL2s-6qt.js} +1 -1
- package/dist/static/assets/{tsMode-DEMWhFCv.js → tsMode-DSFhDcf0.js} +1 -1
- package/dist/static/assets/{typescript-DUe9LVDn.js → typescript-CmHv7Jwl.js} +1 -1
- package/dist/static/assets/{xml-Dqap22Hx.js → xml-Cyy6zXDM.js} +1 -1
- package/dist/static/assets/{yaml-Suu2-EtH.js → yaml-D_D6TAHE.js} +1 -1
- package/dist/static/assets/{yaml.worker.entry-BdO9k22I.js → yaml.worker.entry-BB81z30Q.js} +228 -228
- package/dist/static/index.html +2 -2
- package/dist/static/locales/en/translation.json +32 -3
- package/dist/static/locales/fr/translation.json +32 -3
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/user/controllers/auth.controller.d.ts +2 -2
- package/dist/user/controllers/credential.controller.d.ts +1 -1
- package/dist/user/controllers/model.controller.d.ts +3 -3
- package/dist/user/controllers/permission.controller.d.ts +2 -2
- package/dist/user/controllers/role.controller.d.ts +1 -1
- package/dist/user/controllers/user.controller.d.ts +3 -5
- package/dist/user/dto/credential.dto.d.ts +1 -1
- package/dist/user/dto/model.dto.d.ts +1 -1
- package/dist/user/dto/permission.dto.d.ts +1 -1
- package/dist/user/dto/role.dto.d.ts +1 -1
- package/dist/user/dto/user-profile.dto.d.ts +1 -1
- package/dist/user/dto/user.dto.d.ts +2 -2
- package/dist/user/entities/credential.entity.d.ts +1 -1
- package/dist/user/entities/model.entity.d.ts +2 -2
- package/dist/user/entities/model.entity.js +4 -3
- package/dist/user/entities/model.entity.js.map +1 -1
- package/dist/user/entities/permission.entity.d.ts +3 -3
- package/dist/user/entities/permission.entity.js +7 -7
- package/dist/user/entities/permission.entity.js.map +1 -1
- package/dist/user/entities/role.entity.d.ts +2 -2
- package/dist/user/entities/role.entity.js +3 -2
- package/dist/user/entities/role.entity.js.map +1 -1
- package/dist/user/entities/user-profile.entity.d.ts +3 -3
- package/dist/user/entities/user.entity.d.ts +1 -3
- package/dist/user/guards/ability.guard.js +12 -2
- package/dist/user/guards/ability.guard.js.map +1 -1
- package/dist/user/repositories/credential.repository.d.ts +1 -1
- package/dist/user/repositories/model.repository.d.ts +1 -1
- package/dist/user/repositories/permission.repository.d.ts +1 -1
- package/dist/user/repositories/role.repository.d.ts +1 -1
- package/dist/user/repositories/user.repository.d.ts +1 -1
- package/dist/user/seeds/model.seed.d.ts +1 -1
- package/dist/user/seeds/permission.seed.d.ts +1 -1
- package/dist/user/seeds/role.seed.d.ts +1 -1
- package/dist/user/seeds/user.seed.d.ts +1 -1
- package/dist/user/services/credential.service.d.ts +1 -1
- package/dist/user/services/model.service.d.ts +1 -1
- package/dist/user/services/passwordReset.service.d.ts +4 -4
- package/dist/user/services/permission.service.d.ts +1 -1
- package/dist/user/services/role.service.d.ts +1 -1
- package/dist/user/services/user.service.d.ts +1 -1
- package/dist/user/services/validate-account.service.d.ts +4 -4
- package/dist/utils/decorators/roles.decorator.d.ts +1 -1
- package/dist/utils/generics/base-orm.controller.d.ts +2 -2
- package/dist/utils/generics/base-orm.repository.d.ts +2 -2
- package/dist/utils/generics/base-orm.seeder.d.ts +1 -1
- package/dist/utils/generics/base-orm.service.d.ts +2 -2
- package/dist/utils/generics/extension.d.ts +3 -4
- package/dist/utils/generics/extension.js.map +1 -1
- package/dist/utils/helpers/safe-property-path.d.ts +1 -0
- package/dist/utils/helpers/safe-property-path.js +12 -0
- package/dist/utils/helpers/safe-property-path.js.map +1 -0
- package/dist/utils/helpers/zod.d.ts +1 -1
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.js +0 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/pipes/typeorm-search-filter.pipe.js +4 -3
- package/dist/utils/pipes/typeorm-search-filter.pipe.js.map +1 -1
- package/dist/utils/pipes/uuid.pipe.js +3 -3
- package/dist/utils/pipes/uuid.pipe.js.map +1 -1
- package/dist/utils/test/dummy/controllers/dummy.controller.d.ts +1 -1
- package/dist/utils/test/dummy/dto/dummy.dto.d.ts +1 -1
- package/dist/utils/test/dummy/dummy.action.d.ts +1 -1
- package/dist/utils/test/dummy/entities/dummy.entity.d.ts +1 -1
- package/dist/utils/test/dummy/repositories/dummy.repository.d.ts +1 -1
- package/dist/utils/test/dummy/services/dummy.service.d.ts +1 -1
- package/dist/utils/test/fixtures/attachment.d.ts +1 -1
- package/dist/utils/test/fixtures/content.d.ts +2 -2
- package/dist/utils/test/fixtures/contenttype.d.ts +2 -2
- package/dist/utils/test/fixtures/contenttype.js +2 -2
- package/dist/utils/test/fixtures/contenttype.js.map +1 -1
- package/dist/utils/test/fixtures/dummy.d.ts +2 -2
- package/dist/utils/test/fixtures/label-group.d.ts +4 -5
- package/dist/utils/test/fixtures/label.d.ts +3 -4
- package/dist/utils/test/fixtures/label.js +0 -19
- package/dist/utils/test/fixtures/label.js.map +1 -1
- package/dist/utils/test/fixtures/language.d.ts +2 -2
- package/dist/utils/test/fixtures/mcp-server.d.ts +3 -3
- package/dist/utils/test/fixtures/memory-definition.d.ts +2 -2
- package/dist/utils/test/fixtures/memory-record.d.ts +2 -2
- package/dist/utils/test/fixtures/menu.d.ts +1 -1
- package/dist/utils/test/fixtures/message.d.ts +1 -1
- package/dist/utils/test/fixtures/migration.d.ts +1 -1
- package/dist/utils/test/fixtures/model.d.ts +2 -2
- package/dist/utils/test/fixtures/permission.d.ts +4 -4
- package/dist/utils/test/fixtures/role.d.ts +2 -2
- package/dist/utils/test/fixtures/setting.d.ts +1 -1
- package/dist/utils/test/fixtures/stats.d.ts +1 -1
- package/dist/utils/test/fixtures/subscriber.d.ts +4 -4
- package/dist/utils/test/fixtures/translation.d.ts +1 -1
- package/dist/utils/test/fixtures/user.d.ts +2 -2
- package/dist/utils/test/fixtures/workflow-run.d.ts +2 -2
- package/dist/utils/test/fixtures/workflow.d.ts +2 -2
- package/dist/utils/test/providers/i18n-service.provider.d.ts +1 -1
- package/dist/utils/test/providers/i18n-service.provider.js +2 -2
- package/dist/utils/test/providers/i18n-service.provider.js.map +1 -1
- package/dist/utils/test/providers/mailer-service.provider.d.ts +3 -3
- package/dist/utils/test/providers/mailer-service.provider.js +2 -2
- package/dist/utils/test/providers/mailer-service.provider.js.map +1 -1
- package/dist/utils/test/providers/setting-service.provider.d.ts +1 -1
- package/dist/utils/test/providers/setting-service.provider.js +2 -2
- package/dist/utils/test/providers/setting-service.provider.js.map +1 -1
- package/dist/utils/test/test.d.ts +4 -0
- package/dist/utils/test/test.js +34 -1
- package/dist/utils/test/test.js.map +1 -1
- package/dist/utils/test/types.d.ts +1 -1
- package/dist/utils/test/utils.d.ts +2 -1
- package/dist/utils/test/utils.js +203 -46
- package/dist/utils/test/utils.js.map +1 -1
- package/dist/utils/types/dto.types.d.ts +1 -1
- package/dist/utils/types/entity-event.types.d.ts +1 -1
- package/dist/websocket/services/socket-event-dispatcher.service.d.ts +1 -1
- package/dist/websocket/websocket.gateway.d.ts +6 -6
- package/dist/websocket/websocket.gateway.js +2 -2
- package/dist/websocket/websocket.gateway.js.map +1 -1
- package/dist/workflow/contexts/conversational-workflow.context.d.ts +1 -1
- package/dist/workflow/contexts/workflow-runtime.context.d.ts +10 -10
- package/dist/workflow/contexts/workflow-runtime.context.js +6 -6
- package/dist/workflow/contexts/workflow-runtime.context.js.map +1 -1
- package/dist/workflow/controllers/mcp-server.controller.d.ts +1 -1
- package/dist/workflow/controllers/memory-definition.controller.d.ts +1 -1
- package/dist/workflow/controllers/workflow-run.controller.d.ts +1 -1
- package/dist/workflow/controllers/workflow-version.controller.d.ts +1 -1
- package/dist/workflow/controllers/workflow.controller.d.ts +4 -4
- package/dist/workflow/controllers/workflow.controller.js +9 -9
- package/dist/workflow/controllers/workflow.controller.js.map +1 -1
- package/dist/workflow/dto/mcp-server.dto.d.ts +1 -1
- package/dist/workflow/dto/memory-definition.dto.d.ts +1 -1
- package/dist/workflow/dto/memory-record.dto.d.ts +1 -1
- package/dist/workflow/dto/workflow-run.dto.d.ts +1 -1
- package/dist/workflow/dto/workflow-version.dto.d.ts +1 -1
- package/dist/workflow/dto/workflow.dto.d.ts +1 -1
- package/dist/workflow/entities/mcp-server.entity.d.ts +2 -2
- package/dist/workflow/entities/mcp-server.entity.js +4 -4
- package/dist/workflow/entities/mcp-server.entity.js.map +1 -1
- package/dist/workflow/entities/memory-definition.entity.d.ts +1 -1
- package/dist/workflow/entities/memory-record.entity.d.ts +4 -4
- package/dist/workflow/entities/workflow-run.entity.d.ts +4 -4
- package/dist/workflow/entities/workflow-version.entity.d.ts +3 -3
- package/dist/workflow/entities/workflow-version.entity.js +6 -4
- package/dist/workflow/entities/workflow-version.entity.js.map +1 -1
- package/dist/workflow/entities/workflow.entity.d.ts +2 -2
- package/dist/workflow/entities/workflow.entity.js +2 -1
- package/dist/workflow/entities/workflow.entity.js.map +1 -1
- package/dist/workflow/lib/trigger-event-wrapper.d.ts +1 -1
- package/dist/workflow/repositories/mcp-server.repository.d.ts +1 -1
- package/dist/workflow/repositories/memory-definition.repository.d.ts +1 -1
- package/dist/workflow/repositories/memory-record.repository.d.ts +1 -1
- package/dist/workflow/repositories/workflow-run.repository.d.ts +1 -1
- package/dist/workflow/repositories/workflow-version.repository.d.ts +1 -1
- package/dist/workflow/repositories/workflow.repository.d.ts +1 -1
- package/dist/workflow/seeds/memory-definition.seed.d.ts +1 -1
- package/dist/workflow/seeds/workflow.seed.d.ts +1 -1
- package/dist/workflow/services/agentic.service.d.ts +6 -5
- package/dist/workflow/services/agentic.service.js +11 -6
- package/dist/workflow/services/agentic.service.js.map +1 -1
- package/dist/workflow/services/mcp-client-pool.service.d.ts +2 -2
- package/dist/workflow/services/mcp-server.service.d.ts +1 -1
- package/dist/workflow/services/memory-definition.service.d.ts +1 -1
- package/dist/workflow/services/memory-record.service.d.ts +1 -1
- package/dist/workflow/services/memory.service.js +1 -0
- package/dist/workflow/services/memory.service.js.map +1 -1
- package/dist/workflow/services/workflow-run.service.d.ts +1 -1
- package/dist/workflow/services/workflow-scheduler.service.d.ts +3 -3
- package/dist/workflow/services/workflow-scheduler.service.js +2 -2
- package/dist/workflow/services/workflow-scheduler.service.js.map +1 -1
- package/dist/workflow/services/workflow-version.service.d.ts +1 -1
- package/dist/workflow/services/workflow.service.d.ts +3 -3
- package/dist/workflow/utils/memory-store.js +12 -1
- package/dist/workflow/utils/memory-store.js.map +1 -1
- package/dist/workflow/workflow.module.js +4 -4
- package/dist/workflow/workflow.module.js.map +1 -1
- package/package.json +65 -32
- package/src/app.controller.ts +1 -0
- package/src/app.module.ts +15 -1
- package/src/attachment/utilities/index.ts +2 -2
- package/src/bootstrap.ts +13 -1
- package/src/channel/channel.service.ts +5 -2
- package/src/channel/lib/Handler.ts +3 -2
- package/src/channel/lib/__test__/label.mock.ts +0 -24
- package/src/channel/services/source.service.ts +38 -1
- package/src/chat/chat.module.ts +1 -1
- package/src/chat/dto/label.dto.ts +1 -12
- package/src/chat/entities/label.entity.ts +0 -4
- package/src/chat/entities/subscriber.entity.ts +14 -7
- package/src/chat/services/subscriber.service.ts +3 -2
- package/src/cms/entities/content-type.entity.ts +12 -4
- package/src/cms/entities/content.entity.ts +13 -5
- package/src/cms/services/content-type.service.ts +1 -1
- package/src/cms/services/rag.service.ts +1 -1
- package/src/config/index.ts +17 -2
- package/src/config/types.ts +9 -0
- package/src/database/decorators/json-column.decorator.ts +1 -0
- package/src/database/typeorm-config.service.ts +1 -1
- package/src/extensions/actions/ai/mcp.binding.ts +4 -3
- package/src/extensions/actions/web/http-request.action.ts +23 -4
- package/src/extensions/actions/web/i18n/en.translations.json +9 -0
- package/src/extensions/actions/web/i18n/fr.translations.json +9 -0
- package/src/extensions/actions/web/send-mail.action.ts +89 -0
- package/src/extensions/channels/web/base-web-channel.ts +51 -13
- package/src/extensions/channels/web/outbound/web-outbound-message-encoder.ts +2 -2
- package/src/extensions/channels/web/services/web-session.service.ts +35 -0
- package/src/extensions/index.ts +2 -0
- package/src/global.d.ts +0 -6
- package/src/license/services/lemon-squeezy.service.ts +3 -2
- package/src/mailer/mailer.module.ts +1 -54
- package/src/mailer/mailer.service.ts +86 -2
- package/src/mcp/README.md +244 -0
- package/src/mcp/controllers/mcp-token.controller.ts +64 -0
- package/src/mcp/decorators/mcp-permission.decorator.ts +23 -0
- package/src/mcp/dto/mcp-token.dto.ts +48 -0
- package/src/mcp/entities/mcp-token.entity.ts +60 -0
- package/src/mcp/guards/hexabot-mcp-token.guard.ts +55 -0
- package/src/mcp/guards/mcp-permission.guard.ts +61 -0
- package/src/mcp/mcp-api.module.ts +61 -0
- package/src/mcp/repositories/mcp-token.repository.ts +34 -0
- package/src/mcp/services/mcp-token.service.ts +138 -0
- package/src/mcp/tools/hexabot-mcp.tools.ts +1041 -0
- package/src/mcp/types.ts +14 -0
- package/src/user/entities/model.entity.ts +13 -5
- package/src/user/entities/permission.entity.ts +21 -9
- package/src/user/entities/role.entity.ts +12 -4
- package/src/user/guards/ability.guard.ts +15 -3
- package/src/utils/generics/extension.ts +1 -3
- package/src/utils/helpers/safe-property-path.ts +13 -0
- package/src/utils/index.ts +0 -2
- package/src/utils/pipes/typeorm-search-filter.pipe.ts +4 -3
- package/src/utils/pipes/uuid.pipe.ts +3 -3
- package/src/utils/test/fixtures/contenttype.ts +1 -1
- package/src/utils/test/fixtures/label.ts +0 -19
- package/src/utils/test/fixtures/workflow.ts +1 -1
- package/src/utils/test/providers/i18n-service.provider.ts +1 -1
- package/src/utils/test/providers/mailer-service.provider.ts +1 -1
- package/src/utils/test/providers/setting-service.provider.ts +1 -1
- package/src/utils/test/test.ts +39 -0
- package/src/utils/test/utils.ts +332 -57
- package/src/websocket/websocket.gateway.ts +2 -2
- package/src/workflow/contexts/workflow-runtime.context.ts +2 -2
- package/src/workflow/controllers/workflow.controller.ts +2 -2
- package/src/workflow/entities/mcp-server.entity.ts +2 -2
- package/src/workflow/entities/workflow-version.entity.ts +8 -3
- package/src/workflow/entities/workflow.entity.ts +2 -1
- package/src/workflow/services/agentic.service.ts +19 -8
- package/src/workflow/services/memory.service.ts +1 -0
- package/src/workflow/services/workflow-scheduler.service.ts +1 -1
- package/src/workflow/utils/memory-store.ts +13 -1
- package/src/workflow/workflow.module.ts +2 -2
- package/dist/mailer/mjml-adapter.class.d.ts +0 -4
- package/dist/mailer/mjml-adapter.class.js +0 -67
- package/dist/mailer/mjml-adapter.class.js.map +0 -1
- package/dist/utils/types/extension.d.ts +0 -4
- package/dist/utils/types/extension.js.map +0 -1
- package/src/mailer/mjml-adapter.class.ts +0 -41
- package/src/utils/types/extension.ts +0 -13
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hexabot-ai/api",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "3.2.2-alpha.
|
|
4
|
+
"version": "3.2.2-alpha.10",
|
|
5
5
|
"description": "Hexabot is a solution for creating and managing chatbots across multiple channels, leveraging AI for advanced conversational capabilities. It provides a user-friendly interface for building, training, and deploying chatbots with integrated support for various messaging platforms.",
|
|
6
6
|
"author": "Hexastack",
|
|
7
7
|
"license": "FCL-1.0-ALv2",
|
|
@@ -31,32 +31,34 @@
|
|
|
31
31
|
"@keyv/redis": "^5.1.3",
|
|
32
32
|
"@llamaindex/openai": "0.4.22",
|
|
33
33
|
"@llamaindex/postgres": "0.0.65",
|
|
34
|
-
"@
|
|
34
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
35
35
|
"@nestjs/axios": "^4.0.1",
|
|
36
|
-
"@nestjs/cache-manager": "^3.
|
|
37
|
-
"@nestjs/common": "^11.1.
|
|
38
|
-
"@nestjs/core": "^11.1.
|
|
39
|
-
"@nestjs/event-emitter": "^3.0
|
|
36
|
+
"@nestjs/cache-manager": "^3.1.2",
|
|
37
|
+
"@nestjs/common": "^11.1.19",
|
|
38
|
+
"@nestjs/core": "^11.1.19",
|
|
39
|
+
"@nestjs/event-emitter": "^3.1.0",
|
|
40
40
|
"@nestjs/jwt": "^11.0.1",
|
|
41
41
|
"@nestjs/mapped-types": "^2.1.0",
|
|
42
42
|
"@nestjs/passport": "^11.0.5",
|
|
43
|
-
"@nestjs/platform-express": "^11.1.
|
|
44
|
-
"@nestjs/platform-socket.io": "^11.1.
|
|
43
|
+
"@nestjs/platform-express": "^11.1.19",
|
|
44
|
+
"@nestjs/platform-socket.io": "^11.1.19",
|
|
45
45
|
"@nestjs/schedule": "^6.1.3",
|
|
46
|
-
"@nestjs/serve-static": "^5.0.
|
|
47
|
-
"@nestjs/swagger": "^11.2
|
|
48
|
-
"@nestjs/typeorm": "^11.0.
|
|
49
|
-
"@nestjs/websockets": "^11.1.
|
|
46
|
+
"@nestjs/serve-static": "^5.0.5",
|
|
47
|
+
"@nestjs/swagger": "^11.4.2",
|
|
48
|
+
"@nestjs/typeorm": "^11.0.1",
|
|
49
|
+
"@nestjs/websockets": "^11.1.19",
|
|
50
|
+
"@rekog/mcp-nest": "^1.9.9",
|
|
50
51
|
"@resvg/resvg-js": "^2.6.2",
|
|
51
52
|
"@socket.io/redis-adapter": "^8.3.0",
|
|
52
|
-
"@types/uuid": "^10.0.0",
|
|
53
53
|
"ai": "^6.0.17",
|
|
54
54
|
"async-mutex": "^0.5.0",
|
|
55
|
-
"axios": "^1.
|
|
55
|
+
"axios": "^1.15.2",
|
|
56
56
|
"bcryptjs": "^3.0.2",
|
|
57
|
+
"better-sqlite3": "^12.9.0",
|
|
57
58
|
"cache-manager": "^7.2.4",
|
|
58
59
|
"cacheable": "^2.1.0",
|
|
59
60
|
"class-transformer": "^0.5.1",
|
|
61
|
+
"class-validator": "^0.15.1",
|
|
60
62
|
"connect-typeorm": "^2.0.0",
|
|
61
63
|
"cookie-parser": "^1.4.7",
|
|
62
64
|
"csrf-sync": "^4.2.1",
|
|
@@ -66,12 +68,14 @@
|
|
|
66
68
|
"keyv": "^5.5.3",
|
|
67
69
|
"llamaindex": "0.12.1",
|
|
68
70
|
"mime": "^1.6.0",
|
|
71
|
+
"mjml": "^5.1.0",
|
|
69
72
|
"module-alias": "2.2.3",
|
|
70
73
|
"nest-commander": "^3.20.1",
|
|
71
74
|
"nestjs-auditlog": "^1.5.6",
|
|
72
75
|
"nestjs-cls": "^6.2.0",
|
|
73
76
|
"nestjs-dynamic-providers": "^0.3.7",
|
|
74
77
|
"nestjs-i18n": "^10.5.1",
|
|
78
|
+
"nodemailer": "^8.0.7",
|
|
75
79
|
"p-limit": "^3.1.0",
|
|
76
80
|
"papaparse": "^5.5.3",
|
|
77
81
|
"passport": "^0.7.0",
|
|
@@ -85,19 +89,19 @@
|
|
|
85
89
|
"rxjs": "^7.8.2",
|
|
86
90
|
"sanitize-filename": "^1.6.3",
|
|
87
91
|
"slug": "^11.0.0",
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
"uuid": "^9.0.1",
|
|
91
|
-
"yaml": "^2.5.0",
|
|
92
|
+
"typeorm": "^0.3.28",
|
|
93
|
+
"yaml": "^2.8.3",
|
|
92
94
|
"zod": "^4.3.6",
|
|
93
|
-
"@hexabot-ai/agentic": "3.1.2-alpha.
|
|
94
|
-
"@hexabot-ai/types": "3.0.2-alpha.
|
|
95
|
+
"@hexabot-ai/agentic": "3.1.2-alpha.10",
|
|
96
|
+
"@hexabot-ai/types": "3.0.2-alpha.10"
|
|
95
97
|
},
|
|
96
98
|
"devDependencies": {
|
|
97
99
|
"@compodoc/compodoc": "^1.1.31",
|
|
98
|
-
"@nestjs/cli": "^11.0.
|
|
99
|
-
"@nestjs/schematics": "^11.0
|
|
100
|
-
"@nestjs/testing": "^11.1.
|
|
100
|
+
"@nestjs/cli": "^11.0.21",
|
|
101
|
+
"@nestjs/schematics": "^11.1.0",
|
|
102
|
+
"@nestjs/testing": "^11.1.19",
|
|
103
|
+
"@swc/core": "^1.15.32",
|
|
104
|
+
"@swc/jest": "^0.2.39",
|
|
101
105
|
"@types/cookie-parser": "^1.4.9",
|
|
102
106
|
"@types/cookie-signature": "^1.1.2",
|
|
103
107
|
"@types/express": "^5.0.3",
|
|
@@ -105,10 +109,12 @@
|
|
|
105
109
|
"@types/jest": "^30.0.0",
|
|
106
110
|
"@types/json-schema": "^7.0.15",
|
|
107
111
|
"@types/lodash": "^4.17.20",
|
|
112
|
+
"@types/mjml": "^5.0.0",
|
|
108
113
|
"@types/module-alias": "^2.0.4",
|
|
109
114
|
"@types/multer": "^2.0.0",
|
|
110
115
|
"@types/node": "^20.3.1",
|
|
111
116
|
"@types/node-fetch": "^2.6.13",
|
|
117
|
+
"@types/nodemailer": "^8.0.0",
|
|
112
118
|
"@types/papaparse": "^5.3.16",
|
|
113
119
|
"@types/passport-anonymous": "^1.0.5",
|
|
114
120
|
"@types/passport-jwt": "^4.0.1",
|
|
@@ -133,13 +139,12 @@
|
|
|
133
139
|
"socket.io-client": "^4.8.1",
|
|
134
140
|
"source-map-support": "^0.5.21",
|
|
135
141
|
"supertest": "^7.1.4",
|
|
136
|
-
"ts-jest": "^29.4.5",
|
|
137
142
|
"ts-loader": "^9.4.3",
|
|
138
143
|
"ts-node": "^10.9.2",
|
|
139
144
|
"tsconfig-paths": "^4.2.0",
|
|
140
145
|
"tsconfig-paths-jest": "^0.0.1",
|
|
141
146
|
"typescript": "^5.1.3",
|
|
142
|
-
"@hexabot-ai/frontend": "3.2.2-alpha.
|
|
147
|
+
"@hexabot-ai/frontend": "3.2.2-alpha.10"
|
|
143
148
|
},
|
|
144
149
|
"optionalDependencies": {
|
|
145
150
|
"@css-inline/css-inline-linux-arm64-musl": "^0.14.1",
|
|
@@ -163,7 +168,35 @@
|
|
|
163
168
|
"rootDir": "src",
|
|
164
169
|
"testRegex": ".*\\.spec\\.ts$",
|
|
165
170
|
"transform": {
|
|
166
|
-
"^.+\\.(t|j)s$":
|
|
171
|
+
"^.+\\.(t|j)s$": [
|
|
172
|
+
"@swc/jest",
|
|
173
|
+
{
|
|
174
|
+
"jsc": {
|
|
175
|
+
"parser": {
|
|
176
|
+
"syntax": "typescript",
|
|
177
|
+
"decorators": true,
|
|
178
|
+
"dynamicImport": true
|
|
179
|
+
},
|
|
180
|
+
"target": "es2021",
|
|
181
|
+
"transform": {
|
|
182
|
+
"legacyDecorator": true,
|
|
183
|
+
"decoratorMetadata": true
|
|
184
|
+
},
|
|
185
|
+
"keepClassNames": true,
|
|
186
|
+
"loose": true,
|
|
187
|
+
"baseUrl": ".",
|
|
188
|
+
"paths": {
|
|
189
|
+
"@/*": [
|
|
190
|
+
"src/*"
|
|
191
|
+
]
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
"module": {
|
|
195
|
+
"type": "commonjs"
|
|
196
|
+
},
|
|
197
|
+
"sourceMaps": true
|
|
198
|
+
}
|
|
199
|
+
]
|
|
167
200
|
},
|
|
168
201
|
"collectCoverageFrom": [
|
|
169
202
|
"**/*.(t|j)s"
|
|
@@ -195,13 +228,13 @@
|
|
|
195
228
|
"start:repl": "pnpm run start -- --entryFile repl",
|
|
196
229
|
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\"",
|
|
197
230
|
"lint:fix": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
|
|
198
|
-
"test": "jest --logHeapUsage --maxWorkers=50% --workerIdleMemoryLimit=
|
|
199
|
-
"test:runInBand": "jest --runInBand --logHeapUsage --detectOpenHandles --forceExit",
|
|
200
|
-
"test:half": "jest --logHeapUsage --maxWorkers=50% --testTimeout=10000",
|
|
201
|
-
"test:full": "jest --logHeapUsage --maxWorkers=100% --testTimeout=10000",
|
|
231
|
+
"test": "NODE_OPTIONS=--expose-gc jest --logHeapUsage --maxWorkers=50% --workerIdleMemoryLimit=1500MB --testTimeout=10000",
|
|
232
|
+
"test:runInBand": "NODE_OPTIONS=--expose-gc jest --runInBand --logHeapUsage --detectOpenHandles --forceExit",
|
|
233
|
+
"test:half": "NODE_OPTIONS=--expose-gc jest --logHeapUsage --maxWorkers=50% --workerIdleMemoryLimit=1500MB --testTimeout=10000",
|
|
234
|
+
"test:full": "NODE_OPTIONS=--expose-gc jest --logHeapUsage --maxWorkers=100% --workerIdleMemoryLimit=1500MB --testTimeout=10000",
|
|
202
235
|
"test:watch": "jest --watch --detectOpenHandles",
|
|
203
|
-
"test:cov": "jest --coverage --runInBand --detectOpenHandles --forceExit",
|
|
204
|
-
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
|
|
236
|
+
"test:cov": "NODE_OPTIONS=--expose-gc jest --coverage --runInBand --detectOpenHandles --forceExit",
|
|
237
|
+
"test:debug": "node --expose-gc --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
|
|
205
238
|
"test:e2e": "jest --config ./test/jest-e2e.json",
|
|
206
239
|
"test:clear": "jest --clearCache",
|
|
207
240
|
"typecheck": "tsc --noEmit -p tsconfig.typecheck.json",
|
package/src/app.controller.ts
CHANGED
package/src/app.module.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { existsSync } from 'fs';
|
|
8
|
+
import { createRequire } from 'node:module';
|
|
8
9
|
import path, { join } from 'path';
|
|
9
10
|
|
|
10
11
|
import KeyvRedis from '@keyv/redis';
|
|
@@ -57,6 +58,18 @@ const workspaceFrontendPath = join(__dirname, '..', '..', 'frontend', 'dist');
|
|
|
57
58
|
const frontendStaticPath = existsSync(compiledFrontendPath)
|
|
58
59
|
? compiledFrontendPath
|
|
59
60
|
: workspaceFrontendPath;
|
|
61
|
+
const requireModule = createRequire(__filename);
|
|
62
|
+
const getMcpModuleImports = (): ModuleImports => {
|
|
63
|
+
if (!config.mcp.enabled) {
|
|
64
|
+
return [];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const { McpApiModule } = requireModule(
|
|
68
|
+
'./mcp/mcp-api.module',
|
|
69
|
+
) as typeof import('./mcp/mcp-api.module');
|
|
70
|
+
|
|
71
|
+
return [McpApiModule];
|
|
72
|
+
};
|
|
60
73
|
// I18N options
|
|
61
74
|
const i18nOptions: I18nOptions = {
|
|
62
75
|
fallbackLanguage: 'en',
|
|
@@ -68,7 +81,7 @@ const i18nOptions: I18nOptions = {
|
|
|
68
81
|
path.join(__dirname, '/extensions/helpers/'),
|
|
69
82
|
path.join(__dirname, '/extensions/channels/'),
|
|
70
83
|
],
|
|
71
|
-
watch:
|
|
84
|
+
watch: config.env.toLowerCase() !== 'test',
|
|
72
85
|
},
|
|
73
86
|
resolvers: [
|
|
74
87
|
{ use: QueryResolver, options: ['lang'] },
|
|
@@ -123,6 +136,7 @@ export const HEXABOT_MODULE_IMPORTS: ModuleImports = [
|
|
|
123
136
|
ignoreErrors: false,
|
|
124
137
|
}),
|
|
125
138
|
I18nModule.forRoot(i18nOptions),
|
|
139
|
+
...getMcpModuleImports(),
|
|
126
140
|
CacheModule.registerAsync({
|
|
127
141
|
isGlobal: true,
|
|
128
142
|
useFactory: async () => ({
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
* Full terms: see LICENSE.md.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import { randomUUID } from 'crypto';
|
|
7
8
|
import { createReadStream, existsSync } from 'fs';
|
|
8
9
|
import { extname } from 'path';
|
|
9
10
|
import { Readable } from 'stream';
|
|
10
11
|
|
|
11
12
|
import { Logger, StreamableFile } from '@nestjs/common';
|
|
12
13
|
import { StreamableFileOptions } from '@nestjs/common/file-stream/interfaces/streamable-options.interface';
|
|
13
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
14
14
|
|
|
15
15
|
import { config } from '@/config';
|
|
16
16
|
|
|
@@ -80,7 +80,7 @@ export const generateUniqueFilename = (originalname: string) => {
|
|
|
80
80
|
const extension = extname(originalname);
|
|
81
81
|
const name = originalname.slice(0, -extension.length);
|
|
82
82
|
|
|
83
|
-
return `${name}-${
|
|
83
|
+
return `${name}-${randomUUID()}${extension}`;
|
|
84
84
|
};
|
|
85
85
|
|
|
86
86
|
/**
|
package/src/bootstrap.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Full terms: see LICENSE.md.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { Type, ValidationPipe } from '@nestjs/common';
|
|
7
|
+
import { ConsoleLogger, Logger, Type, ValidationPipe } from '@nestjs/common';
|
|
8
8
|
import { NestFactory } from '@nestjs/core';
|
|
9
9
|
import type { NestExpressApplication } from '@nestjs/platform-express';
|
|
10
10
|
import bodyParser from 'body-parser';
|
|
@@ -25,6 +25,12 @@ moduleAlias.addAliases({
|
|
|
25
25
|
'@': __dirname,
|
|
26
26
|
});
|
|
27
27
|
|
|
28
|
+
class HexabotBootstrapLogger extends ConsoleLogger {
|
|
29
|
+
override log(message: unknown, context?: string) {
|
|
30
|
+
super.log(message, context === 'NestApplication' ? 'Hexabot' : context);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
28
34
|
const rawBodyBuffer = (req, res, buf, encoding) => {
|
|
29
35
|
if (buf?.length) {
|
|
30
36
|
req.rawBody = buf.toString(encoding || 'utf8');
|
|
@@ -37,6 +43,9 @@ const isProductionEnv = (forced?: boolean): boolean => {
|
|
|
37
43
|
|
|
38
44
|
return config.env.toLowerCase().includes('prod');
|
|
39
45
|
};
|
|
46
|
+
const normalizeLocalhostUrl = (url: string): string => {
|
|
47
|
+
return url.replace('://127.0.0.1', '://localhost');
|
|
48
|
+
};
|
|
40
49
|
|
|
41
50
|
export interface HexabotBootstrapOptions {
|
|
42
51
|
listen?: {
|
|
@@ -54,6 +63,7 @@ export async function createHexabotApplication<
|
|
|
54
63
|
await resolveDynamicProviders();
|
|
55
64
|
const app = await NestFactory.create<TApp>(moduleRef, {
|
|
56
65
|
bodyParser: false,
|
|
66
|
+
logger: new HexabotBootstrapLogger(),
|
|
57
67
|
});
|
|
58
68
|
|
|
59
69
|
app.set('query parser', 'extended');
|
|
@@ -134,6 +144,8 @@ export async function bootstrapHexabotApp(
|
|
|
134
144
|
const host = options.listen?.host ?? '0.0.0.0';
|
|
135
145
|
|
|
136
146
|
await app.listen(port, host);
|
|
147
|
+
const appUrl = normalizeLocalhostUrl(await app.getUrl());
|
|
148
|
+
Logger.log(`Hexabot is running at ${appUrl}`, 'Hexabot');
|
|
137
149
|
|
|
138
150
|
return app;
|
|
139
151
|
}
|
|
@@ -42,9 +42,12 @@ export class ChannelService implements OnApplicationBootstrap {
|
|
|
42
42
|
) {}
|
|
43
43
|
|
|
44
44
|
async onApplicationBootstrap(): Promise<void> {
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
const registeredChannelNames = this.getAll().map((handler) =>
|
|
46
|
+
handler.getName(),
|
|
47
47
|
);
|
|
48
|
+
|
|
49
|
+
await this.sourceService.ensureDefaultSources(registeredChannelNames);
|
|
50
|
+
await this.sourceService.disableUnregisteredSources(registeredChannelNames);
|
|
48
51
|
}
|
|
49
52
|
|
|
50
53
|
public setChannel<T extends ChannelName, C extends ChannelHandler<T>>(
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* Full terms: see LICENSE.md.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import { randomUUID } from 'crypto';
|
|
8
|
+
|
|
7
9
|
import type {
|
|
8
10
|
ActionOptions,
|
|
9
11
|
Attachment,
|
|
@@ -16,7 +18,6 @@ import { Inject, Injectable, OnModuleInit, Type } from '@nestjs/common';
|
|
|
16
18
|
import { ModuleRef } from '@nestjs/core';
|
|
17
19
|
import { Request, Response } from 'express';
|
|
18
20
|
import mime from 'mime';
|
|
19
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
20
21
|
import z from 'zod';
|
|
21
22
|
|
|
22
23
|
import { AttachmentService } from '@/attachment/services/attachment.service';
|
|
@@ -232,7 +233,7 @@ export default abstract class ChannelHandler<
|
|
|
232
233
|
const attachments = await Promise.all(
|
|
233
234
|
metadatas.map(({ file, name, type, size }) => {
|
|
234
235
|
return this.attachmentService.store(file, {
|
|
235
|
-
name: `${name ? `${name}-` : ''}${
|
|
236
|
+
name: `${name ? `${name}-` : ''}${randomUUID()}.${mime.extension(type)}`,
|
|
236
237
|
type,
|
|
237
238
|
size,
|
|
238
239
|
resourceRef: AttachmentResourceRef.MessageAttachment,
|
|
@@ -12,12 +12,6 @@ const baseLabel: Label = {
|
|
|
12
12
|
...modelInstance,
|
|
13
13
|
title: '',
|
|
14
14
|
name: '',
|
|
15
|
-
label_id: {
|
|
16
|
-
messenger: '',
|
|
17
|
-
web: '',
|
|
18
|
-
dimelo: '',
|
|
19
|
-
twitter: '',
|
|
20
|
-
},
|
|
21
15
|
description: '',
|
|
22
16
|
builtin: false,
|
|
23
17
|
group: null,
|
|
@@ -27,12 +21,6 @@ export const labelMock: Label = {
|
|
|
27
21
|
...baseLabel,
|
|
28
22
|
title: 'Label',
|
|
29
23
|
name: 'label',
|
|
30
|
-
label_id: {
|
|
31
|
-
messenger: 'none',
|
|
32
|
-
web: 'none',
|
|
33
|
-
dimelo: 'none',
|
|
34
|
-
twitter: 'none',
|
|
35
|
-
},
|
|
36
24
|
};
|
|
37
25
|
|
|
38
26
|
export const customerLabelsMock: Label[] = [
|
|
@@ -40,22 +28,10 @@ export const customerLabelsMock: Label[] = [
|
|
|
40
28
|
...baseLabel,
|
|
41
29
|
title: 'Client',
|
|
42
30
|
name: 'client',
|
|
43
|
-
label_id: {
|
|
44
|
-
messenger: 'none',
|
|
45
|
-
web: 'none',
|
|
46
|
-
dimelo: 'none',
|
|
47
|
-
twitter: 'none',
|
|
48
|
-
},
|
|
49
31
|
},
|
|
50
32
|
{
|
|
51
33
|
...baseLabel,
|
|
52
34
|
title: 'Professional',
|
|
53
35
|
name: 'profressional',
|
|
54
|
-
label_id: {
|
|
55
|
-
messenger: 'none',
|
|
56
|
-
web: 'none',
|
|
57
|
-
dimelo: 'none',
|
|
58
|
-
twitter: 'none',
|
|
59
|
-
},
|
|
60
36
|
},
|
|
61
37
|
];
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
MethodNotAllowedException,
|
|
12
12
|
NotFoundException,
|
|
13
13
|
} from '@nestjs/common';
|
|
14
|
-
import { FindManyOptions, FindOneOptions } from 'typeorm';
|
|
14
|
+
import { FindManyOptions, FindOneOptions, In, Not } from 'typeorm';
|
|
15
15
|
import { DeleteResult } from 'typeorm/driver/mongodb/typings';
|
|
16
16
|
import z from 'zod';
|
|
17
17
|
|
|
@@ -107,6 +107,12 @@ export class SourceService extends BaseOrmService<SourceOrmEntity> {
|
|
|
107
107
|
return defaultWorkflow;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
private isStateOnlyDisablePayload(payload: SourceUpdateDto): boolean {
|
|
111
|
+
const keys = Object.keys(payload);
|
|
112
|
+
|
|
113
|
+
return keys.length === 1 && keys[0] === 'state' && payload.state === false;
|
|
114
|
+
}
|
|
115
|
+
|
|
110
116
|
private async buildCreatePayload(
|
|
111
117
|
payload: SourceCreateDto,
|
|
112
118
|
): Promise<SourceCreateDto> {
|
|
@@ -141,6 +147,16 @@ export class SourceService extends BaseOrmService<SourceOrmEntity> {
|
|
|
141
147
|
throw new NotFoundException('Source not found');
|
|
142
148
|
}
|
|
143
149
|
|
|
150
|
+
if (!this.channelRegistry.findChannel(existing.channel)) {
|
|
151
|
+
if (this.isStateOnlyDisablePayload(payload)) {
|
|
152
|
+
return await super.updateOne(idOrOptions, { state: false }, options);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
throw new BadRequestException(
|
|
156
|
+
`Channel "${existing.channel}" is not registered`,
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
|
|
144
160
|
const channel = payload.channel ?? existing.channel;
|
|
145
161
|
const shouldResetSettings =
|
|
146
162
|
payload.channel !== undefined && payload.settings === undefined;
|
|
@@ -167,6 +183,27 @@ export class SourceService extends BaseOrmService<SourceOrmEntity> {
|
|
|
167
183
|
);
|
|
168
184
|
}
|
|
169
185
|
|
|
186
|
+
async disableUnregisteredSources(
|
|
187
|
+
registeredChannelNames: string[],
|
|
188
|
+
): Promise<Source[]> {
|
|
189
|
+
const uniqueRegisteredChannelNames = Array.from(
|
|
190
|
+
new Set(registeredChannelNames),
|
|
191
|
+
);
|
|
192
|
+
|
|
193
|
+
return await super.updateMany(
|
|
194
|
+
{
|
|
195
|
+
where:
|
|
196
|
+
uniqueRegisteredChannelNames.length > 0
|
|
197
|
+
? {
|
|
198
|
+
state: true,
|
|
199
|
+
channel: Not(In(uniqueRegisteredChannelNames)),
|
|
200
|
+
}
|
|
201
|
+
: { state: true },
|
|
202
|
+
},
|
|
203
|
+
{ state: false },
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
|
|
170
207
|
async findActiveByRef(sourceRef: string): Promise<Source> {
|
|
171
208
|
const normalizedSourceRef = sourceRef.trim();
|
|
172
209
|
const source = await this.findOne(normalizedSourceRef);
|
package/src/chat/chat.module.ts
CHANGED
|
@@ -6,13 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import { labelFullSchema, labelSchema } from '@hexabot-ai/types';
|
|
8
8
|
import { ApiProperty, ApiPropertyOptional, PartialType } from '@nestjs/swagger';
|
|
9
|
-
import {
|
|
10
|
-
IsNotEmpty,
|
|
11
|
-
IsObject,
|
|
12
|
-
IsOptional,
|
|
13
|
-
IsString,
|
|
14
|
-
Matches,
|
|
15
|
-
} from 'class-validator';
|
|
9
|
+
import { IsNotEmpty, IsOptional, IsString, Matches } from 'class-validator';
|
|
16
10
|
|
|
17
11
|
import { IsUUIDv4 } from '@/utils/decorators/is-uuid.decorator';
|
|
18
12
|
import { TDto } from '@/utils/types/dto.types';
|
|
@@ -43,11 +37,6 @@ export class LabelCreateDto {
|
|
|
43
37
|
@IsOptional()
|
|
44
38
|
@IsString()
|
|
45
39
|
description?: string;
|
|
46
|
-
|
|
47
|
-
@ApiPropertyOptional({ description: 'Label id', type: Object })
|
|
48
|
-
@IsOptional()
|
|
49
|
-
@IsObject()
|
|
50
|
-
label_id?: Record<string, any>;
|
|
51
40
|
}
|
|
52
41
|
|
|
53
42
|
export class LabelUpdateDto extends PartialType(LabelCreateDto) {}
|
|
@@ -16,7 +16,6 @@ import {
|
|
|
16
16
|
} from 'typeorm';
|
|
17
17
|
|
|
18
18
|
import { AuditLabel } from '@/audit/decorators/audit-label.decorator';
|
|
19
|
-
import { JsonColumn } from '@/database/decorators/json-column.decorator';
|
|
20
19
|
import { BaseOrmEntity } from '@/database/entities/base.entity';
|
|
21
20
|
import { AsRelation } from '@/utils/decorators/relation-ref.decorator';
|
|
22
21
|
|
|
@@ -51,9 +50,6 @@ export class LabelOrmEntity extends BaseOrmEntity<LabelDto> {
|
|
|
51
50
|
@RelationId((label: LabelOrmEntity) => label.group)
|
|
52
51
|
private readonly groupId?: string | null;
|
|
53
52
|
|
|
54
|
-
@JsonColumn({ nullable: true })
|
|
55
|
-
label_id?: Record<string, any> | null;
|
|
56
|
-
|
|
57
53
|
@Column({ type: 'text', nullable: true })
|
|
58
54
|
description?: string | null;
|
|
59
55
|
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* Full terms: see LICENSE.md.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import { createRequire } from 'node:module';
|
|
8
|
+
|
|
7
9
|
import { subscriberSchema, subscriberFullSchema } from '@hexabot-ai/types';
|
|
8
10
|
import {
|
|
9
11
|
Check,
|
|
@@ -30,6 +32,8 @@ import { SubscriberDto } from '../dto/subscriber.dto';
|
|
|
30
32
|
|
|
31
33
|
import { LabelOrmEntity } from './label.entity';
|
|
32
34
|
|
|
35
|
+
const requireEntity = createRequire(__filename);
|
|
36
|
+
|
|
33
37
|
export class SubscriberChannel {
|
|
34
38
|
@Column()
|
|
35
39
|
name: string;
|
|
@@ -65,13 +69,16 @@ export class SubscriberOrmEntity<
|
|
|
65
69
|
@Column({ type: 'varchar', length: 64 })
|
|
66
70
|
foreignId: string;
|
|
67
71
|
|
|
68
|
-
@ManyToOne(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
@ManyToOne(
|
|
73
|
+
() => requireEntity('../../channel/entities/source.entity').SourceOrmEntity,
|
|
74
|
+
{
|
|
75
|
+
// STI (`users` table) stores both subscribers and operators.
|
|
76
|
+
// Keep the column nullable at the DB level, and enforce non-null for
|
|
77
|
+
// Subscriber rows via `CHK_SUBSCRIBER_SOURCE_REQUIRED`.
|
|
78
|
+
nullable: true,
|
|
79
|
+
onDelete: 'CASCADE',
|
|
80
|
+
},
|
|
81
|
+
)
|
|
75
82
|
@JoinColumn({ name: 'source_id' })
|
|
76
83
|
@AsRelation()
|
|
77
84
|
source: SourceOrmEntity;
|
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
* Full terms: see LICENSE.md.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import { randomUUID } from 'crypto';
|
|
8
|
+
|
|
7
9
|
import { Subscriber } from '@hexabot-ai/types';
|
|
8
10
|
import { Inject, Injectable, Optional, forwardRef } from '@nestjs/common';
|
|
9
11
|
import { OnEvent } from '@nestjs/event-emitter';
|
|
10
12
|
import mime from 'mime';
|
|
11
13
|
import { In, IsNull, Not } from 'typeorm';
|
|
12
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
13
14
|
|
|
14
15
|
import { AttachmentService } from '@/attachment/services/attachment.service';
|
|
15
16
|
import {
|
|
@@ -159,7 +160,7 @@ export class SubscriberService extends BaseOrmService<SubscriberOrmEntity> {
|
|
|
159
160
|
const { file, type, size } = avatar;
|
|
160
161
|
const extension = mime.extension(type);
|
|
161
162
|
const attachment = await this.attachmentService.store(file, {
|
|
162
|
-
name: `avatar-${
|
|
163
|
+
name: `avatar-${randomUUID()}.${extension}`,
|
|
163
164
|
size,
|
|
164
165
|
type,
|
|
165
166
|
resourceRef: AttachmentResourceRef.SubscriberAvatar,
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* Full terms: see LICENSE.md.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import { createRequire } from 'node:module';
|
|
8
|
+
|
|
7
9
|
import { contentTypeSchema, contentTypeFullSchema } from '@hexabot-ai/types';
|
|
8
10
|
import { JSONSchema7 as JsonSchema } from 'json-schema';
|
|
9
11
|
import { Column, Entity, Index, OneToMany } from 'typeorm';
|
|
@@ -14,7 +16,9 @@ import { BaseOrmEntity } from '@/database/entities/base.entity';
|
|
|
14
16
|
|
|
15
17
|
import { ContentTypeDto } from '../dto/contentType.dto';
|
|
16
18
|
|
|
17
|
-
import { ContentOrmEntity } from './content.entity';
|
|
19
|
+
import type { ContentOrmEntity } from './content.entity';
|
|
20
|
+
|
|
21
|
+
const requireEntity = createRequire(__filename);
|
|
18
22
|
|
|
19
23
|
@Entity({ name: 'content_types' })
|
|
20
24
|
@Index(['name'], { unique: true })
|
|
@@ -31,8 +35,12 @@ export class ContentTypeOrmEntity extends BaseOrmEntity<ContentTypeDto> {
|
|
|
31
35
|
@JsonColumn({ nullable: true })
|
|
32
36
|
schema!: JsonSchema;
|
|
33
37
|
|
|
34
|
-
@OneToMany(
|
|
35
|
-
|
|
36
|
-
|
|
38
|
+
@OneToMany(
|
|
39
|
+
() => requireEntity('./content.entity').ContentOrmEntity,
|
|
40
|
+
(content: ContentOrmEntity) => content.contentType,
|
|
41
|
+
{
|
|
42
|
+
cascade: ['remove'],
|
|
43
|
+
},
|
|
44
|
+
)
|
|
37
45
|
contents?: ContentOrmEntity[];
|
|
38
46
|
}
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* Full terms: see LICENSE.md.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import { createRequire } from 'node:module';
|
|
8
|
+
|
|
7
9
|
import {
|
|
8
10
|
contentSchema,
|
|
9
11
|
contentFullSchema,
|
|
@@ -31,7 +33,9 @@ import { AsRelation } from '@/utils/decorators/relation-ref.decorator';
|
|
|
31
33
|
|
|
32
34
|
import { ContentDto } from '../dto/content.dto';
|
|
33
35
|
|
|
34
|
-
import { ContentTypeOrmEntity } from './content-type.entity';
|
|
36
|
+
import type { ContentTypeOrmEntity } from './content-type.entity';
|
|
37
|
+
|
|
38
|
+
const requireEntity = createRequire(__filename);
|
|
35
39
|
|
|
36
40
|
@Entity({ name: 'contents' })
|
|
37
41
|
@Index(['title'])
|
|
@@ -44,10 +48,14 @@ export class ContentOrmEntity extends BaseOrmEntity<ContentDto> {
|
|
|
44
48
|
/**
|
|
45
49
|
* The content type of this content.
|
|
46
50
|
*/
|
|
47
|
-
@ManyToOne(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
@ManyToOne(
|
|
52
|
+
() => requireEntity('./content-type.entity').ContentTypeOrmEntity,
|
|
53
|
+
(entity: ContentTypeOrmEntity) => entity.contents,
|
|
54
|
+
{
|
|
55
|
+
nullable: false,
|
|
56
|
+
onDelete: 'CASCADE',
|
|
57
|
+
},
|
|
58
|
+
)
|
|
51
59
|
@JoinColumn({ name: 'content_type_id' })
|
|
52
60
|
@AsRelation()
|
|
53
61
|
contentType!: ContentTypeOrmEntity;
|