/* * Copyright © 2025 Hexastack. All rights reserved. * * Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms: * 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission. * 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file). */ import { type OnEventOptions } from '@nestjs/event-emitter/dist/interfaces'; import { type Session as ExpressSession } from 'express-session'; import type { Document, Query } from 'mongoose'; import { type Socket } from 'socket.io'; import { type BotStats } from '@/analytics/schemas/bot-stats.schema'; import { type Attachment } from '@/attachment/schemas/attachment.schema'; import type EventWrapper from '@/channel/lib/EventWrapper'; import { type SubscriberUpdateDto } from '@/chat/dto/subscriber.dto'; import type { Block, BlockFull } from '@/chat/schemas/block.schema'; import { type Category } from '@/chat/schemas/category.schema'; import { type ContextVar } from '@/chat/schemas/context-var.schema'; import { type Conversation } from '@/chat/schemas/conversation.schema'; import type { Label } from '@/chat/schemas/label.schema'; import { type Message } from '@/chat/schemas/message.schema'; import { type Subscriber } from '@/chat/schemas/subscriber.schema'; import { type ContentType } from '@/cms/schemas/content-type.schema'; import { type Content } from '@/cms/schemas/content.schema'; import { type Menu } from '@/cms/schemas/menu.schema'; import { type Language } from '@/i18n/schemas/language.schema'; import { type Translation } from '@/i18n/schemas/translation.schema'; import type { NlpEntity } from '@/nlp/schemas/nlp-entity.schema'; import { type NlpSampleEntity } from '@/nlp/schemas/nlp-sample-entity.schema'; import { type NlpSample } from '@/nlp/schemas/nlp-sample.schema'; import type { NlpValue } from '@/nlp/schemas/nlp-value.schema'; import { type Setting } from '@/setting/schemas/setting.schema'; import { type Invitation } from '@/user/schemas/invitation.schema'; import { type Model } from '@/user/schemas/model.schema'; import { type Permission } from '@/user/schemas/permission.schema'; import { type Role } from '@/user/schemas/role.schema'; import { type User } from '@/user/schemas/user.schema'; import { EHook, type DeleteResult } from '@/utils/generics/base-repository'; import type { TFilterQuery, THydratedDocument, } from '@/utils/types/filter.types'; import '@nestjs/event-emitter'; /** * @description Module declaration that extends the NestJS EventEmitter with custom event types and methods. */ declare module '@nestjs/event-emitter' { interface TDefinition { schema: S; operations: O; } interface IHookExtensionsOperationMap {} interface IHookSettingsGroupLabelOperationMap { chatbot_settings: TDefinition< object, { global_fallback: Setting; fallback_block: Setting; fallback_message: Setting; } >; contact: TDefinition< object, { contact_email_recipient: Setting; company_name: Setting; company_phone: Setting; company_email: Setting; company_address1: Setting; company_address2: Setting; company_city: Setting; company_zipcode: Setting; company_state: Setting; company_country: Setting; } >; } /* custom hooks */ interface IHookOperationMap extends IHookSettingsGroupLabelOperationMap, IHookExtensionsOperationMap { analytics: TDefinition< object, { block: BlockFull; passation: Subscriber; 'fallback-local': BlockFull; 'fallback-global': EventWrapper; intervention: Subscriber; } >; chatbot: TDefinition< object, { sent: unknown; received: unknown; message: unknown; delivery: unknown; read: unknown; typing: unknown; follow: unknown; echo: unknown; } >; websocket: TDefinition< object, { connection: Socket; } >; } /* hooks */ interface IHookEntityOperationMap extends IHookOperationMap { stats: TDefinition; attachment: TDefinition; block: TDefinition; category: TDefinition; contextVar: TDefinition; conversation: TDefinition; label: TDefinition