@hexabot-ai/api 3.2.2-alpha.7 → 3.2.2-alpha.8
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/channel/channel.service.js +3 -1
- package/dist/channel/channel.service.js.map +1 -1
- package/dist/channel/services/source.service.d.ts +2 -0
- package/dist/channel/services/source.service.js +22 -0
- package/dist/channel/services/source.service.js.map +1 -1
- package/dist/static/assets/{browser-ponyfill-CEwoCVSx.js → browser-ponyfill-IkrOfrbH.js} +1 -1
- package/dist/static/assets/{cssMode--IlDJz7y.js → cssMode-BVh8Ojbf.js} +1 -1
- package/dist/static/assets/{freemarker2-bg_Owo1H.js → freemarker2-Cnk90W15.js} +1 -1
- package/dist/static/assets/{handlebars-CO-ZB4C_.js → handlebars-DDmCOyIG.js} +1 -1
- package/dist/static/assets/{html-jwF9Nzjc.js → html-cDkAkcNZ.js} +1 -1
- package/dist/static/assets/{htmlMode-DRaYXCag.js → htmlMode-BKekdtGx.js} +1 -1
- package/dist/static/assets/{index-C1EyZVnd.js → index-CnXiX03v.js} +2028 -2028
- package/dist/static/assets/{javascript-BXVcPsQH.js → javascript-bO_Y-MtP.js} +1 -1
- package/dist/static/assets/{jsonMode-DnXHebnn.js → jsonMode-p7oe1x6a.js} +1 -1
- package/dist/static/assets/{liquid-K9ivjSXd.js → liquid-DehK5Toi.js} +1 -1
- package/dist/static/assets/{lspLanguageFeatures-Bec2yhP4.js → lspLanguageFeatures-C8ni2Y8s.js} +1 -1
- package/dist/static/assets/{mdx-CjD0T1se.js → mdx-BqE3GcoU.js} +1 -1
- package/dist/static/assets/{python-DRkLfGvI.js → python-DYGyqTrT.js} +1 -1
- package/dist/static/assets/{razor-DSBkwv0Q.js → razor-CTOqYwI_.js} +1 -1
- package/dist/static/assets/{tsMode-F8_-k2jz.js → tsMode-n7ps72jb.js} +1 -1
- package/dist/static/assets/{typescript-fuBu-iOB.js → typescript-B0sRB56_.js} +1 -1
- package/dist/static/assets/{xml-BlB1OdEv.js → xml-C4I4RxHC.js} +1 -1
- package/dist/static/assets/{yaml-BIRHigS_.js → yaml-V_o23lNz.js} +1 -1
- package/dist/static/index.html +1 -1
- package/dist/static/locales/en/translation.json +2 -0
- package/dist/static/locales/fr/translation.json +2 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/src/channel/channel.service.ts +5 -2
- package/src/channel/services/source.service.ts +38 -1
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.8",
|
|
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",
|
|
@@ -90,8 +90,8 @@
|
|
|
90
90
|
"typeorm": "^0.3.28",
|
|
91
91
|
"yaml": "^2.8.3",
|
|
92
92
|
"zod": "^4.3.6",
|
|
93
|
-
"@hexabot-ai/
|
|
94
|
-
"@hexabot-ai/
|
|
93
|
+
"@hexabot-ai/types": "3.0.2-alpha.8",
|
|
94
|
+
"@hexabot-ai/agentic": "3.1.2-alpha.8"
|
|
95
95
|
},
|
|
96
96
|
"devDependencies": {
|
|
97
97
|
"@compodoc/compodoc": "^1.1.31",
|
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
"tsconfig-paths": "^4.2.0",
|
|
143
143
|
"tsconfig-paths-jest": "^0.0.1",
|
|
144
144
|
"typescript": "^5.1.3",
|
|
145
|
-
"@hexabot-ai/frontend": "3.2.2-alpha.
|
|
145
|
+
"@hexabot-ai/frontend": "3.2.2-alpha.8"
|
|
146
146
|
},
|
|
147
147
|
"optionalDependencies": {
|
|
148
148
|
"@css-inline/css-inline-linux-arm64-musl": "^0.14.1",
|
|
@@ -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>>(
|
|
@@ -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);
|