mirror of
https://github.com/hexastack/hexabot
synced 2024-11-24 04:53:41 +00:00
Merge pull request #228 from Hexastack/227-bug-settings-events-types
fix(api): settings types
This commit is contained in:
commit
f68ef8a9a3
44
api/src/eventemitter.d.ts
vendored
44
api/src/eventemitter.d.ts
vendored
@ -1,15 +1,15 @@
|
|||||||
import { type OnEventOptions } from '@nestjs/event-emitter/dist/interfaces';
|
import { type OnEventOptions } from '@nestjs/event-emitter/dist/interfaces';
|
||||||
import type { TFilterQuery, HydratedDocument, Query, Document } from 'mongoose';
|
import type { Document, HydratedDocument, Query, TFilterQuery } from 'mongoose';
|
||||||
import { type Socket } from 'socket.io';
|
import { type Socket } from 'socket.io';
|
||||||
|
|
||||||
import { type BotStats } from '@/analytics/schemas/bot-stats.schema';
|
import { type BotStats } from '@/analytics/schemas/bot-stats.schema';
|
||||||
import { type Attachment } from '@/attachment/schemas/attachment.schema';
|
import { type Attachment } from '@/attachment/schemas/attachment.schema';
|
||||||
import type EventWrapper from '@/channel/lib/EventWrapper';
|
import type EventWrapper from '@/channel/lib/EventWrapper';
|
||||||
import { type Block, BlockFull } from '@/chat/schemas/block.schema';
|
import { BlockFull, type Block } from '@/chat/schemas/block.schema';
|
||||||
import { type Category } from '@/chat/schemas/category.schema';
|
import { type Category } from '@/chat/schemas/category.schema';
|
||||||
import { type ContextVar } from '@/chat/schemas/context-var.schema';
|
import { type ContextVar } from '@/chat/schemas/context-var.schema';
|
||||||
import { type Conversation } from '@/chat/schemas/conversation.schema';
|
import { type Conversation } from '@/chat/schemas/conversation.schema';
|
||||||
import { LabelDocument, type Label } from '@/chat/schemas/label.schema';
|
import type { Label, LabelDocument } from '@/chat/schemas/label.schema';
|
||||||
import { type Message } from '@/chat/schemas/message.schema';
|
import { type Message } from '@/chat/schemas/message.schema';
|
||||||
import { type Subscriber } from '@/chat/schemas/subscriber.schema';
|
import { type Subscriber } from '@/chat/schemas/subscriber.schema';
|
||||||
import { type ContentType } from '@/cms/schemas/content-type.schema';
|
import { type ContentType } from '@/cms/schemas/content-type.schema';
|
||||||
@ -23,9 +23,9 @@ import type {
|
|||||||
} from '@/nlp/schemas/nlp-entity.schema';
|
} from '@/nlp/schemas/nlp-entity.schema';
|
||||||
import { type NlpSampleEntity } from '@/nlp/schemas/nlp-sample-entity.schema';
|
import { type NlpSampleEntity } from '@/nlp/schemas/nlp-sample-entity.schema';
|
||||||
import { type NlpSample } from '@/nlp/schemas/nlp-sample.schema';
|
import { type NlpSample } from '@/nlp/schemas/nlp-sample.schema';
|
||||||
import {
|
import type {
|
||||||
|
NlpValue,
|
||||||
NlpValueDocument,
|
NlpValueDocument,
|
||||||
type NlpValue,
|
|
||||||
} from '@/nlp/schemas/nlp-value.schema';
|
} from '@/nlp/schemas/nlp-value.schema';
|
||||||
import { type Setting } from '@/setting/schemas/setting.schema';
|
import { type Setting } from '@/setting/schemas/setting.schema';
|
||||||
import type { CheckboxSetting, TextSetting } from '@/setting/schemas/types';
|
import type { CheckboxSetting, TextSetting } from '@/setting/schemas/types';
|
||||||
@ -64,33 +64,33 @@ declare module '@nestjs/event-emitter' {
|
|||||||
chatbot_settings: TDefinition<
|
chatbot_settings: TDefinition<
|
||||||
object,
|
object,
|
||||||
{
|
{
|
||||||
global_fallback: unknown;
|
global_fallback: Setting;
|
||||||
fallback_block: unknown;
|
fallback_block: Setting;
|
||||||
fallback_message: unknown;
|
fallback_message: Setting;
|
||||||
}
|
}
|
||||||
>;
|
>;
|
||||||
contact: TDefinition<
|
contact: TDefinition<
|
||||||
object,
|
object,
|
||||||
{
|
{
|
||||||
contact_email_recipient: unknown;
|
contact_email_recipient: Setting;
|
||||||
company_name: unknown;
|
company_name: Setting;
|
||||||
company_phone: unknown;
|
company_phone: Setting;
|
||||||
company_email: unknown;
|
company_email: Setting;
|
||||||
company_address1: unknown;
|
company_address1: Setting;
|
||||||
company_address2: unknown;
|
company_address2: Setting;
|
||||||
company_city: unknown;
|
company_city: Setting;
|
||||||
company_zipcode: unknown;
|
company_zipcode: Setting;
|
||||||
company_state: unknown;
|
company_state: Setting;
|
||||||
company_country: unknown;
|
company_country: Setting;
|
||||||
}
|
}
|
||||||
>;
|
>;
|
||||||
nlp_settings: TDefinition<
|
nlp_settings: TDefinition<
|
||||||
object,
|
object,
|
||||||
{
|
{
|
||||||
provider: unknown;
|
provider: Setting;
|
||||||
endpoint: unknown;
|
endpoint: Setting;
|
||||||
token: unknown;
|
token: Setting;
|
||||||
threshold: number;
|
threshold: Setting;
|
||||||
}
|
}
|
||||||
>;
|
>;
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { EventEmitter2 } from '@nestjs/event-emitter';
|
import {
|
||||||
|
EventEmitter2,
|
||||||
|
IHookSettingsGroupLabelOperationMap,
|
||||||
|
} from '@nestjs/event-emitter';
|
||||||
import { InjectModel } from '@nestjs/mongoose';
|
import { InjectModel } from '@nestjs/mongoose';
|
||||||
import { Document, Model, Query, Types } from 'mongoose';
|
import { Document, Model, Query, Types } from 'mongoose';
|
||||||
|
|
||||||
@ -78,9 +81,10 @@ export class SettingRepository extends BaseRepository<Setting> {
|
|||||||
>,
|
>,
|
||||||
setting: Setting,
|
setting: Setting,
|
||||||
) {
|
) {
|
||||||
const group = setting.group as any;
|
const group = setting.group as keyof IHookSettingsGroupLabelOperationMap;
|
||||||
const label = setting.label as string;
|
const label = setting.label as '*';
|
||||||
|
|
||||||
// Sync global settings var
|
// Sync global settings var
|
||||||
this.eventEmitter.emit(`hook:${group}:${label}`, setting as any);
|
this.eventEmitter.emit(`hook:${group}:${label}`, setting);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user